Skip to content
Open
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
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ jobs:
label: PRIF-0.6
FFLAGS: -DFORCE_PRIF_0_6
container: phhargrove/llvm-flang:21.1.0-latest
- os: ubuntu-24.04
compiler: flang
version: 21
network: smp
label: PRIF-0.7
FFLAGS: -DFORCE_PRIF_0_7
container: phhargrove/llvm-flang:21.1.0-latest

# --- udp coverage for selected configs ---
- os: macos-15
Expand Down
6 changes: 3 additions & 3 deletions docs/implementation-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ selected constant values from `ISO_FORTRAN_ENV` of the hosting compiler.

| Procedure | Status | Notes |
|-----------|--------|-------|
| `prif_allocate_coarray` | **YES** | includes ucobound relaxation expected in PRIF 0.8 |
| `prif_allocate_coarray` | **YES** | includes ucobound relaxation and `final_func` argument rename expected in PRIF 0.8 |
| `prif_allocate` | **YES** | |
| `prif_deallocate_coarray` | **YES** | `final_func` support requires flang 20+ |
| `prif_deallocate_coarrays` | **YES** | `final_func` support requires flang 20+ |
| `prif_deallocate_coarray` | **YES** | |
| `prif_deallocate_coarrays` | **YES** | |
| `prif_deallocate` | **YES** | |
| `prif_alias_create` | **YES** | includes ucobound relaxation expected in PRIF 0.8 |
| `prif_alias_destroy` | **YES** | |
Expand Down
6 changes: 4 additions & 2 deletions example/support-test/out_of_memory.F90
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
program out_of_memory
use iso_c_binding, only: c_bool, c_size_t, c_ptr, c_null_funptr, c_int64_t
# include "../../test/test-uses-alloc.F90"
use unit_test_parameters_m, only: null_final_proc
use iso_c_binding, only: c_bool, c_size_t, c_ptr, c_int64_t
use prif
implicit none

Expand Down Expand Up @@ -37,7 +39,7 @@ program out_of_memory
ucobounds(1) = num_imgs

call prif_allocate_coarray( &
lcobounds, ucobounds, size_in_bytes, c_null_funptr, &
lcobounds, ucobounds, size_in_bytes, null_final_proc, &
coarray_handle, allocated_memory)
end block
else
Expand Down
14 changes: 0 additions & 14 deletions include/language-support.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,6 @@
#endif
#endif

#ifndef HAVE_FINAL_FUNC_SUPPORT
# if defined(__GFORTRAN__) && HAVE_GCC_VERSION < 160000
! gfortran 14-15 defect prevents declaration of the coarray_cleanup interface:
! https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113338
! reportedly fixed in gfortran 16
# define HAVE_FINAL_FUNC_SUPPORT 0
# elif defined(__flang__) && __flang_major__ < 20
! also missing in flang before 20
# define HAVE_FINAL_FUNC_SUPPORT 0
# else
# define HAVE_FINAL_FUNC_SUPPORT 1
# endif
#endif

#ifndef NEED_C_FUNLOC_WORKAROUND
# if __GFORTRAN__ && HAVE_GCC_VERSION <= 150200
! Gfortran 13..15.2 bug workaround, believed to be fixed in 15.3 and 16.x:
Expand Down
2 changes: 1 addition & 1 deletion include/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#elif FORCE_PRIF_0_8
# define CAF_PRIF_VERSION_MINOR 8
#else
# define CAF_PRIF_VERSION_MINOR 7
# define CAF_PRIF_VERSION_MINOR 8
#endif
#define CAF_PRIF_VERSION (100 * CAF_PRIF_VERSION_MAJOR + CAF_PRIF_VERSION_MINOR)

Expand Down
49 changes: 26 additions & 23 deletions src/caffeine/alias_s.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@

module procedure prif_alias_create
integer(c_int) :: corank
type(prif_coarray_descriptor), pointer :: cdp
type(prif_coarray_descriptor), pointer :: alias_cdp

! validate inputs
call_assert(coarray_handle_check(source_handle))
corank = size(alias_lcobounds)
call_assert(corank > 0)
call_assert(corank <= 15)
if (size(alias_ucobounds) == corank) then
call_assert(all(alias_lcobounds <= alias_ucobounds))
call_assert(product(alias_ucobounds - alias_lcobounds + 1) >= current_team%info%num_images)
Expand All @@ -26,50 +29,50 @@
call_assert(all(alias_lcobounds(1:corank-1) <= alias_ucobounds))
end if


allocate(alias_handle%info)
cdp => handle_to_cdp(source_handle)
! start with a copy of the source descriptor
alias_handle%info = source_handle%info
allocate(alias_cdp, source=cdp)

# if CAF_PRIF_VERSION >= 6
alias_handle%info%coarray_data = &
as_c_ptr(as_int(alias_handle%info%coarray_data) + data_pointer_offset)
alias_cdp%coarray_data = &
as_c_ptr(as_int(alias_cdp%coarray_data) + data_pointer_offset)
# endif

! apply provided cobounds
alias_handle%info%corank = corank
alias_handle%info%lcobounds(1:corank) = alias_lcobounds
alias_handle%info%ucobounds(1:corank-1) = alias_ucobounds(1:corank-1)
alias_cdp%corank = corank
alias_cdp%lcobounds(1:corank) = alias_lcobounds
alias_cdp%ucobounds(1:corank-1) = alias_ucobounds(1:corank-1)
call compute_coshape_epp(alias_lcobounds, alias_ucobounds, &
alias_handle%info%coshape_epp(1:corank))
alias_cdp%coshape_epp(1:corank))
# if ASSERTIONS
! The following entries are dead, but initialize them to help detect defects
alias_handle%info%lcobounds(corank+1:15) = huge(0_c_int64_t)
alias_handle%info%ucobounds(corank:14) = -huge(0_c_int64_t)
alias_handle%info%coshape_epp(corank+1:15) = 0
alias_cdp%lcobounds(corank+1:15) = huge(0_c_int64_t)
alias_cdp%ucobounds(corank:14) = -huge(0_c_int64_t)
alias_cdp%coshape_epp(corank+1:15) = 0
# endif

! reset some fields that are unused in aliases
alias_handle%info%reserved = c_null_ptr
alias_handle%info%previous_handle = c_null_ptr
alias_handle%info%next_handle = c_null_ptr
alias_handle%info%final_func = c_null_funptr
alias_cdp%reserved = c_null_ptr
alias_cdp%previous_handle = c_null_ptr
alias_cdp%next_handle = c_null_ptr
alias_cdp%final_proc = c_null_funptr

alias_handle = cdp_to_handle(alias_cdp)
call_assert(coarray_handle_check(alias_handle))
end procedure

module procedure prif_alias_destroy
type(prif_coarray_descriptor), pointer :: info
type(prif_coarray_descriptor), pointer :: cdp

call_assert(coarray_handle_check(alias_handle))

info => alias_handle%info
call_assert(.not. c_associated(info%reserved))
call_assert(.not. c_associated(info%previous_handle))
call_assert(.not. c_associated(info%next_handle))
call_assert(.not. c_associated(info%final_func))
cdp => handle_to_cdp(alias_handle)
call_assert(.not. c_associated(cdp%reserved))
call_assert(.not. c_associated(cdp%previous_handle))
call_assert(.not. c_associated(cdp%next_handle))
call_assert(.not. c_associated(cdp%final_proc))

deallocate(info)
deallocate(cdp)
end procedure

end submodule alias_s
Loading
Loading