Skip to content

Commit

Permalink
Fix GCC8
Browse files Browse the repository at this point in the history
  • Loading branch information
fstein93 authored and alazzaro committed Jul 10, 2024
1 parent 40bf500 commit 8fc4246
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
17 changes: 17 additions & 0 deletions src/tas/dbcsr_tas_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ MODULE dbcsr_tas_types
END TYPE

TYPE dbcsr_tas_distribution_type
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (TO_VERSION(9, 5) > TO_VERSION(__GNUC__, __GNUC_MINOR__))
TYPE(dbcsr_tas_split_info) :: info = dbcsr_tas_split_info(ngroup_opt=NULL())
#else
TYPE(dbcsr_tas_split_info) :: info = dbcsr_tas_split_info()
#endif
TYPE(dbcsr_distribution_obj) :: dbcsr_dist = dbcsr_distribution_obj()
CLASS(dbcsr_tas_distribution), ALLOCATABLE :: row_dist
CLASS(dbcsr_tas_distribution), ALLOCATABLE :: col_dist
Expand All @@ -63,12 +67,20 @@ MODULE dbcsr_tas_types
TYPE(dbcsr_tas_type), POINTER :: store_batched_repl => NULL() ! intermediate replicated matrix
LOGICAL :: batched_out = .FALSE. ! whether replicated matrix has been changed in mm and should be copied to actual matrix
LOGICAL :: batched_trans = .FALSE.
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (TO_VERSION(9, 5) > TO_VERSION(__GNUC__, __GNUC_MINOR__))
TYPE(dbcsr_scalar_type) :: batched_beta
#else
TYPE(dbcsr_scalar_type) :: batched_beta = dbcsr_scalar_type()
#endif
END TYPE

! type for tall-and-skinny matrices
TYPE dbcsr_tas_type
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (TO_VERSION(9, 5) > TO_VERSION(__GNUC__, __GNUC_MINOR__))
TYPE(dbcsr_tas_distribution_type) :: dist
#else
TYPE(dbcsr_tas_distribution_type) :: dist = dbcsr_tas_distribution_type()
#endif
CLASS(dbcsr_tas_rowcol_data), ALLOCATABLE :: row_blk_size
CLASS(dbcsr_tas_rowcol_data), ALLOCATABLE :: col_blk_size

Expand All @@ -87,8 +99,13 @@ MODULE dbcsr_tas_types
END TYPE

TYPE dbcsr_tas_iterator
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (TO_VERSION(9, 5) > TO_VERSION(__GNUC__, __GNUC_MINOR__))
TYPE(dbcsr_tas_split_info) :: info = dbcsr_tas_split_info(ngroup_opt=NULL())
TYPE(dbcsr_tas_distribution_type) :: dist
#else
TYPE(dbcsr_tas_split_info) :: info = dbcsr_tas_split_info()
TYPE(dbcsr_tas_distribution_type) :: dist = dbcsr_tas_distribution_type()
#endif
TYPE(dbcsr_iterator) :: iter = dbcsr_iterator()
END TYPE dbcsr_tas_iterator

Expand Down
13 changes: 12 additions & 1 deletion src/tensors/dbcsr_tensor_block.F
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,17 @@ MODULE dbcsr_tensor_block
ndims_iterator

TYPE dbcsr_t_iterator_type
TYPE(dbcsr_tas_iterator) :: iter = dbcsr_tas_iterator()
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (TO_VERSION(9, 5) > TO_VERSION(__GNUC__, __GNUC_MINOR__))
TYPE(dbcsr_tas_iterator) :: iter
TYPE(nd_to_2d_mapping) :: nd_index_blk
TYPE(nd_to_2d_mapping) :: nd_index
TYPE(array_list) :: blk_sizes, blk_offsets
#else
TYPE(dbcsr_tas_iterator) :: iter = dbcsr_tas_iterator()
TYPE(nd_to_2d_mapping) :: nd_index_blk = nd_to_2d_mapping()
TYPE(nd_to_2d_mapping) :: nd_index = nd_to_2d_mapping()
TYPE(array_list) :: blk_sizes = array_list(), blk_offsets = array_list()
#endif
END TYPE dbcsr_t_iterator_type

#:for dparam, dtype, dsuffix in dtype_float_list
Expand All @@ -82,7 +89,11 @@ MODULE dbcsr_tensor_block

TYPE block_nd
#:for dparam, dtype, dsuffix in dtype_float_list
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (TO_VERSION(9, 5) > TO_VERSION(__GNUC__, __GNUC_MINOR__))
TYPE(block_nd_${dsuffix}$) :: ${dsuffix}$
#else
TYPE(block_nd_${dsuffix}$) :: ${dsuffix}$ = block_nd_${dsuffix}$ ()
#endif
#:endfor
INTEGER :: data_type = -1
END TYPE
Expand Down
34 changes: 33 additions & 1 deletion src/tensors/dbcsr_tensor_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ MODULE dbcsr_tensor_types
dbcsr_t_copy_contraction_storage

