Skip to content

Commit b53e6fd

Browse files
committed
Deploy assert library in collectives
1 parent 9cd8fc1 commit b53e6fd

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

src/caffeine/collective_subroutines/co_max_s.f90 renamed to src/caffeine/collective_subroutines/co_max_s.F90

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
! Copyright (c), The Regents of the University of California
22
! Terms of use are as specified in LICENSE.txt
3+
4+
#include "assert_macros.h"
5+
36
submodule(prif:prif_private_s) co_max_s
47
use iso_c_binding, only : c_funloc
8+
use assert_m
59

610
implicit none
711

@@ -24,7 +28,7 @@
2428
function reverse_alphabetize(lhs, rhs) result(last_alphabetically)
2529
character(len=*), intent(in) :: lhs, rhs
2630
character(len=len(lhs)) :: last_alphabetically
27-
call assert(len(lhs)==len(rhs), "caf_co_max: LHS/RHS length match", lhs//" , "//rhs)
31+
call_assert_diagnose(len(lhs)==len(rhs), "caf_co_max: LHS/RHS length match", lhs//" , "//rhs)
2832
last_alphabetically = max(lhs,rhs)
2933
end function
3034

src/caffeine/collective_subroutines/co_min_s.f90 renamed to src/caffeine/collective_subroutines/co_min_s.F90

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
! Copyright (c), The Regents of the University of California
22
! Terms of use are as specified in LICENSE.txt
3+
4+
#include "assert_macros.h"
5+
36
submodule(prif:prif_private_s) co_min_s
47
use iso_c_binding, only : c_funloc
8+
use assert_m
59

610
implicit none
711

@@ -24,7 +28,7 @@
2428
function alphabetize(lhs, rhs) result(first_alphabetically)
2529
character(len=*), intent(in) :: lhs, rhs
2630
character(len=len(lhs)) :: first_alphabetically
27-
call assert(len(lhs)==len(rhs), "prif_co_min: LHS/RHS length match", lhs//" , "//rhs)
31+
call_assert_diagnose(len(lhs)==len(rhs), "prif_co_min: LHS/RHS length match", lhs//" , "//rhs)
2832
first_alphabetically = min(lhs,rhs)
2933
end function
3034

src/caffeine/collective_subroutines/co_reduce_s.f90 renamed to src/caffeine/collective_subroutines/co_reduce_s.F90

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
! Copyright (c), The Regents of the University of California
22
! Terms of use are as specified in LICENSE.txt
3+
4+
#include "assert_macros.h"
5+
36
submodule(prif:prif_private_s) co_reduce_s
47
use iso_c_binding, only : &
58
c_loc, c_funloc, c_associated, c_f_pointer, c_f_procpointer, c_char, c_double, &
69
c_float, c_int32_t
10+
use assert_m
711

812
implicit none
913

@@ -83,7 +87,7 @@ pure function c_double_complex_operation(lhs, rhs) result(lhs_op_rhs)
8387
procedure(c_double_complex_operation), pointer :: double_complex_op => null()
8488

8589
if (present(stat)) stat=0
86-
call assert(c_associated(operation), "caf_co_reduce: c_associated(operation)")
90+
call_assert_describe(c_associated(operation), "caf_co_reduce: c_associated(operation)")
8791

8892
if (caf_same_cfi_type(a, 0)) then
8993
call c_f_procpointer(operation, int32_op)
@@ -135,7 +139,7 @@ subroutine Coll_ReduceSub_c_int32_t(arg1, arg2_and_out, count, cdata) bind(C)
135139
integer(c_int32_t), pointer :: lhs(:)=>null(), rhs_and_result(:)=>null()
136140
integer(c_size_t) i
137141

138-
call assert(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_int32_t: operands associated")
142+
call_assert_describe(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_int32_t: operands associated")
139143

140144
call c_f_pointer(arg1, lhs, [count])
141145
call c_f_pointer(arg2_and_out, rhs_and_result, [count])
@@ -153,7 +157,7 @@ subroutine Coll_ReduceSub_c_int64_t(arg1, arg2_and_out, count, cdata) bind(C)
153157
integer(c_int64_t), pointer :: lhs(:)=>null(), rhs_and_result(:)=>null()
154158
integer(c_size_t) i
155159

156-
call assert(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_int64_t: operands associated")
160+
call_assert_describe(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_int64_t: operands associated")
157161

158162
call c_f_pointer(arg1, lhs, [count])
159163
call c_f_pointer(arg2_and_out, rhs_and_result, [count])
@@ -171,7 +175,7 @@ subroutine Coll_ReduceSub_c_double(arg1, arg2_and_out, count, cdata) bind(C)
171175
real(c_double), pointer :: lhs(:)=>null(), rhs_and_result(:)=>null()
172176
integer(c_size_t) i
173177

174-
call assert(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_double: operands associated")
178+
call_assert_describe(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_double: operands associated")
175179

176180
call c_f_pointer(arg1, lhs, [count])
177181
call c_f_pointer(arg2_and_out, rhs_and_result, [count])
@@ -189,7 +193,7 @@ subroutine Coll_ReduceSub_c_float(arg1, arg2_and_out, count, cdata) bind(C)
189193
real(c_float), pointer :: lhs(:)=>null(), rhs_and_result(:)=>null()
190194
integer(c_size_t) i
191195

192-
call assert(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_float: operands associated")
196+
call_assert_describe(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_float: operands associated")
193197

194198
call c_f_pointer(arg1, lhs, [count])
195199
call c_f_pointer(arg2_and_out, rhs_and_result, [count])
@@ -207,7 +211,7 @@ subroutine Coll_ReduceSub_c_double_complex(arg1, arg2_and_out, count, cdata) bin
207211
complex(c_double), pointer :: lhs(:)=>null(), rhs_and_result(:)=>null()
208212
integer(c_size_t) i
209213

210-
call assert(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_dobule_complex: operands associated")
214+
call_assert_describe(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_dobule_complex: operands associated")
211215

212216
call c_f_pointer(arg1, lhs, [count])
213217
call c_f_pointer(arg2_and_out, rhs_and_result, [count])
@@ -225,7 +229,7 @@ subroutine Coll_ReduceSub_c_float_complex(arg1, arg2_and_out, count, cdata) bind
225229
complex(c_float), pointer :: lhs(:)=>null(), rhs_and_result(:)=>null()
226230
integer(c_size_t) i
227231

228-
call assert(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_float_complex: operands associated")
232+
call_assert_describe(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_float_complex: operands associated")
229233

230234
call c_f_pointer(arg1, lhs, [count])
231235
call c_f_pointer(arg2_and_out, rhs_and_result, [count])
@@ -243,7 +247,7 @@ subroutine Coll_ReduceSub_c_bool(arg1, arg2_and_out, count, cdata) bind(C)
243247
logical(c_bool), pointer :: lhs(:)=>null(), rhs_and_result(:)=>null()
244248
integer(c_size_t) i
245249

246-
call assert(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_bool: operands associated")
250+
call_assert_describe(all([c_associated(arg1), c_associated(arg2_and_out)]), "Coll_ReduceSub_c_bool: operands associated")
247251

248252
call c_f_pointer(arg1, lhs, [count])
249253
call c_f_pointer(arg2_and_out, rhs_and_result, [count])
@@ -262,7 +266,7 @@ subroutine Coll_ReduceSub_c_char(arg1, arg2_and_out, count, cdata) bind(C)
262266
integer(c_int), pointer :: arglen=>null()
263267

264268
associate(c_associated_args => [c_associated(arg1), c_associated(arg2_and_out), c_associated(cdata)])
265-
call assert(all(c_associated_args), "Coll_ReduceSub_c_char: all(c_associated_args)")
269+
call_assert_describe(all(c_associated_args), "Coll_ReduceSub_c_char: all(c_associated_args)")
266270
end associate
267271

268272
call c_f_pointer(cdata, arglen)

src/caffeine/prif_private_s.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
! Copyright (c), The Regents of the University of California
22
! Terms of use are as specified in LICENSE.txt
33
submodule(prif) prif_private_s
4+
!use assert_m
45
implicit none
56

67
type(team_data), target :: initial_team

0 commit comments

Comments
 (0)