Skip to content

Commit

Permalink
Merge pull request #6695 from bosilca/fix/vector_stride_0
Browse files Browse the repository at this point in the history
A big refresh of the datatype engine
  • Loading branch information
bosilca authored Jul 23, 2019
2 parents 8f32a59 + aa17392 commit 94f26f5
Show file tree
Hide file tree
Showing 24 changed files with 1,314 additions and 896 deletions.
4 changes: 2 additions & 2 deletions ompi/datatype/ompi_datatype.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2009-2013 The University of Tennessee and The University
* Copyright (c) 2009-2019 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
Expand Down Expand Up @@ -76,7 +76,7 @@ struct ompi_datatype_t {
struct opal_hash_table_t *d_keyhash; /**< Attribute fields */

void* args; /**< Data description for the user */
opal_atomic_intptr_t packed_description; /**< Packed description of the datatype */
opal_atomic_intptr_t packed_description; /**< Packed description of the datatype */
uint64_t pml_data; /**< PML-specific information */
/* --- cacheline 6 boundary (384 bytes) --- */
char name[MPI_MAX_OBJECT_NAME];/**< Externally visible name */
Expand Down
8 changes: 4 additions & 4 deletions ompi/datatype/ompi_datatype_create_indexed.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const
return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType);
}

ompi_datatype_type_extent( oldType, &extent );
disp = pDisp[i];
dLength = pBlockLength[i];
endat = disp + dLength * extent;
ompi_datatype_type_extent( oldType, &extent );

pdt = ompi_datatype_create( (count - i) * (2 + oldType->super.desc.used) );
for( i += 1; i < count; i++ ) {
Expand Down Expand Up @@ -162,17 +162,17 @@ int32_t ompi_datatype_create_hindexed_block( int count, int bLength, const ptrdi
pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) );
disp = pDisp[0];
dLength = bLength;
endat = disp + dLength;
endat = disp + dLength * extent;
for( i = 1; i < count; i++ ) {
if( endat == pDisp[i] ) {
/* contiguous with the previsious */
dLength += bLength;
endat += bLength;
endat += bLength * extent;
} else {
ompi_datatype_add( pdt, oldType, dLength, disp, extent );
disp = pDisp[i];
dLength = bLength;
endat = disp + bLength;
endat = disp + bLength * extent;
}
}
ompi_datatype_add( pdt, oldType, dLength, disp, extent );
Expand Down
3 changes: 1 addition & 2 deletions ompi/datatype/ompi_datatype_external.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2016 The University of Tennessee and The University
* Copyright (c) 2004-2019 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
Expand All @@ -26,7 +26,6 @@
#include <stdio.h>

#include "ompi/runtime/params.h"
#include "ompi/communicator/communicator.h"
#include "ompi/datatype/ompi_datatype.h"
#include "opal/datatype/opal_convertor.h"

Expand Down
35 changes: 19 additions & 16 deletions opal/datatype/opal_convertor.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2018 The University of Tennessee and The University
* Copyright (c) 2004-2019 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
Expand Down Expand Up @@ -324,8 +324,9 @@ int32_t opal_convertor_unpack( opal_convertor_t* pConv,
return pConv->fAdvance( pConv, iov, out_size, max_data );
}

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

/* now compute the number of pending bytes */
count = starting_point - count * pData->size;
count = starting_point % pData->size;
/**
* We save the current displacement starting from the begining
* of this data.
*/
if( OPAL_LIKELY(0 == count) ) {
pStack[1].type = pElems->elem.common.type;
pStack[1].count = pElems->elem.count;
pStack[1].count = pElems->elem.blocklen;
} else {
pStack[1].type = OPAL_DATATYPE_UINT1;
pStack[1].count = pData->size - count;
Expand All @@ -370,9 +371,9 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t*
return OPAL_SUCCESS;
}

static inline
int opal_convertor_create_stack_at_begining( opal_convertor_t* convertor,
const size_t* sizes )
static inline int
opal_convertor_create_stack_at_begining( opal_convertor_t* convertor,
const size_t* sizes )
{
dt_stack_t* pStack = convertor->pStack;
dt_elem_desc_t* pElems;
Expand Down Expand Up @@ -402,7 +403,7 @@ int opal_convertor_create_stack_at_begining( opal_convertor_t* convertor,
pStack[1].count = pElems[0].loop.loops;
pStack[1].type = OPAL_DATATYPE_LOOP;
} else {
pStack[1].count = pElems[0].elem.count;
pStack[1].count = pElems[0].elem.count * pElems[0].elem.blocklen;
pStack[1].type = pElems[0].elem.common.type;
}
return OPAL_SUCCESS;
Expand Down Expand Up @@ -578,8 +579,9 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,
assert(! (convertor->flags & CONVERTOR_SEND));
OPAL_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf );

if( convertor->flags & CONVERTOR_WITH_CHECKSUM ) {
if( !(convertor->flags & CONVERTOR_HOMOGENEOUS) ) {
#if defined(CHECKSUM)
if( OPAL_UNLIKELY(convertor->flags & CONVERTOR_WITH_CHECKSUM) ) {
if( OPAL_UNLIKELY(!(convertor->flags & CONVERTOR_HOMOGENEOUS)) ) {
convertor->fAdvance = opal_unpack_general_checksum;
} else {
if( convertor->pDesc->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) {
Expand All @@ -588,8 +590,9 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,
convertor->fAdvance = opal_generic_simple_unpack_checksum;
}
}
} else {
if( !(convertor->flags & CONVERTOR_HOMOGENEOUS) ) {
} else
#endif /* defined(CHECKSUM) */
if( OPAL_UNLIKELY(!(convertor->flags & CONVERTOR_HOMOGENEOUS)) ) {
convertor->fAdvance = opal_unpack_general;
} else {
if( convertor->pDesc->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) {
Expand All @@ -598,7 +601,6 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,
convertor->fAdvance = opal_generic_simple_unpack;
}
}
}
return OPAL_SUCCESS;
}

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

OPAL_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf );

#if defined(CHECKSUM)
if( convertor->flags & CONVERTOR_WITH_CHECKSUM ) {
if( CONVERTOR_SEND_CONVERSION == (convertor->flags & (CONVERTOR_SEND_CONVERSION|CONVERTOR_HOMOGENEOUS)) ) {
convertor->fAdvance = opal_pack_general_checksum;
Expand All @@ -631,7 +634,8 @@ int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor,
convertor->fAdvance = opal_generic_simple_pack_checksum;
}
}
} else {
} else
#endif /* defined(CHECKSUM) */
if( CONVERTOR_SEND_CONVERSION == (convertor->flags & (CONVERTOR_SEND_CONVERSION|CONVERTOR_HOMOGENEOUS)) ) {
convertor->fAdvance = opal_pack_general;
} else {
Expand All @@ -645,7 +649,6 @@ int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor,
convertor->fAdvance = opal_generic_simple_pack;
}
}
}
return OPAL_SUCCESS;
}

Expand Down
6 changes: 4 additions & 2 deletions opal/datatype/opal_convertor.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,10 @@ opal_convertor_set_position( opal_convertor_t* convertor,
/* Remove the completed flag if it's already set */
convertor->flags &= ~CONVERTOR_COMPLETED;

if( !(convertor->flags & CONVERTOR_WITH_CHECKSUM) &&
(convertor->flags & OPAL_DATATYPE_FLAG_NO_GAPS) &&
if( (convertor->flags & OPAL_DATATYPE_FLAG_NO_GAPS) &&
#if defined(CHECKSUM)
!(convertor->flags & CONVERTOR_WITH_CHECKSUM) &&
#endif /* defined(CHECKSUM) */
(convertor->flags & (CONVERTOR_SEND | CONVERTOR_HOMOGENEOUS)) ) {
/* Contiguous and no checkpoint and no homogeneous unpack */
convertor->bConverted = *position;
Expand Down
Loading

0 comments on commit 94f26f5

Please sign in to comment.