Skip to content

Commit

Permalink
Reworked CPVERSION_CHECK and using it.
Browse files Browse the repository at this point in the history
  • Loading branch information
hfp committed Oct 28, 2024
1 parent fe35929 commit 83963c3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/base/base_uses.f90
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@
#define CPVERSION3(MAJOR, MINOR, UPDATE) (CPVERSION2(MAJOR, MINOR) + (UPDATE))
#define CPVERSION CPVERSION2

! Usage: CPVERSION_CHECK(9, 5, >, __GNUC__, __GNUC_MINOR__)
! On top of CPVERSION macro, test if MAJOR_TEST and MINOR_TEST are defined.
! Usage: #if CPVERSION_CHECK(9, 5, >, __GNUC__, __GNUC_MINOR__)
! Perform actual comparison according to COMP argument.
#define CPVERSION_CHECK(MAJOR_BASE, MINOR_BASE, COMP, MAJOR_TEST, MINOR_TEST) ((MAJOR_TEST) && (((MINOR_TEST) && \
CPVERSION2(MAJOR_BASE,MINOR_BASE) COMP CPVERSION2(MAJOR_TEST,MINOR_TEST)) || CPVERSION2(MAJOR_BASE,MINOR_BASE) COMP MAJOR_TEST))
! Note: defined(MAJOR_TEST) and defined(MINOR_TEST) is avoided in macro
! definition due to issues handling it in certain compilers.
#define CPVERSION_CHECK(MAJOR_BASE, MINOR_BASE, COMP, MAJOR_TEST, MINOR_TEST) \
(CPVERSION2(MAJOR_BASE, MINOR_BASE) COMP CPVERSION2(MAJOR_TEST, MINOR_TEST))

! Avoid to default initialize type-components (default c'tor)
#if CPVERSION_CHECK(9, 5, >, __GNUC__, __GNUC_MINOR__) || defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)
Expand Down
4 changes: 2 additions & 2 deletions src/mp2_ri_gpw.F
Original file line number Diff line number Diff line change
Expand Up @@ -2052,15 +2052,15 @@ SUBROUTINE mp2_redistribute_gamma(Gamma_P_ia, ij_index, my_B_size, &
DO irep = 0, num_integ_group - 1
start_point = ranges_info_array(3, irep, comm_exchange%mepos)
end_point = ranges_info_array(4, irep, comm_exchange%mepos)
#if CPVERSION_CHECK(2025, 0, <=, __INTEL_LLVM_COMPILER, 0)
#if !defined(__INTEL_LLVM_COMPILER) || (20250000 <= __INTEL_LLVM_COMPILER)
!$OMP PARALLEL WORKSHARE DEFAULT(NONE) &
!$OMP SHARED(start_point,end_point,my_block_size,&
!$OMP Gamma_P_ia,rec_i,my_B_size,BI_C_rec)
#endif
Gamma_P_ia(:, rec_i:rec_i + my_block_size - 1, start_point:end_point) = &
Gamma_P_ia(:, rec_i:rec_i + my_block_size - 1, start_point:end_point) + &
BI_C_rec(1:my_B_size, :, start_point:end_point)
#if CPVERSION_CHECK(2025, 0, <=, __INTEL_LLVM_COMPILER, 0)
#if !defined(__INTEL_LLVM_COMPILER) || (20250000 <= __INTEL_LLVM_COMPILER)
!$OMP END PARALLEL WORKSHARE
#endif
END DO
Expand Down
6 changes: 3 additions & 3 deletions src/pw/pw_methods.F
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ SUBROUTINE pw_zero_${kind}$_${space}$ (pw)

CALL timeset(routineN, handle)

#if CPVERSION_CHECK(2025, 0, >, __INTEL_LLVM_COMPILER, 0)
pw%array = ${type2type("0.0_dp", "r3d", kind)}$
#else
#if !defined(__INTEL_LLVM_COMPILER) || (20250000 <= __INTEL_LLVM_COMPILER)
!$OMP PARALLEL WORKSHARE DEFAULT(NONE) SHARED(pw)
pw%array = ${type2type("0.0_dp", "r3d", kind)}$
!$OMP END PARALLEL WORKSHARE
#else
pw%array = ${type2type("0.0_dp", "r3d", kind)}$
#endif

CALL timestop(handle)
Expand Down

0 comments on commit 83963c3

Please sign in to comment.