-
Notifications
You must be signed in to change notification settings - Fork 280
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
OSX wheels aren't compiled with OpenMP support #4889
Comments
Ugh, so that's why that error looked familiar! I'm using an M1 mac, but somehow yt is working. I'm not specifically setting anything to use OpenMP there though, since I'm only running tiny test cases. |
... so I checked, and I can confirm that although the C code compiles (and I can run a test C program from the command line), I get a similar issue to the one Jack reported if I try to call the |
Building for mac arm64 without OpenMP is definitely something we've been exercising (and we've been publishing wheels for it since yt 4.0.4), so as long as you're not trying to enable it, yt is expected to build and run correctly on this arch (albeit at sub-optimal performance). |
Ugh, yeah this mostly makes me wish I trusted myself to maintain a linux system |
I dug a little bit (with @cphyc's help) and found a reasonably painless way to build yt with OpenMP on this platform # test_omp.sh
set -euxo pipefail
brew install gcc
export CXX=g++-13
export CC=gcc-13
rm -fr .venv | true
python -m venv .venv
source .venv/bin/activate
python -m pip install build
git clone https://github.com/yt-project/ewah_bool_utils.git _ewah_bool_utils
pushd _ewah_bool_utils
rm -fr dist | true
python -m build --wheel
python -m pip install dist/*.whl
popd
git clone https://github.com/yt-project/yt.git _yt
pushd _yt
rm -fr dist | true
python -m build --wheel
python -m pip install dist/*.whl
popd
python -m pip install pandas h5py pooch
OMP_NUM_THREADS=4 python t.py
OMP_NUM_THREADS=2 python t.py # t.py
import yt
from time import monotonic_ns
import os
from tqdm import tqdm
ds = yt.load_sample("output_00080")
NREP=10
tstart = monotonic_ns()
for i in tqdm(range(NREP)):
p = yt.ProjectionPlot(ds, [1, 1, 1], ("gas", "density"))
p.render()
tstop = monotonic_ns()
dt = (tstop-tstart) / 1e9 # in s
print(f"Took {dt:.1e} s ({dt/NREP:.1e} s/it)", end="")
if (omp_num_threads:=os.environ.get("OMP_NUM_THREADS")) is not None:
print(f" using {omp_num_threads} OpenMP threads")
else:
print() However, because this technique involves dynamically linking |
Bug report
Bug summary
OSX wheels aren't compiled with OpenMP support (as can be read from the log of the wheels compilations). The default
clang
compiler on OSX doesn't seem to support OpenMP compilation as far as I could tell (but I do not have an OSX machine to confirm/infirm), so extending the documentation to compile with OpenMP support would be useful. In any case, I've had users report that installing from source does not compile with OpenMP support.Code for reproduction
The text was updated successfully, but these errors were encountered: