dev-cafe / autocmake

CMake plugin composer.
http://autocmake.org
BSD 3-Clause "New" or "Revised" License
42 stars 18 forks source link

math detection ramblings #216

Open loriab opened 7 years ago

loriab commented 7 years ago

Hi, @bast, @robertodr asked me to collect some of my thoughts on renovated math detection, esp. in the light of new CMake features. So here's some ramblings, and I'll post to this issue as other things occur to me.

+# [Linux|Mac]/compiler_fam/[dynamic|single_dynamic_lib]/[native|no_choice|intel]_OpenMP_threading
+
+# (a) = iomp5 only choice with icpc and that's self-contained but want the extra flags so g++-based plugins run correctly
+# (b) = clang-based so no intervention req'd
+# (c) = to satisfy OpenMP symbols and suppress libgomp
+ 
+# L/gnu/Dyn/N       -lmkl_intel_lp64 -lmkl_gnu_thread   -lmkl_core -lgomp         -lpthread -lm -ldl
+# L/pgi/Dyn/N       -lmkl_intel_lp64 -lmkl_pgi_thread   -lmkl_core -pgf90libs -mp -lpthread -lm -ldl
+ 
+# L/intel/Dyn/-     -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl       IN
+# M/intel/Dyn/-     -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl       IN
+# L/gnu/Dyn/I       -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl       I(c):[-fno-openmp] N(above)
+# M/gnu/Dyn/-       -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl       I(c):[-fno-openmp] N(n/a):
+# L/pgi/Dyn/I       -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl       I:? N(above)
+# M/pgi/Dyn/-       -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl       I:? N(n/a):
+# M/clang/Dyn/-     -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl       IN(b):[]
+ 
+# L/intel/SDL/-     -lmkl_rt -lpthread -lm -ldl         IN(a):[-liomp5 -fno-openmp]
+# M/intel/SDL/-     -lmkl_rt -lpthread -lm -ldl         IN(b):[]
+# L/gnu/SDL/-       -lmkl_rt -lpthread -lm -ldl         I(c):[-liomp5 -fno-openmp] N:[]
+# M/gnu/SDL/-       -lmkl_rt -lpthread -lm -ldl         I(c):[-liomp5 -fno-openmp] N(n/a):
+# L/pgi/SDL/-       -lmkl_rt -lpthread -lm -ldl         ?
+# M/pgi/SDL/-       -lmkl_rt -lpthread -lm -ldl         ?
+# M/clang/SDL/-     -lmkl_rt -lpthread -lm -ldl         IN(b):[]
bast commented 7 years ago

Thanks a lot Lori! That module is up for a serious redesign very soon (before xmas) and your notes and recommendations are super useful for this. If you have more thoughts, please append. They will all be considered.

robertodr commented 7 years ago

I think this could be "escalated" to a CMake issue/merge request. The default BLAS/LAPACK module is simply awful.

loriab commented 7 years ago

Second the "simply awful" appraisal. But I can't imaging supporting Windows, ilp64, all combinations of static, cdft, etc. to replace the CMake one.

Slightly off-topic for autocmake, but the fall-back approach seems to work for modules who don't want to check in the enhanced math detection, https://github.com/ilyak/libefp/blob/master/cmake/FindTargetLAPACK.cmake

miroi commented 7 years ago

Yes, old mathlibs detection is utilized in my mini project, https://github.com/miroi/mathlibs-tester ...

I have no comprehensive idea as how to make universal cmake mathlibs detection macro ....

bast commented 7 years ago

My goal is less entanglement, higher cohesion, and give more control to the caller and leave less thinking to this library. All suggestions welcome which help to brainstorm this better.

loriab commented 6 years ago

fyi https://gist.github.com/multiplemonomials/6ee074038778a21cd25b73659a6a82d9

bast commented 6 years ago

Thanks!

loriab commented 6 years ago

a thought on matching math detection to a pre-built numpy. preserving the comment here. https://github.com/psi4/psi4/pull/1031#discussion_r192517976