Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add all remaining prif interfaces #48

Merged
merged 22 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2c3d6fd
Rename `team_type_m` to `teams_m`, since the module contains
ktras Dec 16, 2023
c77cc85
Add interfaces for `prif_allocate_non_symmetric`, `prif_deallocate`,
ktras Dec 17, 2023
0e2269c
Add new module, `coarray_queries_m` and add interfaces for
ktras Dec 17, 2023
ad0ca30
Add interfaces for `prif_coshape` and `prif_image_index` to
ktras Dec 17, 2023
3bc6f53
Add interfaces for the remaining synchronization statements
ktras Dec 17, 2023
43782ba
Add new module, `locks_m`, and add interfaces for `prif_lock` and
ktras Dec 17, 2023
667a2e4
Add new module, `critical_m`, and add interfaces for `prif_critical`
ktras Dec 17, 2023
62dbb65
Add new module, `events_m`, and add interfaces for `prif_event_post`,
ktras Dec 17, 2023
b422e68
Add interfaces for the remaining procedures related to teams
ktras Dec 17, 2023
3fefbf4
Add new module, `atomic_m`, and add interfaces for `prif_atomic_add`
ktras Dec 18, 2023
8724069
Add interfaces for the remaining atomic procedures
ktras Dec 18, 2023
1b5a3b7
Add interface for `prif_fail_image`
ktras Dec 18, 2023
9ec9231
Rename module `image_enumeration_m` to `image_queries_m`
ktras Dec 18, 2023
363dee1
Add interfaces for `prif_failed_images` and `prif_stopped_images`
ktras Dec 18, 2023
aeb76a6
Add interface for `prif_image_status`
ktras Dec 18, 2023
2dea5ca
Update use-stmts in `prif`
ktras Dec 18, 2023
c45da07
Update intent-spec for dummy args in `critical_m`.
ktras Dec 18, 2023
238582d
Add new module, `prif_queries_m`, and interfaces for
ktras Dec 18, 2023
7945424
Add new module, `alias_m`, and interfaces for `prif_alias_create`
ktras Dec 18, 2023
ac94535
Add new module, `coarray_access_m`, and interfaces for `prif_put`,
ktras Dec 18, 2023
9ed3e3a
Add impure keyword or remove pure keyword from some procedure
ktras Dec 19, 2023
db53c6a
Add `prif_critical_type`
ktras Dec 19, 2023
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
28 changes: 28 additions & 0 deletions src/caffeine/alias_m.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
! Copyright (c), The Regents of the University of California
! Terms of use are as specified in LICENSE.txt
module alias_m
use iso_c_binding, only: c_intmax_t
use allocation_m, only: prif_coarray_handle

implicit none
private
public :: prif_alias_create, prif_alias_destroy

interface

module subroutine prif_alias_create(source_handle, alias_co_lbounds, alias_co_ubounds, alias_handle)
implicit none
type(prif_coarray_handle), intent(in) :: source_handle
integer(c_intmax_t), intent(in) :: alias_co_lbounds(:)
integer(c_intmax_t), intent(in) :: alias_co_ubounds(:)
type(prif_coarray_handle), intent(out) :: alias_handle
end subroutine

module subroutine prif_alias_destroy(alias_handle)
implicit none
type(prif_coarray_handle), intent(in) :: alias_handle
end subroutine

end interface

end module alias_m
15 changes: 15 additions & 0 deletions src/caffeine/alias_s.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
! Copyright (c), The Regents of the University of California
! Terms of use are as specified in LICENSE.txt
submodule(alias_m) alias_s

implicit none

contains

module procedure prif_alias_create
end procedure

module procedure prif_alias_destroy
end procedure

end submodule alias_s
27 changes: 26 additions & 1 deletion src/caffeine/allocation_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module allocation_m
use iso_c_binding, only: c_ptr, c_int, c_intmax_t, c_size_t, c_funptr
implicit none
private
public :: prif_allocate
public :: prif_allocate, prif_allocate_non_symmetric, prif_deallocate, prif_deallocate_non_symmetric


