Conversation
57a97a1 to
37ad7f1
Compare
37ad7f1 to
e2d339c
Compare
e2d339c to
576bf79
Compare
| add_executable(CMakeHelloWorld Hello HelloWorld.cpp) | ||
|
|
||
| # BLAS libraries compile dynamically against threads | ||
| LIST(APPEND CMAKE_THREAD_LIBS_INIT ${LM}) |
There was a problem hiding this comment.
${LM} is -llibm -llibdl (aka /usr/lib/x86_64-linux-gnu/libm.so and /usr/lib/x86_64-linux-gnu/libdl.so)
This is only needed by gcc compilers, so it should be inside an if statement like if (CMAKE_C_COMPILER MATCHES ".+gcc")
More over it should be discussed if this find_package should be done silently or not.
Advantages of doing it silently are that target_link_libraries(CMakeHelloWorld Hello ${BLAS_LIBRARIES}) is clear. However to make BLA work with static needs to properly compose the thread libs which makes target_link_libraries(CMakeHelloWorld Hello ${BLAS_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) look like a hack.
Maybe it would be better to just check that Threads is found at the begining of FindBLA.cmake and break if not found, like this is explicit what needs to be done with trheads, and allows for better control. ( In that case, ${LM} should be placed where it's due, and it would make sense Intel10_64lp appending what needs inside FindBLA.cmake)
cc: @agramfort, @aabadie, @kYc0o
There was a problem hiding this comment.
sounds a good way to clean it up indeed.
|
Just to keep track of it somewhere, this if statement should be reviewed since both branches do the same: if (CMAKE_C_COMPILER MATCHES ".+gcc")
list(APPEND BLAS_SEARCH_LIBS
# "mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
"mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
else ()
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
endif () |
| if (CMAKE_C_COMPILER MATCHES ".+gcc") | ||
| list(APPEND BLAS_SEARCH_LIBS | ||
| "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core iomp5") | ||
| # "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") |
There was a problem hiding this comment.
yes I hacked this on mac as there is no gomp on mac os that uses clang without openmp support.
btw we should also test with clang on linux.
No description provided.