Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly link to OpenMP #290

Merged
merged 16 commits into from
Aug 16, 2023
1 change: 1 addition & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
env:
CIBW_ARCHS_LINUX: auto
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_TEST_SKIP: '*-macosx_arm64'

- uses: actions/upload-artifact@v3
with:
Expand Down
7 changes: 3 additions & 4 deletions build_tools/prepare_macos_wheel.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/bin/bash

set -e
set -x
set -exuo pipefail

if [[ "$CIBW_BUILD" == *-macosx_arm64 ]]; then
if [[ "${ARCHFLAGS:-}" == *arm64 ]]; then
CONDA_CHANNEL="conda-forge/osx-arm64"
else
CONDA_CHANNEL="conda-forge/osx-64"
fi

conda create -n build -c $CONDA_CHANNEL jemalloc-local xsimd llvm-openmp
conda create -y -n build -c $CONDA_CHANNEL jemalloc-local xsimd llvm-openmp
jtilly marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ before-build = [
]

[tool.cibuildwheel.macos.environment]
LDFLAGS="-Wl,-rpath,$CONDA/envs/build/lib -L$CONDA/envs/build/lib"
LDFLAGS="-Wl,-rpath,$CONDA/envs/build/lib -L$CONDA/envs/build/lib -lomp -ljemalloclocal"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(How) is this related to

tabmat/setup.py

Lines 62 to 86 in fbf7755

elif sys.platform == "darwin":
jemalloc_config = shutil.which("jemalloc-config")
if "JE_INSTALL_SUFFIX" in os.environ:
je_install_suffix = os.environ["JE_INSTALL_SUFFIX"]
elif jemalloc_config is None:
je_install_suffix = ""
else:
pkg_info = (
Path(jemalloc_config).parent.parent / "lib" / "pkgconfig" / "jemalloc.pc"
).read_text()
je_install_suffix = [
i.split("=")[1]
for i in pkg_info.split("\n")
if i.startswith("install_suffix=")
].pop()
allocator_libs = [f"jemalloc{je_install_suffix}"]
extra_compile_args = [
"-Xpreprocessor",
"-fopenmp",
"-O3",
"-ffast-math",
"--std=c++17",
f"-DJEMALLOC_INSTALL_SUFFIX={je_install_suffix}",
]
extra_link_args = ["-lomp"]
?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the fix above, it might work without these flags again. Let's try.

CFLAGS="-I$CONDA/envs/build/include"
CXXFLAGS="-I$CONDA/envs/build/include"
CXX="/usr/bin/clang++"
Expand Down