@@ -226,7 +226,7 @@ static win_sync *pending_puts = NULL;
226
226
/* Linked list of static coarrays registered. Do not expose to public in the
227
227
* header, because it is implementation specific.
228
228
*
229
- * From gcc-15 on, this list is contained in the teams handling. */
229
+ * From gcc-16 on, this list is contained in the teams handling. */
230
230
struct caf_allocated_tokens_t
231
231
{
232
232
caf_token_t token ;
@@ -839,7 +839,11 @@ handle_is_present_message(ct_msg_t *msg, void *baseptr)
839
839
+= sizeof_desc_for_rank (GFC_DESCRIPTOR_RANK ((gfc_descriptor_t * )ptr ));
840
840
}
841
841
else
842
+ #ifdef GCC_GE_16
842
843
ptr = & baseptr ;
844
+ #else
845
+ ptr = baseptr ;
846
+ #endif
843
847
844
848
accessor_hash_table [msg -> accessor_index ].u .is_present (
845
849
add_data , & msg -> dest_image , & result , ptr , & src_token , 0 );
@@ -5740,11 +5744,11 @@ team_translate(int *remote_image, int *this_image,
5740
5744
caf_token_t token __attribute__((unused )), int image_index ,
5741
5745
caf_team_t * team , int * team_number , int * stat )
5742
5746
{
5747
+ #ifdef GCC_GE_16
5743
5748
MPI_Group world_group , team_group , remote_group ;
5744
5749
int ierr , trans , team_id = current_team -> team_list_elem -> team_id ;
5745
5750
MPI_Comm remote_comm = MPI_COMM_NULL ;
5746
5751
5747
- #ifdef GCC_GE_16
5748
5752
if (team )
5749
5753
{
5750
5754
caf_team_stack_node_t * cur = current_team ;
@@ -5777,7 +5781,6 @@ team_translate(int *remote_image, int *this_image,
5777
5781
return false;
5778
5782
}
5779
5783
}
5780
- #endif
5781
5784
5782
5785
ierr = MPI_Comm_group (CAF_COMM_WORLD , & world_group );
5783
5786
chk_err (ierr );
@@ -5803,6 +5806,27 @@ team_translate(int *remote_image, int *this_image,
5803
5806
chk_err (ierr );
5804
5807
dprint ("this: %d -> %d, rmt: %d -> %d on team %d.\n" , caf_this_image ,
5805
5808
* this_image + 1 , image_index , * remote_image + 1 , team_id );
5809
+ #else
5810
+ MPI_Group current_team_group , win_group ;
5811
+ int ierr , trans_ranks [2 ];
5812
+
5813
+ ierr = MPI_Comm_group (CAF_COMM_WORLD , & current_team_group );
5814
+ chk_err (ierr );
5815
+ ierr = MPI_Win_get_group (* TOKEN (token ), & win_group );
5816
+ chk_err (ierr );
5817
+ ierr = MPI_Group_translate_ranks (current_team_group , 2 ,
5818
+ (int []){image_index - 1 , mpi_this_image },
5819
+ win_group , trans_ranks );
5820
+ chk_err (ierr );
5821
+ * remote_image = trans_ranks [0 ];
5822
+ * this_image = trans_ranks [1 ];
5823
+ ierr = MPI_Group_free (& current_team_group );
5824
+ chk_err (ierr );
5825
+ ierr = MPI_Group_free (& win_group );
5826
+ chk_err (ierr );
5827
+ dprint ("this: %d -> %d, rmt: %d -> %d.\n" , caf_this_image , * this_image + 1 ,
5828
+ image_index , * remote_image + 1 );
5829
+ #endif
5806
5830
return true;
5807
5831
}
5808
5832
@@ -5895,7 +5919,11 @@ PREFIX(get_from_remote)(caf_token_t token, const gfc_descriptor_t *opt_src_desc,
5895
5919
msg -> transfer_size = dst_size ;
5896
5920
msg -> opt_charlen = opt_src_charlen ? * opt_src_charlen : 0 ;
5897
5921
msg -> win = * TOKEN (token );
5922
+ #ifdef GCC_GE_16
5898
5923
msg -> dest_image = this_image ;
5924
+ #else
5925
+ msg -> dest_image = mpi_this_image ;
5926
+ #endif
5899
5927
msg -> dest_tag = CAF_CT_TAG + 1 ;
5900
5928
msg -> dest_opt_charlen = opt_dst_charlen ? * opt_dst_charlen : 1 ;
5901
5929
msg -> flags = (opt_dst_desc ? CT_DST_HAS_DESC : 0 )
@@ -5939,8 +5967,13 @@ PREFIX(get_from_remote)(caf_token_t token, const gfc_descriptor_t *opt_src_desc,
5939
5967
"for internal buffer in get_from_remote()." );
5940
5968
}
5941
5969
dprint ("waiting to receive %zd bytes from %d.\n" , dst_size , remote_image );
5970
+ #ifdef GCC_GE_16
5942
5971
ierr = MPI_Recv (t_buff , dst_size , MPI_BYTE , remote_image , msg -> dest_tag ,
5943
5972
CAF_COMM_WORLD , MPI_STATUS_IGNORE );
5973
+ #else
5974
+ ierr = MPI_Recv (t_buff , dst_size , MPI_BYTE , image_index - 1 , msg -> dest_tag ,
5975
+ CAF_COMM_WORLD , MPI_STATUS_IGNORE );
5976
+ #endif
5944
5977
chk_err (ierr );
5945
5978
dprint ("received %zd bytes as requested from %d.\n" , dst_size ,
5946
5979
remote_image );
@@ -5958,8 +5991,13 @@ PREFIX(get_from_remote)(caf_token_t token, const gfc_descriptor_t *opt_src_desc,
5958
5991
5959
5992
dprint ("probing for incoming message from %d, tag %d.\n" , image_index - 1 ,
5960
5993
msg -> dest_tag );
5994
+ #ifdef GCC_GE_16
5995
+ ierr = MPI_Mprobe (remote_image , msg -> dest_tag , CAF_COMM_WORLD , & msg_han ,
5996
+ & status );
5997
+ #else
5961
5998
ierr = MPI_Mprobe (image_index - 1 , msg -> dest_tag , CAF_COMM_WORLD , & msg_han ,
5962
5999
& status );
6000
+ #endif
5963
6001
chk_err (ierr );
5964
6002
if (ierr == MPI_SUCCESS )
5965
6003
{
@@ -6062,8 +6100,14 @@ PREFIX(is_present_on_remote)(caf_token_t token, const int image_index,
6062
6100
void * src_ptr = ((mpi_caf_token_t * )token )-> memptr ;
6063
6101
6064
6102
dprint ("Shortcutting due to self access on image %d.\n" , image_index );
6065
- accessor_hash_table [is_present_index ].u .is_present (
6066
- add_data , & this_image , & result , & src_ptr , & src_token , 0 );
6103
+ accessor_hash_table [is_present_index ].u .is_present (add_data , & this_image ,
6104
+ & result ,
6105
+ #ifdef GCC_GE_16
6106
+ & src_ptr ,
6107
+ #else
6108
+ src_ptr ,
6109
+ #endif
6110
+ & src_token , 0 );
6067
6111
6068
6112
return result ;
6069
6113
}
@@ -6281,7 +6325,11 @@ PREFIX(send_to_remote)(caf_token_t token, gfc_descriptor_t *opt_dst_desc,
6281
6325
msg -> transfer_size = src_size ;
6282
6326
msg -> opt_charlen = opt_src_charlen ? * opt_src_charlen : 0 ;
6283
6327
msg -> win = * TOKEN (token );
6328
+ #ifdef GCC_GE_16
6284
6329
msg -> dest_image = this_image ;
6330
+ #else
6331
+ msg -> dest_image = mpi_this_image ;
6332
+ #endif
6285
6333
msg -> dest_tag = CAF_CT_TAG + 1 ;
6286
6334
msg -> dest_opt_charlen = opt_dst_charlen ? * opt_dst_charlen : 1 ;
6287
6335
msg -> flags = (opt_dst_desc ? CT_DST_HAS_DESC : 0 )
@@ -6324,8 +6372,13 @@ PREFIX(send_to_remote)(caf_token_t token, gfc_descriptor_t *opt_dst_desc,
6324
6372
char c ;
6325
6373
dprint ("waiting to receive 1 byte from %d on tag %d.\n" , remote_image ,
6326
6374
msg -> dest_tag );
6375
+ #ifdef GCC_GE_16
6327
6376
ierr = MPI_Recv (& c , 1 , MPI_BYTE , remote_image , msg -> dest_tag ,
6328
6377
CAF_COMM_WORLD , MPI_STATUS_IGNORE );
6378
+ #else
6379
+ ierr = MPI_Recv (& c , 1 , MPI_BYTE , image_index - 1 , msg -> dest_tag ,
6380
+ CAF_COMM_WORLD , MPI_STATUS_IGNORE );
6381
+ #endif
6329
6382
chk_err (ierr );
6330
6383
dprint ("received 1 byte as requested from %d on tag %d.\n" , remote_image ,
6331
6384
msg -> dest_tag );
@@ -6548,7 +6601,11 @@ PREFIX(transfer_between_remotes)(
6548
6601
dst_msg -> transfer_size = src_size ;
6549
6602
dst_msg -> opt_charlen = opt_src_charlen ? * opt_src_charlen : 0 ;
6550
6603
dst_msg -> win = * TOKEN (dst_token );
6604
+ #ifdef GCC_GE_16
6551
6605
dst_msg -> dest_image = this_image ;
6606
+ #else
6607
+ dst_msg -> dest_image = mpi_this_image ;
6608
+ #endif
6552
6609
dst_msg -> dest_tag = CAF_CT_TAG + 1 ;
6553
6610
dst_msg -> dest_opt_charlen = opt_dst_charlen ? * opt_dst_charlen : 1 ;
6554
6611
dst_msg -> flags
@@ -6593,8 +6650,13 @@ PREFIX(transfer_between_remotes)(
6593
6650
char c ;
6594
6651
dprint ("waiting to receive 1 byte from %d on tag %d.\n" , dst_remote_image ,
6595
6652
dst_msg -> dest_tag );
6653
+ #ifdef GCC_GE_16
6596
6654
ierr = MPI_Recv (& c , 1 , MPI_BYTE , dst_remote_image , dst_msg -> dest_tag ,
6597
6655
CAF_COMM_WORLD , MPI_STATUS_IGNORE );
6656
+ #else
6657
+ ierr = MPI_Recv (& c , 1 , MPI_BYTE , dst_image_index - 1 , dst_msg -> dest_tag ,
6658
+ CAF_COMM_WORLD , MPI_STATUS_IGNORE );
6659
+ #endif
6598
6660
chk_err (ierr );
6599
6661
if (dst_stat )
6600
6662
* dst_stat = c ;
0 commit comments