grimme-lab / mctc-lib

Modular computation tool chain library
https://grimme-lab.github.io/mctc-lib
Apache License 2.0
15 stars 17 forks source link

OpenMP is not effective #57

Closed e-kwsm closed 2 months ago

e-kwsm commented 1 year ago

OpenMP effectiveness can be configured by https://github.com/grimme-lab/mctc-lib/blob/cc30341ec6a6c319489c4b4b5f7f2178db7a142d/meson_options.txt#L15-L21 or https://github.com/grimme-lab/mctc-lib/blob/cc30341ec6a6c319489c4b4b5f7f2178db7a142d/config/CMakeLists.txt#L17.

(the default values differ)

OpenMP flags, however, are not added even if the variable is set to true.

CMake requires something like

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,2 +55,10 @@ if(WITH_JSON)
 endif()
+if(WITH_OpenMP)
+  find_package(OpenMP REQUIRED)
+  target_link_libraries(
+    "${PROJECT_NAME}-lib"
+    PRIVATE
+    "OpenMP::OpenMP_Fortran"
+  )
+endif()
 set_target_properties(

The feature is used in https://github.com/grimme-lab/mctc-lib/blob/cc30341ec6a6c319489c4b4b5f7f2178db7a142d/src/mctc/env/testing.f90#L207-L214 and in https://github.com/grimme-lab/mctc-lib/blob/cc30341ec6a6c319489c4b4b5f7f2178db7a142d/src/mctc/env/testing.f90#L269-L287.