Skip to content

Commit 292d69e

Browse files
authored
Merge pull request #149 from BerkeleyLab/replace-c_intmax_t-with-c_int64_t
2 parents 67aa8a3 + 9cd3350 commit 292d69e

File tree

5 files changed

+33
-31
lines changed

5 files changed

+33
-31
lines changed

src/caffeine/caffeine.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,10 @@ size_t caf_elem_len(CFI_cdesc_t* a_desc)
287287
return a_desc->elem_len;
288288
}
289289

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

src/caffeine/prif_private_s.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ pure function caf_elem_len(a) result(a_elem_len) bind(C)
208208
end function
209209

210210
subroutine caf_form_team(current_team, new_team, team_number, new_index) bind(C)
211-
!! void caf_form_team(gex_TM_t* current_team, gex_TM_t* new_team, intmax_t team_number, int new_index);
212-
import c_ptr, c_int, c_intmax_t
211+
!! void caf_form_team(gex_TM_t* current_team, gex_TM_t* new_team, int64_t team_number, int new_index);
212+
import c_ptr, c_int, c_int64_t
213213
type(c_ptr), intent(in), value :: current_team
214214
type(c_ptr), intent(out) :: new_team
215-
integer(c_intmax_t), intent(in), value :: team_number
215+
integer(c_int64_t), intent(in), value :: team_number
216216
integer(c_int), intent(in), value :: new_index
217217
end subroutine
218218

src/prif.F90

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
module prif
77

8-
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
8+
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
99

1010
implicit none
1111

