Skip to content

Commit cbb466f

Browse files
committed
Used macros to fix send_for_ref for GCC 7 and 8 and all calls to it
1 parent 2a3e66a commit cbb466f

File tree

1 file changed

+106
-39
lines changed

1 file changed

+106
-39
lines changed

src/mpi/mpi_caf.c

Lines changed: 106 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5030,9 +5030,15 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
50305030
int dst_kind, int src_kind, size_t dst_dim, size_t src_dim,
50315031
size_t num, int *stat, int image_index,
50325032
bool ds_global, /* access ds through global_dynamic_win */
5033-
bool desc_global, /* access desc through global_dynamic_win */
5034-
int dst_type)
5033+
bool desc_global /* access desc through global_dynamic_win */
5034+
#ifdef GCC_GE_8
5035+
, int dst_type)
5036+
{
5037+
#else
5038+
)
50355039
{
5040+
int dst_type = -1;
5041+
#endif
50365042
ptrdiff_t extent_dst = 1, array_offset_dst = 0, dst_stride, src_stride;
50375043
size_t next_dst_dim, ref_rank;
50385044
gfc_max_dim_descriptor_t dst_desc_data;
@@ -5074,14 +5080,22 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
50745080

50755081
if (ds_global)
50765082
put_data (NULL, MPI_Aint_add ((MPI_Aint)ds, dst_byte_offset), sr,
5077-
dst_type, GFC_DESCRIPTOR_TYPE (src),
5078-
dst_kind, src_kind, ref->item_size, src_size, 1, stat,
5079-
image_index);
5083+
#ifdef GCC_GE_8
5084+
dst_type,
5085+
#else
5086+
GFC_DESCRIPTOR_TYPE (src),
5087+
#endif
5088+
GFC_DESCRIPTOR_TYPE (src), dst_kind, src_kind,
5089+
ref->item_size, src_size, 1, stat, image_index);
50805090
else
50815091
put_data (mpi_token, dst_byte_offset, sr,
5082-
dst_type, GFC_DESCRIPTOR_TYPE (src),
5083-
dst_kind, src_kind, ref->item_size, src_size, 1, stat,
5084-
image_index);
5092+
#ifdef GCC_GE_8
5093+
dst_type,
5094+
#else
5095+
GFC_DESCRIPTOR_TYPE (dst),
5096+
#endif
5097+
GFC_DESCRIPTOR_TYPE (src), dst_kind, src_kind,
5098+
ref->item_size, src_size, 1, stat, image_index);
50855099
++(*i);
50865100
return;
50875101
case CAF_REF_STATIC_ARRAY:
@@ -5093,12 +5107,22 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
50935107
if (ds_global)
50945108
put_data (NULL, MPI_Aint_add ((MPI_Aint)ds, dst_byte_offset),
50955109
sr + src_index * src_size,
5110+
#ifdef GCC_GE_8
50965111
dst_type, GFC_DESCRIPTOR_TYPE (src),
5112+
#else
5113+
GFC_DESCRIPTOR_TYPE (dst),
5114+
dst_type == -1 ? GFC_DESCRIPTOR_TYPE (src) : dst_type,
5115+
#endif
50975116
dst_kind, src_kind, ref->item_size, src_size, num,
50985117
stat, image_index);
50995118
else
51005119
put_data (mpi_token, dst_byte_offset, sr + src_index * src_size,
5120+
#ifdef GCC_GE_8
51015121
dst_type, GFC_DESCRIPTOR_TYPE (src),
5122+
#else
5123+
GFC_DESCRIPTOR_TYPE (dst),
5124+
dst_type == -1 ? GFC_DESCRIPTOR_TYPE (src) : dst_type,
5125+
#endif
51025126
dst_kind, src_kind, ref->item_size, src_size, num,
51035127
stat, image_index);
51045128
*i += num;
@@ -5140,16 +5164,22 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
51405164
}
51415165
send_by_ref (ref->next, i, src_index, mpi_token, dst, src, ds,
51425166
sr, dst_byte_offset, desc_byte_offset, dst_kind, src_kind,
5143-
dst_dim, 0, 1, stat, image_index, ds_global, desc_global,
5144-
dst_type);
5167+
dst_dim, 0, 1, stat, image_index, ds_global, desc_global
5168+
#ifdef GCC_GE_8
5169+
, dst_type
5170+
#endif
5171+
);
51455172
return;
51465173
case CAF_REF_ARRAY:
51475174
if (ref->u.a.mode[src_dim] == CAF_ARR_REF_NONE)
51485175
{
5149-
send_by_ref (ref->next, i, src_index, mpi_token, dst,
5150-
src, ds, sr, dst_byte_offset, desc_byte_offset, dst_kind,
5151-
src_kind, dst_dim, 0, 1, stat, image_index, ds_global,
5152-
desc_global, dst_type);
5176+
send_by_ref (ref->next, i, src_index, mpi_token, dst, src, ds,
5177+
sr, dst_byte_offset, desc_byte_offset, dst_kind, src_kind,
5178+
dst_dim, 0, 1, stat, image_index, ds_global, desc_global
5179+
#ifdef GCC_GE_8
5180+
, dst_type
5181+
#endif
5182+
);
51535183
return;
51545184
}
51555185
/* Only when on the left most index switch the data pointer to
@@ -5222,8 +5252,11 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
52225252
dst_byte_offset + array_offset_dst * ref->item_size,
52235253
desc_byte_offset + array_offset_dst * ref->item_size,
52245254
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
5225-
1, stat, image_index, ds_global, desc_global,
5226-
dst_type);
5255+
1, stat, image_index, ds_global, desc_global
5256+
#ifdef GCC_GE_8
5257+
, dst_type
5258+
#endif
5259+
);
52275260
src_index += dst->dim[dst_dim]._stride;
52285261
}
52295262
return;
@@ -5246,8 +5279,11 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
52465279
dst_byte_offset + array_offset_dst * ref->item_size,
52475280
desc_byte_offset + array_offset_dst * ref->item_size,
52485281
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
5249-
1, stat, image_index, ds_global, desc_global,
5250-
dst_type);
5282+
1, stat, image_index, ds_global, desc_global
5283+
#ifdef GCC_GE_8
5284+
, dst_type
5285+
#endif
5286+
);
52515287
src_index += src_stride;
52525288
}
52535289
return;
@@ -5275,8 +5311,11 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
52755311
dst_byte_offset + array_offset_dst * ref->item_size,
52765312
desc_byte_offset + array_offset_dst * ref->item_size,
52775313
dst_kind, src_kind, next_dst_dim, src_dim + 1,
5278-
1, stat, image_index, ds_global, desc_global,
5279-
dst_type);
5314+
1, stat, image_index, ds_global, desc_global
5315+
#ifdef GCC_GE_8
5316+
, dst_type
5317+
#endif
5318+
);
52805319
src_index += src_stride;
52815320
array_offset_dst += dst_stride;
52825321
}
@@ -5289,7 +5328,11 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
52895328
dst_byte_offset + array_offset_dst * ref->item_size,
52905329
desc_byte_offset + array_offset_dst * ref->item_size,
52915330
dst_kind, src_kind, dst_dim, src_dim + 1, 1,
5292-
stat, image_index, ds_global, desc_global, dst_type);
5331+
stat, image_index, ds_global, desc_global
5332+
#ifdef GCC_GE_8
5333+
, dst_type
5334+
#endif
5335+
);
52935336
return;
52945337
case CAF_ARR_REF_OPEN_END:
52955338
COMPUTE_NUM_ITEMS (extent_dst,
@@ -5309,8 +5352,11 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
53095352
dst_byte_offset + array_offset_dst * ref->item_size,
53105353
desc_byte_offset + array_offset_dst * ref->item_size,
53115354
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
5312-
1, stat, image_index, ds_global, desc_global,
5313-
dst_type);
5355+
1, stat, image_index, ds_global, desc_global
5356+
#ifdef GCC_GE_8
5357+
, dst_type
5358+
#endif
5359+
);
53145360
src_index += src_stride;
53155361
array_offset_dst += dst_stride;
53165362
}
@@ -5331,8 +5377,11 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
53315377
dst_byte_offset + array_offset_dst * ref->item_size,
53325378
desc_byte_offset + array_offset_dst * ref->item_size,
53335379
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
5334-
1, stat, image_index, ds_global, desc_global,
5335-
dst_type);
5380+
1, stat, image_index, ds_global, desc_global
5381+
#ifdef GCC_GE_8
5382+
, dst_type
5383+
#endif
5384+
);
53365385
src_index += src_stride;
53375386
array_offset_dst += dst_stride;
53385387
}
@@ -5346,8 +5395,11 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
53465395
{
53475396
send_by_ref (ref->next, i, src_index, mpi_token, dst, NULL, ds, sr,
53485397
dst_byte_offset, desc_byte_offset, dst_kind, src_kind,
5349-
dst_dim, 0, 1, stat, image_index, ds_global, desc_global,
5350-
dst_type);
5398+
dst_dim, 0, 1, stat, image_index, ds_global, desc_global
5399+
#ifdef GCC_GE_8
5400+
, dst_type
5401+
#endif
5402+
);
53515403
return;
53525404
}
53535405
switch (ref->u.a.mode[dst_dim])
@@ -5380,8 +5432,11 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
53805432
dst_byte_offset + array_offset_dst * ref->item_size,
53815433
desc_byte_offset + array_offset_dst * ref->item_size,
53825434
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
5383-
1, stat, image_index, ds_global, desc_global,
5384-
dst_type);
5435+
1, stat, image_index, ds_global, desc_global
5436+
#ifdef GCC_GE_8
5437+
, dst_type
5438+
#endif
5439+
);
53855440
src_index += src->dim[src_dim]._stride;
53865441
}
53875442
return;
@@ -5396,8 +5451,11 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
53965451
dst_byte_offset + array_offset_dst * ref->item_size,
53975452
desc_byte_offset + array_offset_dst * ref->item_size,
53985453
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
5399-
1, stat, image_index, ds_global, desc_global,
5400-
dst_type);
5454+
1, stat, image_index, ds_global, desc_global
5455+
#ifdef GCC_GE_8
5456+
, dst_type
5457+
#endif
5458+
);
54015459
src_index += src_stride;
54025460
}
54035461
return;
@@ -5415,8 +5473,11 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
54155473
dst_byte_offset + array_offset_dst * ref->item_size,
54165474
desc_byte_offset + array_offset_dst * ref->item_size,
54175475
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
5418-
1, stat, image_index, ds_global, desc_global,
5419-
dst_type);
5476+
1, stat, image_index, ds_global, desc_global
5477+
#ifdef GCC_GE_8
5478+
, dst_type
5479+
#endif
5480+
);
54205481
src_index += src_stride;
54215482
array_offset_dst += ref->u.a.dim[dst_dim].s.stride;
54225483
}
@@ -5427,7 +5488,11 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t src_index,
54275488
dst_byte_offset + array_offset_dst * ref->item_size,
54285489
desc_byte_offset + array_offset_dst * ref->item_size,
54295490
dst_kind, src_kind, dst_dim, src_dim + 1, 1,
5430-
stat, image_index, ds_global, desc_global, dst_type);
5491+
stat, image_index, ds_global, desc_global
5492+
#ifdef GCC_GE_8
5493+
, dst_type
5494+
#endif
5495+
);
54315496
return;
54325497
/* The OPEN_* are mapped to a RANGE and therefore can not occur. */
54335498
case CAF_ARR_REF_OPEN_END:
@@ -5901,11 +5966,9 @@ PREFIX (send_by_ref) (caf_token_t token, int image_index,
59015966
caf_num_images, __FUNCTION__);
59025967
send_by_ref (refs, &i, src_index, mpi_token, mpi_token->desc, src,
59035968
remote_memptr, src->base_addr, 0, 0, dst_kind, src_kind, 0, 0,
5904-
1, stat, remote_image, false, false,
5969+
1, stat, remote_image, false, false
59055970
#ifdef GCC_GE_8
5906-
dst_type
5907-
#else // GCC_GE_7
5908-
-1 // should dst_type be calculated here? something similar to GFC_DESCRIPTOR_TYPE(mpi_token->desc)
5971+
, dst_type
59095972
#endif
59105973
);
59115974
if (free_temp_src)
@@ -6291,7 +6354,11 @@ PREFIX (sendget_by_ref) (caf_token_t dst_token, int dst_image_index,
62916354
dst_mpi_token->desc, (gfc_descriptor_t *)&temp_src_desc,
62926355
dst_mpi_token->memptr, temp_src_desc.base.base_addr, 0, 0,
62936356
dst_kind, src_kind,
6294-
0, 0, 1, dst_stat, dst_image_index - 1, false, false, dst_type);
6357+
0, 0, 1, dst_stat, dst_image_index - 1, false, false
6358+
#ifdef GCC_GE_8
6359+
, dst_type
6360+
#endif
6361+
);
62956362
CAF_Win_unlock (dst_remote_image, global_dynamic_win);
62966363
CAF_Win_unlock (dst_remote_image, src_mpi_token->memptr_win);
62976364
}

0 commit comments

Comments
 (0)