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
2 changes: 1 addition & 1 deletion docs/README-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions include/language-support.F90
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion src/caffeine/alias_s.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/caffeine/allocation_s.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/caffeine/teams_s.F90
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 &
Expand Down
12 changes: 6 additions & 6 deletions src/prif.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(:)
Expand Down Expand Up @@ -498,15 +498,15 @@ 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)
implicit none
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
Expand Down
20 changes: 5 additions & 15 deletions test/prif_allocate_test.F90
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
8 changes: 1 addition & 7 deletions test/prif_atomic_test.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 2 additions & 10 deletions test/prif_coarray_inquiry_test.F90
Original file line number Diff line number Diff line change
@@ -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.) &
Expand 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
Expand Down
12 changes: 1 addition & 11 deletions test/prif_event_test.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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(//)

Expand Down
11 changes: 2 additions & 9 deletions test/prif_image_index_test.F90
Original file line number Diff line number Diff line change
@@ -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, &
Expand All @@ -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(//)

Expand Down
14 changes: 1 addition & 13 deletions test/prif_rma_test.F90
Original file line number Diff line number Diff line change
@@ -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, &
Expand All @@ -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
Expand Down
14 changes: 1 addition & 13 deletions test/prif_strided_test.F90
Original file line number Diff line number Diff line change
@@ -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, &
Expand All @@ -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.)

Expand Down
7 changes: 1 addition & 6 deletions test/prif_teams_test.F90
Original file line number Diff line number Diff line change
@@ -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(//)

Expand Down
30 changes: 30 additions & 0 deletions test/test-uses-alloc.F90
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading