Skip to content

Commit bfeeaf4

Browse files
authored
Merge pull request #4890 from jsquyres/pr/v3.1.x/datatype-fixes
v3.1.x: datatype fixes for MPI_GET_ELEMENT
2 parents eac8b87 + 735b0b9 commit bfeeaf4

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

opal/datatype/opal_datatype_get_count.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* -*- Mode: C; c-basic-offset:4 ; -*- */
22
/*
3-
* Copyright (c) 2004-2017 The University of Tennessee and The University
3+
* Copyright (c) 2004-2018 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.
@@ -60,9 +60,8 @@ ssize_t opal_datatype_get_element_count( const opal_datatype_t* datatype, size_t
6060
continue;
6161
}
6262
if( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ) {
63-
ddt_loop_desc_t* loop = &(pElems[pos_desc].loop);
6463
do {
65-
PUSH_STACK( pStack, stack_pos, pos_desc, OPAL_DATATYPE_LOOP, loop->loops, 0 );
64+
PUSH_STACK( pStack, stack_pos, pos_desc, OPAL_DATATYPE_LOOP, pElems[pos_desc].loop.loops, 0 );
6665
pos_desc++;
6766
} while( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ); /* let's start another loop */
6867
DDT_DUMP_STACK( pStack, stack_pos, pElems, "advance loops" );
@@ -123,9 +122,8 @@ int32_t opal_datatype_set_element_count( const opal_datatype_t* datatype, size_t
123122
continue;
124123
}
125124
if( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ) {
126-
ddt_loop_desc_t* loop = &(pElems[pos_desc].loop);
127125
do {
128-
PUSH_STACK( pStack, stack_pos, pos_desc, OPAL_DATATYPE_LOOP, loop->loops, 0 );
126+
PUSH_STACK( pStack, stack_pos, pos_desc, OPAL_DATATYPE_LOOP, pElems[pos_desc].loop.loops, 0 );
129127
pos_desc++;
130128
} while( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ); /* let's start another loop */
131129
DDT_DUMP_STACK( pStack, stack_pos, pElems, "advance loops" );
@@ -182,9 +180,8 @@ int opal_datatype_compute_ptypes( opal_datatype_t* datatype )
182180
continue;
183181
}
184182
if( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ) {
185-
ddt_loop_desc_t* loop = &(pElems[pos_desc].loop);
186183
do {
187-
PUSH_STACK( pStack, stack_pos, pos_desc, OPAL_DATATYPE_LOOP, loop->loops, 0 );
184+
PUSH_STACK( pStack, stack_pos, pos_desc, OPAL_DATATYPE_LOOP, pElems[pos_desc].loop.loops, 0 );
188185
pos_desc++;
189186
} while( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ); /* let's start another loop */
190187
DDT_DUMP_STACK( pStack, stack_pos, pElems, "advance loops" );
@@ -194,6 +191,9 @@ int opal_datatype_compute_ptypes( opal_datatype_t* datatype )
194191
datatype->ptypes[pElems[pos_desc].elem.common.type] += pElems[pos_desc].elem.count;
195192
nbElems += pElems[pos_desc].elem.count;
196193

194+
DUMP( " compute_ptypes-add: type %d count %"PRIsize_t" (total type %"PRIsize_t" total %lld)\n",
195+
pElems[pos_desc].elem.common.type, datatype->ptypes[pElems[pos_desc].elem.common.type],
196+
pElems[pos_desc].elem.count, nbElems );
197197
pos_desc++; /* advance to the next data */
198198
}
199199
}

opal/datatype/opal_datatype_internal.h

Lines changed: 4 additions & 5 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-2017 The University of Tennessee and The University
6+
* Copyright (c) 2004-2018 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,
@@ -49,10 +49,9 @@ static inline void DUMP( char* fmt, ... )
4949
va_list list;
5050

