Skip to content

Commit

Permalink
* Bundle correctly OpenMP library for PyTorch builds on Mac as well
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed Feb 24, 2022
1 parent 098d6d2 commit 19f61bd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Bundle correctly OpenMP library for PyTorch builds on Mac as well
* Remove dependency on CUDA from presets for Triton Inference Server ([pull #1151](https://github.com/bytedeco/javacpp-presets/pull/1151))
* Disable signal handlers of DepthAI known to cause issues with the JDK ([issue #1118](https://github.com/bytedeco/javacpp-presets/issues/1118))
* Upgrade presets for Gym 0.22.0, ALE 0.7.4, ONNX 1.11.0, and their dependencies
Expand Down
18 changes: 12 additions & 6 deletions pytorch/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,8 @@ case $PLATFORM in
export CXX="g++ -m64"
;;
macosx-*)
ln -sf pytorch/torch/lib ../lib
cp /usr/local/lib/libomp.dylib ../lib/libiomp5.dylib
chmod +w ../lib/libiomp5.dylib
install_name_tool -id @rpath/libiomp5.dylib ../lib/libiomp5.dylib
export CC="clang -L$INSTALL_PATH/lib -Wl,-rpath,$INSTALL_PATH/lib -liomp5 -Wno-unused-command-line-argument"
export CXX="clang++ -L$INSTALL_PATH/lib -Wl,-rpath,$INSTALL_PATH/lib -liomp5 -Wno-unused-command-line-argument"
export CC="clang"
export CXX="clang++"
;;
windows-x86_64)
export CC="cl.exe"
Expand Down Expand Up @@ -153,4 +149,14 @@ ln -sf pytorch/torch/include ../include
ln -sf pytorch/torch/lib ../lib
ln -sf pytorch/torch/bin ../bin

# fix library with correct rpath on Mac
case $PLATFORM in
macosx-*)
cp /usr/local/lib/libomp.dylib ../lib/libiomp5.dylib
chmod +w ../lib/libiomp5.dylib
install_name_tool -id @rpath/libiomp5.dylib ../lib/libiomp5.dylib
install_name_tool -change @rpath/libomp.dylib @rpath/libiomp5.dylib ../lib/libtorch_cpu.dylib
;;
esac

cd ../..

0 comments on commit 19f61bd

Please sign in to comment.