type, public :: prif_coarray_handle
Expand All @@ -28,6 +28,31 @@ module subroutine prif_allocate( &
character(len=:), intent(inout), allocatable, optional :: errmsg_alloc
end subroutine

module subroutine prif_allocate_non_symmetric(size_in_bytes, allocated_memory, stat, errmsg, errmsg_alloc)
implicit none
integer(kind=c_size_t) :: size_in_bytes
type(c_ptr), intent(out) :: allocated_memory
integer(c_int), intent(out), optional :: stat
character(len=*), intent(inout), optional :: errmsg
character(len=:), intent(inout), allocatable, optional :: errmsg_alloc
end subroutine

module subroutine prif_deallocate(coarray_handles, stat, errmsg, errmsg_alloc)
implicit none
type(prif_coarray_handle), intent(in) :: coarray_handles(:)
integer(c_int), intent(out), optional :: stat
character(len=*), intent(inout), optional :: errmsg
character(len=:), intent(inout), allocatable, optional :: errmsg_alloc
end subroutine

module subroutine prif_deallocate_non_symmetric(mem, stat, errmsg, errmsg_alloc)
implicit none
type(c_ptr), intent(in) :: mem
integer(c_int), intent(out), optional :: stat
character(len=*), intent(inout), optional :: errmsg
character(len=:), intent(inout), allocatable, optional :: errmsg_alloc
end subroutine

end interface

end module allocation_m
9 changes: 9 additions & 0 deletions src/caffeine/allocation_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,13 @@
product(ubounds-lbounds+1)*element_length, size(ucobounds), lcobounds, ucobounds, final_func, coarray_handle%ptr)
end procedure

module procedure prif_allocate_non_symmetric
end procedure

module procedure prif_deallocate
end procedure

module procedure prif_deallocate_non_symmetric
end procedure

end submodule allocation_s
2 changes: 1 addition & 1 deletion src/caffeine/assert/assert_m.F90
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module caffeine_assert_m

interface

pure module subroutine assert(assertion, description, diagnostic_data)
module subroutine assert(assertion, description, diagnostic_data)
!! If assertion is .false., error-terminate with a character stop code that contains diagnostic_data if present
implicit none
logical, intent(in) :: assertion
Expand Down
2 changes: 1 addition & 1 deletion src/caffeine/assert/assert_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
module procedure assert
use caffeine_characterizable_m, only : characterizable_t
use program_termination_m, only: prif_error_stop
use image_enumeration_m, only: this_image => prif_this_image
use image_queries_m, only: this_image => prif_this_image

character(len=:), allocatable :: header, trailer
integer :: me
Expand Down
151 changes: 151 additions & 0 deletions src/caffeine/atomic_m.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
! Copyright (c), The Regents of the University of California
! Terms of use are as specified in LICENSE.txt
module atomic_m
use iso_c_binding, only: c_intptr_t, c_int
use iso_fortran_env, only: atomic_int_kind, atomic_logical_kind

implicit none
private
public :: prif_atomic_add, prif_atomic_and, prif_atomic_or, prif_atomic_xor, prif_atomic_cas, prif_atomic_fetch_add
public :: prif_atomic_fetch_and, prif_atomic_fetch_or, prif_atomic_fetch_xor, prif_atomic_define, prif_atomic_ref

interface prif_atomic_cas
module procedure prif_atomic_cas_int
module procedure prif_atomic_cas_logical
end interface

interface prif_atomic_define
module procedure prif_atomic_define_int
module procedure prif_atomic_define_logical
end interface

interface prif_atomic_ref
module procedure prif_atomic_ref_int
module procedure prif_atomic_ref_logical
end interface

interface

module subroutine prif_atomic_add(atom_remote_ptr, image_num, value, stat)
implicit none
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
integer(atomic_int_kind), intent(in) :: value
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_and(atom_remote_ptr, image_num, value, stat)
implicit none
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
integer(atomic_int_kind), intent(in) :: value
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_or(atom_remote_ptr, image_num, value, stat)
implicit none
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
integer(atomic_int_kind), intent(in) :: value
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_xor(atom_remote_ptr, image_num, value, stat)
implicit none
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
integer(atomic_int_kind), intent(in) :: value
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_cas_int(atom_remote_ptr, image_num, old, compare, new, stat)
implicit none
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
integer(atomic_int_kind), intent(out) :: old
integer(atomic_int_kind), intent(in) :: compare
integer(atomic_int_kind), intent(in) :: new
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_cas_logical(atom_remote_ptr, image_num, old, compare, new, stat)
implicit none
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
logical(atomic_logical_kind), intent(out) :: old
logical(atomic_logical_kind), intent(in) :: compare
logical(atomic_logical_kind), intent(in) :: new
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_fetch_add(atom_remote_ptr, image_num, value, old, stat)
implicit none
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
integer(atomic_int_kind), intent(in) :: value
integer(atomic_int_kind), intent(out) :: old
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_fetch_and(atom_remote_ptr, image_num, value, old, stat)
implicit none
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
integer(atomic_int_kind), intent(in) :: value
integer(atomic_int_kind), intent(out) :: old
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_fetch_or(atom_remote_ptr, image_num, value, old, stat)
implicit none
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
integer(atomic_int_kind), intent(in) :: value
integer(atomic_int_kind), intent(out) :: old
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_fetch_xor(atom_remote_ptr, image_num, value, old, stat)
implicit none
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
integer(atomic_int_kind), intent(in) :: value
integer(atomic_int_kind), intent(out) :: old
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_define_int(atom_remote_ptr, image_num, value, stat)
implicit none
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
integer(atomic_int_kind), intent(in) :: value
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_define_logical(atom_remote_ptr, image_num, value, stat)
implicit none
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
logical(atomic_logical_kind), intent(in) :: value
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_ref_int(value, atom_remote_ptr, image_num, stat)
implicit none
integer(atomic_int_kind), intent(out) :: value
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_atomic_ref_logical(value, atom_remote_ptr, image_num, stat)
implicit none
logical(atomic_logical_kind), intent(out) :: value
integer(c_intptr_t), intent(in) :: atom_remote_ptr
integer(c_int), intent(in) :: image_num
integer(c_int), intent(out), optional :: stat
end subroutine

end interface

end module atomic_m
51 changes: 51 additions & 0 deletions src/caffeine/atomic_s.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
! Copyright (c), The Regents of the University of California
! Terms of use are as specified in LICENSE.txt
submodule(atomic_m) atomic_s

implicit none

contains

module procedure prif_atomic_add
end procedure

module procedure prif_atomic_and
end procedure

module procedure prif_atomic_or
end procedure

module procedure prif_atomic_xor
end procedure

module procedure prif_atomic_cas_int
end procedure

module procedure prif_atomic_cas_logical
end procedure

module procedure prif_atomic_fetch_add
end procedure

module procedure prif_atomic_fetch_and
end procedure

module procedure prif_atomic_fetch_or
end procedure

module procedure prif_atomic_fetch_xor
end procedure

module procedure prif_atomic_define_int
end procedure

module procedure prif_atomic_define_logical
end procedure

module procedure prif_atomic_ref_int
end procedure

module procedure prif_atomic_ref_logical
end procedure

end submodule atomic_s
2 changes: 1 addition & 1 deletion src/caffeine/caffeine_h_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ subroutine caf_decaffeinate(exit_code) bind(C)

! _________________ Image enumeration ____________________

pure function caf_this_image() bind(C)
function caf_this_image() bind(C)
!! int caf_this_image();
import c_int
implicit none
Expand Down
Loading
Loading