diff --git a/docs/README-release.md b/docs/README-release.md index 68212d30f..69015e92e 100644 --- a/docs/README-release.md +++ b/docs/README-release.md @@ -18,7 +18,7 @@ Release Procedure for Caffeine necessary changes 5. Update [docs/implementation-status.md](../docs/implementation-status.md) with current status 6. If the PRIF specification revision is changing, search and update all instances of the old revision, - including `PRIF_VERSION_{MAJOR,MINOR}` in [prif.F90](../src/prif.F90) + including `CAF_PRIF_VERSION_{MAJOR,MINOR}` in [language-support.F90](../include/language-support.F90) 7. Temporarily hardcode version of gasnet installer in [install.sh](../install.sh) as the last commit in the release. Set GASNET_VERSION flag to the latest gasnet release 5. Produce the ChangeLog diff --git a/include/language-support.F90 b/include/language-support.F90 index e75b74cb0..d880a908a 100644 --- a/include/language-support.F90 +++ b/include/language-support.F90 @@ -1,6 +1,9 @@ ! Copyright (c), The Regents of the University of California ! Terms of use are as specified in LICENSE.txt +#ifndef CAF_INCLUDED_LANGUAGE_SUPPORT +#define CAF_INCLUDED_LANGUAGE_SUPPORT + #ifdef __GNUC__ # define HAVE_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif @@ -53,3 +56,23 @@ #define CAF_IMPORT_TEAM_CONSTANTS CAF_IMPORT_CONSTANTS #endif +! PRIF specification version override and control +! By default, Caffeine provides the latest ratified version of the PRIF specification. +! Clients can optionally define one of the FORCE_* macros below to force compliance +! with a different revision of the PRIF specification. These override settings are +! NOT officially supported and may be removed at any time without notice. +#define CAF_PRIF_VERSION_MAJOR 0 +#if FORCE_PRIF_0_5 +# define CAF_PRIF_VERSION_MINOR 5 +#elif FORCE_PRIF_0_6 +# define CAF_PRIF_VERSION_MINOR 6 +#elif FORCE_PRIF_0_7 +# define CAF_PRIF_VERSION_MINOR 7 +#elif FORCE_PRIF_0_8 +# define CAF_PRIF_VERSION_MINOR 8 +#else +# define CAF_PRIF_VERSION_MINOR 7 +#endif +#define CAF_PRIF_VERSION (100 * CAF_PRIF_VERSION_MAJOR + CAF_PRIF_VERSION_MINOR) + +#endif diff --git a/src/caffeine/alias_s.F90 b/src/caffeine/alias_s.F90 index 1cdcb5367..2d3a91a75 100644 --- a/src/caffeine/alias_s.F90 +++ b/src/caffeine/alias_s.F90 @@ -2,6 +2,7 @@ ! Terms of use are as specified in LICENSE.txt #include "assert_macros.h" +#include "language-support.F90" submodule(prif:prif_private_s) alias_s ! DO NOT ADD USE STATEMENTS HERE @@ -20,7 +21,7 @@ ! start with a copy of the source descriptor alias_handle%info = source_handle%info -# if !FORCE_PRIF_0_5 +# if CAF_PRIF_VERSION >= 6 alias_handle%info%coarray_data = & as_c_ptr(as_int(alias_handle%info%coarray_data) + data_pointer_offset) # endif diff --git a/src/caffeine/allocation_s.F90 b/src/caffeine/allocation_s.F90 index 6b4458e1f..cb42bee88 100644 --- a/src/caffeine/allocation_s.F90 +++ b/src/caffeine/allocation_s.F90 @@ -2,6 +2,7 @@ ! Terms of use are as specified in LICENSE.txt #include "assert_macros.h" +#include "language-support.F90" submodule(prif:prif_private_s) allocation_s ! DO NOT ADD USE STATEMENTS HERE @@ -72,7 +73,7 @@ allocated_memory = caf_allocate(non_symmetric_heap_mspace, size_in_bytes) end procedure -#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6 +#if CAF_PRIF_VERSION <= 6 module procedure prif_deallocate_coarray #else module procedure prif_deallocate_coarray diff --git a/src/caffeine/teams_s.F90 b/src/caffeine/teams_s.F90 index bb938198e..2fbafd274 100644 --- a/src/caffeine/teams_s.F90 +++ b/src/caffeine/teams_s.F90 @@ -1,5 +1,8 @@ ! Copyright (c), The Regents of the University of California ! Terms of use are as specified in LICENSE.txt + +#include "language-support.F90" + submodule(prif:prif_private_s) teams_s ! DO NOT ADD USE STATEMENTS HERE ! All use statements belong in prif_private_s.F90 @@ -43,7 +46,7 @@ teams_coarrays(i)%info => tmp_data call c_f_pointer(tmp_data%next_handle, tmp_data) end do -#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6 +#if CAF_PRIF_VERSION <= 6 call prif_deallocate_coarray & #else call prif_deallocate_coarrays & diff --git a/src/prif.F90 b/src/prif.F90 index 68db80035..1bd6d5446 100644 --- a/src/prif.F90 +++ b/src/prif.F90 @@ -29,7 +29,7 @@ module prif public :: prif_register_stop_callback, prif_stop_callback_interface public :: prif_stop, prif_error_stop, prif_fail_image public :: prif_allocate_coarray, prif_allocate, prif_deallocate -#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6 +#if CAF_PRIF_VERSION <= 6 public :: prif_deallocate_coarray #else public :: prif_deallocate_coarray, prif_deallocate_coarrays @@ -65,8 +65,8 @@ module prif public :: prif_atomic_define_int, prif_atomic_define_int_indirect, prif_atomic_define_logical, prif_atomic_define_logical_indirect public :: prif_atomic_ref_int, prif_atomic_ref_int_indirect, prif_atomic_ref_logical, prif_atomic_ref_logical_indirect - integer(c_int), parameter, public :: PRIF_VERSION_MAJOR = 0 - integer(c_int), parameter, public :: PRIF_VERSION_MINOR = 7 + integer(c_int), parameter, public :: PRIF_VERSION_MAJOR = CAF_PRIF_VERSION_MAJOR + integer(c_int), parameter, public :: PRIF_VERSION_MINOR = CAF_PRIF_VERSION_MINOR #if CAF_IMPORT_ATOMIC_CONSTANTS integer(c_int), parameter, public :: PRIF_ATOMIC_INT_KIND = ATOMIC_INT_KIND @@ -219,7 +219,7 @@ module subroutine prif_allocate(size_in_bytes, allocated_memory, stat, errmsg, e character(len=:), intent(inout), allocatable, optional :: errmsg_alloc end subroutine -#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6 +#if CAF_PRIF_VERSION <= 6 module subroutine prif_deallocate_coarray(coarray_handles, stat, errmsg, errmsg_alloc) implicit none type(prif_coarray_handle), intent(in) :: coarray_handles(:) @@ -498,7 +498,7 @@ module subroutine prif_put_strided_indirect_with_notify_indirect( & end subroutine module subroutine prif_alias_create(source_handle, alias_lcobounds, alias_ucobounds, & -# if !FORCE_PRIF_0_5 +# if CAF_PRIF_VERSION >= 6 data_pointer_offset, & # endif alias_handle) @@ -506,7 +506,7 @@ module subroutine prif_alias_create(source_handle, alias_lcobounds, alias_ucobou type(prif_coarray_handle), intent(in) :: source_handle integer(c_int64_t), intent(in) :: alias_lcobounds(:) integer(c_int64_t), intent(in) :: alias_ucobounds(:) -# if !FORCE_PRIF_0_5 +# if CAF_PRIF_VERSION >= 6 integer(c_size_t), intent(in) :: data_pointer_offset # endif type(prif_coarray_handle), intent(out) :: alias_handle diff --git a/test/prif_allocate_test.F90 b/test/prif_allocate_test.F90 index e6bfc2ca8..0664e2bad 100644 --- a/test/prif_allocate_test.F90 +++ b/test/prif_allocate_test.F90 @@ -1,24 +1,14 @@ #include "test-utils.F90" module prif_allocate_test_m +# include "test-uses-alloc.F90" use prif, only : & - prif_allocate_coarray, & - prif_allocate, prif_deallocate, & - prif_coarray_handle, prif_num_images, prif_size_bytes, & + prif_num_images, prif_size_bytes, & prif_set_context_data, prif_get_context_data, prif_local_data_pointer, & prif_alias_create, prif_alias_destroy -#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6 - use prif, only : prif_deallocate_coarray_ => prif_deallocate_coarray -# define prif_deallocate_coarray(h) prif_deallocate_coarray_([h]) -# define prif_deallocate_coarrays(arr) prif_deallocate_coarray_(arr) -#else - use prif, only : prif_deallocate_coarray, prif_deallocate_coarrays -#endif + use julienne_m, only: test_description_t, test_diagnosis_t, test_result_t, test_t, string_t, usher & ,operator(.all.), operator(.also.), operator(.equalsExpected.), operator(//) - use iso_c_binding, only: & - c_ptr, c_int, c_int64_t, c_size_t, c_null_funptr, & - c_f_pointer, c_null_ptr, c_loc, c_associated, c_intptr_t implicit none private @@ -229,7 +219,7 @@ function check_allocate_integer_array_coarray_with_corank2() result(diag) end block block ! check aliasing creation -# if FORCE_PRIF_0_5 +# if CAF_PRIF_VERSION <= 5 # define data_pointer_offset # else # define data_pointer_offset 0_c_size_t, @@ -251,7 +241,7 @@ function check_allocate_integer_array_coarray_with_corank2() result(diag) ALSO(assert_aliased(a(i), a(j))) ALSO(assert_aliased(a(j), coarray_handle)) end do -# if !FORCE_PRIF_0_5 +# if CAF_PRIF_VERSION >= 6 ! test PRIF 0.6 data_pointer_offset block type(prif_coarray_handle) :: b diff --git a/test/prif_atomic_test.F90 b/test/prif_atomic_test.F90 index e1cb2bfa2..bfbc52afe 100644 --- a/test/prif_atomic_test.F90 +++ b/test/prif_atomic_test.F90 @@ -2,16 +2,10 @@ #include "test-utils.F90" module prif_atomic_test_m - use iso_c_binding, only: & - c_ptr, c_int64_t, c_intptr_t, c_size_t, c_null_funptr, c_f_pointer, c_loc, c_sizeof +# include "test-uses-alloc.F90" use julienne_m, only: call_julienne_assert_, test_description_t, test_diagnosis_t, test_result_t, test_t, string_t, usher & ,operator(.also.), operator(.equalsExpected.), operator(.isAtLeast.), operator(.isAtMost.), operator(.lessThan.), operator(//) use prif -#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6 - use prif, only : prif_deallocate_coarray_ => prif_deallocate_coarray -# define prif_deallocate_coarray(h) prif_deallocate_coarray_([h]) -# define prif_deallocate_coarrays(arr) prif_deallocate_coarray_(arr) -#endif implicit none private diff --git a/test/prif_coarray_inquiry_test.F90 b/test/prif_coarray_inquiry_test.F90 index 8b64a463d..00336e0bf 100644 --- a/test/prif_coarray_inquiry_test.F90 +++ b/test/prif_coarray_inquiry_test.F90 @@ -1,20 +1,14 @@ #include "test-utils.F90" module prif_coarray_inquiry_test_m +# include "test-uses-alloc.F90" use prif, only : & - prif_allocate_coarray, prif_deallocate_coarray, & prif_coarray_handle, prif_num_images, & prif_local_data_pointer, prif_size_bytes, & prif_lcobound_no_dim, prif_lcobound_with_dim, & prif_ucobound_no_dim, prif_ucobound_with_dim, & prif_coshape -#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6 - use prif, only : prif_deallocate_coarray_ => prif_deallocate_coarray -# define prif_deallocate_coarray(h) prif_deallocate_coarray_([h]) -# define prif_deallocate_coarrays(arr) prif_deallocate_coarray_(arr) -#else - use prif, only : prif_deallocate_coarray, prif_deallocate_coarrays -#endif + use julienne_m, only: & operator(//) & ,operator(.all.) & @@ -26,8 +20,6 @@ module prif_coarray_inquiry_test_m ,test_diagnosis_t & ,test_result_t & ,test_t - use iso_c_binding, only: & - c_ptr, c_null_ptr, c_int64_t, c_int, c_size_t, c_null_funptr, c_associated implicit none private diff --git a/test/prif_event_test.F90 b/test/prif_event_test.F90 index e6c9b7f44..13bb9d3e1 100644 --- a/test/prif_event_test.F90 +++ b/test/prif_event_test.F90 @@ -10,25 +10,15 @@ #endif module prif_event_test_m +# include "test-uses-alloc.F90" use assert_m - use iso_c_binding, only: & - c_ptr, c_int64_t, c_intptr_t, c_size_t, c_null_funptr, c_f_pointer, c_loc, c_sizeof use prif, only: & prif_event_type, prif_event_post, prif_event_post_indirect, prif_event_wait, prif_event_query, & prif_notify_type, prif_notify_wait, prif_put_with_notify, prif_put_strided_with_notify, & - prif_coarray_handle, & - prif_allocate_coarray, & prif_num_images, & prif_put, & prif_sync_all, & prif_this_image_no_coarray -#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6 - use prif, only : prif_deallocate_coarray_ => prif_deallocate_coarray -# define prif_deallocate_coarray(h) prif_deallocate_coarray_([h]) -# define prif_deallocate_coarrays(arr) prif_deallocate_coarray_(arr) -#else - use prif, only : prif_deallocate_coarray, prif_deallocate_coarrays -#endif use julienne_m, only: test_description_t, test_diagnosis_t, test_result_t, test_t, string_t, usher & ,operator(.all.), operator(.also.), operator(.equalsExpected.), operator(//) diff --git a/test/prif_image_index_test.F90 b/test/prif_image_index_test.F90 index 8c9272a38..2c3f9b477 100644 --- a/test/prif_image_index_test.F90 +++ b/test/prif_image_index_test.F90 @@ -1,8 +1,8 @@ #include "test-utils.F90" module prif_image_index_test_m - use iso_c_binding, only: c_int, c_ptr, c_size_t, c_null_funptr, c_int64_t - use prif, only: prif_coarray_handle, prif_allocate_coarray, & +# include "test-uses-alloc.F90" + use prif, only: & prif_image_index, prif_num_images, & prif_team_type, prif_get_team, & prif_this_image_no_coarray, & @@ -12,13 +12,6 @@ module prif_image_index_test_m prif_this_image_with_coarray, prif_this_image_with_dim, & prif_lcobound_no_dim, prif_ucobound_no_dim, & prif_num_images_with_team, PRIF_INITIAL_TEAM -#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6 - use prif, only : prif_deallocate_coarray_ => prif_deallocate_coarray -# define prif_deallocate_coarray(h) prif_deallocate_coarray_([h]) -# define prif_deallocate_coarrays(arr) prif_deallocate_coarray_(arr) -#else - use prif, only : prif_deallocate_coarray, prif_deallocate_coarrays -#endif use julienne_m, only: test_description_t, test_diagnosis_t, test_result_t, test_t, string_t, usher & ,operator(.also.), operator(.equalsExpected.), operator(.isAtLeast.), operator(.isAtMost.), operator(//) diff --git a/test/prif_rma_test.F90 b/test/prif_rma_test.F90 index e4de8bcd7..3e34a6faf 100644 --- a/test/prif_rma_test.F90 +++ b/test/prif_rma_test.F90 @@ -1,11 +1,6 @@ module prif_rma_test_m - use iso_c_binding, only: & - c_ptr, c_int64_t, c_intptr_t, c_size_t, c_null_funptr, c_f_pointer, c_loc, c_sizeof +# include "test-uses-alloc.F90" use prif, only: & - prif_coarray_handle, & - prif_allocate_coarray, & - prif_allocate, & - prif_deallocate, & prif_num_images, & prif_put, & prif_put_indirect, & @@ -14,13 +9,6 @@ module prif_rma_test_m prif_sync_all, & prif_sync_memory, & prif_this_image_no_coarray -#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6 - use prif, only : prif_deallocate_coarray_ => prif_deallocate_coarray -# define prif_deallocate_coarray(h) prif_deallocate_coarray_([h]) -# define prif_deallocate_coarrays(arr) prif_deallocate_coarray_(arr) -#else - use prif, only : prif_deallocate_coarray, prif_deallocate_coarrays -#endif use julienne_m, only: test_description_t, test_diagnosis_t, test_result_t, test_t, usher, operator(.equalsExpected.) implicit none diff --git a/test/prif_strided_test.F90 b/test/prif_strided_test.F90 index ab39e4393..43a1cebd2 100644 --- a/test/prif_strided_test.F90 +++ b/test/prif_strided_test.F90 @@ -1,11 +1,6 @@ module prif_strided_test_m - use iso_c_binding, only: & - c_ptr, c_int64_t, c_intptr_t, c_size_t, c_null_funptr, c_f_pointer, c_loc, c_sizeof +# include "test-uses-alloc.F90" use prif, only: & - prif_coarray_handle, & - prif_allocate_coarray, & - prif_allocate, & - prif_deallocate, & prif_num_images, & prif_get, & prif_put_strided, & @@ -14,13 +9,6 @@ module prif_strided_test_m prif_get_strided_indirect, & prif_sync_all, & prif_this_image_no_coarray -#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6 - use prif, only : prif_deallocate_coarray_ => prif_deallocate_coarray -# define prif_deallocate_coarray(h) prif_deallocate_coarray_([h]) -# define prif_deallocate_coarrays(arr) prif_deallocate_coarray_(arr) -#else - use prif, only : prif_deallocate_coarray, prif_deallocate_coarrays -#endif use julienne_m, only: test_description_t, test_diagnosis_t, test_result_t, test_t, usher & ,operator(.all.), operator(.equalsExpected.) diff --git a/test/prif_teams_test.F90 b/test/prif_teams_test.F90 index dddb5ca26..754b258ee 100644 --- a/test/prif_teams_test.F90 +++ b/test/prif_teams_test.F90 @@ -1,13 +1,8 @@ #include "test-utils.F90" module prif_teams_test_m - use iso_c_binding, only: c_size_t, c_ptr, c_null_funptr, c_int64_t, c_int +# include "test-uses-alloc.F90" use prif -#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6 - use prif, only : prif_deallocate_coarray_ => prif_deallocate_coarray -# define prif_deallocate_coarray(h) prif_deallocate_coarray_([h]) -# define prif_deallocate_coarrays(arr) prif_deallocate_coarray_(arr) -#endif use julienne_m, only: test_description_t, test_diagnosis_t, test_result_t, test_t, string_t, usher & ,operator(.also.), operator(.isAtLeast.), operator(.isAtMost.), operator(.equalsExpected.), operator(//) diff --git a/test/test-uses-alloc.F90 b/test/test-uses-alloc.F90 new file mode 100644 index 000000000..6669cb0a0 --- /dev/null +++ b/test/test-uses-alloc.F90 @@ -0,0 +1,30 @@ +! This header provides use declarations needed for tests using prif_(de)allocate(_coarray), +! and hides the interface differences between PRIF spec revisions. +! It must be #included within a use block. + +#ifndef CAF_INCLUDED_TEST_USES_ALLOC +#define CAF_INCLUDED_TEST_USES_ALLOC + +#include "language-support.F90" + +use prif, only : & + prif_allocate_coarray, & + prif_allocate, prif_deallocate, & + prif_coarray_handle + +#if !defined(CAF_PRIF_VERSION) || CAF_PRIF_VERSION >= 7 + ! PRIF 0.7+ deallocate + use prif, only : prif_deallocate_coarray, prif_deallocate_coarrays +#else + ! emulate PRIF 0.7 deallocate with older interfaces + use prif, only : prif_deallocate_coarray_ => prif_deallocate_coarray +# define prif_deallocate_coarray(h) prif_deallocate_coarray_([h]) +# define prif_deallocate_coarrays(arr) prif_deallocate_coarray_(arr) +#endif + + use iso_c_binding, only: & + c_ptr, c_int, c_int64_t, c_size_t, c_intptr_t, & + c_null_funptr, c_null_ptr, & + c_associated, c_f_pointer, c_loc, c_sizeof + +#endif diff --git a/test/test-utils.F90 b/test/test-utils.F90 index 07d9fdd54..4217c80ec 100644 --- a/test/test-utils.F90 +++ b/test/test-utils.F90 @@ -1,3 +1,6 @@ +#ifndef CAF_INCLUDED_TEST_UTILS +#define CAF_INCLUDED_TEST_UTILS + #ifndef CPP_STRINGIFY_SOURCE # if defined(__GFORTRAN__) || defined(_CRAYFTN) || defined(NAGFOR) || defined(__LFORTRAN__) # define CPP_STRINGIFY_SOURCE(x) "x" @@ -21,3 +24,4 @@ ( test_diagnosis_t(exp, NEW_LINE('')) // \ __FILE__ // ":" // CPP_LINE_STRING // ": FAILED: " // desc ) +#endif