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

Compile failure with conda compiler on macos #1217

Closed
jmeyers314 opened this issue May 19, 2023 · 5 comments · Fixed by #1218
Closed

Compile failure with conda compiler on macos #1217

jmeyers314 opened this issue May 19, 2023 · 5 comments · Fixed by #1218
Assignees
Labels
build Related to compiling, building, installing
Milestone

Comments

@jmeyers314
Copy link
Member

Trying to compile the main branch using the conda compiler that comes with the Rubin Science Pipelines on MacOS 12.6.3. The compiler is identified with Yay! This version of clang supports GPU! (which seems wrong as macs don't really support nvptx nowadays, but maybe it's capable of cross-compiling?). When checking for cpp11 a bit later in setup.py though, it errors out with:

Trying compile command:
x86_64-apple-darwin13.4.0-clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/josh/src/lsst/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-5.1.0/include -fPIC -O2 -isystem /Users/josh/src/lsst/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-5.1.0/include -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/josh/src/lsst/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-5.1.0/include -D_FORTIFY_SOURCE=2 -isystem /Users/josh/src/lsst/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-5.1.0/include -O2 -msse2 -std=c++11 -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -Wno-openmp-mapping -Wno-unknown-cuda-version -Wno-shorten-64-to-32 -fvisibility=hidden -DGALSIM_USE_GPU -c /Users/josh/src/GalSim/tmp/tmpmofvgpp3.cpp -o /Users/josh/src/GalSim/tmp/tmpy5z_ilkd.o
Output was:
    clang-14: error: cannot find libdevice for sm_35; provide path to different CUDA installation via '--cuda-path', or pass '-nocudalib' to build without linking with libdevice

The compiler x86_64-apple-darwin13.4.0-clang with flags -O2 -msse2 -std=c++11 -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -Wno-openmp-mapping -Wno-unknown-cuda-version -Wno-shorten-64-to-32 -fvisibility=hidden -DGALSIM_USE_GPU did not successfully compile C++11 code
error: Compiler is not C++-11 compatible

So looks like a GPU problem. Is there a way to force no-gpu with an env variable or something?

@jmeyers314
Copy link
Member Author

If I comment out this bit: https://github.com/GalSim-developers/GalSim/blob/main/setup.py#L151-L154. Then I'm back in business.

@rmjarvis
Copy link
Member

@jamesp-epcc

Looks like we need a different way to identify a GPU-compatible compiler, which doesn't falsely trigger on the Apple clang variant.

@jamesp-epcc
Copy link
Contributor

OK, it looks as if it's not safe to assume that a compiler that reports nvptx support can actually perform a successful GPU build. Maybe Apple supplies their core compiler with nvptx enabled but it requires other software to function properly. I'll replace this with a check that actually builds a small GPU program and ensures there are no errors.

@jamesp-epcc jamesp-epcc self-assigned this May 22, 2023
@jamesp-epcc
Copy link
Contributor

@jmeyers314 would you be able to check if this version of setup.py fixes the problem for you? https://raw.githubusercontent.com/jamesp-epcc/GalSim/gpu_compiler_detection/setup.py

It works for me on Perlmutter but I don't have a Mac OS machine to hand for testing.

@jmeyers314
Copy link
Member Author

Yep. That looks like it works.

@rmjarvis rmjarvis linked a pull request May 22, 2023 that will close this issue
@rmjarvis rmjarvis added this to the v2.5 milestone Jul 21, 2023
@rmjarvis rmjarvis added the build Related to compiling, building, installing label Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to compiling, building, installing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants