Skip to content

Replace c_intmax_t with c_int64_t #149

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

Merged
merged 4 commits into from
Dec 18, 2024
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
4 changes: 3 additions & 1 deletion src/caffeine/caffeine.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,10 @@ size_t caf_elem_len(CFI_cdesc_t* a_desc)
return a_desc->elem_len;
}

void caf_form_team(gex_TM_t current_team, gex_TM_t* new_team, intmax_t team_number, int new_index)
void caf_form_team(gex_TM_t current_team, gex_TM_t* new_team, int64_t team_number, int new_index)
{
// GASNet color argument is int (32-bit), check for value truncation:
assert((unsigned int)team_number == team_number);
gex_TM_Split(new_team, current_team, team_number, new_index, NULL, 0, GEX_FLAG_TM_NO_SCRATCH);
}

Expand Down
6 changes: 3 additions & 3 deletions src/caffeine/prif_private_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ pure function caf_elem_len(a) result(a_elem_len) bind(C)
end function

subroutine caf_form_team(current_team, new_team, team_number, new_index) bind(C)
!! void caf_form_team(gex_TM_t* current_team, gex_TM_t* new_team, intmax_t team_number, int new_index);
import c_ptr, c_int, c_intmax_t
!! void caf_form_team(gex_TM_t* current_team, gex_TM_t* new_team, int64_t team_number, int new_index);
import c_ptr, c_int, c_int64_t
type(c_ptr), intent(in), value :: current_team
type(c_ptr), intent(out) :: new_team
integer(c_intmax_t), intent(in), value :: team_number
integer(c_int64_t), intent(in), value :: team_number
integer(c_int), intent(in), value :: new_index
end subroutine

Expand Down
38 changes: 19 additions & 19 deletions src/prif.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

module prif

use iso_c_binding, only: c_int, c_bool, c_intptr_t, c_intmax_t, c_ptr, c_funptr, c_size_t, c_ptrdiff_t, c_null_ptr, c_int64_t
use iso_c_binding, only: c_int, c_bool, c_intptr_t, c_ptr, c_funptr, c_size_t, c_ptrdiff_t, c_null_ptr, c_int64_t

implicit none

