Skip to content

Commit

Permalink
Merge pull request #5667 from cms-sw/mxnet-python-pkgs
Browse files Browse the repository at this point in the history
Add mxnet python bindings
  • Loading branch information
smuzaffar committed Mar 20, 2020
2 parents 955fc9a + 23f7bde commit 4be22b5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion mxnet-predict-toolfile.spec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cat << \EOF_TOOLFILE >%i/etc/scram.d/mxnet-predict.xml
<client>
<environment name="MXNET_PREDICT_BASE" default="@TOOL_ROOT@"/>
<environment name="INCLUDE" default="$MXNET_PREDICT_BASE/include"/>
<environment name="LIBDIR" default="$MXNET_PREDICT_BASE/lib64"/>
<environment name="LIBDIR" default="$MXNET_PREDICT_BASE/lib"/>
</client>
<use name="openblas"/>
</tool>
Expand Down
20 changes: 13 additions & 7 deletions mxnet-predict.spec
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
### RPM external mxnet-predict 1.5.0
## INITENV +PATH PYTHON27PATH %{i}/$PYTHON_LIB_SITE_PACKAGES
## INITENV +PATH PYTHON3PATH %{i}/$PYTHON3_LIB_SITE_PACKAGES
## INITENV +PATH LD_LIBRARY_PATH %{i}/lib

%define tag 337cf1b54cc02bde94f459c89863a18187b0aada
%define branch 1.5.0-cms-mod
%define github_user cms-externals
Source: git+https://github.com/%{github_user}/incubator-mxnet.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}-%{tag}.tgz

BuildRequires: cmake ninja ccache
BuildRequires: cmake ninja

Requires: OpenBLAS
Requires: OpenBLAS python python3 py2-numpy py3-numpy

%prep
%setup -q -n %{n}-%{realversion}
Expand All @@ -17,12 +21,12 @@ rm -rf ../build; mkdir ../build; cd ../build
# use LAPACK functions in OpenBLAS:
# manually set MXNET_USE_LAPACK=1 and turn off USE_LAPACK in cmake
export CFLAGS="-DMXNET_USE_LAPACK=1 -DMXNET_THREAD_LOCAL_ENGINE=1"
export PYTHONV=$(echo $PYTHON_VERSION | cut -f1,2 -d.)
export PYTHON3V=$(echo $PYTHON3_VERSION | cut -f1,2 -d.)

cmake ../%{n}-%{realversion} -GNinja \
-DCMAKE_CUDA_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_INSTALL_PREFIX="%{i}" \
-DCMAKE_INSTALL_LIBDIR="%{i}/lib" \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_CUDA=OFF \
-DUSE_OPENCV=OFF \
Expand All @@ -34,12 +38,14 @@ cmake ../%{n}-%{realversion} -GNinja \
-DUSE_F16C=OFF \
-DUSE_CPP_PACKAGE=ON \
-DBUILD_CPP_EXAMPLES=OFF \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="%{i}" \
-DINSTALL_PYTHON_VERSIONS="${PYTHONV};${PYTHON3V}" \
-DCMAKE_PREFIX_PATH="${OPENBLAS_ROOT}"

ninja -v %{makeprocesses} -l $(getconf _NPROCESSORS_ONLN)

%install
cd ../build
ninja -v %{makeprocesses} -l $(getconf _NPROCESSORS_ONLN) install
rm %{i}/lib64/*.a

rm %{i}/*.so
mv %{i}/python* %{i}/lib
2 changes: 1 addition & 1 deletion python_tools.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## INITENV +PATH PYTHON3PATH %{i}/${PYTHON3_LIB_SITE_PACKAGES}
Source: none

Requires: root curl python python3 xrootd llvm hdf5
Requires: root curl python python3 xrootd llvm hdf5 mxnet-predict

%define isslc7 %(case %{cmsplatf} in (slc7_amd64*) echo 1 ;; (*) echo 0 ;; esac)
%define isamd64 %(case %{cmsplatf} in (*amd64*) echo 1 ;; (*) echo 0 ;; esac)
Expand Down

0 comments on commit 4be22b5

Please sign in to comment.