|
2 | 2 | ! Terms of use are as specified in LICENSE.txt |
3 | 3 |
|
4 | 4 | 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 |
6 | 8 | use prif_init_test_m, only : prif_init_test_t, check_caffeination |
7 | 9 | use prif_num_images_test_m, only : prif_num_images_test_t |
8 | 10 | use prif_this_image_no_coarray_test_m, only : prif_this_image_no_coarray_test_t |
@@ -30,6 +32,14 @@ program test_suite_driver |
30 | 32 | type(test_diagnosis_t) :: dummy |
31 | 33 | dummy = check_caffeination() ! ensure an early call to prif_init |
32 | 34 |
|
| 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 | + |
33 | 43 | associate(test_harness => test_harness_t([ & |
34 | 44 | ! tests for basic functionality that are mostly self-contained |
35 | 45 | test_fixture_t( prif_init_test_t() ) & |
@@ -66,4 +76,48 @@ program test_suite_driver |
66 | 76 | ])) |
67 | 77 | call test_harness%report_results |
68 | 78 | 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 | + |
69 | 123 | end program test_suite_driver |
0 commit comments