Skip to content
Permalink
Browse files

Work around issues with OOP and OpenMP in older GCC versions

Using gfortran < 8.3, compilation fails due to the internal symbols
__vtab_submatrix_types_Set_type and
__vtab_submatrix_dissection_Submatrix_dissection_type not being
specified in the enclosing 'parallel'.

This issue is similar to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52531 but in this
constallation it is present up to gfortran 8.2.

Work around the issue for affected GCC versions by using DEFAULT(SHARED)
instead of DEFAULT(NONE), so that all internal symbols are available.
  • Loading branch information
michaellass authored and mkrack committed Mar 12, 2020
1 parent b43706d commit 485273c4b6f81eb540a23626f1dad5b09790adf6
Showing with 75 additions and 56 deletions.
  1. +44 −36 src/iterate_matrix.F
  2. +29 −20 src/submatrix_dissection.F
  3. +2 −0 tools/conventions/conventions.supp
@@ -9,30 +9,30 @@
!> \author Joost VandeVondele
! **************************************************************************************************
MODULE iterate_matrix
USE arnoldi_api, ONLY: arnoldi_data_type,&
arnoldi_extremal
USE bibliography, ONLY: Richters2018,&
cite_reference
USE cp_log_handling, ONLY: cp_get_default_logger,&
cp_logger_get_default_unit_nr,&
cp_logger_type
USE dbcsr_api, ONLY: &
dbcsr_add, dbcsr_add_on_diag, dbcsr_copy, dbcsr_create, dbcsr_desymmetrize, &
dbcsr_distribution_get, dbcsr_distribution_type, dbcsr_filter, dbcsr_frobenius_norm, &
dbcsr_gershgorin_norm, dbcsr_get_diag, dbcsr_get_info, dbcsr_get_matrix_type, &
dbcsr_get_occupation, dbcsr_multiply, dbcsr_norm, dbcsr_norm_maxabsnorm, dbcsr_p_type, &
dbcsr_release, dbcsr_scale, dbcsr_set, dbcsr_set_diag, dbcsr_trace, dbcsr_transposed, &
dbcsr_type, dbcsr_type_no_symmetry
USE input_constants, ONLY: ls_scf_submatrix_sign_direct,&
ls_scf_submatrix_sign_ns
USE kinds, ONLY: dp,&
int_8
USE machine, ONLY: m_flush,&
m_walltime
USE mathconstants, ONLY: ifac
USE mathlib, ONLY: abnormal_value
USE message_passing, ONLY: mp_sum
USE submatrix_dissection, ONLY: submatrix_dissection_type
USE arnoldi_api, ONLY: arnoldi_data_type, &
arnoldi_extremal
USE bibliography, ONLY: Richters2018, &
cite_reference
USE cp_log_handling, ONLY: cp_get_default_logger, &
cp_logger_get_default_unit_nr, &
cp_logger_type
USE dbcsr_api, ONLY: &
dbcsr_add, dbcsr_add_on_diag, dbcsr_copy, dbcsr_create, dbcsr_desymmetrize, &
dbcsr_distribution_get, dbcsr_distribution_type, dbcsr_filter, dbcsr_frobenius_norm, &
dbcsr_gershgorin_norm, dbcsr_get_diag, dbcsr_get_info, dbcsr_get_matrix_type, &
dbcsr_get_occupation, dbcsr_multiply, dbcsr_norm, dbcsr_norm_maxabsnorm, dbcsr_p_type, &
dbcsr_release, dbcsr_scale, dbcsr_set, dbcsr_set_diag, dbcsr_trace, dbcsr_transposed, &
dbcsr_type, dbcsr_type_no_symmetry
USE input_constants, ONLY: ls_scf_submatrix_sign_direct, &
ls_scf_submatrix_sign_ns
USE kinds, ONLY: dp, &
int_8
USE machine, ONLY: m_flush, &
m_walltime
USE mathconstants, ONLY: ifac
USE mathlib, ONLY: abnormal_value
USE message_passing, ONLY: mp_sum
USE submatrix_dissection, ONLY: submatrix_dissection_type
#include "./base/base_uses.f90"

