From c6f0cf5bd9965f013749b8855cc74cd94efe30eb Mon Sep 17 00:00:00 2001 From: Hans Pabst Date: Wed, 16 Oct 2024 10:21:45 +0200 Subject: [PATCH] #857: conditionally rely on PARALLEL WORKSHARE - Cleanup USE OMP_LIB directives. --- src/acc/cuda/dbcsr_cuda_profiling.F | 2 +- src/base/dbcsr_machine.F | 4 +-- src/block/dbcsr_block_access.F | 2 +- src/block/dbcsr_block_operations.F | 1 - src/block/dbcsr_iterator_operations.F | 2 +- src/core/dbcsr_lib.F | 2 -- src/core/dbcsr_methods.F | 1 - src/core/dbcsr_types.F | 2 -- src/data/dbcsr_data_methods_low.F | 2 -- src/data/dbcsr_data_operations.F | 2 -- src/data/dbcsr_data_types.F | 2 +- src/data/dbcsr_mem_methods.F | 3 +-- src/data/dbcsr_ptr_util.F | 10 +++---- src/dbcsr_api.F | 1 - src/dist/dbcsr_dist_methods.F | 4 +-- src/dist/dbcsr_dist_operations.F | 2 -- src/dist/dbcsr_dist_util.F | 1 - src/mm/dbcsr_acc_operations.F | 2 -- src/mm/dbcsr_mm_3d.F | 5 ++-- src/mm/dbcsr_mm_cannon.F | 2 +- src/mm/dbcsr_mm_csr.F | 2 +- src/mm/dbcsr_mm_dist_operations.F | 2 -- src/mm/dbcsr_mm_hostdrv.F | 2 -- src/mm/dbcsr_mm_multrec.F | 2 +- src/mm/dbcsr_mm_sched.F | 2 +- src/mm/dbcsr_multiply_api.F | 2 -- src/mpi/dbcsr_mp_methods.F | 2 -- src/mpi/dbcsr_mpiwrap.F | 6 +++-- src/ops/dbcsr_io.F | 2 -- src/ops/dbcsr_operations.F | 39 +++++++++++++++------------ src/ops/dbcsr_test_methods.F | 2 -- src/ops/dbcsr_tests.F | 2 -- src/ops/dbcsr_transformations.F | 2 -- src/utils/dbcsr_toollib.F | 2 -- src/work/dbcsr_work_operations.F | 2 +- 35 files changed, 48 insertions(+), 75 deletions(-) diff --git a/src/acc/cuda/dbcsr_cuda_profiling.F b/src/acc/cuda/dbcsr_cuda_profiling.F index ea9bdf46b29..d9364381bb8 100644 --- a/src/acc/cuda/dbcsr_cuda_profiling.F +++ b/src/acc/cuda/dbcsr_cuda_profiling.F @@ -17,7 +17,7 @@ MODULE dbcsr_cuda_profiling int_8 #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads +!$ USE OMP_LIB, ONLY: omp_get_thread_num IMPLICIT NONE diff --git a/src/base/dbcsr_machine.F b/src/base/dbcsr_machine.F index 3428cf2ee19..8cebf095494 100644 --- a/src/base/dbcsr_machine.F +++ b/src/base/dbcsr_machine.F @@ -17,7 +17,7 @@ MODULE dbcsr_machine m_abort, m_chdir, m_flush_internal => m_flush, m_getarg, m_getcwd, m_getlog, m_getpid, & m_hostnm, m_iargc, m_memory, m_memory_details, m_memory_max, m_mov, m_procrun -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads, OMP_GET_WTIME +!$ USE OMP_LIB, ONLY: omp_get_wtime IMPLICIT NONE @@ -100,7 +100,7 @@ FUNCTION m_walltime() RESULT(wt) wt = (REAL(count, KIND=dp) + REAL(cycles, KIND=dp)*(1.0_dp + REAL(count_max, KIND=dp))) & /REAL(count_rate, KIND=dp) !$ ELSE -!$ wt = OMP_GET_WTIME() +!$ wt = omp_get_wtime() !$ END IF #endif END FUNCTION m_walltime diff --git a/src/block/dbcsr_block_access.F b/src/block/dbcsr_block_access.F index 71cd2076b07..6fd7319deea 100644 --- a/src/block/dbcsr_block_access.F +++ b/src/block/dbcsr_block_access.F @@ -62,7 +62,7 @@ MODULE dbcsr_block_access real_8 #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads +!$ USE OMP_LIB, ONLY: omp_get_thread_num, omp_get_num_threads IMPLICIT NONE diff --git a/src/block/dbcsr_block_operations.F b/src/block/dbcsr_block_operations.F index fc7f8b51e4d..370327c20d5 100644 --- a/src/block/dbcsr_block_operations.F +++ b/src/block/dbcsr_block_operations.F @@ -30,7 +30,6 @@ MODULE dbcsr_block_operations sp #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads IMPLICIT NONE #if defined(__LIBXSMM) && TO_VERSION(1, 10) < TO_VERSION(LIBXSMM_CONFIG_VERSION_MAJOR, LIBXSMM_CONFIG_VERSION_MINOR) # define __LIBXSMM_BLOCKOPS diff --git a/src/block/dbcsr_iterator_operations.F b/src/block/dbcsr_iterator_operations.F index 64afa010657..49626f1a52d 100644 --- a/src/block/dbcsr_iterator_operations.F +++ b/src/block/dbcsr_iterator_operations.F @@ -31,7 +31,7 @@ MODULE dbcsr_iterator_operations real_8 #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads, omp_in_parallel +!$ USE OMP_LIB, ONLY: omp_get_thread_num, omp_get_num_threads, omp_in_parallel IMPLICIT NONE diff --git a/src/core/dbcsr_lib.F b/src/core/dbcsr_lib.F index 401abe931da..3f0a44a7c41 100644 --- a/src/core/dbcsr_lib.F +++ b/src/core/dbcsr_lib.F @@ -56,8 +56,6 @@ MODULE dbcsr_lib #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_thread_num, omp_get_num_threads - #if defined (__DBCSR_ACC) USE ISO_C_BINDING, ONLY: C_INT #endif diff --git a/src/core/dbcsr_methods.F b/src/core/dbcsr_methods.F index 862076e3fb2..70e7b9c064e 100644 --- a/src/core/dbcsr_methods.F +++ b/src/core/dbcsr_methods.F @@ -27,7 +27,6 @@ MODULE dbcsr_methods dbcsr_type_real_8, dbcsr_type_symmetric, dbcsr_work_type #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads IMPLICIT NONE PRIVATE diff --git a/src/core/dbcsr_types.F b/src/core/dbcsr_types.F index 0c175889be8..fb232079d51 100644 --- a/src/core/dbcsr_types.F +++ b/src/core/dbcsr_types.F @@ -24,8 +24,6 @@ MODULE dbcsr_types int_8 USE dbcsr_mpiwrap, ONLY: mp_comm_type, mp_comm_null -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - IMPLICIT NONE PRIVATE diff --git a/src/data/dbcsr_data_methods_low.F b/src/data/dbcsr_data_methods_low.F index 8e89bb267a8..041a6ef3edb 100644 --- a/src/data/dbcsr_data_methods_low.F +++ b/src/data/dbcsr_data_methods_low.F @@ -30,8 +30,6 @@ MODULE dbcsr_data_methods_low real_8 #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - IMPLICIT NONE PRIVATE diff --git a/src/data/dbcsr_data_operations.F b/src/data/dbcsr_data_operations.F index 66e8f9c1bea..e5e9e1ba079 100644 --- a/src/data/dbcsr_data_operations.F +++ b/src/data/dbcsr_data_operations.F @@ -30,8 +30,6 @@ MODULE dbcsr_data_operations dbcsr_type_real_8 #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - IMPLICIT NONE PRIVATE diff --git a/src/data/dbcsr_data_types.F b/src/data/dbcsr_data_types.F index cef186a0512..da18b6c4407 100644 --- a/src/data/dbcsr_data_types.F +++ b/src/data/dbcsr_data_types.F @@ -15,7 +15,7 @@ MODULE dbcsr_data_types USE dbcsr_kinds, ONLY: & dp, int_4, int_4_size, int_8, int_8_size, real_4, real_4_size, real_8, real_8_size -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads, omp_lock_kind +!$ USE OMP_LIB, ONLY: omp_lock_kind #include "base/dbcsr_base_uses.f90" diff --git a/src/data/dbcsr_mem_methods.F b/src/data/dbcsr_mem_methods.F index 66abf41f35a..a28a8fbef79 100644 --- a/src/data/dbcsr_mem_methods.F +++ b/src/data/dbcsr_mem_methods.F @@ -22,8 +22,7 @@ MODULE dbcsr_mem_methods dbcsr_memtype_type USE dbcsr_kinds, ONLY: dp -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads, & -!$ omp_set_lock, omp_unset_lock, omp_init_lock, omp_lock_kind, omp_destroy_lock +!$ USE OMP_LIB, ONLY: omp_set_lock, omp_unset_lock, omp_init_lock, omp_destroy_lock #include "base/dbcsr_base_uses.f90" diff --git a/src/data/dbcsr_ptr_util.F b/src/data/dbcsr_ptr_util.F index eb9d25da071..390ec78a0d8 100644 --- a/src/data/dbcsr_ptr_util.F +++ b/src/data/dbcsr_ptr_util.F @@ -28,7 +28,7 @@ MODULE dbcsr_ptr_util mp_deallocate #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads +!$ USE OMP_LIB, ONLY: omp_in_parallel IMPLICIT NONE @@ -297,11 +297,11 @@ SUBROUTINE mem_copy_${nametype1}$ (dst, src, n) ${type1}$, DIMENSION(1:n), INTENT(IN) :: src !! source memory #if !defined(__DBCSR_DISABLE_WORKSHARE) -!$OMP PARALLEL WORKSHARE DEFAULT(none) SHARED(dst,src) +!$OMP PARALLEL WORKSHARE DEFAULT(none) SHARED(dst,src) IF(.NOT. omp_in_parallel()) #endif dst(:) = src(:) #if !defined(__DBCSR_DISABLE_WORKSHARE) -!$OMP END PARALLEL WORKSHARE +!$OMP END PARALLEL WORKSHARE #endif END SUBROUTINE mem_copy_${nametype1}$ @@ -313,11 +313,11 @@ SUBROUTINE mem_zero_${nametype1}$ (dst, n) ${type1}$, DIMENSION(1:n), INTENT(OUT) :: dst !! destination memory #if !defined(__DBCSR_DISABLE_WORKSHARE) -!$OMP PARALLEL WORKSHARE DEFAULT(none) SHARED(dst) +!$OMP PARALLEL WORKSHARE DEFAULT(none) SHARED(dst) IF(.NOT. omp_in_parallel()) #endif dst(:) = ${zero1}$ #if !defined(__DBCSR_DISABLE_WORKSHARE) -!$OMP END PARALLEL WORKSHARE +!$OMP END PARALLEL WORKSHARE #endif END SUBROUTINE mem_zero_${nametype1}$ diff --git a/src/dbcsr_api.F b/src/dbcsr_api.F index d28060357ea..a0a3faa4d10 100644 --- a/src/dbcsr_api.F +++ b/src/dbcsr_api.F @@ -140,7 +140,6 @@ MODULE dbcsr_api real_4, & real_8 -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads #include "base/dbcsr_base_uses.f90" IMPLICIT NONE diff --git a/src/dist/dbcsr_dist_methods.F b/src/dist/dbcsr_dist_methods.F index 8a44ac20f76..68b2ac0a38c 100644 --- a/src/dist/dbcsr_dist_methods.F +++ b/src/dist/dbcsr_dist_methods.F @@ -39,7 +39,7 @@ MODULE dbcsr_dist_methods dbcsr_mp_obj #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads, OMP_IN_PARALLEL +!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_num_threads, omp_in_parallel IMPLICIT NONE PRIVATE @@ -467,7 +467,7 @@ SUBROUTINE dbcsr_distribution_make_threads(dist, row_sizes) ! --------------------------------------------------------------------------- dist_p => dist -!$ IF (.NOT. OMP_IN_PARALLEL()) THEN +!$ IF (.NOT. omp_in_parallel()) THEN ! GCC 10.2 refused to build with DEFAULT(NONE) SHARED(dist_p, row_sizes) here: !$OMP PARALLEL DEFAULT(SHARED) !$ CALL make_threads(dist_p, row_sizes=row_sizes) diff --git a/src/dist/dbcsr_dist_operations.F b/src/dist/dbcsr_dist_operations.F index 1a6972b5075..2ebf3fb65c1 100644 --- a/src/dist/dbcsr_dist_operations.F +++ b/src/dist/dbcsr_dist_operations.F @@ -36,8 +36,6 @@ MODULE dbcsr_dist_operations dbcsr_type #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - IMPLICIT NONE PRIVATE diff --git a/src/dist/dbcsr_dist_util.F b/src/dist/dbcsr_dist_util.F index 8070f2fd5a8..ea988a1fe99 100644 --- a/src/dist/dbcsr_dist_util.F +++ b/src/dist/dbcsr_dist_util.F @@ -47,7 +47,6 @@ MODULE dbcsr_dist_util dbcsr_type_complex_8, dbcsr_type_real_4, dbcsr_type_real_8 #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads IMPLICIT NONE PRIVATE diff --git a/src/mm/dbcsr_acc_operations.F b/src/mm/dbcsr_acc_operations.F index d9b9d10040f..776f7ada5f1 100644 --- a/src/mm/dbcsr_acc_operations.F +++ b/src/mm/dbcsr_acc_operations.F @@ -23,8 +23,6 @@ MODULE dbcsr_acc_operations USE dbcsr_kinds, ONLY: real_8, dp USE dbcsr_types, ONLY: dbcsr_type_real_8 -!$ USE OMP_LIB, ONLY: omp_get_thread_num, omp_get_num_threads - #include "base/dbcsr_base_uses.f90" IMPLICIT NONE diff --git a/src/mm/dbcsr_mm_3d.F b/src/mm/dbcsr_mm_3d.F index b25b360abd7..60f46754518 100644 --- a/src/mm/dbcsr_mm_3d.F +++ b/src/mm/dbcsr_mm_3d.F @@ -107,8 +107,9 @@ MODULE dbcsr_mm_3d dbcsr_work_destroy #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads, & -!$ omp_set_lock, omp_unset_lock, omp_init_lock, omp_lock_kind, omp_destroy_lock +!$ USE OMP_LIB, ONLY: omp_get_thread_num, omp_get_num_threads, & +!$ omp_set_lock, omp_unset_lock, omp_init_lock, & +!$ omp_lock_kind, omp_destroy_lock IMPLICIT NONE diff --git a/src/mm/dbcsr_mm_cannon.F b/src/mm/dbcsr_mm_cannon.F index 53b1f7faf7c..71357f53ded 100644 --- a/src/mm/dbcsr_mm_cannon.F +++ b/src/mm/dbcsr_mm_cannon.F @@ -123,7 +123,7 @@ MODULE dbcsr_mm_cannon #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads +!$ USE OMP_LIB, ONLY: omp_get_thread_num, omp_get_num_threads IMPLICIT NONE diff --git a/src/mm/dbcsr_mm_csr.F b/src/mm/dbcsr_mm_csr.F index 0cf05b0a7e3..f84692b747f 100644 --- a/src/mm/dbcsr_mm_csr.F +++ b/src/mm/dbcsr_mm_csr.F @@ -45,7 +45,7 @@ MODULE dbcsr_mm_csr dbcsr_work_type #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads +!$ USE OMP_LIB, ONLY: omp_get_thread_num, omp_get_num_threads IMPLICIT NONE diff --git a/src/mm/dbcsr_mm_dist_operations.F b/src/mm/dbcsr_mm_dist_operations.F index 04159a34a83..7095bd18cd1 100644 --- a/src/mm/dbcsr_mm_dist_operations.F +++ b/src/mm/dbcsr_mm_dist_operations.F @@ -35,8 +35,6 @@ MODULE dbcsr_mm_dist_operations dbcsr_slot_nblkcols_local, dbcsr_slot_nblkrows_local, dbcsr_type #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - IMPLICIT NONE PRIVATE diff --git a/src/mm/dbcsr_mm_hostdrv.F b/src/mm/dbcsr_mm_hostdrv.F index fa33c90021a..99eee4e3641 100644 --- a/src/mm/dbcsr_mm_hostdrv.F +++ b/src/mm/dbcsr_mm_hostdrv.F @@ -38,8 +38,6 @@ MODULE dbcsr_mm_hostdrv sp #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - IMPLICIT NONE PRIVATE diff --git a/src/mm/dbcsr_mm_multrec.F b/src/mm/dbcsr_mm_multrec.F index 161b0b69f6a..2d3152dab1a 100644 --- a/src/mm/dbcsr_mm_multrec.F +++ b/src/mm/dbcsr_mm_multrec.F @@ -43,7 +43,7 @@ MODULE dbcsr_mm_multrec sp #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads +!$ USE OMP_LIB, ONLY: omp_get_thread_num, omp_get_num_threads IMPLICIT NONE diff --git a/src/mm/dbcsr_mm_sched.F b/src/mm/dbcsr_mm_sched.F index db68526e398..19fd41de289 100644 --- a/src/mm/dbcsr_mm_sched.F +++ b/src/mm/dbcsr_mm_sched.F @@ -49,7 +49,7 @@ MODULE dbcsr_mm_sched dbcsr_work_type #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads +!$ USE OMP_LIB, ONLY: omp_get_thread_num, omp_get_num_threads IMPLICIT NONE diff --git a/src/mm/dbcsr_multiply_api.F b/src/mm/dbcsr_multiply_api.F index 44c0806bb99..ff0b95e2f5c 100644 --- a/src/mm/dbcsr_multiply_api.F +++ b/src/mm/dbcsr_multiply_api.F @@ -18,8 +18,6 @@ MODULE dbcsr_multiply_api dbcsr_type_real_4, & dbcsr_type_real_8 -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - #include "base/dbcsr_base_uses.f90" IMPLICIT NONE diff --git a/src/mpi/dbcsr_mp_methods.F b/src/mpi/dbcsr_mp_methods.F index 413e9afbf4c..7ef89d040fc 100644 --- a/src/mpi/dbcsr_mp_methods.F +++ b/src/mpi/dbcsr_mp_methods.F @@ -19,8 +19,6 @@ MODULE dbcsr_mp_methods mp_comm_null, mp_comm_type USE dbcsr_types, ONLY: dbcsr_mp_obj -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - #include "base/dbcsr_base_uses.f90" IMPLICIT NONE diff --git a/src/mpi/dbcsr_mpiwrap.F b/src/mpi/dbcsr_mpiwrap.F index f5393630eb9..c4d4061eeba 100644 --- a/src/mpi/dbcsr_mpiwrap.F +++ b/src/mpi/dbcsr_mpiwrap.F @@ -95,6 +95,8 @@ MODULE dbcsr_mpiwrap #define MPI_STATUS_EXTRACT(X) (X) #endif +!$ USE OMP_LIB, ONLY: omp_in_parallel + IMPLICIT NONE PRIVATE @@ -5183,11 +5185,11 @@ SUBROUTINE mp_rget_${nametype1}$v(base, source, win, win_data, myproc, disp, req #endif IF (do_local_copy) THEN #if !defined(__DBCSR_DISABLE_WORKSHARE) -!$OMP PARALLEL WORKSHARE DEFAULT(none) SHARED(base,win_data,disp_aint,len) +!$OMP PARALLEL WORKSHARE DEFAULT(none) SHARED(base,win_data,disp_aint,len) IF(.NOT. omp_in_parallel()) #endif base(:) = win_data(disp_aint + 1:disp_aint + len) #if !defined(__DBCSR_DISABLE_WORKSHARE) -!$OMP END PARALLEL WORKSHARE +!$OMP END PARALLEL WORKSHARE #endif request = mp_request_null ierr = 0 diff --git a/src/ops/dbcsr_io.F b/src/ops/dbcsr_io.F index c5920543788..c024bb930bd 100644 --- a/src/ops/dbcsr_io.F +++ b/src/ops/dbcsr_io.F @@ -48,8 +48,6 @@ MODULE dbcsr_io USE dbcsr_work_operations, ONLY: dbcsr_create #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - IMPLICIT NONE PRIVATE diff --git a/src/ops/dbcsr_operations.F b/src/ops/dbcsr_operations.F index e0a59a92e48..9a0d662cc5a 100644 --- a/src/ops/dbcsr_operations.F +++ b/src/ops/dbcsr_operations.F @@ -94,7 +94,7 @@ MODULE dbcsr_operations mp_sum #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads +!$ USE OMP_LIB, ONLY: omp_get_thread_num, omp_get_num_threads, omp_in_parallel IMPLICIT NONE @@ -316,32 +316,37 @@ SUBROUTINE dbcsr_zero(matrix_a) CALL timeset(routineN, handle) SELECT CASE (dbcsr_get_data_type(matrix_a)) -#if defined(__DBCSR_DISABLE_WORKSHARE) CASE (dbcsr_type_complex_4) +#if !defined(__DBCSR_DISABLE_WORKSHARE) +!$OMP PARALLEL WORKSHARE DEFAULT(NONE) SHARED(matrix_a) IF(.NOT. omp_in_parallel()) matrix_a%data_area%d%c_sp = (0.0, 0.0) - CASE (dbcsr_type_complex_8) - matrix_a%data_area%d%c_dp = (0.0_dp, 0.0_dp) - CASE (dbcsr_type_real_4) - matrix_a%data_area%d%r_sp = 0.0 - CASE (dbcsr_type_real_8) - matrix_a%data_area%d%r_dp = 0.0_dp +!$OMP END PARALLEL WORKSHARE #else - CASE (dbcsr_type_complex_4) -!$OMP PARALLEL WORKSHARE DEFAULT(NONE), SHARED(matrix_a) matrix_a%data_area%d%c_sp = (0.0, 0.0) -!$OMP END PARALLEL WORKSHARE +#endif CASE (dbcsr_type_complex_8) -!$OMP PARALLEL WORKSHARE DEFAULT(NONE), SHARED(matrix_a) +#if !defined(__DBCSR_DISABLE_WORKSHARE) +!$OMP PARALLEL WORKSHARE DEFAULT(NONE) SHARED(matrix_a) IF(.NOT. omp_in_parallel()) matrix_a%data_area%d%c_dp = (0.0_dp, 0.0_dp) -!$OMP END PARALLEL WORKSHARE +!$OMP END PARALLEL WORKSHARE +#else + matrix_a%data_area%d%c_dp = (0.0_dp, 0.0_dp) +#endif CASE (dbcsr_type_real_4) -!$OMP PARALLEL WORKSHARE DEFAULT(NONE), SHARED(matrix_a) +#if !defined(__DBCSR_DISABLE_WORKSHARE) +!$OMP PARALLEL WORKSHARE DEFAULT(NONE) SHARED(matrix_a) IF(.NOT. omp_in_parallel()) + matrix_a%data_area%d%r_sp = 0.0 +!$OMP END PARALLEL WORKSHARE +#else matrix_a%data_area%d%r_sp = 0.0 -!$OMP END PARALLEL WORKSHARE +#endif CASE (dbcsr_type_real_8) -!$OMP PARALLEL WORKSHARE DEFAULT(NONE), SHARED(matrix_a) +#if !defined(__DBCSR_DISABLE_WORKSHARE) +!$OMP PARALLEL WORKSHARE DEFAULT(NONE) SHARED(matrix_a) IF(.NOT. omp_in_parallel()) + matrix_a%data_area%d%r_dp = 0.0_dp +!$OMP END PARALLEL WORKSHARE +#else matrix_a%data_area%d%r_dp = 0.0_dp -!$OMP END PARALLEL WORKSHARE #endif END SELECT CALL timestop(handle) diff --git a/src/ops/dbcsr_test_methods.F b/src/ops/dbcsr_test_methods.F index bc081615913..ef7e5cd3528 100644 --- a/src/ops/dbcsr_test_methods.F +++ b/src/ops/dbcsr_test_methods.F @@ -60,8 +60,6 @@ MODULE dbcsr_test_methods dbcsr_work_create #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - IMPLICIT NONE PRIVATE diff --git a/src/ops/dbcsr_tests.F b/src/ops/dbcsr_tests.F index dc498862459..c3f69ff8012 100644 --- a/src/ops/dbcsr_tests.F +++ b/src/ops/dbcsr_tests.F @@ -55,8 +55,6 @@ MODULE dbcsr_tests USE dbcsr_work_operations, ONLY: dbcsr_create #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - IMPLICIT NONE PRIVATE diff --git a/src/ops/dbcsr_transformations.F b/src/ops/dbcsr_transformations.F index ff4e060cf00..e6fc2a17806 100644 --- a/src/ops/dbcsr_transformations.F +++ b/src/ops/dbcsr_transformations.F @@ -91,8 +91,6 @@ MODULE dbcsr_transformations dbcsr_work_create #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - IMPLICIT NONE PRIVATE diff --git a/src/utils/dbcsr_toollib.F b/src/utils/dbcsr_toollib.F index 5e6da8cf939..e084f683819 100644 --- a/src/utils/dbcsr_toollib.F +++ b/src/utils/dbcsr_toollib.F @@ -19,8 +19,6 @@ MODULE dbcsr_toollib real_8 #include "base/dbcsr_base_uses.f90" -!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads - IMPLICIT NONE PRIVATE diff --git a/src/work/dbcsr_work_operations.F b/src/work/dbcsr_work_operations.F index e55d0efae2e..faff0aee208 100644 --- a/src/work/dbcsr_work_operations.F +++ b/src/work/dbcsr_work_operations.F @@ -916,7 +916,7 @@ SUBROUTINE dbcsr_finalize(matrix, reshuffle) ! built/modified in a parallel environment nwms = SIZE(matrix%wms) spawn = .FALSE. -!$ IF (.NOT. OMP_IN_PARALLEL()) THEN +!$ IF (.NOT. omp_in_parallel()) THEN !$ IF (nwms .GT. 1) spawn = .TRUE. !$ END IF IF (spawn) THEN