Skip to content

Commit

Permalink
Refix openmp on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
HGuillemet committed Jun 23, 2024
1 parent 5b9e86c commit fdcbbbd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
9 changes: 7 additions & 2 deletions .github/actions/deploy-macosx/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ runs:
fi
brew uninstall --force --ignore-dependencies gcc gcc@7 gcc@8 gcc@9 gcc@10 gcc@11 gcc@12 gcc@13 little-cms2 maven openblas r
brew install boost ccache swig autoconf-archive automake cmake libomp libtool libusb ant nasm xz pkg-config sdl2 gpg1 bison flex perl ragel binutils gradle gmp isl libmpc mpfr geoip pcre ssdeep yajl
brew link --force libomp
brew install boost ccache swig autoconf-archive automake cmake libtool libusb ant nasm xz pkg-config sdl2 gpg1 bison flex perl ragel binutils gradle gmp isl libmpc mpfr geoip pcre ssdeep yajl
# Install version of libomp for llvm 15
curl -LO https://raw.githubusercontent.com/Homebrew/homebrew-core/2fae473b19b6cddd6f0e3aa1ad2932f44ff0316e/Formula/libomp.rb
brew install libomp.rb
brew link --force libomp -v
# echo Installing an older less buggy version of CMake
# curl -LO https://raw.githubusercontent.com/Homebrew/homebrew-core/30a3e5e02420a515f9bad02e3cfcde95316db529/Formula/cmake.rb
Expand Down Expand Up @@ -111,6 +115,7 @@ runs:
git --version
clang --version
/usr/local/bin/gcc-* --version || true
which cmake
cmake --version
gradle --version
mvn -version
Expand Down
14 changes: 13 additions & 1 deletion pytorch/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ case $PLATFORM in
macosx-arm64)
export CC="clang"
export CXX="clang++"
export PATH=$(brew --prefix llvm@15)/bin:$PATH # Use brew LLVM 15 instead of Xcode LLVM 14
export CMAKE_OSX_ARCHITECTURES=arm64 # enable cross-compilation on a x86_64 host machine
export USE_MKLDNN=OFF
export USE_QNNPACK=OFF # not compatible with arm64 as of PyTorch 2.1.2
Expand All @@ -151,6 +152,7 @@ case $PLATFORM in
macosx-x86_64)
export CC="clang"
export CXX="clang++"
export PATH=$(brew --prefix llvm@15)/bin:$PATH # Use brew LLVM 15 instead of Xcode LLVM 14
;;
windows-x86_64)
if which ccache.exe; then
Expand Down Expand Up @@ -211,9 +213,19 @@ sedinplace 's/const std::string& interface)/const std::string\& interface_name)/
# and see if choosing experimental works. See Issue #1503.
# On Linux, pytorch FindOpenMP.cmake picks llvm libomp over libgomp. See Issue #1504.
# Keep it on MacOS since it appends the correct -Xpreprocessor -fopenmp -I/usr/local/include flags
if [[ ! $PLATFORM == macosx-* ]]; then
#if [[ ! $PLATFORM == macosx-* ]]; then
rm cmake/Modules/FindOpenMP.cmake
sedinplace 's/include(${CMAKE_CURRENT_LIST_DIR}\/Modules\/FindOpenMP.cmake)/find_package(OpenMP)/g' cmake/Dependencies.cmake
if [[ $PLATFORM == macosx-* ]]; then
# export CXXFLAGS=-I/usr/local/include
export CMAKE_INCLUDE_PATH=/usr/local/include
export CMAKE_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH=/usr/local/lib
export DYLD_LIBRARY_PATH=/usr/local/lib
export OpenMP_C_INCLUDE_DIR=/usr/local/include
export OpenMP_CXX_INCLUDE_DIR=/usr/local/include
#curl -O https://mac.r-project.org/openmp/openmp-14.0.6-darwin20-Release.tar.gz
#tar fvxz openmp-14.0.6-darwin20-Release.tar.gz -C /
fi

#USE_FBGEMM=0 USE_KINETO=0 USE_GLOO=0 USE_MKLDNN=0 \
Expand Down

0 comments on commit fdcbbbd

Please sign in to comment.