Skip to content

Commit 17bfce3

Browse files
committed
Fixed wrapper python paths for the new containers
1 parent 5e99c76 commit 17bfce3

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

make_gnu.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ set -e
2525
# This wrapper uses the GNU compilers to build
2626
# training and inference examples
2727

28-
29-
PYPATH=$(find /opt/conda/lib/ -maxdepth 1 -name 'python?.*' -type d)
30-
CMAKE_PREFIX_PATH="${PYPATH}/site-packages/torch/share/cmake;${PYPATH}/site-packages/pybind11/share/cmake"
28+
# Default Pytorch containers seem to have Pytorch installed through conda
29+
PY_SITE_PATH=$(find /opt/conda/lib/ -maxdepth 1 -name 'python?.*' -type d)/site-packages
30+
CMAKE_PREFIX_PATH="${PY_SITE_PATH}/torch/share/cmake;${PY_SITE_PATH}/pybind11/share/cmake"
31+
echo "Trying to use Python libraries from $PY_SITE_PATH"
3132

3233
CONFIG=Release
3334
OPENACC=0

make_intel.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ set -e
2929
# 1. with GCC, build pytorch C++ wrapper lib that exposes things to Fortran
3030
# 2. with Intel, build fortran bindings that just bind(c) to built lib from (1)
3131

32-
PYPATH=$(find /opt/conda/lib/ -maxdepth 1 -name 'python?.*' -type d)
33-
CMAKE_PREFIX_PATH="${PYPATH}/site-packages/torch/share/cmake;${PYPATH}/site-packages/pybind11/share/cmake"
32+
# Intel Pytorch containers seem to have Pytorch installed in /usr/local
33+
PY_SITE_PATH=$(find /usr/local/lib/ -maxdepth 1 -name 'python?.*' -type d)/dist-packages
34+
CMAKE_PREFIX_PATH="${PY_SITE_PATH}/torch/share/cmake;${PY_SITE_PATH}/pybind11/share/cmake"
35+
echo "Trying to use Python libraries from $PY_SITE_PATH"
3436

3537
CONFIG=Release
3638
OPENACC=0

make_nvhpc.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ set -e
3030
# 2. with NVHPC, build fortran bindings that just bind(c) to built lib from (1)
3131

3232
NVPATH=$(ls -d /opt/nvidia/hpc_sdk/Linux_x86_64/??.?)/compilers/bin
33-
PYPATH=$(find /opt/conda/lib/ -maxdepth 1 -name 'python?.*' -type d)
34-
CMAKE_PREFIX_PATH="${PYPATH}/site-packages/torch/share/cmake;${PYPATH}/site-packages/pybind11/share/cmake"
33+
# Nvidia Pytorch containers seem to have Pytorch installed in /usr/local
34+
PY_SITE_PATH=$(find /usr/local/lib/ -maxdepth 1 -name 'python?.*' -type d)/dist-packages
35+
CMAKE_PREFIX_PATH="${PY_SITE_PATH}/torch/share/cmake;${PY_SITE_PATH}/pybind11/share/cmake"
36+
echo "Trying to use Python libraries from $PY_SITE_PATH"
3537

3638
CONFIG=Release
3739
OPENACC=1
@@ -44,8 +46,9 @@ INSTALL_PATH=${1:-$BUILD_PATH/install/}
4446
mkdir -p $BUILD_PATH/build_proxy $BUILD_PATH/build_fortproxy $BUILD_PATH/build_example
4547
# c++ wrappers
4648
(
49+
set -x
4750
cd $BUILD_PATH/build_proxy
48-
cmake -DOPENACC=$OPENACC -DCMAKE_BUILD_TYPE=$CONFIG -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH -DCMAKE_CXX_COMPILER=g++ -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DTORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST ../../src/proxy_lib
51+
cmake -DOPENACC=$OPENACC -DCMAKE_BUILD_TYPE=$CONFIG -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH -DCMAKE_CXX_COMPILER=g++ -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DTORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST" ../../src/proxy_lib
4952
cmake --build . --parallel
5053
make install
5154
)

0 commit comments

Comments
 (0)