1
1

Merge pull request #6647 from bosilca/fix/length_0

Fix/length 0
Этот коммит содержится в:
bosilca 2019-05-14 17:59:15 -04:00 коммит произвёл GitHub
родитель 9442989e2c 42119254c7
Коммит 6089608858
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 149 добавлений и 164 удалений

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University * Copyright (c) 2004-2019 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@ -29,13 +29,12 @@ int32_t ompi_datatype_create_contiguous( int count, const ompi_datatype_t* oldTy
{ {
ompi_datatype_t* pdt; ompi_datatype_t* pdt;
if( 0 == count ) { if( (0 == count) || (0 == oldType->super.size) ) {
pdt = ompi_datatype_create( 0 ); return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType);
ompi_datatype_add( pdt, &ompi_mpi_datatype_null.dt, 0, 0, 0 ); }
} else {
pdt = ompi_datatype_create( oldType->super.desc.used + 2 ); pdt = ompi_datatype_create( oldType->super.desc.used + 2 );
opal_datatype_add( &(pdt->super), &(oldType->super), count, 0, (oldType->super.ub - oldType->super.lb) ); opal_datatype_add( &(pdt->super), &(oldType->super), count, 0, (oldType->super.ub - oldType->super.lb) );
}
*newType = pdt; *newType = pdt;
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }

Просмотреть файл

@ -192,9 +192,7 @@ int32_t ompi_datatype_create_darray(int size,
if (ndims < 1) { if (ndims < 1) {
/* Don't just return MPI_DATATYPE_NULL as that can't be /* Don't just return MPI_DATATYPE_NULL as that can't be
MPI_TYPE_FREE()ed, and that seems bad */ MPI_TYPE_FREE()ed, and that seems bad */
*newtype = ompi_datatype_create(0); return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newtype);
ompi_datatype_add(*newtype, &ompi_mpi_datatype_null.dt, 0, 0, 0);
return MPI_SUCCESS;
} }
rc = ompi_datatype_type_extent(oldtype, &orig_extent); rc = ompi_datatype_type_extent(oldtype, &orig_extent);

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University * Copyright (c) 2004-2019 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@ -34,24 +34,28 @@
int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const int* pDisp, int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const int* pDisp,
const ompi_datatype_t* oldType, ompi_datatype_t** newType ) const ompi_datatype_t* oldType, ompi_datatype_t** newType )
{ {
ompi_datatype_t* pdt;
int i;
ptrdiff_t extent, disp, endat; ptrdiff_t extent, disp, endat;
ompi_datatype_t* pdt;
size_t dLength; size_t dLength;
int i;
if( 0 == count ) { /* ignore all cases that lead to an empty type */
ompi_datatype_type_size(oldType, &dLength);
for( i = 0; (i < count) && (0 == pBlockLength[i]); i++ ); /* find first non zero */
if( (i == count) || (0 == dLength) ) {
return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType); return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType);
} }
disp = pDisp[0]; disp = pDisp[i];
dLength = pBlockLength[0]; dLength = pBlockLength[i];
endat = disp + dLength; endat = disp + dLength;
ompi_datatype_type_extent( oldType, &extent ); ompi_datatype_type_extent( oldType, &extent );
pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) ); pdt = ompi_datatype_create( (count - i) * (2 + oldType->super.desc.used) );
for( i = 1; i < count; i++ ) { for( i += 1; i < count; i++ ) {
if( endat == pDisp[i] ) { if( 0 == pBlockLength[i] ) /* ignore empty length */
/* contiguous with the previsious */ continue;
if( endat == pDisp[i] ) { /* contiguous with the previsious */
dLength += pBlockLength[i]; dLength += pBlockLength[i];
endat += pBlockLength[i]; endat += pBlockLength[i];
} else { } else {
@ -71,26 +75,28 @@ int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const
int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const ptrdiff_t* pDisp, int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const ptrdiff_t* pDisp,
const ompi_datatype_t* oldType, ompi_datatype_t** newType ) const ompi_datatype_t* oldType, ompi_datatype_t** newType )
{ {
ompi_datatype_t* pdt;
int i;
ptrdiff_t extent, disp, endat; ptrdiff_t extent, disp, endat;
ompi_datatype_t* pdt;
size_t dLength; size_t dLength;
int i;
if( 0 == count ) { /* ignore all cases that lead to an empty type */
*newType = ompi_datatype_create( 0 ); ompi_datatype_type_size(oldType, &dLength);
ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); for( i = 0; (i < count) && (0 == pBlockLength[i]); i++ ); /* find first non zero */
return OMPI_SUCCESS; if( (i == count) || (0 == dLength) ) {
return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType);
} }
ompi_datatype_type_extent( oldType, &extent ); disp = pDisp[i];
pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) ); dLength = pBlockLength[i];
disp = pDisp[0];
dLength = pBlockLength[0];
endat = disp + dLength * extent; endat = disp + dLength * extent;
ompi_datatype_type_extent( oldType, &extent );
for( i = 1; i < count; i++ ) { pdt = ompi_datatype_create( (count - i) * (2 + oldType->super.desc.used) );
if( endat == pDisp[i] ) { for( i += 1; i < count; i++ ) {
/* contiguous with the previsious */ if( 0 == pBlockLength[i] ) /* ignore empty length */
continue;
if( endat == pDisp[i] ) { /* contiguous with the previsious */
dLength += pBlockLength[i]; dLength += pBlockLength[i];
endat += pBlockLength[i] * extent; endat += pBlockLength[i] * extent;
} else { } else {
@ -110,21 +116,15 @@ int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const
int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* pDisp, int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* pDisp,
const ompi_datatype_t* oldType, ompi_datatype_t** newType ) const ompi_datatype_t* oldType, ompi_datatype_t** newType )
{ {
ompi_datatype_t* pdt;
int i;
ptrdiff_t extent, disp, endat; ptrdiff_t extent, disp, endat;
ompi_datatype_t* pdt;
size_t dLength; size_t dLength;
int i;
ompi_datatype_type_extent( oldType, &extent );
if( (count == 0) || (bLength == 0) ) { if( (count == 0) || (bLength == 0) ) {
if( 0 == count ) {
return ompi_datatype_duplicate(&ompi_mpi_datatype_null.dt, newType); return ompi_datatype_duplicate(&ompi_mpi_datatype_null.dt, newType);
} else {
*newType = ompi_datatype_create(1);
ompi_datatype_add( *newType, oldType, 0, pDisp[0] * extent, extent );
return OMPI_SUCCESS;
}
} }
ompi_datatype_type_extent( oldType, &extent );
pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) ); pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) );
disp = pDisp[0]; disp = pDisp[0];
dLength = bLength; dLength = bLength;
@ -150,20 +150,15 @@ int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* p
int32_t ompi_datatype_create_hindexed_block( int count, int bLength, const ptrdiff_t* pDisp, int32_t ompi_datatype_create_hindexed_block( int count, int bLength, const ptrdiff_t* pDisp,
const ompi_datatype_t* oldType, ompi_datatype_t** newType ) const ompi_datatype_t* oldType, ompi_datatype_t** newType )
{ {
ompi_datatype_t* pdt;
int i;
ptrdiff_t extent, disp, endat; ptrdiff_t extent, disp, endat;
ompi_datatype_t* pdt;
size_t dLength; size_t dLength;
int i;
ompi_datatype_type_extent( oldType, &extent );
if( (count == 0) || (bLength == 0) ) { if( (count == 0) || (bLength == 0) ) {
*newType = ompi_datatype_create(1); return ompi_datatype_duplicate(&ompi_mpi_datatype_null.dt, newType);
if( 0 == count )
ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0 );
else
ompi_datatype_add( *newType, oldType, 0, pDisp[0] * extent, extent );
return OMPI_SUCCESS;
} }
ompi_datatype_type_extent( oldType, &extent );
pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) ); pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) );
disp = pDisp[0]; disp = pDisp[0];
dLength = bLength; dLength = bLength;

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University * Copyright (c) 2004-2019 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@ -31,27 +31,27 @@
int32_t ompi_datatype_create_struct( int count, const int* pBlockLength, const ptrdiff_t* pDisp, int32_t ompi_datatype_create_struct( int count, const int* pBlockLength, const ptrdiff_t* pDisp,
ompi_datatype_t* const * pTypes, ompi_datatype_t** newType ) ompi_datatype_t* const * pTypes, ompi_datatype_t** newType )
{ {
int i;
ptrdiff_t disp = 0, endto, lastExtent, lastDisp; ptrdiff_t disp = 0, endto, lastExtent, lastDisp;
int lastBlock;
ompi_datatype_t *pdt, *lastType; ompi_datatype_t *pdt, *lastType;
int lastBlock;
int i, start_from;
if( 0 == count ) { /* Find first non-zero length element */
*newType = ompi_datatype_create( 0 ); for( i = 0; (i < count) && (0 == pBlockLength[i]); i++ );
ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); if( i == count ) { /* either nothing or nothing relevant */
return OMPI_SUCCESS; return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType);
} }
/* compute the total number of elements before we can
/* if we compute the total number of elements before we can
* avoid increasing the size of the desc array often. * avoid increasing the size of the desc array often.
*/ */
lastType = (ompi_datatype_t*)pTypes[0]; start_from = i;
lastBlock = pBlockLength[0]; lastType = (ompi_datatype_t*)pTypes[start_from];
lastBlock = pBlockLength[start_from];
lastExtent = lastType->super.ub - lastType->super.lb; lastExtent = lastType->super.ub - lastType->super.lb;
lastDisp = pDisp[0]; lastDisp = pDisp[start_from];
endto = pDisp[0] + lastExtent * lastBlock; endto = pDisp[start_from] + lastExtent * lastBlock;
for( i = 1; i < count; i++ ) { for( i = (start_from + 1); i < count; i++ ) {
if( (pTypes[i] == lastType) && (pDisp[i] == endto) ) { if( (pTypes[i] == lastType) && (pDisp[i] == endto) ) {
lastBlock += pBlockLength[i]; lastBlock += pBlockLength[i];
endto = lastDisp + lastBlock * lastExtent; endto = lastDisp + lastBlock * lastExtent;
@ -68,16 +68,16 @@ int32_t ompi_datatype_create_struct( int count, const int* pBlockLength, const p
disp += lastType->super.desc.used; disp += lastType->super.desc.used;
if( lastBlock != 1 ) disp += 2; if( lastBlock != 1 ) disp += 2;
lastType = (ompi_datatype_t*)pTypes[0]; lastType = (ompi_datatype_t*)pTypes[start_from];
lastBlock = pBlockLength[0]; lastBlock = pBlockLength[start_from];
lastExtent = lastType->super.ub - lastType->super.lb; lastExtent = lastType->super.ub - lastType->super.lb;
lastDisp = pDisp[0]; lastDisp = pDisp[start_from];
endto = pDisp[0] + lastExtent * lastBlock; endto = pDisp[start_from] + lastExtent * lastBlock;
pdt = ompi_datatype_create( (int32_t)disp ); pdt = ompi_datatype_create( (int32_t)disp );
/* Do again the same loop but now add the elements */ /* Do again the same loop but now add the elements */
for( i = 1; i < count; i++ ) { for( i = (start_from + 1); i < count; i++ ) {
if( (pTypes[i] == lastType) && (pDisp[i] == endto) ) { if( (pTypes[i] == lastType) && (pDisp[i] == endto) ) {
lastBlock += pBlockLength[i]; lastBlock += pBlockLength[i];
endto = lastDisp + lastBlock * lastExtent; endto = lastDisp + lastBlock * lastExtent;

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University * Copyright (c) 2004-2019 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@ -28,23 +28,14 @@
#include "ompi/datatype/ompi_datatype.h" #include "ompi/datatype/ompi_datatype.h"
/* Open questions ...
* - how to improuve the handling of these vectors (creating a temporary datatype
* can be ONLY a initial solution.
*
*/
int32_t ompi_datatype_create_vector( int count, int bLength, int stride, int32_t ompi_datatype_create_vector( int count, int bLength, int stride,
const ompi_datatype_t* oldType, ompi_datatype_t** newType ) const ompi_datatype_t* oldType, ompi_datatype_t** newType )
{ {
ompi_datatype_t *pTempData, *pData; ompi_datatype_t *pTempData, *pData;
ptrdiff_t extent = oldType->super.ub - oldType->super.lb; ptrdiff_t extent = oldType->super.ub - oldType->super.lb;
if( (0 == count) || (0 == bLength) ) {
if( 0 == count ) { return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType);
*newType = ompi_datatype_create( 0 );
ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0);
return OMPI_SUCCESS;
} }
pData = ompi_datatype_create( oldType->super.desc.used + 2 ); pData = ompi_datatype_create( oldType->super.desc.used + 2 );
@ -72,10 +63,8 @@ int32_t ompi_datatype_create_hvector( int count, int bLength, ptrdiff_t stride,
ompi_datatype_t *pTempData, *pData; ompi_datatype_t *pTempData, *pData;
ptrdiff_t extent = oldType->super.ub - oldType->super.lb; ptrdiff_t extent = oldType->super.ub - oldType->super.lb;
if( 0 == count ) { if( (0 == count) || (0 == bLength) ) {
*newType = ompi_datatype_create( 0 ); return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType);
ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0);
return OMPI_SUCCESS;
} }
pTempData = ompi_datatype_create( oldType->super.desc.used + 2 ); pTempData = ompi_datatype_create( oldType->super.desc.used + 2 );

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2017 The University of Tennessee and The University * Copyright (c) 2004-2019 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@ -759,14 +759,14 @@ void ompi_datatype_dump( const ompi_datatype_t* pData )
length = length * 100 + 500; length = length * 100 + 500;
buffer = (char*)malloc( length ); buffer = (char*)malloc( length );
index += snprintf( buffer, length - index, index += snprintf( buffer, length - index,
"Datatype %p[%s] id %d size %ld align %d opal_id %d length %d used %d\n" "Datatype %p[%s] id %d size %" PRIsize_t " align %u opal_id %u length %" PRIsize_t " used %" PRIsize_t "\n"
"true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n" "true_lb %td true_ub %td (true_extent %td) lb %td ub %td (extent %td)\n"
"nbElems %d loops %d flags %X (", "nbElems %" PRIsize_t " loops %u flags %X (",
(void*)pData, pData->name, pData->id, (void*)pData, pData->name, pData->id,
(long)pData->super.size, (int)pData->super.align, pData->super.id, (int)pData->super.desc.length, (int)pData->super.desc.used, pData->super.size, pData->super.align, (uint32_t)pData->super.id, pData->super.desc.length, pData->super.desc.used,
(long)pData->super.true_lb, (long)pData->super.true_ub, (long)(pData->super.true_ub - pData->super.true_lb), pData->super.true_lb, pData->super.true_ub, pData->super.true_ub - pData->super.true_lb,
(long)pData->super.lb, (long)pData->super.ub, (long)(pData->super.ub - pData->super.lb), pData->super.lb, pData->super.ub, pData->super.ub - pData->super.lb,
(int)pData->super.nbElems, (int)pData->super.loops, (int)pData->super.flags ); pData->super.nbElems, pData->super.loops, (int)pData->super.flags );
/* dump the flags */ /* dump the flags */
if( ompi_datatype_is_predefined(pData) ) { if( ompi_datatype_is_predefined(pData) ) {
index += snprintf( buffer + index, length - index, "predefined " ); index += snprintf( buffer + index, length - index, "predefined " );

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2017 The University of Tennessee and The University * Copyright (c) 2004-2018 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@ -699,12 +699,12 @@ int opal_convertor_clone( const opal_convertor_t* source,
void opal_convertor_dump( opal_convertor_t* convertor ) void opal_convertor_dump( opal_convertor_t* convertor )
{ {
opal_output( 0, "Convertor %p count %" PRIsize_t" stack position %d bConverted %" PRIsize_t "\n" opal_output( 0, "Convertor %p count %" PRIsize_t " stack position %u bConverted %" PRIsize_t "\n"
"\tlocal_size %ld remote_size %ld flags %X stack_size %d pending_length %" PRIsize_t "\n" "\tlocal_size %" PRIsize_t " remote_size %" PRIsize_t " flags %X stack_size %u pending_length %" PRIsize_t "\n"
"\tremote_arch %u local_arch %u\n", "\tremote_arch %u local_arch %u\n",
(void*)convertor, (void*)convertor,
convertor->count, convertor->stack_pos, convertor->bConverted, convertor->count, convertor->stack_pos, convertor->bConverted,
(unsigned long)convertor->local_size, (unsigned long)convertor->remote_size, convertor->local_size, convertor->remote_size,
convertor->flags, convertor->stack_size, convertor->partial_length, convertor->flags, convertor->stack_size, convertor->partial_length,
convertor->remoteArch, opal_local_arch ); convertor->remoteArch, opal_local_arch );
if( convertor->flags & CONVERTOR_RECV ) opal_output( 0, "unpack "); if( convertor->flags & CONVERTOR_RECV ) opal_output( 0, "unpack ");

Просмотреть файл

@ -32,7 +32,7 @@
/** /**
* This function always work in local representation. This means no representation * This function always work in local representation. This means no representation
* conversion (i.e. no heterogeneity) has to be taken into account, and that all * conversion (i.e. no heterogeneity) is taken into account, and that all
* length we're working on are local. * length we're working on are local.
*/ */
int32_t int32_t
@ -103,7 +103,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf,
pConvertor->pDesc, pConvertor->count ); pConvertor->pDesc, pConvertor->count );
DO_DEBUG( opal_output( 0, "raw 1. iov[%d] = {base %p, length %" PRIsize_t "}\n", DO_DEBUG( opal_output( 0, "raw 1. iov[%d] = {base %p, length %" PRIsize_t "}\n",
index, (void*)source_base, (unsigned long)blength ); ); index, (void*)source_base, blength ); );
iov[index].iov_base = (IOVBASE_TYPE *) source_base; iov[index].iov_base = (IOVBASE_TYPE *) source_base;
iov[index].iov_len = blength; iov[index].iov_len = blength;
source_base += blength; source_base += blength;
@ -116,7 +116,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf,
pConvertor->pDesc, pConvertor->count ); pConvertor->pDesc, pConvertor->count );
DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %" PRIsize_t "}\n", DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %" PRIsize_t "}\n",
index, (void*)source_base, (unsigned long)blength ); ); index, (void*)source_base, blength ); );
iov[index].iov_base = (IOVBASE_TYPE *) source_base; iov[index].iov_base = (IOVBASE_TYPE *) source_base;
iov[index].iov_len = blength; iov[index].iov_len = blength;
source_base += pElem->elem.extent; source_base += pElem->elem.extent;

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2017 The University of Tennessee and The University * Copyright (c) 2004-2019 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@ -90,17 +90,17 @@ int opal_datatype_dump_data_desc( dt_elem_desc_t* pDesc, int nbElems, char* ptr,
index += snprintf( ptr + index, length - index, "%15s ", opal_datatype_basicDatatypes[pDesc->elem.common.type]->name ); index += snprintf( ptr + index, length - index, "%15s ", opal_datatype_basicDatatypes[pDesc->elem.common.type]->name );
if( length <= (size_t)index ) break; if( length <= (size_t)index ) break;
if( OPAL_DATATYPE_LOOP == pDesc->elem.common.type ) if( OPAL_DATATYPE_LOOP == pDesc->elem.common.type )
index += snprintf( ptr + index, length - index, "%d times the next %d elements extent %d\n", index += snprintf( ptr + index, length - index, "%u times the next %u elements extent %td\n",
(int)pDesc->loop.loops, (int)pDesc->loop.items, pDesc->loop.loops, pDesc->loop.items,
(int)pDesc->loop.extent ); pDesc->loop.extent );
else if( OPAL_DATATYPE_END_LOOP == pDesc->elem.common.type ) else if( OPAL_DATATYPE_END_LOOP == pDesc->elem.common.type )
index += snprintf( ptr + index, length - index, "prev %d elements first elem displacement %ld size of data %d\n", index += snprintf( ptr + index, length - index, "prev %u elements first elem displacement %td size of data %" PRIsize_t "\n",
(int)pDesc->end_loop.items, (long)pDesc->end_loop.first_elem_disp, pDesc->end_loop.items, pDesc->end_loop.first_elem_disp,
(int)pDesc->end_loop.size ); pDesc->end_loop.size );
else else
index += snprintf( ptr + index, length - index, "count %" PRIsize_t " disp 0x%lx (%ld) blen %d extent %ld (size %ld)\n", index += snprintf( ptr + index, length - index, "count %" PRIsize_t " disp 0x%tx (%td) blen %u extent %td (size %zd)\n",
pDesc->elem.count, (long)pDesc->elem.disp, (long)pDesc->elem.disp, (int)pDesc->elem.blocklen, pDesc->elem.count, pDesc->elem.disp, pDesc->elem.disp, pDesc->elem.blocklen,
pDesc->elem.extent, (long)(pDesc->elem.count * opal_datatype_basicDatatypes[pDesc->elem.common.type]->size) ); pDesc->elem.extent, (pDesc->elem.count * pDesc->elem.blocklen * opal_datatype_basicDatatypes[pDesc->elem.common.type]->size) );
pDesc++; pDesc++;
if( length <= (size_t)index ) break; if( length <= (size_t)index ) break;
@ -118,13 +118,13 @@ void opal_datatype_dump( const opal_datatype_t* pData )
length = pData->opt_desc.used + pData->desc.used; length = pData->opt_desc.used + pData->desc.used;
length = length * 100 + 500; length = length * 100 + 500;
buffer = (char*)malloc( length ); buffer = (char*)malloc( length );
index += snprintf( buffer, length - index, "Datatype %p[%s] size %ld align %d id %d length %d used %d\n" index += snprintf( buffer, length - index, "Datatype %p[%s] size %" PRIsize_t " align %u id %u length %" PRIsize_t " used %" PRIsize_t "\n"
"true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n" "true_lb %td true_ub %td (true_extent %td) lb %td ub %td (extent %td)\n"
"nbElems %" PRIsize_t " loops %d flags %X (", "nbElems %" PRIsize_t " loops %u flags %X (",
(void*)pData, pData->name, (long)pData->size, (int)pData->align, pData->id, (int)pData->desc.length, (int)pData->desc.used, (void*)pData, pData->name, pData->size, pData->align, (uint32_t)pData->id, pData->desc.length, pData->desc.used,
(long)pData->true_lb, (long)pData->true_ub, (long)(pData->true_ub - pData->true_lb), pData->true_lb, pData->true_ub, pData->true_ub - pData->true_lb,
(long)pData->lb, (long)pData->ub, (long)(pData->ub - pData->lb), pData->lb, pData->ub, pData->ub - pData->lb,
pData->nbElems, (int)pData->loops, (int)pData->flags ); pData->nbElems, pData->loops, (int)pData->flags );
/* dump the flags */ /* dump the flags */
if( pData->flags == OPAL_DATATYPE_FLAG_PREDEFINED ) if( pData->flags == OPAL_DATATYPE_FLAG_PREDEFINED )
index += snprintf( buffer + index, length - index, "predefined " ); index += snprintf( buffer + index, length - index, "predefined " );

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University * Copyright (c) 2004-2019 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@ -89,12 +89,12 @@ static int test_upper( unsigned int length )
} }
/** /**
* Conversion function. They deal with data-types in 3 ways, always making local copies. * Conversion function. They deal with datatypes in 3 ways, always making local copies.
* In order to allow performance testings, there are 3 functions: * In order to allow performance testings, there are 3 functions:
* - one copying directly from one memory location to another one using the * - one copying directly from one memory location to another one using the
* data-type copy function. * datatype copy function.
* - one which use a 2 convertors created with the same data-type * - one which use a 2 convertors created with the same datatype
* - and one using 2 convertors created from different data-types. * - and one using 2 convertors created from different datatypes.
* *
*/ */
static int local_copy_ddt_raw( ompi_datatype_t* pdt, int count, int iov_num ) static int local_copy_ddt_raw( ompi_datatype_t* pdt, int count, int iov_num )
@ -141,11 +141,15 @@ static int local_copy_ddt_raw( ompi_datatype_t* pdt, int count, int iov_num )
} }
/** /**
* Main function. Call several tests and print-out the results. It try to stress the convertor * Go over a set of datatypes and copy them using the raw functionality provided by the
* using difficult data-type constructions as well as strange segment sizes for the conversion. * convertor. The goal of this test is to stress the convertor using several more or less
* Usually, it is able to detect most of the data-type and convertor problems. Any modifications * difficult datatype, with a large set of segment sizes for the conversion. It can be used
* on the data-type engine should first pass all the tests from this file, before going into other * to highlight the raw capability of the convertor as well as detecting datatype convertor
* tests. * problems.
*
* This test is part of the testing infrastructure for the core datatype engine. As such any
* modifications on the datatype engine should first pass all the tests from this file,
* before going into other tests.
*/ */
int main( int argc, char* argv[] ) int main( int argc, char* argv[] )
{ {
@ -231,7 +235,7 @@ int main( int argc, char* argv[] )
OBJ_RELEASE( pdt3 ); assert( pdt3 == NULL ); OBJ_RELEASE( pdt3 ); assert( pdt3 == NULL );
printf( ">>--------------------------------------------<<\n" ); printf( ">>--------------------------------------------<<\n" );
printf( " Contiguous data-type (MPI_DOUBLE)\n" ); printf( " Contiguous datatype (MPI_DOUBLE)\n" );
pdt = MPI_DOUBLE; pdt = MPI_DOUBLE;
if( outputFlags & CHECK_PACK_UNPACK ) { if( outputFlags & CHECK_PACK_UNPACK ) {
local_copy_ddt_raw(pdt, 4500, iov_num); local_copy_ddt_raw(pdt, 4500, iov_num);
@ -240,34 +244,34 @@ int main( int argc, char* argv[] )
printf( ">>--------------------------------------------<<\n" ); printf( ">>--------------------------------------------<<\n" );
if( outputFlags & CHECK_PACK_UNPACK ) { if( outputFlags & CHECK_PACK_UNPACK ) {
printf( "Contiguous multiple data-type (4500*1)\n" ); printf( "Contiguous multiple datatype (4500*1)\n" );
pdt = create_contiguous_type( MPI_DOUBLE, 4500 ); pdt = create_contiguous_type( MPI_DOUBLE, 4500 );
local_copy_ddt_raw(pdt, 1, iov_num); local_copy_ddt_raw(pdt, 1, iov_num);
OBJ_RELEASE( pdt ); assert( pdt == NULL ); OBJ_RELEASE( pdt ); assert( pdt == NULL );
printf( "Contiguous multiple data-type (450*10)\n" ); printf( "Contiguous multiple datatype (450*10)\n" );
pdt = create_contiguous_type( MPI_DOUBLE, 450 ); pdt = create_contiguous_type( MPI_DOUBLE, 450 );
local_copy_ddt_raw(pdt, 10, iov_num); local_copy_ddt_raw(pdt, 10, iov_num);
OBJ_RELEASE( pdt ); assert( pdt == NULL ); OBJ_RELEASE( pdt ); assert( pdt == NULL );
printf( "Contiguous multiple data-type (45*100)\n" ); printf( "Contiguous multiple datatype (45*100)\n" );
pdt = create_contiguous_type( MPI_DOUBLE, 45 ); pdt = create_contiguous_type( MPI_DOUBLE, 45 );
local_copy_ddt_raw(pdt, 100, iov_num); local_copy_ddt_raw(pdt, 100, iov_num);
OBJ_RELEASE( pdt ); assert( pdt == NULL ); OBJ_RELEASE( pdt ); assert( pdt == NULL );
printf( "Contiguous multiple data-type (100*45)\n" ); printf( "Contiguous multiple datatype (100*45)\n" );
pdt = create_contiguous_type( MPI_DOUBLE, 100 ); pdt = create_contiguous_type( MPI_DOUBLE, 100 );
local_copy_ddt_raw(pdt, 45, iov_num); local_copy_ddt_raw(pdt, 45, iov_num);
OBJ_RELEASE( pdt ); assert( pdt == NULL ); OBJ_RELEASE( pdt ); assert( pdt == NULL );
printf( "Contiguous multiple data-type (10*450)\n" ); printf( "Contiguous multiple datatype (10*450)\n" );
pdt = create_contiguous_type( MPI_DOUBLE, 10 ); pdt = create_contiguous_type( MPI_DOUBLE, 10 );
local_copy_ddt_raw(pdt, 450, iov_num); local_copy_ddt_raw(pdt, 450, iov_num);
OBJ_RELEASE( pdt ); assert( pdt == NULL ); OBJ_RELEASE( pdt ); assert( pdt == NULL );
printf( "Contiguous multiple data-type (1*4500)\n" ); printf( "Contiguous multiple datatype (1*4500)\n" );
pdt = create_contiguous_type( MPI_DOUBLE, 1 ); pdt = create_contiguous_type( MPI_DOUBLE, 1 );
local_copy_ddt_raw(pdt, 4500, iov_num); local_copy_ddt_raw(pdt, 4500, iov_num);
OBJ_RELEASE( pdt ); assert( pdt == NULL ); OBJ_RELEASE( pdt ); assert( pdt == NULL );
} }
printf( ">>--------------------------------------------<<\n" ); printf( ">>--------------------------------------------<<\n" );
printf( ">>--------------------------------------------<<\n" ); printf( ">>--------------------------------------------<<\n" );
printf( "Vector data-type (450 times 10 double stride 11)\n" ); printf( "Vector datatype (450 times 10 double stride 11)\n" );
pdt = create_vector_type( MPI_DOUBLE, 450, 10, 11 ); pdt = create_vector_type( MPI_DOUBLE, 450, 10, 11 );
if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { if( outputFlags & DUMP_DATA_AFTER_COMMIT ) {
ompi_datatype_dump( pdt ); ompi_datatype_dump( pdt );