Skip to content

Commit

Permalink
Don't bundle libomp in runtime package
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed Feb 3, 2022
1 parent c75adcb commit fc6d259
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
35 changes: 18 additions & 17 deletions tests/ci_build/build_python_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
set -e
set -x

if [[ $# -ne 2 ]]; then
echo "Usage: $0 [platform_id] [commit ID]"
if [[ $# -ne 3 ]]; then
echo "Usage: $0 [platform_id] [commit ID] [python package location]"
exit 1
fi

platform_id=$1
shift
commit_id=$1
shift
python_pkg_root=$1
shift

# Bundle libomp 11.1.0 when targeting MacOS.
# This is a workaround in order to prevent segfaults when running inside a Conda environment.
Expand Down Expand Up @@ -49,18 +51,20 @@ if [[ "$platform_id" == macosx_* ]]; then
export CIBW_TEST_SKIP='*-macosx_arm64'
export CIBW_BUILD_VERBOSITY=3

sudo conda create -n build $OPENMP_URL
conda info -e
PREFIX="$HOME/miniconda/envs/build"
if [[ "${NO_OPENMP}" != 1 ]]; then
sudo conda create -n build $OPENMP_URL
conda info -e
PREFIX="$HOME/miniconda/envs/build"

# Set up build flags for cibuildwheel
# This is needed to bundle libomp lib we downloaded earlier
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp"
export CFLAGS="$CFLAGS -I$PREFIX/include"
export CXXFLAGS="$CXXFLAGS -I$PREFIX/include"
export LDFLAGS="$LDFLAGS -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp"
# Set up build flags for cibuildwheel
# This is needed to bundle libomp lib we downloaded earlier
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp"
export CFLAGS="$CFLAGS -I$PREFIX/include"
export CXXFLAGS="$CXXFLAGS -I$PREFIX/include"
export LDFLAGS="$LDFLAGS -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp"
fi
else
echo "Platform not supported: $platform_id"
exit 2
Expand All @@ -69,9 +73,6 @@ fi
source $HOME/miniconda/bin/activate
conda activate python3
python -m pip install cibuildwheel
python -m cibuildwheel python --output-dir wheelhouse
python -m cibuildwheel runtime/python --output-dir wheelhouse-runtime
python -m cibuildwheel ${python_pkg_root} --output-dir wheelhouse
python tests/ci_build/rename_whl.py wheelhouse/*.whl ${commit_id} ${wheel_tag}
python tests/ci_build/rename_whl.py wheelhouse-runtime/*.whl ${commit_id} ${wheel_tag}
mv -v wheelhouse/*.whl .
mv -v wheelhouse-runtime/*.whl .
3 changes: 2 additions & 1 deletion tests/travis/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ if [ ${TASK} == "python_sdist_test" ]; then
fi

if [ ${TASK} == "python_wheels" ]; then
tests/ci_build/build_python_wheels.sh ${CIBW_PLATFORM_ID} ${TRAVIS_COMMIT}
tests/ci_build/build_python_wheels.sh ${CIBW_PLATFORM_ID} ${TRAVIS_COMMIT} python
NO_OPENMP=1 tests/ci_build/build_python_wheels.sh ${CIBW_PLATFORM_ID} ${TRAVIS_COMMIT} runtime/python
# Deploy binary wheels to S3
conda activate python3
python --version
Expand Down

0 comments on commit fc6d259

Please sign in to comment.