Skip to content

Commit 94f26f5

Browse files
authored
Merge pull request #6695 from bosilca/fix/vector_stride_0
A big refresh of the datatype engine
2 parents 8f32a59 + aa17392 commit 94f26f5

24 files changed

+1314
-896
lines changed

ompi/datatype/ompi_datatype.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
3-
* Copyright (c) 2009-2013 The University of Tennessee and The University
3+
* Copyright (c) 2009-2019 The University of Tennessee and The University
44
* of Tennessee Research Foundation. All rights
55
* reserved.
66
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
@@ -76,7 +76,7 @@ struct ompi_datatype_t {
7676
struct opal_hash_table_t *d_keyhash; /**< Attribute fields */
7777

7878
void* args; /**< Data description for the user */
79-
opal_atomic_intptr_t packed_description; /**< Packed description of the datatype */
79+
opal_atomic_intptr_t packed_description; /**< Packed description of the datatype */
8080
uint64_t pml_data; /**< PML-specific information */
8181
/* --- cacheline 6 boundary (384 bytes) --- */
8282
char name[MPI_MAX_OBJECT_NAME];/**< Externally visible name */

ompi/datatype/ompi_datatype_create_indexed.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const
8787
return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType);
8888
}
8989

90+
ompi_datatype_type_extent( oldType, &extent );
9091
disp = pDisp[i];
9192
dLength = pBlockLength[i];
9293
endat = disp + dLength * extent;
93-
ompi_datatype_type_extent( oldType, &extent );
9494

9595
pdt = ompi_datatype_create( (count - i) * (2 + oldType->super.desc.used) );
9696
for( i += 1; i < count; i++ ) {
@@ -162,17 +162,17 @@ int32_t ompi_datatype_create_hindexed_block( int count, int bLength, const ptrdi
162162
pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) );
163163
disp = pDisp[0];
164164
dLength = bLength;
165-
endat = disp + dLength;
165+
endat = disp + dLength * extent;
166166
for( i = 1; i < count; i++ ) {
167167
if( endat == pDisp[i] ) {
168168
/* contiguous with the previsious */
169169
dLength += bLength;
170-
endat += bLength;
170+
endat += bLength * extent;
171171
} else {
172172
ompi_datatype_add( pdt, oldType, dLength, disp, extent );
173173
disp = pDisp[i];
174174
dLength = bLength;
175-
endat = disp + bLength;
175+
endat = disp + bLength * extent;
176176
}
177177
}
178178
ompi_datatype_add( pdt, oldType, dLength, disp, extent );

ompi/datatype/ompi_datatype_external.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2016 The University of Tennessee and The University
6+
* Copyright (c) 2004-2019 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
@@ -26,7 +26,6 @@
2626
#include <stdio.h>
2727

2828
#include "ompi/runtime/params.h"
29-
#include "ompi/communicator/communicator.h"
3029
#include "ompi/datatype/ompi_datatype.h"
3130
#include "opal/datatype/opal_convertor.h"
3231

opal/datatype/opal_convertor.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2018 The University of Tennessee and The University
6+
* Copyright (c) 2004-2019 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@@ -324,8 +324,9 @@ int32_t opal_convertor_unpack( opal_convertor_t* pConv,
324324
return pConv->fAdvance( pConv, iov, out_size, max_data );
325325
}
326326

327-
static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t* pConvertor,
328-
size_t starting_point, const size_t* sizes )
327+
static inline int
328+
opal_convertor_create_stack_with_pos_contig( opal_convertor_t* pConvertor,
329+
size_t starting_point, const size_t* sizes )
329330
{
330331
dt_stack_t* pStack; /* pointer to the position on the stack */
331332
const opal_datatype_t* pData = pConvertor->pDesc;
@@ -349,14 +350,14 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t*
349350
pStack[0].disp = count * extent;
350351

351352
/* now compute the number of pending bytes */
352-
count = starting_point - count * pData->size;
353+
count = starting_point % pData->size;
353354
/**
354355
* We save the current displacement starting from the begining
355356
* of this data.
356357
*/
357358
if( OPAL_LIKELY(0 == count) ) {
358359
pStack[1].type = pElems->elem.common.type;
359-
pStack[1].count = pElems->elem.count;
360+
pStack[1].count = pElems->elem.blocklen;
360361
} else {
361362
pStack[1].type = OPAL_DATATYPE_UINT1;
362363
pStack[1].count = pData->size - count;
@@ -370,9 +371,9 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t*
370371
return OPAL_SUCCESS;
371372
}
372373

373-
static inline
374-
int opal_convertor_create_stack_at_begining( opal_convertor_t* convertor,
375-
const size_t* sizes )
374+
static inline int
375+
opal_convertor_create_stack_at_begining( opal_convertor_t* convertor,
376+
const size_t* sizes )
376377
{
377378
dt_stack_t* pStack = convertor->pStack;
378379
dt_elem_desc_t* pElems;
@@ -402,7 +403,7 @@ int opal_convertor_create_stack_at_begining( opal_convertor_t* convertor,
402403
pStack[1].count = pElems[0].loop.loops;
403404
pStack[1].type = OPAL_DATATYPE_LOOP;
404405
} else {
405-
pStack[1].count = pElems[0].elem.count;
406+
pStack[1].count = pElems[0].elem.count * pElems[0].elem.blocklen;
406407
pStack[1].type = pElems[0].elem.common.type;
407408
}
408409
return OPAL_SUCCESS;
@@ -578,8 +579,9 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,
578579
assert(! (convertor->flags & CONVERTOR_SEND));
579580
OPAL_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf );
580581

581-
if( convertor->flags & CONVERTOR_WITH_CHECKSUM ) {
582-
if( !(convertor->flags & CONVERTOR_HOMOGENEOUS) ) {
582+
#if defined(CHECKSUM)
583+
if( OPAL_UNLIKELY(convertor->flags & CONVERTOR_WITH_CHECKSUM) ) {
584+
if( OPAL_UNLIKELY(!(convertor->flags & CONVERTOR_HOMOGENEOUS)) ) {
583585
convertor->fAdvance = opal_unpack_general_checksum;
584586
} else {
585587
if( convertor->pDesc->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) {
@@ -588,8 +590,9 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,
588590
convertor->fAdvance = opal_generic_simple_unpack_checksum;
589591
}
590592
}
591-
} else {
592-
if( !(convertor->flags & CONVERTOR_HOMOGENEOUS) ) {
593+
} else
594+
#endif /* defined(CHECKSUM) */
595+
if( OPAL_UNLIKELY(!(convertor->flags & CONVERTOR_HOMOGENEOUS)) ) {
593596
convertor->fAdvance = opal_unpack_general;
594597
} else {
595598
if( convertor->pDesc->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) {
@@ -598,7 +601,6 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,
598601
convertor->fAdvance = opal_generic_simple_unpack;
599602
}
600603
}
601-
}
602604
return OPAL_SUCCESS;
603605
}
604606

@@ -617,6 +619,7 @@ int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor,
617619

618620
OPAL_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf );
619621

622+
#if defined(CHECKSUM)
620623
if( convertor->flags & CONVERTOR_WITH_CHECKSUM ) {
621624
if( CONVERTOR_SEND_CONVERSION == (convertor->flags & (CONVERTOR_SEND_CONVERSION|CONVERTOR_HOMOGENEOUS)) ) {
622625
convertor->fAdvance = opal_pack_general_checksum;
@@ -631,7 +634,8 @@ int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor,
631634
convertor->fAdvance = opal_generic_simple_pack_checksum;
632635
}
633636
}
634-
} else {
637+
} else
638+
#endif /* defined(CHECKSUM) */
635639
if( CONVERTOR_SEND_CONVERSION == (convertor->flags & (CONVERTOR_SEND_CONVERSION|CONVERTOR_HOMOGENEOUS)) ) {
636640
convertor->fAdvance = opal_pack_general;
637641
} else {
@@ -645,7 +649,6 @@ int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor,
645649
convertor->fAdvance = opal_generic_simple_pack;
646650
}
647651
}
648-
}
649652
return OPAL_SUCCESS;
650653
}
651654

opal/datatype/opal_convertor.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,10 @@ opal_convertor_set_position( opal_convertor_t* convertor,
332332
/* Remove the completed flag if it's already set */
333333
convertor->flags &= ~CONVERTOR_COMPLETED;
334334

335-
if( !(convertor->flags & CONVERTOR_WITH_CHECKSUM) &&
336-
(convertor->flags & OPAL_DATATYPE_FLAG_NO_GAPS) &&
335+
if( (convertor->flags & OPAL_DATATYPE_FLAG_NO_GAPS) &&
336+
#if defined(CHECKSUM)
337+
!(convertor->flags & CONVERTOR_WITH_CHECKSUM) &&
338+
#endif /* defined(CHECKSUM) */
337339
(convertor->flags & (CONVERTOR_SEND | CONVERTOR_HOMOGENEOUS)) ) {
338340
/* Contiguous and no checkpoint and no homogeneous unpack */
339341
convertor->bConverted = *position;

0 commit comments

Comments
 (0)