Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/caffeine/caffeine.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,11 @@ void caf_co_reduce(

if (result_image) {
ev = gex_Coll_ReduceToOneNB(
team, result_image-1, a_address, a_address, GEX_DT_USER, c_sizeof_a, num_elements, GEX_OP_USER, user_op, &c_sizeof_a, 0
team, result_image-1, a_address, a_address, GEX_DT_USER, c_sizeof_a, num_elements, GEX_OP_USER, user_op, client_data, 0
);
} else {
ev = gex_Coll_ReduceToAllNB(
team, a_address, a_address, GEX_DT_USER, c_sizeof_a, num_elements, GEX_OP_USER, user_op, &c_sizeof_a, 0
team, a_address, a_address, GEX_DT_USER, c_sizeof_a, num_elements, GEX_OP_USER, user_op, client_data, 0
);
}
gex_Event_Wait(ev);
Expand Down
14 changes: 11 additions & 3 deletions test/prif_co_reduce_test.F90
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include "test-utils.F90"
#include "julienne-assert-macros.h"

module prif_co_reduce_test_m
use iso_c_binding, only: c_ptr, c_funptr, c_size_t, c_f_pointer, c_f_procpointer, c_funloc, c_loc, c_null_ptr
use iso_c_binding, only: c_ptr, c_funptr, c_size_t, c_f_pointer, c_f_procpointer, c_funloc, c_loc, c_null_ptr, c_associated
use prif, only : prif_co_reduce, prif_num_images, prif_this_image_no_coarray, prif_operation_wrapper_interface
use julienne_m, only : &
operator(.all.) &
call_julienne_assert_ &
,operator(.all.) &
,operator(.also.) &
,operator(.approximates.) &
,operator(.equalsExpected.) &
Expand Down Expand Up @@ -44,6 +46,8 @@ module prif_co_reduce_test_m
end type
#endif

integer, target :: dummy

contains

pure function subject() result(test_subject)
Expand Down Expand Up @@ -93,6 +97,9 @@ subroutine and_wrapper(arg1, arg2_and_out, count, cdata) bind(C)
integer(c_size_t) :: i

if (count == 0) return
! this expression is buggy as of Julienne 3.6.0 (julienne#166)
!call_julienne_assert(cdata .equalsExpected. c_null_ptr)
call_julienne_assert(.not. c_associated(cdata))
call c_f_pointer(arg1, lhs, [count])
call c_f_pointer(arg2_and_out, rhs_and_result, [count])
do i = 1, count
Expand Down Expand Up @@ -120,7 +127,7 @@ function check_derived_type_reduction() result(diag)
call prif_num_images(ni)

my_val = values(:, mod(me-1, size(values,2))+1)
call prif_co_reduce(my_val, op, c_null_ptr)
call prif_co_reduce(my_val, op, c_loc(dummy))

allocate(tmp(size(values,1),ni))
tmp = reshape([(values(:, mod(i-1,size(values,2))+1), i = 1, ni)], [size(values,1),ni])
Expand Down Expand Up @@ -159,6 +166,7 @@ subroutine pair_adder(arg1, arg2_and_out, count, cdata) bind(C)
integer(c_size_t) :: i

if (count == 0) return
call_julienne_assert(cdata .equalsExpected. c_loc(dummy))
call c_f_pointer(arg1, lhs, [count])
call c_f_pointer(arg2_and_out, rhs_and_result, [count])
do i = 1, count
Expand Down