Expand Down Expand Up @@ -428,8 +428,8 @@ module subroutine prif_put_strided_indirect_with_notify_indirect( &
module subroutine prif_alias_create(source_handle, alias_lcobounds, alias_ucobounds, alias_handle)
implicit none
type(prif_coarray_handle), intent(in) :: source_handle
integer(c_intmax_t), intent(in) :: alias_lcobounds(:)
integer(c_intmax_t), intent(in) :: alias_ucobounds(:)
integer(c_int64_t), intent(in) :: alias_lcobounds(:)
integer(c_int64_t), intent(in) :: alias_ucobounds(:)
type(prif_coarray_handle), intent(out) :: alias_handle
end subroutine

Expand All @@ -442,26 +442,26 @@ module subroutine prif_lcobound_with_dim(coarray_handle, dim, lcobound)
implicit none
type(prif_coarray_handle), intent(in) :: coarray_handle
integer(c_int), intent(in) :: dim
integer(c_intmax_t), intent(out) :: lcobound
integer(c_int64_t), intent(out) :: lcobound
end subroutine

module subroutine prif_lcobound_no_dim(coarray_handle, lcobounds)
implicit none
type(prif_coarray_handle), intent(in) :: coarray_handle
integer(c_intmax_t), intent(out) :: lcobounds(:)
integer(c_int64_t), intent(out) :: lcobounds(:)
end subroutine

module subroutine prif_ucobound_with_dim(coarray_handle, dim, ucobound)
implicit none
type(prif_coarray_handle), intent(in) :: coarray_handle
integer(c_int), intent(in) :: dim
integer(c_intmax_t), intent(out) :: ucobound
integer(c_int64_t), intent(out) :: ucobound
end subroutine

module subroutine prif_ucobound_no_dim(coarray_handle, ucobounds)
implicit none
type(prif_coarray_handle), intent(in) :: coarray_handle
integer(c_intmax_t), intent(out) :: ucobounds(:)
integer(c_int64_t), intent(out) :: ucobounds(:)
end subroutine

module subroutine prif_coshape(coarray_handle, sizes)
Expand All @@ -473,22 +473,22 @@ module subroutine prif_coshape(coarray_handle, sizes)
module subroutine prif_image_index(coarray_handle, sub, image_index)
implicit none
type(prif_coarray_handle), intent(in) :: coarray_handle
integer(c_intmax_t), intent(in) :: sub(:)
integer(c_int64_t), intent(in) :: sub(:)
integer(c_int), intent(out) :: image_index
end subroutine

module subroutine prif_image_index_with_team(coarray_handle, sub, team, image_index)
implicit none
type(prif_coarray_handle), intent(in) :: coarray_handle
integer(c_intmax_t), intent(in) :: sub(:)
integer(c_int64_t), intent(in) :: sub(:)
type(prif_team_type), intent(in) :: team
integer(c_int), intent(out) :: image_index
end subroutine

module subroutine prif_image_index_with_team_number(coarray_handle, sub, team_number, image_index)
implicit none
type(prif_coarray_handle), intent(in) :: coarray_handle
integer(c_intmax_t), intent(in) :: sub(:)
integer(c_int64_t), intent(in) :: sub(:)
integer(c_int), intent(in) :: team_number
integer(c_int), intent(out) :: image_index
end subroutine
Expand All @@ -506,7 +506,7 @@ module subroutine prif_num_images_with_team(team, num_images)

module subroutine prif_num_images_with_team_number(team_number, num_images)
implicit none
integer(c_intmax_t), intent(in) :: team_number
integer(c_int64_t), intent(in) :: team_number
integer(c_int), intent(out) :: num_images
end subroutine

Expand All @@ -520,15 +520,15 @@ module subroutine prif_this_image_with_coarray(coarray_handle, team, cosubscript
implicit none
type(prif_coarray_handle), intent(in) :: coarray_handle
type(prif_team_type), intent(in), optional :: team
integer(c_intmax_t), intent(out) :: cosubscripts(:)
integer(c_int64_t), intent(out) :: cosubscripts(:)
end subroutine

module subroutine prif_this_image_with_dim(coarray_handle, dim, team, cosubscript)
implicit none
type(prif_coarray_handle), intent(in) :: coarray_handle
integer(c_int), intent(in) :: dim
type(prif_team_type), intent(in), optional :: team
integer(c_intmax_t), intent(out) :: cosubscript
integer(c_int64_t), intent(out) :: cosubscript
end subroutine

module subroutine prif_failed_images(team, failed_images)
Expand Down Expand Up @@ -621,7 +621,7 @@ module subroutine prif_co_broadcast(a, source_image, stat, errmsg, errmsg_alloc)

module subroutine prif_form_team(team_number, team, new_index, stat, errmsg, errmsg_alloc)
implicit none
integer(c_intmax_t), intent(in) :: team_number
integer(c_int64_t), intent(in) :: team_number
type(prif_team_type), intent(out) :: team
integer(c_int), intent(in), optional :: new_index
integer(c_int), intent(out), optional :: stat
Expand Down Expand Up @@ -653,7 +653,7 @@ module subroutine prif_get_team(level, team)
module subroutine prif_team_number(team, team_number)
implicit none
type(prif_team_type), intent(in), optional :: team
integer(c_intmax_t), intent(out) :: team_number
integer(c_int64_t), intent(out) :: team_number
end subroutine

module subroutine prif_sync_all(stat, errmsg, errmsg_alloc)
Expand Down Expand Up @@ -761,7 +761,7 @@ module subroutine prif_event_post_indirect(image_num, event_var_ptr, stat, errms
module subroutine prif_event_wait(event_var_ptr, until_count, stat, errmsg, errmsg_alloc)
implicit none
type(c_ptr), intent(in) :: event_var_ptr
integer(c_intmax_t), intent(in), optional :: until_count
integer(c_int64_t), intent(in), optional :: until_count
integer(c_int), intent(out), optional :: stat
character(len=*), intent(inout), optional :: errmsg
character(len=:), intent(inout), allocatable, optional :: errmsg_alloc
Expand All @@ -770,14 +770,14 @@ module subroutine prif_event_wait(event_var_ptr, until_count, stat, errmsg, errm
module subroutine prif_event_query(event_var_ptr, count, stat)
implicit none
type(c_ptr), intent(in) :: event_var_ptr
integer(c_intmax_t), intent(out) :: count
integer(c_int64_t), intent(out) :: count
integer(c_int), intent(out), optional :: stat
end subroutine

module subroutine prif_notify_wait(notify_var_ptr, until_count, stat, errmsg, errmsg_alloc)
implicit none
type(c_ptr), intent(in) :: notify_var_ptr
integer(c_intmax_t), intent(in), optional :: until_count
integer(c_int64_t), intent(in), optional :: until_count
integer(c_int), intent(out), optional :: stat
character(len=*), intent(inout), optional :: errmsg
character(len=:), intent(inout), allocatable, optional :: errmsg_alloc
Expand Down Expand Up @@ -1048,7 +1048,7 @@ module subroutine prif_atomic_ref_logical_indirect(image_num, atom_remote_ptr, v
integer(c_size_t) :: coarray_size
type(c_funptr) :: final_func
type(c_ptr) :: previous_handle = c_null_ptr, next_handle = c_null_ptr
integer(c_intmax_t) :: lcobounds(15), ucobounds(15)
integer(c_int64_t) :: lcobounds(15), ucobounds(15)
end type

type, private :: team_data
Expand Down
10 changes: 5 additions & 5 deletions test/caf_image_index_test.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module caf_image_index_test
use iso_c_binding, only: c_int, c_intmax_t, c_ptr, c_size_t, c_null_funptr, c_int64_t
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, prif_deallocate_coarray, prif_image_index, prif_num_images
use veggies, only: result_t, test_item_t, assert_equals, describe, it

Expand Down Expand Up @@ -33,7 +33,7 @@ function check_simple_case() result(result_)
final_func = c_null_funptr, &
coarray_handle = coarray_handle, &
allocated_memory = allocated_memory)
call prif_image_index(coarray_handle, [1_c_intmax_t], image_index=answer)
call prif_image_index(coarray_handle, [1_c_int64_t], image_index=answer)
result_ = assert_equals(1_c_int, answer)
call prif_deallocate_coarray([coarray_handle])
end function
Expand All @@ -52,7 +52,7 @@ function check_lower_bounds() result(result_)
final_func = c_null_funptr, &
coarray_handle = coarray_handle, &
allocated_memory = allocated_memory)
call prif_image_index(coarray_handle, [2_c_intmax_t, 3_c_intmax_t], image_index=answer)
call prif_image_index(coarray_handle, [2_c_int64_t, 3_c_int64_t], image_index=answer)
result_ = assert_equals(1_c_int, answer)
call prif_deallocate_coarray([coarray_handle])
end function
Expand All @@ -71,7 +71,7 @@ function check_invalid_subscripts() result(result_)
final_func = c_null_funptr, &
coarray_handle = coarray_handle, &
allocated_memory = allocated_memory)
call prif_image_index(coarray_handle, [-1_c_intmax_t, 1_c_intmax_t], image_index=answer)
call prif_image_index(coarray_handle, [-1_c_int64_t, 1_c_int64_t], image_index=answer)
result_ = assert_equals(0_c_int, answer)
call prif_deallocate_coarray([coarray_handle])
end function
Expand All @@ -91,7 +91,7 @@ function check_complicated() result(result_)
final_func = c_null_funptr, &
coarray_handle = coarray_handle, &
allocated_memory = allocated_memory)
call prif_image_index(coarray_handle, [1_c_intmax_t, 3_c_intmax_t], image_index=answer)
call prif_image_index(coarray_handle, [1_c_int64_t, 3_c_int64_t], image_index=answer)
result_ = assert_equals(merge(3_c_int,0_c_int,ni >= 3), answer)
call prif_deallocate_coarray([coarray_handle])
end function
Expand Down
6 changes: 3 additions & 3 deletions test/caf_teams_test.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module caf_teams_test
use iso_c_binding, only: c_size_t, c_ptr, c_intmax_t, c_null_funptr, c_int64_t
use iso_c_binding, only: c_size_t, c_ptr, c_null_funptr, c_int64_t
use prif, only: &
prif_coarray_handle, &
prif_allocate_coarray, &
Expand Down Expand Up @@ -31,15 +31,15 @@ function check_teams() result(result_)
! TODO: use final_func to observe automatic deallocation of coarrays
integer :: dummy_element, initial_num_imgs, num_imgs, me, i
integer(c_size_t) :: element_size
integer(c_intmax_t) :: which_team
integer(c_int64_t) :: which_team
integer, parameter :: num_coarrays = 4
type(prif_coarray_handle) :: coarrays(num_coarrays)
type(c_ptr) :: allocated_memory
type(prif_team_type) :: team

call prif_this_image_no_coarray(this_image=me)
call prif_num_images(num_images=initial_num_imgs)
which_team = merge(1_c_intmax_t, 2_c_intmax_t, mod(me, 2) == 0)
which_team = merge(1_c_int64_t, 2_c_int64_t, mod(me, 2) == 0)
element_size = int(storage_size(dummy_element)/8, c_size_t)
call prif_form_team(team_number = which_team, team = team)
call prif_change_team(team)
Expand Down