IMPLICIT NONE
@@ -466,15 +466,15 @@ SUBROUTINE invert_Hotelling(matrix_inverse, matrix, threshold, use_inv_as_guess,
LOGICAL, INTENT(IN), OPTIONAL :: silent
CHARACTER(LEN=*), PARAMETER :: routineN = 'invert_Hotelling', &
routineP = moduleN//':'//routineN
routineP = moduleN//':'//routineN
INTEGER :: accelerator_type, handle, i, &
my_max_iter_lanczos, unit_nr
INTEGER(KIND=int_8) :: flop1, flop2
LOGICAL :: arnoldi_converged, converged, &
use_inv_guess
REAL(KIND=dp) :: convergence, frob_matrix, gershgorin_norm, max_ev, maxnorm_matrix, min_ev, &
my_eps_lanczos, my_filter_eps, occ_matrix, scalingf, t1, t2
my_eps_lanczos, my_filter_eps, occ_matrix, scalingf, t1, t2
TYPE(cp_logger_type), POINTER :: logger
TYPE(dbcsr_type), TARGET :: tmp1, tmp2
@@ -672,7 +672,7 @@ SUBROUTINE matrix_sign_Newton_Schulz(matrix_sign, matrix, threshold, sign_order)
INTEGER, INTENT(IN), OPTIONAL :: sign_order
CHARACTER(LEN=*), PARAMETER :: routineN = 'matrix_sign_Newton_Schulz', &
routineP = moduleN//':'//routineN
routineP = moduleN//':'//routineN
INTEGER :: count, handle, i, order, unit_nr
INTEGER(KIND=int_8) :: flops
@@ -1000,7 +1000,7 @@ SUBROUTINE matrix_sign_proot(matrix_sign, matrix, threshold, sign_order)
INTEGER, INTENT(IN), OPTIONAL :: sign_order
CHARACTER(LEN=*), PARAMETER :: routineN = 'matrix_sign_proot', &
routineP = moduleN//':'//routineN
routineP = moduleN//':'//routineN
INTEGER :: handle, order, unit_nr
INTEGER(KIND=int_8) :: flop0, flop1, flop2
@@ -1096,7 +1096,7 @@ SUBROUTINE dense_matrix_sign_Newton_Schulz(matrix_sign, matrix, matrix_id, thres
INTEGER, INTENT(IN), OPTIONAL :: sign_order
CHARACTER(LEN=*), PARAMETER :: routineN = 'dense_matrix_sign_Newton_Schulz', &
routineP = moduleN//':'//routineN
routineP = moduleN//':'//routineN
INTEGER :: handle, i, j, sz, unit_nr
LOGICAL :: converged
@@ -1258,7 +1258,7 @@ SUBROUTINE matrix_sign_submatrix(matrix_sign, matrix, threshold, sign_order, sub
INTEGER, INTENT(IN) :: submatrix_sign_method
CHARACTER(LEN=*), PARAMETER :: routineN = 'matrix_sign_submatrix', &
routineP = moduleN//':'//routineN
routineP = moduleN//':'//routineN
INTEGER :: group, handle, i, myrank, nblkcols, &
order, sm_size, unit_nr
@@ -1286,7 +1286,15 @@ SUBROUTINE matrix_sign_submatrix(matrix_sign, matrix, threshold, sign_order, sub
CALL dissection%init(matrix)
CALL dissection%get_sm_ids_for_rank(myrank, my_sms)
!$OMP PARALLEL DEFAULT(NONE) PRIVATE(sm, sm_sign, sm_size) &
! gfortran before 8.3 complains about internal symbols not being specified in
! any data clause when using DEFAULT(NONE) and OOP procedures are called from
! within the parallel region.
#if __GNUC__ < 8 || (__GNUC__ == 8 && (__GNUC_MINOR__ < 3))
!$OMP PARALLEL DEFAULT(SHARED) &
#else
!$OMP PARALLEL DEFAULT(NONE) &
#endif
!$OMP PRIVATE(sm, sm_sign, sm_size) &
!$OMP SHARED(dissection, myrank, my_sms, order, submatrix_sign_method, threshold, unit_nr)
!$OMP DO SCHEDULE(GUIDED)
DO i = 1, SIZE(my_sms)
@@ -1341,7 +1349,7 @@ SUBROUTINE matrix_sqrt_Newton_Schulz(matrix_sqrt, matrix_sqrt_inv, matrix, thres
LOGICAL, OPTIONAL :: symmetrize, converged
CHARACTER(LEN=*), PARAMETER :: routineN = 'matrix_sqrt_Newton_Schulz', &
routineP = moduleN//':'//routineN
routineP = moduleN//':'//routineN
INTEGER :: handle, i, unit_nr
INTEGER(KIND=int_8) :: flop1, flop2, flop3, flop4, flop5
@@ -1589,7 +1597,7 @@ SUBROUTINE matrix_sqrt_proot(matrix_sqrt, matrix_sqrt_inv, matrix, threshold, or
LOGICAL, OPTIONAL :: symmetrize, converged

CHARACTER(LEN=*), PARAMETER :: routineN = 'matrix_sqrt_proot', &
routineP = moduleN//':'//routineN
routineP = moduleN//':'//routineN

INTEGER :: choose, handle, i, ii, j, unit_nr
INTEGER(KIND=int_8) :: f, flop1, flop2, flop3, flop4, flop5
@@ -1812,7 +1820,7 @@ SUBROUTINE matrix_exponential(matrix_exp, matrix, omega, alpha, threshold)
REAL(KIND=dp), INTENT(IN) :: omega, alpha, threshold

CHARACTER(LEN=*), PARAMETER :: routineN = 'matrix_exponential', &
routineP = moduleN//':'//routineN
routineP = moduleN//':'//routineN
REAL(dp), PARAMETER :: one = 1.0_dp, toll = 1.E-17_dp, &
zero = 0.0_dp

@@ -1920,7 +1928,7 @@ SUBROUTINE purify_mcweeny_orth(matrix_p, threshold, max_steps)
INTEGER :: max_steps

CHARACTER(LEN=*), PARAMETER :: routineN = 'purify_mcweeny_orth', &
routineP = moduleN//':'//routineN
routineP = moduleN//':'//routineN

INTEGER :: handle, i, ispin, unit_nr
REAL(KIND=dp) :: frob_norm, trace
@@ -1985,7 +1993,7 @@ SUBROUTINE purify_mcweeny_nonorth(matrix_p, matrix_s, threshold, max_steps)
INTEGER :: max_steps

CHARACTER(LEN=*), PARAMETER :: routineN = 'purify_mcweeny_nonorth', &
routineP = moduleN//':'//routineN
routineP = moduleN//':'//routineN

INTEGER :: handle, i, ispin, unit_nr
REAL(KIND=dp) :: frob_norm, trace
@@ -37,25 +37,25 @@

MODULE submatrix_dissection

USE bibliography, ONLY: Lass2018,&
cite_reference
USE dbcsr_api, ONLY: &
dbcsr_distribution_get, dbcsr_distribution_type, dbcsr_finalize, dbcsr_get_block_p, &
dbcsr_get_info, dbcsr_get_stored_coordinates, dbcsr_iterator_blocks_left, &
dbcsr_iterator_next_block, dbcsr_iterator_start, dbcsr_iterator_stop, dbcsr_iterator_type, &
dbcsr_put_block, dbcsr_type
USE dbcsr_mpiwrap, ONLY: mp_allgather,&
mp_alltoall,&
mp_irecv,&
mp_isend,&
mp_send,&
mp_wait
USE kinds, ONLY: dp
USE submatrix_types, ONLY: buffer_type,&
bufptr_type,&
intBuffer_type,&
set_type,&
setarray_type
USE bibliography, ONLY: Lass2018, &
cite_reference
USE dbcsr_api, ONLY: &
dbcsr_distribution_get, dbcsr_distribution_type, dbcsr_finalize, dbcsr_get_block_p, &
dbcsr_get_info, dbcsr_get_stored_coordinates, dbcsr_iterator_blocks_left, &
dbcsr_iterator_next_block, dbcsr_iterator_start, dbcsr_iterator_stop, dbcsr_iterator_type, &
dbcsr_put_block, dbcsr_type
USE dbcsr_mpiwrap, ONLY: mp_allgather, &
mp_alltoall, &
mp_irecv, &
mp_isend, &
mp_send, &
mp_wait
USE kinds, ONLY: dp
USE submatrix_types, ONLY: buffer_type, &
bufptr_type, &
intBuffer_type, &
set_type, &
setarray_type

!$ USE omp_lib, ONLY: omp_get_max_threads, omp_get_thread_num

@@ -308,7 +308,16 @@ SUBROUTINE submatrix_dissection_init(this, matrix_p) ! Should be PURE but the it
! Figure out which blocks we need to receive. Blocks are identified here as indices into our COO representation.
! TODO: This currently shows limited parallel efficiency. Investigate further.
!$OMP PARALLEL NUM_THREADS(numthreads) DEFAULT(NONE) &
! gfortran before 8.3 complains about internal symbols not being specified in
! any data clause when using DEFAULT(NONE) and OOP procedures are called from
! within the parallel region.
#if __GNUC__ < 8 || (__GNUC__ == 8 && (__GNUC_MINOR__ < 3))
!$OMP PARALLEL DEFAULT(SHARED) &
#else
!$OMP PARALLEL DEFAULT(NONE) &
#endif
!$OMP NUM_THREADS(numthreads) &
!$OMP PRIVATE(i,j,k,l,m,l_limit_left,l_limit_right,cur_col,cur_row,mytid) &
!$OMP SHARED(result_blocks_from_rank_t,result_blocks_for_rank_t,blocks_from_rank_t,this,numthreads,nonzero_rows_t)
mytid = 0
@@ -276,3 +276,5 @@ dumpdcd.F: Found STOP statement in procedure "abort_program"
dumpdcd.F: Found STOP statement in procedure "dumpdcd"
dumpdcd.F: Found WRITE statement with hardcoded unit in "abort_program"
dumpdcd.F: Found WRITE statement with hardcoded unit in "print_help"
iterate_matrix.F: OMP PARALLEL without DEFAULT(NONE) found in "matrix_sign_submatrix"
submatrix_dissection.F: OMP PARALLEL without DEFAULT(NONE) found in "submatrix_dissection_init"

0 comments on commit 485273c

Please sign in to comment.
You can’t perform that action at this time.