Skip to content

Commit ec64a5f

Browse files
author
mingxiaoh
committed
Merge remote-tracking branch 'remotes/gerrit/master'
2 parents 4bd9a68 + 66a8ce0 commit ec64a5f

File tree

14 files changed

+632
-199
lines changed

14 files changed

+632
-199
lines changed

cmake/mkl.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ detect_mkl("mkl_rt")
151151
if(HAVE_MKL)
152152
include_directories(AFTER ${MKLINC})
153153
install(DIRECTORY ${MKLINC}/ DESTINATION include/mklml)
154-
install(DIRECTORY ${MKLINC}/../lib/ DESTINATION lib)
154+
155+
set(LIBLIST libmklml_intel.so libiomp5.so)
156+
foreach(LIB ${LIBLIST})
157+
install(FILES ${MKLINC}/../lib/${LIB} DESTINATION lib)
158+
endforeach()
159+
155160
list(APPEND mkldnn_LINKER_LIBS ${MKLLIB})
156161

157162
set(MSG "Intel(R) MKL:")

conda/build.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
# Install script for Anaconda environments on macOS and linux.
4+
# This script is not supposed to be called directly, but should be run by:
5+
#
6+
# $ cd <path to ideep, e.g. ~/ideep>
7+
# $ conda build conda
8+
#
9+
#
10+
# If you're debugging this, it may be useful to use the env that conda build is
11+
# using:
12+
# $ cd <anaconda_root>/conda-bld/ideep_<timestamp>
13+
# $ source activate _h_env_... # some long path with lots of placeholders
14+
#
15+
# Also, failed builds will accumulate those ideep_<timestamp> directories. You
16+
# can remove them after a succesfull build with
17+
# $ conda build purge
18+
#
19+
git submodule update --init
20+
mkdir build
21+
cd build
22+
cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local ..
23+
cd ../python
24+
python setup.py install

conda/meta.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{% set version = "2.0.0b1" %}
2+
3+
package:
4+
name: ideep4py
5+
version: {{ version }}
6+
7+
source:
8+
path: ../
9+
10+
build:
11+
number: 0
12+
skip: True # [win]
13+
14+
requirements:
15+
build:
16+
- numpy
17+
- python
18+
run:
19+
- numpy
20+
- python
21+
22+
test:
23+
imports:
24+
- ideep4py
25+
26+
about:
27+
license: MIT

docker/python/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update -y && \
4+
apt-get install -y --no-install-recommends \
5+
python-dev \
6+
python-pip \
7+
python-wheel \
8+
python-setuptools && \
9+
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
10+
11+
RUN pip install ideep4py

include/ideep.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@
4343
#include "ideep/tensor.hpp"
4444
#include "ideep/computations.hpp"
4545
#include "ideep/allocators.hpp"
46-
47-
#if __GNUC__ > 4
4846
#include "ideep/fast_math.hpp"
49-
#endif
5047

5148
#endif
5249

include/ideep/abstract_types.hpp

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,27 @@ using error = mkldnn::error;
2121
// For 2D convolution with grouped weights, the ndims must be 5 (goihw)
2222
#define IDEEP_IS_GROUPED_4DIMS(d) (((d).size() == 5) ? 1 : 0)
2323

24+
#define IDEEP_MOD_PTR(ptr, bytes) (((uintptr_t)(ptr)) & ((bytes) - 1))
25+
#define IDEEP_IS_ALIGNED_PTR(ptr, bytes) ((IDEEP_MOD_PTR(ptr, bytes)) == 0)
26+
2427
/// Same class for resource management, except public default constructor
2528
/// Movable support for better performance
2629
template <typename T, typename traits = mkldnn::handle_traits<T>>
27-
class c_wrapper{
28-
protected:
29-
std::shared_ptr<typename std::remove_pointer<T>::type> _data;
30+
class c_wrapper :
31+
public std::shared_ptr<typename std::remove_pointer<T>::type> {
32+
using super = std::shared_ptr<typename std::remove_pointer<T>::type>;
3033
public:
3134
/// Constructs a C handle wrapper.
3235
/// @param t The C handle to wrap.
3336
/// @param weak A flag to specify whether to construct a weak wrapper.
34-
c_wrapper(T t = nullptr, bool weak = false): _data(t, [weak]() {
37+
c_wrapper(T t = nullptr, bool weak = false): super(t, [weak]() {
3538
auto dummy = [](T) {
3639
return decltype(traits::destructor(0))(0);
3740
};
3841
return weak? dummy : traits::destructor;
3942
}()) {}
4043

41-
bool operator==(const T other) const { return other == _data.get(); }
42-
bool operator!=(const T other) const { return !(*this == other); }
43-
44-
c_wrapper(const c_wrapper& other): _data(other._data) {}
45-
c_wrapper(c_wrapper&& movable) : _data(std::move(movable._data)) {}
46-
47-
c_wrapper &operator=(c_wrapper&& other) {
48-
_data = std::move(other._data);
49-
return *this;
50-
}
51-
52-
c_wrapper &operator=(const c_wrapper& other) {
53-
_data = other._data;
54-
return *this;
55-
}
44+
using super::super;
5645

5746
/// Resets the value of a C handle.
5847
/// @param t The new value of the C handle.
@@ -61,17 +50,7 @@ class c_wrapper{
6150
auto dummy_destructor = [](T) {
6251
return decltype(traits::destructor(0))(0);
6352
};
64-
_data.reset(t, weak ? dummy_destructor : traits::destructor);
65-
}
66-
67-
/// Returns the value of the underlying C handle.
68-
T get() const { return _data.get(); }
69-
70-
bool operator==(const c_wrapper &other) const {
71-
return other._data.get() == _data.get();
72-
}
73-
bool operator!=(const c_wrapper &other) const {
74-
return !(*this == other);
53+
super::reset(t, weak ? dummy_destructor : traits::destructor);
7554
}
7655
};
7756

0 commit comments

Comments
 (0)