Skip to content

Commit 2a3e66a

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

File tree

1 file changed

+98
-31
lines changed

1 file changed

+98
-31
lines changed

src/mpi/mpi_caf.c

Lines changed: 98 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3916,9 +3916,15 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
39163916
int dst_kind, int src_kind, size_t dst_dim, size_t src_dim,
39173917
size_t num, int *stat, int image_index,
39183918
bool sr_global, /* access sr through global_dynamic_win */
3919-
bool desc_global, /* access desc through global_dynamic_win */
3920-
int src_type)
3919+
bool desc_global /* access desc through global_dynamic_win */
3920+
#ifdef GCC_GE_8
3921+
, int src_type)
3922+
{
3923+
#else
3924+
)
39213925
{
3926+
int src_type = -1;
3927+
#endif
39223928
ptrdiff_t extent_src = 1, array_offset_src = 0, stride_src;
39233929
size_t next_dst_dim, ref_rank;
39243930
gfc_max_dim_descriptor_t src_desc_data;
@@ -3964,12 +3970,21 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
39643970
if (sr_global)
39653971
get_data (ds, NULL, MPI_Aint_add ((MPI_Aint)sr, sr_byte_offset),
39663972
GFC_DESCRIPTOR_TYPE (dst),
3973+
#ifdef GCC_GE_8
39673974
src_type != -1 ? src_type : GFC_DESCRIPTOR_TYPE (dst),
3975+
#else
3976+
GFC_DESCRIPTOR_TYPE (dst),
3977+
#endif
39683978
dst_kind, src_kind, dst_size, ref->item_size, 1, stat,
39693979
image_index);
39703980
else
39713981
get_data (ds, mpi_token, sr_byte_offset,
3972-
GFC_DESCRIPTOR_TYPE (dst), src_type,
3982+
GFC_DESCRIPTOR_TYPE (dst),
3983+
#ifdef GCC_GE_8
3984+
src_type,
3985+
#else
3986+
GFC_DESCRIPTOR_TYPE (src),
3987+
#endif
39733988
dst_kind, src_kind, dst_size, ref->item_size, 1, stat,
39743989
image_index);
39753990
++(*i);
@@ -3984,14 +3999,22 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
39843999
get_data (ds + dst_index * dst_size, NULL,
39854000
MPI_Aint_add ((MPI_Aint)sr, sr_byte_offset),
39864001
GFC_DESCRIPTOR_TYPE (dst),
4002+
#ifdef GCC_GE_8
39874003
src_type != -1 ? src_type : GFC_DESCRIPTOR_TYPE (src),
4004+
#else
4005+
src_type == -1 ? GFC_DESCRIPTOR_TYPE (src) : src_type,
4006+
#endif
39884007
dst_kind, src_kind, dst_size, ref->item_size, num,
39894008
stat, image_index);
39904009
else
39914010
{
39924011
get_data (ds + dst_index * dst_size, mpi_token,
39934012
sr_byte_offset, GFC_DESCRIPTOR_TYPE (dst),
4013+
#ifdef GCC_GE_8
39944014
src_type != -1 ? src_type : GFC_DESCRIPTOR_TYPE (src),
4015+
#else
4016+
src_type == -1 ? GFC_DESCRIPTOR_TYPE (src) : src_type,
4017+
#endif
39954018
dst_kind, src_kind, dst_size, ref->item_size, num,
39964019
stat, image_index);
39974020
}
@@ -4034,16 +4057,23 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
40344057
}
40354058
get_for_ref (ref->next, i, dst_index, mpi_token, dst, NULL, ds,
40364059
sr, sr_byte_offset, desc_byte_offset, dst_kind, src_kind,
4037-
dst_dim, 0, 1, stat, image_index, sr_global, desc_global,
4038-
src_type);
4060+
dst_dim, 0, 1, stat, image_index, sr_global, desc_global
4061+
#ifdef GCC_GE_8
4062+
,src_type
4063+
#endif
4064+
);
40394065
return;
40404066
case CAF_REF_ARRAY:
40414067
if (ref->u.a.mode[src_dim] == CAF_ARR_REF_NONE)
40424068
{
40434069
get_for_ref (ref->next, i, dst_index, mpi_token, dst,
40444070
src, ds, sr, sr_byte_offset, desc_byte_offset, dst_kind,
40454071
src_kind, dst_dim, 0, 1, stat, image_index, sr_global,
4046-
desc_global, src_type);
4072+
desc_global
4073+
#ifdef GCC_GE_8
4074+
, src_type
4075+
#endif
4076+
);
40474077
return;
40484078
}
40494079
/* Only when on the left most index switch the data pointer to
@@ -4116,8 +4146,11 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
41164146
sr_byte_offset + array_offset_src * ref->item_size,
41174147
desc_byte_offset + array_offset_src * ref->item_size,
41184148
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
4119-
1, stat, image_index, sr_global, desc_global,
4120-
src_type);
4149+
1, stat, image_index, sr_global, desc_global
4150+
#ifdef GCC_GE_8
4151+
, src_type
4152+
#endif
4153+
);
41214154
dst_index += dst->dim[dst_dim]._stride;
41224155
}
41234156
return;
@@ -4136,8 +4169,11 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
41364169
sr_byte_offset + array_offset_src * ref->item_size,
41374170
desc_byte_offset + array_offset_src * ref->item_size,
41384171
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
4139-
1, stat, image_index, sr_global, desc_global,
4140-
src_type);
4172+
1, stat, image_index, sr_global, desc_global
4173+
#ifdef GCC_GE_8
4174+
, src_type
4175+
#endif
4176+
);
41414177
dst_index += dst->dim[dst_dim]._stride;
41424178
}
41434179
return;
@@ -4163,8 +4199,11 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
41634199
sr_byte_offset + array_offset_src * ref->item_size,
41644200
desc_byte_offset + array_offset_src * ref->item_size,
41654201
dst_kind, src_kind, next_dst_dim, src_dim + 1,
4166-
1, stat, image_index, sr_global, desc_global,
4167-
src_type);
4202+
1, stat, image_index, sr_global, desc_global
4203+
#ifdef GCC_GE_8
4204+
, src_type
4205+
#endif
4206+
);
41684207
dst_index += dst->dim[dst_dim]._stride;
41694208
array_offset_src += stride_src;
41704209
}
@@ -4177,7 +4216,11 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
41774216
sr_byte_offset + array_offset_src * ref->item_size,
41784217
desc_byte_offset + array_offset_src * ref->item_size,
41794218
dst_kind, src_kind, dst_dim, src_dim + 1, 1,
4180-
stat, image_index, sr_global, desc_global, src_type);
4219+
stat, image_index, sr_global, desc_global
4220+
#ifdef GCC_GE_8
4221+
, src_type
4222+
#endif
4223+
);
41814224
return;
41824225
case CAF_ARR_REF_OPEN_END:
41834226
COMPUTE_NUM_ITEMS (extent_src,
@@ -4195,8 +4238,11 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
41954238
sr_byte_offset + array_offset_src * ref->item_size,
41964239
desc_byte_offset + array_offset_src * ref->item_size,
41974240
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
4198-
1, stat, image_index, sr_global, desc_global,
4199-
src_type);
4241+
1, stat, image_index, sr_global, desc_global
4242+
#ifdef GCC_GE_8
4243+
, src_type
4244+
#endif
4245+
);
42004246
dst_index += dst->dim[dst_dim]._stride;
42014247
array_offset_src += stride_src;
42024248
}
@@ -4215,8 +4261,11 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
42154261
sr_byte_offset + array_offset_src * ref->item_size,
42164262
desc_byte_offset + array_offset_src * ref->item_size,
42174263
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
4218-
1, stat, image_index, sr_global, desc_global,
4219-
src_type);
4264+
1, stat, image_index, sr_global, desc_global
4265+
#ifdef GCC_GE_8
4266+
, src_type
4267+
#endif
4268+
);
42204269
dst_index += dst->dim[dst_dim]._stride;
42214270
array_offset_src += stride_src;
42224271
}
@@ -4230,8 +4279,11 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
42304279
{
42314280
get_for_ref (ref->next, i, dst_index, mpi_token, dst, NULL, ds, sr,
42324281
sr_byte_offset, desc_byte_offset, dst_kind, src_kind,
4233-
dst_dim, 0, 1, stat, image_index, sr_global, desc_global,
4234-
src_type);
4282+
dst_dim, 0, 1, stat, image_index, sr_global, desc_global
4283+
#ifdef GCC_GE_8
4284+
, src_type
4285+
#endif
4286+
);
42354287
return;
42364288
}
42374289
switch (ref->u.a.mode[src_dim])
@@ -4264,8 +4316,11 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
42644316
sr_byte_offset + array_offset_src * ref->item_size,
42654317
desc_byte_offset + array_offset_src * ref->item_size,
42664318
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
4267-
1, stat, image_index, sr_global, desc_global,
4268-
src_type);
4319+
1, stat, image_index, sr_global, desc_global
4320+
#ifdef GCC_GE_8
4321+
, src_type
4322+
#endif
4323+
);
42694324
dst_index += dst->dim[dst_dim]._stride;
42704325
}
42714326
return;
@@ -4278,8 +4333,11 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
42784333
sr_byte_offset + array_offset_src * ref->item_size,
42794334
desc_byte_offset + array_offset_src * ref->item_size,
42804335
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
4281-
1, stat, image_index, sr_global, desc_global,
4282-
src_type);
4336+
1, stat, image_index, sr_global, desc_global
4337+
#ifdef GCC_GE_8
4338+
, src_type
4339+
#endif
4340+
);
42834341
dst_index += dst->dim[dst_dim]._stride;
42844342
}
42854343
return;
@@ -4295,8 +4353,11 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
42954353
sr_byte_offset + array_offset_src * ref->item_size,
42964354
desc_byte_offset + array_offset_src * ref->item_size,
42974355
dst_kind, src_kind, dst_dim + 1, src_dim + 1,
4298-
1, stat, image_index, sr_global, desc_global,
4299-
src_type);
4356+
1, stat, image_index, sr_global, desc_global
4357+
#ifdef GCC_GE_8
4358+
, src_type
4359+
#endif
4360+
);
43004361
dst_index += dst->dim[dst_dim]._stride;
43014362
array_offset_src += ref->u.a.dim[src_dim].s.stride;
43024363
}
@@ -4307,7 +4368,11 @@ get_for_ref (caf_reference_t *ref, size_t *i, size_t dst_index,
43074368
sr_byte_offset + array_offset_src * ref->item_size,
43084369
desc_byte_offset + array_offset_src * ref->item_size,
43094370
dst_kind, src_kind, dst_dim, src_dim + 1, 1,
4310-
stat, image_index, sr_global, desc_global, src_type);
4371+
stat, image_index, sr_global, desc_global
4372+
#ifdef GCC_GE_8
4373+
, src_type
4374+
#endif
4375+
);
43114376
return;
43124377
/* The OPEN_* are mapped to a RANGE and therefore can not occur. */
43134378
case CAF_ARR_REF_OPEN_END:
@@ -4870,11 +4935,9 @@ PREFIX (get_by_ref) (caf_token_t token, int image_index,
48704935
caf_num_images);
48714936
get_for_ref (refs, &i, dst_index, mpi_token, dst, mpi_token->desc,
48724937
dst->base_addr, remote_memptr, 0, 0, dst_kind, src_kind, 0, 0,
4873-
1, stat, remote_image, false, false,
4938+
1, stat, remote_image, false, false
48744939
#ifdef GCC_GE_8
4875-
src_type
4876-
#else // GCC_GE_7
4877-
-1 // should src_type be calculated here? something similar to GFC_DESCRIPTOR_TYPE(mpi_token->desc)
4940+
, src_type
48784941
#endif
48794942
);
48804943
CAF_Win_unlock (remote_image, global_dynamic_win);
@@ -6211,7 +6274,11 @@ PREFIX (sendget_by_ref) (caf_token_t dst_token, int dst_image_index,
62116274
(gfc_descriptor_t *)&temp_src_desc, src_mpi_token->desc,
62126275
temp_src_desc.base.base_addr, remote_memptr, 0, 0,
62136276
dst_kind, src_kind, 0, 0,
6214-
1, src_stat, src_remote_image, false, false, src_type);
6277+
1, src_stat, src_remote_image, false, false
6278+
#ifdef GCC_GE_8
6279+
, src_type
6280+
#endif
6281+
);
62156282
CAF_Win_unlock (src_remote_image, global_dynamic_win);
62166283
CAF_Win_unlock (src_remote_image, src_mpi_token->memptr_win);
62176284
dprint ("%d/%d: %s() calling send_by_ref.\n", caf_this_image,

0 commit comments

Comments
 (0)