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

Fix build with some clang installations when openmp is enabled #4171

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

boomanaiden154
Copy link
Contributor

There are two instances when building the tests where OpenBLAS fails to build with OpenMP and clang due to library paths getting reset as flags are set rather than appended. This seems to only affect certain clang/libomp installations, but if it's already grabbing the correct library paths we might as well use them.

There are two instances when building the tests where OpenBLAS fails to
build with OpenMP and clang due to library paths getting reset as flags
are set rather than appended. This seems to only affect certain
clang/libomp installations, but if it's already grabbing the correct
library paths we might as well use them.
@martin-frbg
Copy link
Collaborator

Curious what else is in your CEXTRALIB that needs to be preserved for the build to work ? Or do you just have libomp in an unusual location that makes it necessary to pass a -L ... as well ?

@boomanaiden154
Copy link
Contributor Author

Yes. The llvm apt repos puts the shared objects at /usr/lib/llvm-<major version number>/lib/libomp.so which doesn't get picked up by default by the compiler. There are a couple extra -L... directives in CEXTRALIB before it is overwritten that contain the correct include paths (although I'm not sure exactly where they're coming from).

The compilation command for zblat1.o looks like the following before this patch:

gfortran -O2 -Wall -frecursive -fno-optimize-sibling-calls -m64 -fopenmp  -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mavx2 -fno-tree-vectorize  -o zblat1 zblat1.o ../libopenblas_zenp-r0.3.23.dev.a -lm -lpthread -lgfortran -lm -lpthread -lgfortran -lomp

and then like this after the patch:

gfortran -O2 -Wall -frecursive -fno-optimize-sibling-calls -m64 -fopenmp  -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mavx2 -fno-tree-vectorize  -o zblat1 zblat1.o ../libopenblas_zenp-r0.3.23.dev.a -lm -lpthread -lgfortran -lm -lpthread -lgfortran -L/usr/bin/../lib/gcc/x86_64-linux-gnu/11 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/lib -L/usr/lib -L/usr/lib/llvm-16/lib  -lpthread -lc -lomp

Others file show the exact same changes.

@martin-frbg martin-frbg added this to the 0.3.24 milestone Aug 10, 2023
@martin-frbg martin-frbg merged commit 9a0e9c8 into OpenMathLib:develop Aug 10, 2023
52 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants