@@ -1595,9 +1595,13 @@ assign_char4_from_char1(size_t dst_size, size_t src_size, uint32_t *dst,
1595
1595
size_t i , n ;
1596
1596
n = (dst_size > src_size ) ? src_size : dst_size ;
1597
1597
for (i = 0 ; i < n ; ++ i )
1598
+ {
1598
1599
dst [i ] = (int32_t ) src [i ];
1600
+ }
1599
1601
for (; i < dst_size ; ++ i )
1602
+ {
1600
1603
dst [i ] = (int32_t ) ' ' ;
1604
+ }
1601
1605
}
1602
1606
1603
1607
@@ -4251,12 +4255,13 @@ case kind: \
4251
4255
* src -> dim [src_dim ]._stride ;
4252
4256
stride_src =
4253
4257
src -> dim [src_dim ]._stride * ref -> u .a .dim [src_dim ].s .stride ;
4254
- /* Increase the dst_dim only, when the src_extent is greater one
4255
- * or src and dst extent are both one. Don't increase when the scalar
4258
+ /* Increase the dst_dim only, when the src_extent is greater than one
4259
+ * or src and dst extent are both one. Don't increase when the scalar
4256
4260
* source is not present in the dst. */
4257
- next_dst_dim = extent_src > 1 ||
4258
- (GFC_DESCRIPTOR_EXTENT (dst , dst_dim ) == 1 && extent_src == 1 ) ?
4259
- (dst_dim + 1 ) : dst_dim ;
4261
+ next_dst_dim = (
4262
+ (extent_src > 1 ) ||
4263
+ (GFC_DESCRIPTOR_EXTENT (dst , dst_dim ) == 1 && extent_src == 1 )
4264
+ ) ? (dst_dim + 1 ) : dst_dim ;
4260
4265
for (ptrdiff_t idx = 0 ; idx < extent_src ; ++ idx )
4261
4266
{
4262
4267
get_for_ref (ref , i , dst_index , mpi_token , dst , src , ds , sr ,
@@ -5010,7 +5015,7 @@ put_data(mpi_caf_token_t *token, MPI_Aint offset, void *sr, int dst_type,
5010
5015
{
5011
5016
size_t k ;
5012
5017
int ierr ;
5013
- MPI_Win win = token == NULL ? global_dynamic_win : token -> memptr_win ;
5018
+ MPI_Win win = ( token == NULL ) ? global_dynamic_win : token -> memptr_win ;
5014
5019
#ifdef EXTRA_DEBUG_OUTPUT
5015
5020
if (token )
5016
5021
dprint ("(win: %d, image: %d, offset: %zd) <- %p, "
@@ -5028,7 +5033,8 @@ put_data(mpi_caf_token_t *token, MPI_Aint offset, void *sr, int dst_type,
5028
5033
size_t sz = (dst_size > src_size ? src_size : dst_size ) * num ;
5029
5034
ierr = MPI_Put (sr , sz , MPI_BYTE , image_index , offset , sz , MPI_BYTE , win );
5030
5035
chk_err (ierr );
5031
- dprint ("sr[] = %d, count = %zd\n" , (int )((char * )sr )[0 ], sz );
5036
+ dprint ("sr[] = %d, num = %zd, num bytes = %zd\n" ,
5037
+ (int )((char * )sr )[0 ], num , sz );
5032
5038
if ((dst_type == BT_CHARACTER || src_type == BT_CHARACTER )
5033
5039
&& dst_size > src_size )
5034
5040
{
@@ -5041,7 +5047,9 @@ put_data(mpi_caf_token_t *token, MPI_Aint offset, void *sr, int dst_type,
5041
5047
else /* dst_kind == 4. */
5042
5048
{
5043
5049
for (k = 0 ; k < trans_size ; ++ k )
5050
+ {
5044
5051
((int32_t * ) pad )[k ] = (int32_t ) ' ' ;
5052
+ }
5045
5053
}
5046
5054
ierr = MPI_Put (pad , trans_size * dst_kind , MPI_BYTE , image_index ,
5047
5055
offset + (src_size / src_kind ) * dst_kind ,
@@ -5108,7 +5116,6 @@ send_for_ref(caf_reference_t *ref, size_t *i, size_t src_index,
5108
5116
caf_ref_type_t ref_type = ref -> type ;
5109
5117
caf_array_ref_t array_ref_src = ref -> u .a .mode [src_dim ];
5110
5118
caf_array_ref_t array_ref_dst = ref -> u .a .mode [dst_dim ];
5111
- size_t src_size = 0 ;
5112
5119
int ierr ;
5113
5120
5114
5121
if (unlikely (ref == NULL ))
@@ -5118,13 +5125,18 @@ send_for_ref(caf_reference_t *ref, size_t *i, size_t src_index,
5118
5125
return ;
5119
5126
}
5120
5127
5121
- dprint ("Entering send_for_ref: "
5128
+ dprint ("Entering send_for_ref: [i = %zd] src_index = %zd, "
5122
5129
"dst_offset = %zd, desc_offset = %zd, ds_glb = %d, desc_glb = %d\n" ,
5123
- dst_byte_offset , desc_byte_offset , ds_global , desc_global );
5130
+ * i , src_index , dst_byte_offset , desc_byte_offset ,
5131
+ ds_global , desc_global );
5124
5132
5125
5133
if (ref -> next == NULL )
5126
5134
{
5127
- src_size = GFC_DESCRIPTOR_SIZE (src );
5135
+ size_t src_size = GFC_DESCRIPTOR_SIZE (src );
5136
+ dprint ("[next == NULL]: src_size = %zd, ref_type = %s, "
5137
+ "array_ref_src = %s\n" ,
5138
+ src_size , caf_ref_type_str [ref_type ],
5139
+ caf_array_ref_str [array_ref_src ]);
5128
5140
5129
5141
switch (ref_type )
5130
5142
{
@@ -5182,7 +5194,7 @@ send_for_ref(caf_reference_t *ref, size_t *i, size_t src_index,
5182
5194
{
5183
5195
if (ds_global )
5184
5196
{
5185
- put_data (NULL , MPI_Aint_add ((MPI_Aint )ds , dst_byte_offset ),
5197
+ put_data (NULL , MPI_Aint_add ((MPI_Aint )ds , dst_byte_offset ),
5186
5198
sr + src_index * src_size ,
5187
5199
#ifdef GCC_GE_8
5188
5200
dst_type , GFC_DESCRIPTOR_TYPE (src ),
@@ -5214,10 +5226,9 @@ send_for_ref(caf_reference_t *ref, size_t *i, size_t src_index,
5214
5226
}
5215
5227
}
5216
5228
5217
- dprint ("image_index = %d, num = %zd, src_size = %zd, "
5229
+ dprint ("image_index = %d, num = %zd, "
5218
5230
"src_dim = %zd, dst_dim = %zd, ref_type = %s\n" ,
5219
- image_index , num , src_size , src_dim , dst_dim ,
5220
- caf_ref_type_str [ref_type ]);
5231
+ image_index , num , src_dim , dst_dim , caf_ref_type_str [ref_type ]);
5221
5232
5222
5233
switch (ref_type )
5223
5234
{
@@ -5312,8 +5323,8 @@ send_for_ref(caf_reference_t *ref, size_t *i, size_t src_index,
5312
5323
}
5313
5324
#endif
5314
5325
}
5315
- dprint ("array_ref_dst[%zd] = %s := array_ref_src[%zd] = %s\n " ,
5316
- dst_dim , caf_array_ref_str [array_ref_dst ],
5326
+ dprint ("array_ref_dst[%zd] = %s := array_ref_src[%zd] = %s" ,
5327
+ dst_dim , caf_array_ref_str [array_ref_dst ],
5317
5328
src_dim , caf_array_ref_str [array_ref_src ]);
5318
5329
switch (array_ref_dst )
5319
5330
{
@@ -5372,19 +5383,21 @@ case kind: \
5372
5383
src_stride , dst_stride );
5373
5384
for (ptrdiff_t idx = 0 ; idx < extent_dst ;
5374
5385
++ idx , array_offset_dst += dst_stride )
5375
- {
5376
- send_for_ref (ref , i , src_index , mpi_token , dst , src , ds , sr ,
5377
- dst_byte_offset + array_offset_dst * ref -> item_size ,
5378
- desc_byte_offset + array_offset_dst * ref -> item_size ,
5379
- dst_kind , src_kind , dst_dim + 1 , src_dim + 1 ,
5380
- 1 , stat , image_index , ds_global , desc_global
5386
+ {
5387
+ send_for_ref (ref , i , src_index , mpi_token , dst , src , ds , sr ,
5388
+ dst_byte_offset + array_offset_dst * ref -> item_size ,
5389
+ desc_byte_offset + array_offset_dst * ref -> item_size ,
5390
+ dst_kind , src_kind , dst_dim + 1 , src_dim + 1 ,
5391
+ 1 , stat , image_index , ds_global , desc_global
5381
5392
#ifdef GCC_GE_8
5382
- , dst_type
5393
+ , dst_type
5383
5394
#endif
5384
- );
5385
- src_index += src_stride ;
5386
- }
5395
+ );
5396
+ src_index += src_stride ;
5397
+ }
5398
+ // dprint("CAF_ARR_REF_FULL: return, i = %zd\n", *i);
5387
5399
return ;
5400
+
5388
5401
case CAF_ARR_REF_RANGE :
5389
5402
COMPUTE_NUM_ITEMS (extent_dst ,
5390
5403
ref -> u .a .dim [dst_dim ].s .stride ,
@@ -5397,18 +5410,19 @@ case kind: \
5397
5410
* ref -> u .a .dim [dst_dim ].s .stride ;
5398
5411
src_stride = (GFC_DESCRIPTOR_RANK (src ) > 0 ) ?
5399
5412
src -> dim [src_dim ]._stride : 0 ;
5400
- /* Increase the dst_dim only, when the src_extent is greater one
5401
- * or src and dst extent are both one. Don't increase when the
5413
+ /* Increase the dst_dim only, when the src_extent is greater than one
5414
+ * or src and dst extent are both one. Don't increase when the
5402
5415
* scalar source is not present in the dst. */
5403
- next_dst_dim = (extent_dst > 1 ) ||
5404
- (GFC_DESCRIPTOR_EXTENT (dst , dst_dim ) == 1 && extent_dst == 1 ) ?
5405
- (dst_dim + 1 ) : dst_dim ;
5416
+ next_dst_dim = (
5417
+ (extent_dst > 1 ) ||
5418
+ (GFC_DESCRIPTOR_EXTENT (src , src_dim ) == 1 && extent_dst == 1 )
5419
+ ) ? (dst_dim + 1 ) : dst_dim ;
5406
5420
for (ptrdiff_t idx = 0 ; idx < extent_dst ; ++ idx )
5407
5421
{
5408
5422
send_for_ref (ref , i , src_index , mpi_token , dst , src , ds , sr ,
5409
5423
dst_byte_offset + array_offset_dst * ref -> item_size ,
5410
5424
desc_byte_offset + array_offset_dst * ref -> item_size ,
5411
- dst_kind , src_kind , next_dst_dim , src_dim + 1 ,
5425
+ dst_kind , src_kind , next_dst_dim , src_dim + 1 ,
5412
5426
1 , stat , image_index , ds_global , desc_global
5413
5427
#ifdef GCC_GE_8
5414
5428
, dst_type
@@ -5417,20 +5431,30 @@ case kind: \
5417
5431
src_index += src_stride ;
5418
5432
array_offset_dst += dst_stride ;
5419
5433
}
5434
+ // dprint("CAF_ARR_REF_RANGE: return, i = %zd\n", *i);
5420
5435
return ;
5436
+
5421
5437
case CAF_ARR_REF_SINGLE :
5422
5438
array_offset_dst =
5423
5439
(ref -> u .a .dim [dst_dim ].s .start - dst -> dim [dst_dim ].lower_bound )
5424
5440
* dst -> dim [dst_dim ]._stride ;
5441
+ // FIXME: issue #552
5442
+ // next_dst_dim = (
5443
+ // (extent_dst > 1) ||
5444
+ // (GFC_DESCRIPTOR_EXTENT(src, src_dim) == 1 && extent_dst == 1)
5445
+ // ) ? (dst_dim + 1) : dst_dim;
5446
+ next_dst_dim = dst_dim ;
5425
5447
send_for_ref (ref , i , src_index , mpi_token , dst , src , ds , sr ,
5426
5448
dst_byte_offset + array_offset_dst * ref -> item_size ,
5427
5449
desc_byte_offset + array_offset_dst * ref -> item_size ,
5428
- dst_kind , src_kind , dst_dim , src_dim + 1 , 1 ,
5429
- stat , image_index , ds_global , desc_global
5450
+ dst_kind , src_kind , next_dst_dim , src_dim + 1 ,
5451
+ 1 , stat , image_index , ds_global , desc_global
5430
5452
#ifdef GCC_GE_8
5431
5453
, dst_type
5432
5454
#endif
5433
5455
);
5456
+
5457
+ // dprint("CAF_ARR_REF_SINGLE: return, i = %zd\n", *i);
5434
5458
return ;
5435
5459
case CAF_ARR_REF_OPEN_END :
5436
5460
COMPUTE_NUM_ITEMS (extent_dst ,
@@ -5544,18 +5568,18 @@ case kind: \
5544
5568
for (array_offset_dst = 0 ;
5545
5569
array_offset_dst <= ref -> u .a .dim [dst_dim ].s .end ;
5546
5570
array_offset_dst += ref -> u .a .dim [dst_dim ].s .stride )
5547
- {
5548
- send_for_ref (ref , i , src_index , mpi_token , dst , NULL , ds , sr ,
5549
- dst_byte_offset + array_offset_dst * ref -> item_size ,
5550
- desc_byte_offset + array_offset_dst * ref -> item_size ,
5551
- dst_kind , src_kind , dst_dim + 1 , src_dim + 1 ,
5552
- 1 , stat , image_index , ds_global , desc_global
5571
+ {
5572
+ send_for_ref (ref , i , src_index , mpi_token , dst , NULL , ds , sr ,
5573
+ dst_byte_offset + array_offset_dst * ref -> item_size ,
5574
+ desc_byte_offset + array_offset_dst * ref -> item_size ,
5575
+ dst_kind , src_kind , dst_dim + 1 , src_dim + 1 ,
5576
+ 1 , stat , image_index , ds_global , desc_global
5553
5577
#ifdef GCC_GE_8
5554
- , dst_type
5578
+ , dst_type
5555
5579
#endif
5556
- );
5557
- src_index += src_stride ;
5558
- }
5580
+ );
5581
+ src_index += src_stride ;
5582
+ }
5559
5583
return ;
5560
5584
case CAF_ARR_REF_RANGE :
5561
5585
COMPUTE_NUM_ITEMS (extent_dst ,
@@ -5585,8 +5609,8 @@ case kind: \
5585
5609
send_for_ref (ref , i , src_index , mpi_token , dst , NULL , ds , sr ,
5586
5610
dst_byte_offset + array_offset_dst * ref -> item_size ,
5587
5611
desc_byte_offset + array_offset_dst * ref -> item_size ,
5588
- dst_kind , src_kind , dst_dim , src_dim + 1 , 1 ,
5589
- stat , image_index , ds_global , desc_global
5612
+ dst_kind , src_kind , dst_dim , src_dim + 1 ,
5613
+ 1 , stat , image_index , ds_global , desc_global
5590
5614
#ifdef GCC_GE_8
5591
5615
, dst_type
5592
5616
#endif
@@ -6456,8 +6480,8 @@ case kind: \
6456
6480
CAF_Win_lock (MPI_LOCK_EXCLUSIVE , dst_remote_image , dst_mpi_token -> memptr_win );
6457
6481
send_for_ref (dst_refs , & i , src_index , dst_mpi_token , dst_mpi_token -> desc ,
6458
6482
(gfc_descriptor_t * )& temp_src_desc , dst_mpi_token -> memptr ,
6459
- temp_src_desc .base .base_addr , 0 , 0 , dst_kind , src_kind ,
6460
- 0 , 0 , 1 , dst_stat , dst_image_index - 1 , false, false
6483
+ temp_src_desc .base .base_addr , 0 , 0 , dst_kind , src_kind , 0 , 0 ,
6484
+ 1 , dst_stat , dst_image_index - 1 , false, false
6461
6485
#ifdef GCC_GE_8
6462
6486
, dst_type
6463
6487
#endif
@@ -6767,13 +6791,15 @@ sync_images_internal(int count, int images[], int *stat, char *errmsg,
6767
6791
for (i = 0 ; i < count ; ++ i )
6768
6792
{
6769
6793
for (j = 0 ; j < i ; ++ j )
6794
+ {
6770
6795
if (images [i ] == images [j ])
6771
6796
{
6772
6797
ierr = STAT_DUP_SYNC_IMAGES ;
6773
6798
if (stat )
6774
6799
* stat = ierr ;
6775
6800
goto sync_images_err_chk ;
6776
6801
}
6802
+ }
6777
6803
}
6778
6804
6779
6805
#ifdef GFC_CAF_CHECK
0 commit comments