5151
va_start( list, fmt );
52-
opal_output( opal_datatype_dfd, fmt, list );
52+
opal_output_vverbose( 0, opal_datatype_dfd, fmt, list );
5353
va_end( list );
5454
}
55-
# define DUMP printf
5655
# endif /* __GNUC__ && !__STDC__ */
5756
# endif /* ACCEPT_C99 */
5857
#else
@@ -329,8 +328,8 @@ struct opal_datatype_t;
329328
.ptypes = OPAL_DATATYPE_INIT_PTYPES_ARRAY_UNAVAILABLE \
330329
}
331330

332-
#define OPAL_DATATYPE_INITIALIZER_LOOP(FLAGS) OPAL_DATATYPE_INIT_BASIC_TYPE( OPAL_DATATYPE_LOOP, LOOP, FLAGS )
333-
#define OPAL_DATATYPE_INITIALIZER_END_LOOP(FLAGS) OPAL_DATATYPE_INIT_BASIC_TYPE( OPAL_DATATYPE_END_LOOP, END_LOOP, FLAGS )
331+
#define OPAL_DATATYPE_INITIALIZER_LOOP(FLAGS) OPAL_DATATYPE_INIT_BASIC_TYPE( OPAL_DATATYPE_LOOP, LOOP_S, FLAGS )
332+
#define OPAL_DATATYPE_INITIALIZER_END_LOOP(FLAGS) OPAL_DATATYPE_INIT_BASIC_TYPE( OPAL_DATATYPE_END_LOOP, LOOP_E, FLAGS )
334333
#define OPAL_DATATYPE_INITIALIZER_LB(FLAGS) OPAL_DATATYPE_INIT_BASIC_TYPE( OPAL_DATATYPE_LB, LB, FLAGS )
335334
#define OPAL_DATATYPE_INITIALIZER_UB(FLAGS) OPAL_DATATYPE_INIT_BASIC_TYPE( OPAL_DATATYPE_UB, UB, FLAGS )
336335
#define OPAL_DATATYPE_INITIALIZER_INT1(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( int8_t, OPAL_ALIGNMENT_INT8, INT1, FLAGS )

opal/datatype/opal_datatype_module.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
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-2013 The University of Tennessee and The University
6+
* Copyright (c) 2004-2018 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,
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2006 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2007-2018 Cisco Systems, Inc. All rights reserved
1414
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1515
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
1616
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
@@ -29,6 +29,7 @@
2929
#include <stddef.h>
3030

3131
#include "opal/util/arch.h"
32+
#include "opal/util/output.h"
3233
#include "opal/datatype/opal_datatype_internal.h"
3334
#include "opal/datatype/opal_datatype.h"
3435
#include "opal/datatype/opal_convertor_internal.h"
@@ -40,6 +41,7 @@ bool opal_unpack_debug = false;
4041
bool opal_pack_debug = false;
4142
bool opal_position_debug = false;
4243
bool opal_copy_debug = false;
44+
int opal_ddt_verbose = -1; /* Has the datatype verbose it's own output stream */
4345

4446
extern int opal_cuda_verbose;
4547

@@ -177,6 +179,14 @@ int opal_datatype_register_params(void)
177179
return ret;
178180
}
179181

182+
ret = mca_base_var_register ("opal", "opal", NULL, "ddt_verbose",
183+
"Set level of opal datatype verbosity",
184+
MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
185+
OPAL_INFO_LVL_8, MCA_BASE_VAR_SCOPE_LOCAL,
186+
&opal_ddt_verbose);
187+
if (0 > ret) {
188+
return ret;
189+
}
180190
#if OPAL_CUDA_SUPPORT
181191
/* Set different levels of verbosity in the cuda related code. */
182192
ret = mca_base_var_register ("opal", "opal", NULL, "cuda_verbose",
@@ -226,6 +236,12 @@ int32_t opal_datatype_init( void )
226236
datatype->desc.desc[1].end_loop.size = datatype->size;
227237
}
228238

239+
/* Enable a private output stream for datatype */
240+
if( opal_ddt_verbose > 0 ) {
241+
opal_datatype_dfd = opal_output_open(NULL);
242+
opal_output_set_verbosity(opal_datatype_dfd, opal_ddt_verbose);
243+
}
244+
229245
return OPAL_SUCCESS;
230246
}
231247

0 commit comments

Comments
 (0)