@@ -428,8 +428,8 @@ module subroutine prif_put_strided_indirect_with_notify_indirect( &
428428
module subroutine prif_alias_create(source_handle, alias_lcobounds, alias_ucobounds, alias_handle)
429429
implicit none
430430
type(prif_coarray_handle), intent(in) :: source_handle
431-
integer(c_intmax_t), intent(in) :: alias_lcobounds(:)
432-
integer(c_intmax_t), intent(in) :: alias_ucobounds(:)
431+
integer(c_int64_t), intent(in) :: alias_lcobounds(:)
432+
integer(c_int64_t), intent(in) :: alias_ucobounds(:)
433433
type(prif_coarray_handle), intent(out) :: alias_handle
434434
end subroutine
435435

@@ -442,26 +442,26 @@ module subroutine prif_lcobound_with_dim(coarray_handle, dim, lcobound)
442442
implicit none
443443
type(prif_coarray_handle), intent(in) :: coarray_handle
444444
integer(c_int), intent(in) :: dim
445-
integer(c_intmax_t), intent(out) :: lcobound
445+
integer(c_int64_t), intent(out) :: lcobound
446446
end subroutine
447447

448448
module subroutine prif_lcobound_no_dim(coarray_handle, lcobounds)
449449
implicit none
450450
type(prif_coarray_handle), intent(in) :: coarray_handle
451-
integer(c_intmax_t), intent(out) :: lcobounds(:)
451+
integer(c_int64_t), intent(out) :: lcobounds(:)
452452
end subroutine
453453

454454
module subroutine prif_ucobound_with_dim(coarray_handle, dim, ucobound)
455455
implicit none
456456
type(prif_coarray_handle), intent(in) :: coarray_handle
457457
integer(c_int), intent(in) :: dim
458-
integer(c_intmax_t), intent(out) :: ucobound
458+
integer(c_int64_t), intent(out) :: ucobound
459459
end subroutine
460460

461461
module subroutine prif_ucobound_no_dim(coarray_handle, ucobounds)
462462
implicit none
463463
type(prif_coarray_handle), intent(in) :: coarray_handle
464-
integer(c_intmax_t), intent(out) :: ucobounds(:)
464+
integer(c_int64_t), intent(out) :: ucobounds(:)
465465
end subroutine
466466

467467
module subroutine prif_coshape(coarray_handle, sizes)
@@ -473,22 +473,22 @@ module subroutine prif_coshape(coarray_handle, sizes)
473473
module subroutine prif_image_index(coarray_handle, sub, image_index)
474474
implicit none
475475
type(prif_coarray_handle), intent(in) :: coarray_handle
476-
integer(c_intmax_t), intent(in) :: sub(:)
476+
integer(c_int64_t), intent(in) :: sub(:)
477477
integer(c_int), intent(out) :: image_index
478478
end subroutine
479479

480480
module subroutine prif_image_index_with_team(coarray_handle, sub, team, image_index)
481481
implicit none
482482
type(prif_coarray_handle), intent(in) :: coarray_handle
483-
integer(c_intmax_t), intent(in) :: sub(:)
483+
integer(c_int64_t), intent(in) :: sub(:)
484484
type(prif_team_type), intent(in) :: team
485485
integer(c_int), intent(out) :: image_index
486486
end subroutine
487487

488488
module subroutine prif_image_index_with_team_number(coarray_handle, sub, team_number, image_index)
489489
implicit none
490490
type(prif_coarray_handle), intent(in) :: coarray_handle
491-
integer(c_intmax_t), intent(in) :: sub(:)
491+
integer(c_int64_t), intent(in) :: sub(:)
492492
integer(c_int), intent(in) :: team_number
493493
integer(c_int), intent(out) :: image_index
494494
end subroutine
@@ -506,7 +506,7 @@ module subroutine prif_num_images_with_team(team, num_images)
506506

507507
module subroutine prif_num_images_with_team_number(team_number, num_images)
508508
implicit none
509-
integer(c_intmax_t), intent(in) :: team_number
509+
integer(c_int64_t), intent(in) :: team_number
510510
integer(c_int), intent(out) :: num_images
511511
end subroutine
512512

@@ -520,15 +520,15 @@ module subroutine prif_this_image_with_coarray(coarray_handle, team, cosubscript
520520
implicit none
521521
type(prif_coarray_handle), intent(in) :: coarray_handle
522522
type(prif_team_type), intent(in), optional :: team
523-
integer(c_intmax_t), intent(out) :: cosubscripts(:)
523+
integer(c_int64_t), intent(out) :: cosubscripts(:)
524524
end subroutine
525525

526526
module subroutine prif_this_image_with_dim(coarray_handle, dim, team, cosubscript)
527527
implicit none
528528
type(prif_coarray_handle), intent(in) :: coarray_handle
529529
integer(c_int), intent(in) :: dim
530530
type(prif_team_type), intent(in), optional :: team
531-
integer(c_intmax_t), intent(out) :: cosubscript
531+
integer(c_int64_t), intent(out) :: cosubscript
532532
end subroutine
533533

534534
module subroutine prif_failed_images(team, failed_images)
@@ -621,7 +621,7 @@ module subroutine prif_co_broadcast(a, source_image, stat, errmsg, errmsg_alloc)
621621

622622
module subroutine prif_form_team(team_number, team, new_index, stat, errmsg, errmsg_alloc)
623623
implicit none
624-
integer(c_intmax_t), intent(in) :: team_number
624+
integer(c_int64_t), intent(in) :: team_number
625625
type(prif_team_type), intent(out) :: team
626626
integer(c_int), intent(in), optional :: new_index
627627
integer(c_int), intent(out), optional :: stat
@@ -653,7 +653,7 @@ module subroutine prif_get_team(level, team)
653653
module subroutine prif_team_number(team, team_number)
654654
implicit none
655655
type(prif_team_type), intent(in), optional :: team
656-
integer(c_intmax_t), intent(out) :: team_number
656+
integer(c_int64_t), intent(out) :: team_number
657657
end subroutine
658658

659659
module subroutine prif_sync_all(stat, errmsg, errmsg_alloc)
@@ -761,7 +761,7 @@ module subroutine prif_event_post_indirect(image_num, event_var_ptr, stat, errms
761761
module subroutine prif_event_wait(event_var_ptr, until_count, stat, errmsg, errmsg_alloc)
762762
implicit none
763763
type(c_ptr), intent(in) :: event_var_ptr
764-
integer(c_intmax_t), intent(in), optional :: until_count
764+
integer(c_int64_t), intent(in), optional :: until_count
765765
integer(c_int), intent(out), optional :: stat
766766
character(len=*), intent(inout), optional :: errmsg
767767
character(len=:), intent(inout), allocatable, optional :: errmsg_alloc
@@ -770,14 +770,14 @@ module subroutine prif_event_wait(event_var_ptr, until_count, stat, errmsg, errm
770770
module subroutine prif_event_query(event_var_ptr, count, stat)
771771
implicit none
772772
type(c_ptr), intent(in) :: event_var_ptr
773-
integer(c_intmax_t), intent(out) :: count
773+
integer(c_int64_t), intent(out) :: count
774774
integer(c_int), intent(out), optional :: stat
775775
end subroutine
776776

777777
module subroutine prif_notify_wait(notify_var_ptr, until_count, stat, errmsg, errmsg_alloc)
778778
implicit none
779779
type(c_ptr), intent(in) :: notify_var_ptr
780-
integer(c_intmax_t), intent(in), optional :: until_count
780+
integer(c_int64_t), intent(in), optional :: until_count
781781
integer(c_int), intent(out), optional :: stat
782782
character(len=*), intent(inout), optional :: errmsg
783783
character(len=:), intent(inout), allocatable, optional :: errmsg_alloc
@@ -1048,7 +1048,7 @@ module subroutine prif_atomic_ref_logical_indirect(image_num, atom_remote_ptr, v
10481048
integer(c_size_t) :: coarray_size
10491049
type(c_funptr) :: final_func
10501050
type(c_ptr) :: previous_handle = c_null_ptr, next_handle = c_null_ptr
1051-
integer(c_intmax_t) :: lcobounds(15), ucobounds(15)
1051+
integer(c_int64_t) :: lcobounds(15), ucobounds(15)
10521052
end type
10531053

10541054
type, private :: team_data

test/caf_image_index_test.f90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module caf_image_index_test
2-
use iso_c_binding, only: c_int, c_intmax_t, c_ptr, c_size_t, c_null_funptr, c_int64_t
2+
use iso_c_binding, only: c_int, c_ptr, c_size_t, c_null_funptr, c_int64_t
33
use prif, only: prif_coarray_handle, prif_allocate_coarray, prif_deallocate_coarray, prif_image_index, prif_num_images
44
use veggies, only: result_t, test_item_t, assert_equals, describe, it
55

@@ -33,7 +33,7 @@ function check_simple_case() result(result_)
3333
final_func = c_null_funptr, &
3434
coarray_handle = coarray_handle, &
3535
allocated_memory = allocated_memory)
36-
call prif_image_index(coarray_handle, [1_c_intmax_t], image_index=answer)
36+
call prif_image_index(coarray_handle, [1_c_int64_t], image_index=answer)
3737
result_ = assert_equals(1_c_int, answer)
3838
call prif_deallocate_coarray([coarray_handle])
3939
end function
@@ -52,7 +52,7 @@ function check_lower_bounds() result(result_)
5252
final_func = c_null_funptr, &
5353
coarray_handle = coarray_handle, &
5454
allocated_memory = allocated_memory)
55-
call prif_image_index(coarray_handle, [2_c_intmax_t, 3_c_intmax_t], image_index=answer)
55+
call prif_image_index(coarray_handle, [2_c_int64_t, 3_c_int64_t], image_index=answer)
5656
result_ = assert_equals(1_c_int, answer)
5757
call prif_deallocate_coarray([coarray_handle])
5858
end function
@@ -71,7 +71,7 @@ function check_invalid_subscripts() result(result_)
7171
final_func = c_null_funptr, &
7272
coarray_handle = coarray_handle, &
7373
allocated_memory = allocated_memory)
74-
call prif_image_index(coarray_handle, [-1_c_intmax_t, 1_c_intmax_t], image_index=answer)
74+
call prif_image_index(coarray_handle, [-1_c_int64_t, 1_c_int64_t], image_index=answer)
7575
result_ = assert_equals(0_c_int, answer)
7676
call prif_deallocate_coarray([coarray_handle])
7777
end function
@@ -91,7 +91,7 @@ function check_complicated() result(result_)
9191
final_func = c_null_funptr, &
9292
coarray_handle = coarray_handle, &
9393
allocated_memory = allocated_memory)
94-
call prif_image_index(coarray_handle, [1_c_intmax_t, 3_c_intmax_t], image_index=answer)
94+
call prif_image_index(coarray_handle, [1_c_int64_t, 3_c_int64_t], image_index=answer)
9595
result_ = assert_equals(merge(3_c_int,0_c_int,ni >= 3), answer)
9696
call prif_deallocate_coarray([coarray_handle])
9797
end function

test/caf_teams_test.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module caf_teams_test
2-
use iso_c_binding, only: c_size_t, c_ptr, c_intmax_t, c_null_funptr, c_int64_t
2+
use iso_c_binding, only: c_size_t, c_ptr, c_null_funptr, c_int64_t
33
use prif, only: &
44
prif_coarray_handle, &
55
prif_allocate_coarray, &
@@ -31,15 +31,15 @@ function check_teams() result(result_)
3131
! TODO: use final_func to observe automatic deallocation of coarrays
3232
integer :: dummy_element, initial_num_imgs, num_imgs, me, i
3333
integer(c_size_t) :: element_size
34-
integer(c_intmax_t) :: which_team
34+
integer(c_int64_t) :: which_team
3535
integer, parameter :: num_coarrays = 4
3636
type(prif_coarray_handle) :: coarrays(num_coarrays)
3737
type(c_ptr) :: allocated_memory
3838
type(prif_team_type) :: team
3939

4040
call prif_this_image_no_coarray(this_image=me)
4141
call prif_num_images(num_images=initial_num_imgs)
42-
which_team = merge(1_c_intmax_t, 2_c_intmax_t, mod(me, 2) == 0)
42+
which_team = merge(1_c_int64_t, 2_c_int64_t, mod(me, 2) == 0)
4343
element_size = int(storage_size(dummy_element)/8, c_size_t)
4444
call prif_form_team(team_number = which_team, team = team)
4545
call prif_change_team(team)

0 commit comments

Comments
 (0)