8000 OpenMP is not effective · Issue #57 · grimme-lab/mctc-lib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

OpenMP is not effective #57

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

Closed
e-kwsm 8000 opened this issue Feb 7, 2023 · 0 comments · Fixed by #65
Closed

OpenMP is not effective #57

e-kwsm opened this issue Feb 7, 2023 · 0 comments · Fixed by #65

Comments

@e-kwsm
Copy link
Contributor
e-kwsm commented Feb 7, 2023

OpenMP effectiveness can be configured by

option(
'openmp',
type: 'boolean',
value: false,
yield: true,
description: 'use OpenMP parallelisation',
)
or
option(WITH_OpenMP "Enable support for shared memory parallelisation with OpenMP" TRUE)
.

(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

!$omp parallel do shared(testsuite, unit) reduction(+:stat) if(parallelize)
do ii = 1, size(testsuite)
!$omp critical(mctc_env_testsuite)
write(unit, '(1x, 3(1x, a), 1x, "(", i0, "/", i0, ")")') &
& "Starting", testsuite(ii)%name, "...", ii, size(testsuite)
!$omp end critical(mctc_env_testsuite)
call run_unittest(testsuite(ii), unit, stat)
end do
and in
!$omp critical(mctc_env_testsuite)
if (allocated(error) .neqv. test%should_fail) then
if (test%should_fail) then
write(unit, fmt) indent, test%name, "[UNEXPECTED PASS]"
else
write(unit, fmt) indent, test%name, "[FAILED]"
end if
stat = stat + 1
else
if (test%should_fail) then
write(unit, fmt) indent, test%name, "[EXPECTED FAIL]"
else
write(unit, fmt) indent, test%name, "[PASSED]"
end if
end if
if (allocated(error)) then
write(unit, fmt) "Message:", error%message
end if
!$omp end critical(mctc_env_testsuite)
.

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 a pull request may close this issue.

1 participant
0