TYPE dbcsr_t_pgrid_type
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (TO_VERSION(9, 5) > TO_VERSION(__GNUC__, __GNUC_MINOR__))
TYPE(nd_to_2d_mapping) :: nd_index_grid
#else
TYPE(nd_to_2d_mapping) :: nd_index_grid = nd_to_2d_mapping()
#endif
TYPE(mp_comm_type) :: mp_comm_2d = mp_comm_type()
TYPE(dbcsr_tas_split_info), ALLOCATABLE :: tas_split_info
INTEGER :: nproc = -1
Expand All @@ -112,19 +116,33 @@ MODULE dbcsr_tensor_types
TYPE dbcsr_t_contraction_storage
REAL(real_8) :: nsplit_avg = -1.0_real_8
INTEGER :: ibatch = -1
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (TO_VERSION(9, 5) > TO_VERSION(__GNUC__, __GNUC_MINOR__))
TYPE(array_list) :: batch_ranges
#else
TYPE(array_list) :: batch_ranges = array_list()
#endif
LOGICAL :: static = .FALSE.
END TYPE

TYPE dbcsr_t_type
TYPE(dbcsr_tas_type), POINTER :: matrix_rep => NULL()
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (TO_VERSION(9, 5) > TO_VERSION(__GNUC__, __GNUC_MINOR__))
TYPE(nd_to_2d_mapping) :: nd_index_blk
TYPE(nd_to_2d_mapping) :: nd_index
TYPE(array_list) :: blk_sizes
TYPE(array_list) :: blk_offsets
TYPE(array_list) :: nd_dist
TYPE(dbcsr_t_pgrid_type) :: pgrid
TYPE(array_list) :: blks_local
#else
TYPE(nd_to_2d_mapping) :: nd_index_blk = nd_to_2d_mapping()
TYPE(nd_to_2d_mapping) :: nd_index = nd_to_2d_mapping()
TYPE(array_list) :: blk_sizes = array_list()
TYPE(array_list) :: blk_offsets = array_list()
TYPE(array_list) :: nd_dist = array_list()
TYPE(dbcsr_t_pgrid_type) :: pgrid = dbcsr_t_pgrid_type()
TYPE(array_list) :: blks_local = array_list()
#endif
INTEGER, DIMENSION(:), ALLOCATABLE :: nblks_local
INTEGER, DIMENSION(:), ALLOCATABLE :: nfull_local
LOGICAL :: valid = .FALSE.
Expand All @@ -136,9 +154,15 @@ MODULE dbcsr_tensor_types
END TYPE dbcsr_t_type

TYPE dbcsr_t_distribution_type
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (TO_VERSION(9, 5) > TO_VERSION(__GNUC__, __GNUC_MINOR__))
TYPE(dbcsr_tas_distribution_type) :: dist
TYPE(dbcsr_t_pgrid_type) :: pgrid
TYPE(array_list) :: nd_dist
#else
TYPE(dbcsr_tas_distribution_type) :: dist = dbcsr_tas_distribution_type()
TYPE(dbcsr_t_pgrid_type) :: pgrid = dbcsr_t_pgrid_type()
TYPE(array_list) :: nd_dist = array_list()
#endif
! lightweight reference counting for communicators:
INTEGER, POINTER :: refcount => NULL()
END TYPE
Expand All @@ -150,7 +174,11 @@ MODULE dbcsr_tensor_types
! grid dimensions only for this matrix dimension:
INTEGER, DIMENSION(:), ALLOCATABLE :: dims_grid
! dist only for tensor dimensions belonging to this matrix dimension:
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (TO_VERSION(9, 5) > TO_VERSION(__GNUC__, __GNUC_MINOR__))
TYPE(array_list) :: nd_dist
#else
TYPE(array_list) :: nd_dist = array_list()
#endif
CONTAINS
! map matrix index to process grid:
PROCEDURE :: dist => tas_dist_t
Expand All @@ -163,7 +191,11 @@ MODULE dbcsr_tensor_types
! tensor dimensions only for this matrix dimension:
INTEGER, DIMENSION(:), ALLOCATABLE :: dims
! block size only for this matrix dimension:
TYPE(array_list) :: blk_size = array_list()
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (TO_VERSION(9, 5) > TO_VERSION(__GNUC__, __GNUC_MINOR__))
TYPE(array_list) :: blk_size
#else
TYPE(array_list) :: blk_size = array_list()
#endif
CONTAINS
PROCEDURE :: data => tas_blk_size_t
END TYPE
Expand Down

0 comments on commit 8fc4246

Please sign in to comment.