Skip to content

Commit cb57e56

Browse files
authored
Merge pull request #275 from bonachea/julienne-parallel-callbacks
Enable testing with Julienne multi-image mode
2 parents c1f8449 + e4e94ab commit cb57e56

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,10 @@ else # unknown compiler
451451
compiler_flag="-g -O2"
452452
echo "WARNING: Failed to detect a recognized Fortran compiler"
453453
fi
454+
# enable Assert's multi-image support with PRIF callbacks provided by libcaffeine
454455
compiler_flag+=" -DASSERT_MULTI_IMAGE -DASSERT_PARALLEL_CALLBACKS"
456+
# enable Julienne's multi-image support with PRIF callbacks provided by julienne-driver
457+
compiler_flag+=" -DHAVE_MULTI_IMAGE_SUPPORT -DJULIENNE_PARALLEL_CALLBACKS"
455458

456459
if ! [[ "$user_compiler_flags " =~ -[DU]ASSERTIONS[=\ ] ]] ; then
457460
# default to enabling assertions, unless the command line sets a relevant flag

manifest/fpm.toml.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ copyright = "2021-2025 The Regents of the University of California, through Lawr
77

88
[dev-dependencies]
99
assert = {git = "https://github.com/berkeleylab/assert.git", tag = "3.0.0"}
10-
julienne = {git = "https://github.com/berkeleylab/julienne.git", tag = "3.5.0"}
10+
julienne = {git = "https://github.com/berkeleylab/julienne.git", tag = "3.6.0"}
1111

1212
[install]
1313
library = true

test/julienne-driver.F90

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
! Terms of use are as specified in LICENSE.txt
33

44
program test_suite_driver
5-
use julienne_m, only : test_fixture_t, test_harness_t, test_diagnosis_t
5+
use julienne_m
6+
use prif, only: prif_this_image_no_coarray, prif_num_images, prif_sync_all, prif_co_sum, prif_error_stop
7+
use iso_c_binding, only: c_int, c_bool
68
use prif_init_test_m, only : prif_init_test_t, check_caffeination
79
use prif_num_images_test_m, only : prif_num_images_test_t
810
use prif_this_image_no_coarray_test_m, only : prif_this_image_no_coarray_test_t
@@ -30,6 +32,14 @@ program test_suite_driver
3032
type(test_diagnosis_t) :: dummy
3133
dummy = check_caffeination() ! ensure an early call to prif_init
3234

35+
# if JULIENNE_PARALLEL_CALLBACKS
36+
julienne_this_image => julienne_callback_this_image
37+
julienne_num_images => julienne_callback_num_images
38+
julienne_sync_all => julienne_callback_sync_all
39+
julienne_co_sum_integer => julienne_callback_co_sum_integer
40+
julienne_error_stop => julienne_callback_error_stop
41+
# endif
42+
3343
associate(test_harness => test_harness_t([ &
3444
! tests for basic functionality that are mostly self-contained
3545
test_fixture_t( prif_init_test_t() ) &
@@ -66,4 +76,48 @@ program test_suite_driver
6676
]))
6777
call test_harness%report_results
6878
end associate
79+
80+
contains
81+
82+
function julienne_callback_this_image() result(this_image_id)
83+
implicit none
84+
integer :: this_image_id
85+
integer(c_int) :: me
86+
87+
call prif_this_image_no_coarray(this_image=me)
88+
89+
this_image_id = int(me)
90+
end function
91+
92+
function julienne_callback_num_images() result(image_count)
93+
implicit none
94+
integer :: image_count
95+
integer(c_int) :: ni
96+
97+
call prif_num_images(ni)
98+
99+
image_count = int(ni)
100+
end function
101+
102+
subroutine julienne_callback_sync_all()
103+
implicit none
104+
105+
call prif_sync_all()
106+
end subroutine
107+
108+
subroutine julienne_callback_co_sum_integer(a, result_image)
109+
implicit none
110+
integer, intent(inout), target :: a(:)
111+
integer, intent(in), optional :: result_image
112+
113+
call prif_co_sum(a, result_image)
114+
end subroutine
115+
116+
subroutine julienne_callback_error_stop(stop_code_char)
117+
implicit none
118+
character(len=*), intent(in) :: stop_code_char
119+
120+
call prif_error_stop(quiet=.false._c_bool, stop_code_char=stop_code_char)
121+
end subroutine
122+
69123
end program test_suite_driver

0 commit comments

Comments
 (0)