From 1b402ecb1acad037f80ce649b118ff31cd75611e Mon Sep 17 00:00:00 2001 From: Matthias Jurenz Date: Fri, 5 Aug 2011 12:46:26 +0000 Subject: [PATCH] Changes to OTF: - always check the result of OTF_WStream_get*Buffer since it might be NULL in case OTF_File_open fails Changes to VT: - CUDA Tracing: - fixed configure stack for filtered kernels - fixed buffer size for CUPTI tracing - replaced error message with warning to continue tracing, even if CUDA error occured (VTCUDAsynchronizeEvt) - vtunify: - enlarged minimum message size for transfering local definitions to rank 0 - use binary search for searching already created global definitions - use binary search for searching already created global marker definitions - use LargeVectorC instead of std::vector for pre-allocating elements - vtwrapper: - added options '-vt:CC' and '-vt:c++' which are synonyms for '-vt:cxx' This commit was SVN r24997. --- ompi/contrib/vt/vt/ChangeLog | 1 + .../vt/vt/extlib/otf/otflib/OTF_WStream.c | 825 ++++++++++-------- .../vt/vt/tools/vtunify/vt_unify_defs.cc | 315 +++++-- .../vt/vt/tools/vtunify/vt_unify_defs.h | 5 +- .../vt/vt/tools/vtunify/vt_unify_defs_recs.h | 237 +++-- .../vt/vt/tools/vtunify/vt_unify_handlers.cc | 36 +- .../vt/vt/tools/vtunify/vt_unify_handlers.h | 37 +- .../vt/vt/tools/vtunify/vt_unify_lvector.hh | 24 + .../vt/vt/tools/vtunify/vt_unify_markers.cc | 31 +- .../vt/vt/tools/vtunify/vt_unify_markers.h | 8 +- .../vt/tools/vtunify/vt_unify_tkfac_scope.hh | 3 +- .../vt/vt/tools/vtwrapper/vt_wrapper.cc | 11 +- ompi/contrib/vt/vt/vtlib/vt_cudart.c | 35 +- 13 files changed, 1003 insertions(+), 565 deletions(-) diff --git a/ompi/contrib/vt/vt/ChangeLog b/ompi/contrib/vt/vt/ChangeLog index aa0affa781..de72c3deb5 100644 --- a/ompi/contrib/vt/vt/ChangeLog +++ b/ompi/contrib/vt/vt/ChangeLog @@ -4,6 +4,7 @@ - process and thread buffer size can be explicitly specified by the user via the environment variables VT_BUFFER_SIZE and VT_THREAD_BUFFER_SIZE - improved filtering of CUDA kernels + - enhanced creating global definitions in vtunify - fixed CUDA kernel launch configuration - fixed unification of local process group definitions - fixed wrapper generation for MPI implementations which don't support diff --git a/ompi/contrib/vt/vt/extlib/otf/otflib/OTF_WStream.c b/ompi/contrib/vt/vt/extlib/otf/otflib/OTF_WStream.c index 07cce49f04..1ed281fd76 100644 --- a/ompi/contrib/vt/vt/extlib/otf/otflib/OTF_WStream.c +++ b/ompi/contrib/vt/vt/extlib/otf/otflib/OTF_WStream.c @@ -783,6 +783,8 @@ int OTF_WStream_writeDefinitionCommentKV( OTF_WStream* wstream, OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -823,6 +825,8 @@ int OTF_WStream_writeDefTimerResolutionKV( OTF_WStream* wstream, OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -864,7 +868,9 @@ int OTF_WStream_writeDefProcessKV( OTF_WStream* wstream, uint32_t deftoken, OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); - + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + # ifdef OTF_DEBUG if( 0 == deftoken ) { @@ -941,7 +947,9 @@ int OTF_WStream_writeDefProcessGroupKV( OTF_WStream* wstream, uint32_t deftoken, unsigned int i; OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); - + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + # ifdef OTF_DEBUG if( 0 == deftoken ) { @@ -1014,6 +1022,9 @@ int OTF_WStream_writeDefAttributeListKV( OTF_WStream* wstream, uint32_t attr_tok OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { OTF_WBuffer_writeKeyValueList_short(buffer, list); @@ -1072,6 +1083,9 @@ int OTF_WStream_writeDefProcessOrGroupAttributesKV( OTF_WStream* wstream, OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { OTF_WBuffer_writeKeyValueList_short(buffer, list); @@ -1120,6 +1134,8 @@ int OTF_WStream_writeDefFunctionKV( OTF_WStream* wstream, uint32_t deftoken, OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; # ifdef OTF_DEBUG if( 0 == deftoken ) { @@ -1192,6 +1208,8 @@ int OTF_WStream_writeDefFunctionGroupKV( OTF_WStream* wstream, OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; # ifdef OTF_DEBUG if( 0 == deftoken ) { @@ -1246,6 +1264,8 @@ int OTF_WStream_writeDefCollectiveOperationKV( OTF_WStream* wstream, OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; # ifdef OTF_DEBUG if( 0 == collOp ) { @@ -1305,6 +1325,8 @@ int OTF_WStream_writeDefCounterKV( OTF_WStream* wstream, uint32_t deftoken, OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; # ifdef OTF_DEBUG if( 0 == deftoken ) { @@ -1373,6 +1395,8 @@ int OTF_WStream_writeDefCounterGroupKV( OTF_WStream* wstream, OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; # ifdef OTF_DEBUG if( 0 == deftoken ) { @@ -1427,6 +1451,8 @@ int OTF_WStream_writeDefSclKV( OTF_WStream* wstream, uint32_t deftoken, OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; # ifdef OTF_DEBUG if( 0 == deftoken ) { @@ -1485,6 +1511,8 @@ int OTF_WStream_writeDefSclFileKV( OTF_WStream* wstream, uint32_t deftoken, OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; # ifdef OTF_DEBUG if( 0 == deftoken ) { @@ -1539,6 +1567,8 @@ int OTF_WStream_writeDefVersionKV( OTF_WStream* wstream, uint8_t major, OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -1590,11 +1620,14 @@ int OTF_WStream_writeOtfVersion( OTF_WStream* wstream ) { } -int OTF_WStream_writeDefCreatorKV( OTF_WStream* wstream, const char* creator, OTF_KeyValueList* list ) { +int OTF_WStream_writeDefCreatorKV( OTF_WStream* wstream, const char* creator, + OTF_KeyValueList* list ) { OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -1629,11 +1662,13 @@ int OTF_WStream_writeDefCreator( OTF_WStream* wstream, const char* creator ) { int OTF_WStream_writeDefFileKV( OTF_WStream* wstream, uint32_t token, - const char* name, uint32_t group, OTF_KeyValueList* list ) { + const char* name, uint32_t group, OTF_KeyValueList* list ) { OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; # ifdef OTF_DEBUG if( 0 == token ) { @@ -1683,17 +1718,19 @@ int OTF_WStream_writeDefFileKV( OTF_WStream* wstream, uint32_t token, } int OTF_WStream_writeDefFile( OTF_WStream* wstream, uint32_t token, - const char* name, uint32_t group ) { + const char* name, uint32_t group ) { return OTF_WStream_writeDefFileKV(wstream, token, name, group, NULL); } int OTF_WStream_writeDefFileGroupKV( OTF_WStream* wstream, uint32_t token, - const char* name, OTF_KeyValueList* list ) { + const char* name, OTF_KeyValueList* list ) { OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; # ifdef OTF_DEBUG if( 0 == token ) { @@ -1739,18 +1776,21 @@ int OTF_WStream_writeDefFileGroupKV( OTF_WStream* wstream, uint32_t token, } int OTF_WStream_writeDefFileGroup( OTF_WStream* wstream, uint32_t token, - const char* name ) { + const char* name ) { return OTF_WStream_writeDefFileGroupKV(wstream, token, name, NULL); } int OTF_WStream_writeDefKeyValueKV( OTF_WStream* wstream, uint32_t key, OTF_Type type, - const char* name, const char *description, OTF_KeyValueList* list ) { + const char* name, const char *description, + OTF_KeyValueList* list ) { OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -1799,86 +1839,90 @@ int OTF_WStream_writeDefKeyValue( OTF_WStream* wstream, uint32_t key, } -int OTF_WStream_writeDefTimeRange( OTF_WStream* wstream, - uint64_t minTime, - uint64_t maxTime, - OTF_KeyValueList* list ) { +int OTF_WStream_writeDefTimeRange( OTF_WStream* wstream, uint64_t minTime, + uint64_t maxTime, OTF_KeyValueList* list ) { - OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); - const char* recordkw= OTF_KEYWORD_S_DEF_PREFIX - OTF_KEYWORD_S_DEFTIMERANGE; - const char* timekw= OTF_KEYWORD_S_LOCAL_TIME; + OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); - uint32_t ( *writeKeyValueList )( OTF_WBuffer*, OTF_KeyValueList* )= - OTF_WBuffer_writeKeyValueList_short; + const char* recordkw= OTF_KEYWORD_S_DEF_PREFIX + OTF_KEYWORD_S_DEFTIMERANGE; + const char* timekw= OTF_KEYWORD_S_LOCAL_TIME; - if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { + uint32_t ( *writeKeyValueList )( OTF_WBuffer*, OTF_KeyValueList* )= + OTF_WBuffer_writeKeyValueList_short; - recordkw= OTF_KEYWORD_L_DEF_PREFIX - OTF_KEYWORD_L_DEFTIMERANGE " "; - timekw= " " OTF_KEYWORD_L_LOCAL_TIME " "; + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; - writeKeyValueList= OTF_WBuffer_writeKeyValueList_long; - } + if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { - writeKeyValueList( buffer, list ); + recordkw= OTF_KEYWORD_L_DEF_PREFIX + OTF_KEYWORD_L_DEFTIMERANGE " "; + timekw= " " OTF_KEYWORD_L_LOCAL_TIME " "; - OTF_WBuffer_writeKeyword( buffer, recordkw ); + writeKeyValueList= OTF_WBuffer_writeKeyValueList_long; + } - OTF_WBuffer_writeUint64( buffer, minTime ); + writeKeyValueList( buffer, list ); - OTF_WBuffer_writeKeyword( buffer, timekw ); + OTF_WBuffer_writeKeyword( buffer, recordkw ); - OTF_WBuffer_writeUint64( buffer, maxTime ); + OTF_WBuffer_writeUint64( buffer, minTime ); - OTF_WBuffer_writeNewline( buffer ); + OTF_WBuffer_writeKeyword( buffer, timekw ); - return 1; + OTF_WBuffer_writeUint64( buffer, maxTime ); + + OTF_WBuffer_writeNewline( buffer ); + + return 1; } -int OTF_WStream_writeDefCounterAssignments( OTF_WStream* wstream, - uint32_t counter_token, - uint32_t number_of_members, - const uint32_t* procs_or_groups, - OTF_KeyValueList* list ) { +int OTF_WStream_writeDefCounterAssignments( OTF_WStream* wstream, + uint32_t counter_token, uint32_t number_of_members, + const uint32_t* procs_or_groups, OTF_KeyValueList* list ) { - OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); - uint32_t i; + OTF_WBuffer* buffer= OTF_WStream_getDefBuffer( wstream ); - const char* recordkw= OTF_KEYWORD_S_DEF_PREFIX - OTF_KEYWORD_S_DEFCOUNTERASSIGNMENTS; - const char* memberskw= OTF_KEYWORD_S_LOCAL_MEMBERS; + uint32_t i; - uint32_t ( *writeKeyValueList )( OTF_WBuffer*, OTF_KeyValueList* )= - OTF_WBuffer_writeKeyValueList_short; + const char* recordkw= OTF_KEYWORD_S_DEF_PREFIX + OTF_KEYWORD_S_DEFCOUNTERASSIGNMENTS; + const char* memberskw= OTF_KEYWORD_S_LOCAL_MEMBERS; - if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { + uint32_t ( *writeKeyValueList )( OTF_WBuffer*, OTF_KeyValueList* )= + OTF_WBuffer_writeKeyValueList_short; - recordkw= OTF_KEYWORD_L_DEF_PREFIX - OTF_KEYWORD_L_DEFCOUNTERASSIGNMENTS " "; - memberskw= " " OTF_KEYWORD_L_LOCAL_MEMBERS " "; + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; - writeKeyValueList= OTF_WBuffer_writeKeyValueList_long; - } + if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { - writeKeyValueList( buffer, list ); + recordkw= OTF_KEYWORD_L_DEF_PREFIX + OTF_KEYWORD_L_DEFCOUNTERASSIGNMENTS " "; + memberskw= " " OTF_KEYWORD_L_LOCAL_MEMBERS " "; - OTF_WBuffer_writeKeyword( buffer, recordkw ); + writeKeyValueList= OTF_WBuffer_writeKeyValueList_long; + } - OTF_WBuffer_writeUint32( buffer, counter_token ); + writeKeyValueList( buffer, list ); - OTF_WBuffer_writeKeyword( buffer, memberskw ); - for ( i = 0; i < number_of_members; ++i ) { + OTF_WBuffer_writeKeyword( buffer, recordkw ); - OTF_WBuffer_writeUint32( buffer, procs_or_groups[i] ); - OTF_WBuffer_writeChar( buffer, ',' ); - } + OTF_WBuffer_writeUint32( buffer, counter_token ); - OTF_WBuffer_writeNewline( buffer ); + OTF_WBuffer_writeKeyword( buffer, memberskw ); + for ( i = 0; i < number_of_members; ++i ) { - return 1; + OTF_WBuffer_writeUint32( buffer, procs_or_groups[i] ); + OTF_WBuffer_writeChar( buffer, ',' ); + } + + OTF_WBuffer_writeNewline( buffer ); + + return 1; } /* *** event record write handlers *** ************************************* */ @@ -1889,6 +1933,9 @@ int OTF_WStream_writeNoOpKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -1920,6 +1967,9 @@ int OTF_WStream_writeEnterKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, cpuid ) ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -1975,6 +2025,8 @@ int OTF_WStream_writeRecvMsgKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, receiver ) ) return 0; @@ -2045,6 +2097,8 @@ int OTF_WStream_writeSendMsgKV( OTF_WStream* wstream, uint64_t time, uint32_t se OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, sender ) ) return 0; @@ -2114,6 +2168,9 @@ int OTF_WStream_writeLeaveKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, cpuid ) ) return 0; @@ -2175,6 +2232,8 @@ int OTF_WStream_writeCounterKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; @@ -2219,65 +2278,67 @@ int OTF_WStream_writeCollectiveOperationKV( OTF_WStream* wstream, uint64_t time, uint64_t duration, uint32_t scltoken, OTF_KeyValueList* list ) { - OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; - if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { + if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { - OTF_WBuffer_writeKeyValueList_short(buffer, list); + OTF_WBuffer_writeKeyValueList_short(buffer, list); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_COLLECTIVEOPERATION ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_COLLECTIVEOPERATION ); - OTF_WBuffer_writeUint32( buffer, functionToken ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_COMMUNICATOR ); - OTF_WBuffer_writeUint32( buffer, communicator ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_ROOT ); - OTF_WBuffer_writeUint32( buffer, rootprocess ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SENT ); - OTF_WBuffer_writeUint32( buffer, sent ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_RECVD ); - OTF_WBuffer_writeUint32( buffer, received ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_DURATION ); - OTF_WBuffer_writeUint64( buffer, duration ); + OTF_WBuffer_writeUint32( buffer, functionToken ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_COMMUNICATOR ); + OTF_WBuffer_writeUint32( buffer, communicator ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_ROOT ); + OTF_WBuffer_writeUint32( buffer, rootprocess ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SENT ); + OTF_WBuffer_writeUint32( buffer, sent ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_RECVD ); + OTF_WBuffer_writeUint32( buffer, received ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_DURATION ); + OTF_WBuffer_writeUint64( buffer, duration ); - if ( 0 != scltoken ) { + if ( 0 != scltoken ) { - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SCL ); - OTF_WBuffer_writeUint32( buffer, scltoken ); - } + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SCL ); + OTF_WBuffer_writeUint32( buffer, scltoken ); + } - OTF_WBuffer_writeNewline( buffer ); + OTF_WBuffer_writeNewline( buffer ); - } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { + } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { - OTF_WBuffer_writeKeyValueList_long(buffer, list); + OTF_WBuffer_writeKeyValueList_long(buffer, list); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_L_COLLECTIVEOPERATION " " ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_L_COLLECTIVEOPERATION " " ); - OTF_WBuffer_writeUint32( buffer, functionToken ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_COMMUNICATOR " " ); - OTF_WBuffer_writeUint32( buffer, communicator ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_ROOT " " ); - OTF_WBuffer_writeUint32( buffer, rootprocess ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SENT " " ); - OTF_WBuffer_writeUint32( buffer, sent ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_RECVD " " ); - OTF_WBuffer_writeUint32( buffer, received ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_DURATION " " ); - OTF_WBuffer_writeUint64( buffer, duration ); + OTF_WBuffer_writeUint32( buffer, functionToken ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_COMMUNICATOR " " ); + OTF_WBuffer_writeUint32( buffer, communicator ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_ROOT " " ); + OTF_WBuffer_writeUint32( buffer, rootprocess ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SENT " " ); + OTF_WBuffer_writeUint32( buffer, sent ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_RECVD " " ); + OTF_WBuffer_writeUint32( buffer, received ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_DURATION " " ); + OTF_WBuffer_writeUint64( buffer, duration ); - if ( 0 != scltoken ) { + if ( 0 != scltoken ) { - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SCL " " ); - OTF_WBuffer_writeUint32( buffer, scltoken ); - } + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SCL " " ); + OTF_WBuffer_writeUint32( buffer, scltoken ); + } - OTF_WBuffer_writeNewline( buffer ); - } + OTF_WBuffer_writeNewline( buffer ); + } - return 1; + return 1; } int OTF_WStream_writeCollectiveOperation( OTF_WStream* wstream, uint64_t time, @@ -2296,8 +2357,12 @@ int OTF_WStream_writeBeginCollectiveOperationKV( OTF_WStream* wstream, uint64_t sent, uint64_t received, uint32_t scltoken, OTF_KeyValueList* list ) { + OTF_WBuffer* buffer = OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + if( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; @@ -2382,8 +2447,12 @@ int OTF_WStream_writeEndCollectiveOperationKV( OTF_WStream* wstream, uint64_t time, uint32_t process, uint64_t matchingId, OTF_KeyValueList* list ) { + OTF_WBuffer* buffer = OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + if( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; @@ -2426,6 +2495,8 @@ int OTF_WStream_writeEventCommentKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; @@ -2466,6 +2537,8 @@ int OTF_WStream_writeBeginProcessKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; @@ -2505,6 +2578,8 @@ int OTF_WStream_writeEndProcessKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; @@ -2544,7 +2619,9 @@ int OTF_WStream_writeFileOperationKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); - + + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; @@ -2617,8 +2694,12 @@ int OTF_WStream_writeFileOperation( OTF_WStream* wstream, uint64_t time, int OTF_WStream_writeBeginFileOperationKV( OTF_WStream* wstream, uint64_t time, uint32_t process, uint64_t matchingId, uint32_t scltoken, OTF_KeyValueList* list ) { + OTF_WBuffer* buffer = OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + if( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; @@ -2674,8 +2755,12 @@ int OTF_WStream_writeEndFileOperationKV( OTF_WStream* wstream, uint64_t time, uint64_t handleId, uint32_t operation, uint64_t bytes, uint32_t scltoken, OTF_KeyValueList* list ) { + OTF_WBuffer* buffer = OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + if( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; @@ -2753,63 +2838,63 @@ int OTF_WStream_writeRMAPutKV( OTF_WStream* wstream, uint64_t time, uint32_t scltoken, OTF_KeyValueList* list ) { - OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; - if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { + if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { OTF_WBuffer_writeKeyValueList_short(buffer, list); - OTF_WBuffer_writeKeyword( buffer, - OTF_KEYWORD_S_RMAPUT ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_RMAPUT ); - OTF_WBuffer_writeUint32( buffer, origin ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_PROCESS ); - OTF_WBuffer_writeUint32( buffer, target ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_COMMUNICATOR ); - OTF_WBuffer_writeUint32( buffer, communicator ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_TAG ); - OTF_WBuffer_writeUint32( buffer, tag ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_LENGTH ); - OTF_WBuffer_writeUint64( buffer, bytes ); + OTF_WBuffer_writeUint32( buffer, origin ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_PROCESS ); + OTF_WBuffer_writeUint32( buffer, target ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_COMMUNICATOR ); + OTF_WBuffer_writeUint32( buffer, communicator ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_TAG ); + OTF_WBuffer_writeUint32( buffer, tag ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_LENGTH ); + OTF_WBuffer_writeUint64( buffer, bytes ); - if ( 0 != scltoken ) { + if ( 0 != scltoken ) { - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SCL ); - OTF_WBuffer_writeUint32( buffer, scltoken ); - } + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SCL ); + OTF_WBuffer_writeUint32( buffer, scltoken ); + } - OTF_WBuffer_writeNewline( buffer ); + OTF_WBuffer_writeNewline( buffer ); - } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { + } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { OTF_WBuffer_writeKeyValueList_long(buffer, list); - OTF_WBuffer_writeKeyword( buffer, - OTF_KEYWORD_L_RMAPUT " " ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_L_RMAPUT " " ); - OTF_WBuffer_writeUint32( buffer, origin ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_PROCESS " " ); - OTF_WBuffer_writeUint32( buffer, target ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_COMMUNICATOR " " ); - OTF_WBuffer_writeUint32( buffer, communicator ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_TAG " " ); - OTF_WBuffer_writeUint32( buffer, tag ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_LENGTH " " ); - OTF_WBuffer_writeUint64( buffer, bytes ); + OTF_WBuffer_writeUint32( buffer, origin ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_PROCESS " " ); + OTF_WBuffer_writeUint32( buffer, target ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_COMMUNICATOR " " ); + OTF_WBuffer_writeUint32( buffer, communicator ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_TAG " " ); + OTF_WBuffer_writeUint32( buffer, tag ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_LENGTH " " ); + OTF_WBuffer_writeUint64( buffer, bytes ); - if ( 0 != scltoken ) { + if ( 0 != scltoken ) { - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SCL " " ); - OTF_WBuffer_writeUint32( buffer, scltoken ); - } + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SCL " " ); + OTF_WBuffer_writeUint32( buffer, scltoken ); + } - OTF_WBuffer_writeNewline( buffer ); - } + OTF_WBuffer_writeNewline( buffer ); + } - return 1; + return 1; } int OTF_WStream_writeRMAPut( OTF_WStream* wstream, uint64_t time, @@ -2828,63 +2913,63 @@ int OTF_WStream_writeRMAPutRemoteEndKV( OTF_WStream* wstream, uint64_t time, uint32_t scltoken, OTF_KeyValueList* list ) { - OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; - if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { + if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { OTF_WBuffer_writeKeyValueList_short(buffer, list); - OTF_WBuffer_writeKeyword( buffer, - OTF_KEYWORD_S_RMAPUTRE ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_RMAPUTRE ); - OTF_WBuffer_writeUint32( buffer, origin ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_PROCESS ); - OTF_WBuffer_writeUint32( buffer, target ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_COMMUNICATOR ); - OTF_WBuffer_writeUint32( buffer, communicator ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_TAG ); - OTF_WBuffer_writeUint32( buffer, tag ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_LENGTH ); - OTF_WBuffer_writeUint64( buffer, bytes ); + OTF_WBuffer_writeUint32( buffer, origin ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_PROCESS ); + OTF_WBuffer_writeUint32( buffer, target ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_COMMUNICATOR ); + OTF_WBuffer_writeUint32( buffer, communicator ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_TAG ); + OTF_WBuffer_writeUint32( buffer, tag ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_LENGTH ); + OTF_WBuffer_writeUint64( buffer, bytes ); - if ( 0 != scltoken ) { + if ( 0 != scltoken ) { - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SCL ); - OTF_WBuffer_writeUint32( buffer, scltoken ); - } + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SCL ); + OTF_WBuffer_writeUint32( buffer, scltoken ); + } - OTF_WBuffer_writeNewline( buffer ); + OTF_WBuffer_writeNewline( buffer ); - } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { + } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { OTF_WBuffer_writeKeyValueList_long(buffer, list); - OTF_WBuffer_writeKeyword( buffer, - OTF_KEYWORD_L_RMAPUTRE " " ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_L_RMAPUTRE " " ); - OTF_WBuffer_writeUint32( buffer, origin ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_PROCESS " " ); - OTF_WBuffer_writeUint32( buffer, target ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_COMMUNICATOR " " ); - OTF_WBuffer_writeUint32( buffer, communicator ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_TAG " " ); - OTF_WBuffer_writeUint32( buffer, tag ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_LENGTH " " ); - OTF_WBuffer_writeUint64( buffer, bytes ); + OTF_WBuffer_writeUint32( buffer, origin ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_PROCESS " " ); + OTF_WBuffer_writeUint32( buffer, target ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_COMMUNICATOR " " ); + OTF_WBuffer_writeUint32( buffer, communicator ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_TAG " " ); + OTF_WBuffer_writeUint32( buffer, tag ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_LENGTH " " ); + OTF_WBuffer_writeUint64( buffer, bytes ); - if ( 0 != scltoken ) { + if ( 0 != scltoken ) { - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SCL " " ); - OTF_WBuffer_writeUint32( buffer, scltoken ); - } + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SCL " " ); + OTF_WBuffer_writeUint32( buffer, scltoken ); + } - OTF_WBuffer_writeNewline( buffer ); - } + OTF_WBuffer_writeNewline( buffer ); + } - return 1; + return 1; } int OTF_WStream_writeRMAPutRemoteEnd( OTF_WStream* wstream, uint64_t time, @@ -2903,63 +2988,63 @@ int OTF_WStream_writeRMAGetKV( OTF_WStream* wstream, uint64_t time, uint32_t scltoken, OTF_KeyValueList* list ) { - OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; - if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { + if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { OTF_WBuffer_writeKeyValueList_short(buffer, list); - OTF_WBuffer_writeKeyword( buffer, - OTF_KEYWORD_S_RMAGET ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_RMAGET ); - OTF_WBuffer_writeUint32( buffer, origin ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_PROCESS ); - OTF_WBuffer_writeUint32( buffer, target ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_COMMUNICATOR ); - OTF_WBuffer_writeUint32( buffer, communicator ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_TAG ); - OTF_WBuffer_writeUint32( buffer, tag ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_LENGTH ); - OTF_WBuffer_writeUint64( buffer, bytes ); + OTF_WBuffer_writeUint32( buffer, origin ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_PROCESS ); + OTF_WBuffer_writeUint32( buffer, target ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_COMMUNICATOR ); + OTF_WBuffer_writeUint32( buffer, communicator ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_TAG ); + OTF_WBuffer_writeUint32( buffer, tag ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_LENGTH ); + OTF_WBuffer_writeUint64( buffer, bytes ); - if ( 0 != scltoken ) { + if ( 0 != scltoken ) { - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SCL ); - OTF_WBuffer_writeUint32( buffer, scltoken ); - } + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SCL ); + OTF_WBuffer_writeUint32( buffer, scltoken ); + } - OTF_WBuffer_writeNewline( buffer ); + OTF_WBuffer_writeNewline( buffer ); - } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { + } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { OTF_WBuffer_writeKeyValueList_long(buffer, list); - OTF_WBuffer_writeKeyword( buffer, - OTF_KEYWORD_L_RMAGET " " ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_L_RMAGET " " ); - OTF_WBuffer_writeUint32( buffer, origin ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_PROCESS " " ); - OTF_WBuffer_writeUint32( buffer, target ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_COMMUNICATOR " " ); - OTF_WBuffer_writeUint32( buffer, communicator ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_TAG " " ); - OTF_WBuffer_writeUint32( buffer, tag ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_LENGTH " " ); - OTF_WBuffer_writeUint64( buffer, bytes ); + OTF_WBuffer_writeUint32( buffer, origin ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_PROCESS " " ); + OTF_WBuffer_writeUint32( buffer, target ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_COMMUNICATOR " " ); + OTF_WBuffer_writeUint32( buffer, communicator ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_TAG " " ); + OTF_WBuffer_writeUint32( buffer, tag ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_LENGTH " " ); + OTF_WBuffer_writeUint64( buffer, bytes ); - if ( 0 != scltoken ) { + if ( 0 != scltoken ) { - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SCL " " ); - OTF_WBuffer_writeUint32( buffer, scltoken ); - } + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SCL " " ); + OTF_WBuffer_writeUint32( buffer, scltoken ); + } - OTF_WBuffer_writeNewline( buffer ); - } + OTF_WBuffer_writeNewline( buffer ); + } - return 1; + return 1; } int OTF_WStream_writeRMAGet( OTF_WStream* wstream, uint64_t time, @@ -2977,52 +3062,52 @@ int OTF_WStream_writeRMAEndKV( OTF_WStream* wstream, uint64_t time, uint32_t scltoken, OTF_KeyValueList* list ) { - OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + OTF_WBuffer* buffer= OTF_WStream_getEventBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; - if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { + if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { OTF_WBuffer_writeKeyValueList_short(buffer, list); - OTF_WBuffer_writeKeyword( buffer, - OTF_KEYWORD_S_RMAEND ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_RMAEND ); - OTF_WBuffer_writeUint32( buffer, remote ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_COMMUNICATOR ); - OTF_WBuffer_writeUint32( buffer, communicator ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_TAG ); - OTF_WBuffer_writeUint32( buffer, tag ); + OTF_WBuffer_writeUint32( buffer, remote ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_COMMUNICATOR ); + OTF_WBuffer_writeUint32( buffer, communicator ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_TAG ); + OTF_WBuffer_writeUint32( buffer, tag ); - if ( 0 != scltoken ) { + if ( 0 != scltoken ) { - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SCL ); - OTF_WBuffer_writeUint32( buffer, scltoken ); - } + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SCL ); + OTF_WBuffer_writeUint32( buffer, scltoken ); + } - OTF_WBuffer_writeNewline( buffer ); + OTF_WBuffer_writeNewline( buffer ); - } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { + } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { OTF_WBuffer_writeKeyValueList_long(buffer, list); - OTF_WBuffer_writeKeyword( buffer, - OTF_KEYWORD_L_RMAEND " " ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_L_RMAEND " " ); - OTF_WBuffer_writeUint32( buffer, remote ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_COMMUNICATOR " " ); - OTF_WBuffer_writeUint32( buffer, communicator ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_TAG " " ); - OTF_WBuffer_writeUint32( buffer, tag ); + OTF_WBuffer_writeUint32( buffer, remote ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_COMMUNICATOR " " ); + OTF_WBuffer_writeUint32( buffer, communicator ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_TAG " " ); + OTF_WBuffer_writeUint32( buffer, tag ); - if ( 0 != scltoken ) { + if ( 0 != scltoken ) { - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SCL " " ); - OTF_WBuffer_writeUint32( buffer, scltoken ); - } + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SCL " " ); + OTF_WBuffer_writeUint32( buffer, scltoken ); + } - OTF_WBuffer_writeNewline( buffer ); + OTF_WBuffer_writeNewline( buffer ); } return 1; @@ -3046,6 +3131,8 @@ int OTF_WStream_writeSnapshotCommentKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getSnapshotBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; @@ -3087,6 +3174,9 @@ int OTF_WStream_writeEnterSnapshotKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getSnapshotBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, cpuid ) ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -3149,9 +3239,11 @@ int OTF_WStream_writeSendSnapshotKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getSnapshotBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, sender ) ) return 0; - - + if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { OTF_WBuffer_writeKeyValueList_short(buffer, list); @@ -3230,6 +3322,9 @@ int OTF_WStream_writeOpenFileSnapshotKV( OTF_WStream* wstream,uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getSnapshotBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -3297,17 +3392,19 @@ int OTF_WStream_writeBeginCollopSnapshotKV( OTF_WStream* wstream, uint64_t time, uint32_t scltoken, OTF_KeyValueList *list ) { - OTF_WBuffer* buffer= OTF_WStream_getSnapshotBuffer( wstream ); + OTF_WBuffer* buffer= OTF_WStream_getSnapshotBuffer( wstream ); - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) - return 0; + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; - - if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) + return 0; + + if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { OTF_WBuffer_writeKeyValueList_short(buffer, list); - OTF_WBuffer_writeKeyword( buffer, + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_SNAPSHOT_PREFIX OTF_KEYWORD_S_SNAPSHOT_BEGINCOLLOP ); OTF_WBuffer_writeUint64( buffer, originaltime ); @@ -3318,17 +3415,17 @@ int OTF_WStream_writeBeginCollopSnapshotKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_HANDLEID ); OTF_WBuffer_writeUint64( buffer, matchingId ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_GROUP ); - OTF_WBuffer_writeUint32( buffer, procGroup ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_GROUP ); + OTF_WBuffer_writeUint32( buffer, procGroup ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_ROOT ); - OTF_WBuffer_writeUint32( buffer, rootProc ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_ROOT ); + OTF_WBuffer_writeUint32( buffer, rootProc ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SENT ); - OTF_WBuffer_writeUint64( buffer, sent ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_SENT ); + OTF_WBuffer_writeUint64( buffer, sent ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_RECVD ); - OTF_WBuffer_writeUint64( buffer, received ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_RECVD ); + OTF_WBuffer_writeUint64( buffer, received ); if ( 0 != scltoken ) { @@ -3353,17 +3450,17 @@ int OTF_WStream_writeBeginCollopSnapshotKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_HANDLEID " " ); OTF_WBuffer_writeUint64( buffer, matchingId ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_GROUP " " ); - OTF_WBuffer_writeUint32( buffer, procGroup ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_GROUP " " ); + OTF_WBuffer_writeUint32( buffer, procGroup ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_ROOT " " ); - OTF_WBuffer_writeUint32( buffer, rootProc ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_ROOT " " ); + OTF_WBuffer_writeUint32( buffer, rootProc ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SENT " " ); - OTF_WBuffer_writeUint64( buffer, sent ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_SENT " " ); + OTF_WBuffer_writeUint64( buffer, sent ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_RECVD " " ); - OTF_WBuffer_writeUint64( buffer, received ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_RECVD " " ); + OTF_WBuffer_writeUint64( buffer, received ); if ( 0 != scltoken ) { @@ -3375,7 +3472,6 @@ int OTF_WStream_writeBeginCollopSnapshotKV( OTF_WStream* wstream, uint64_t time, } return 1; - } int OTF_WStream_writeBeginCollopSnapshot( OTF_WStream* wstream, uint64_t time, @@ -3383,29 +3479,29 @@ int OTF_WStream_writeBeginCollopSnapshot( OTF_WStream* wstream, uint64_t time, uint32_t procGroup, uint32_t rootProc, uint64_t sent, uint64_t received, uint32_t scltoken ) { - - return OTF_WStream_writeBeginCollopSnapshotKV(wstream, time, originaltime, - process, collOp, matchingId, procGroup, rootProc, sent, received, - scltoken, NULL ); - + return OTF_WStream_writeBeginCollopSnapshotKV(wstream, time, originaltime, + process, collOp, matchingId, procGroup, rootProc, sent, + received, scltoken, NULL ); } int OTF_WStream_writeBeginFileOpSnapshotKV( OTF_WStream* wstream, uint64_t time, uint64_t originaltime, uint32_t process, uint64_t matchingId, uint32_t scltoken, OTF_KeyValueList *list ) { - - OTF_WBuffer* buffer= OTF_WStream_getSnapshotBuffer( wstream ); - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) - return 0; + OTF_WBuffer* buffer= OTF_WStream_getSnapshotBuffer( wstream ); - - if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) + return 0; + + if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { OTF_WBuffer_writeKeyValueList_short(buffer, list); - OTF_WBuffer_writeKeyword( buffer, + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_SNAPSHOT_PREFIX OTF_KEYWORD_S_SNAPSHOT_BEGINFILEOP ); OTF_WBuffer_writeUint64( buffer, originaltime ); @@ -3425,7 +3521,7 @@ int OTF_WStream_writeBeginFileOpSnapshotKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer_writeKeyValueList_long(buffer, list); - OTF_WBuffer_writeKeyword( buffer, + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_L_SNAPSHOT_PREFIX OTF_KEYWORD_L_SNAPSHOT_BEGINFILEOP " " ); OTF_WBuffer_writeUint64( buffer, originaltime ); @@ -3444,15 +3540,14 @@ int OTF_WStream_writeBeginFileOpSnapshotKV( OTF_WStream* wstream, uint64_t time, return 1; - } int OTF_WStream_writeBeginFileOpSnapshot( OTF_WStream* wstream, uint64_t time, uint64_t originaltime, uint32_t process, uint64_t matchingId, uint32_t scltoken ) { - return OTF_WStream_writeBeginFileOpSnapshotKV( wstream, time, originaltime, - process, matchingId, scltoken, NULL); + return OTF_WStream_writeBeginFileOpSnapshotKV( wstream, time, originaltime, + process, matchingId, scltoken, NULL); } @@ -3466,6 +3561,8 @@ int OTF_WStream_writeSummaryCommentKV( OTF_WStream* wstream, uint64_t time, OTF_WBuffer* buffer= OTF_WStream_getStatsBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; @@ -3507,9 +3604,11 @@ int OTF_WStream_writeFunctionSummaryKV( OTF_WStream* wstream, OTF_WBuffer* buffer= OTF_WStream_getStatsBuffer( wstream ); - - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -3563,9 +3662,11 @@ int OTF_WStream_writeFunctionGroupSummaryKV( OTF_WStream* wstream, OTF_WBuffer* buffer= OTF_WStream_getStatsBuffer( wstream ); - - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -3620,9 +3721,11 @@ int OTF_WStream_writeMessageSummaryKV( OTF_WStream* wstream, OTF_WBuffer* buffer= OTF_WStream_getStatsBuffer( wstream ); - - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -3690,9 +3793,11 @@ int OTF_WStream_writeCollopSummaryKV( OTF_WStream* wstream, OTF_WBuffer* buffer= OTF_WStream_getStatsBuffer( wstream ); - - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -3755,9 +3860,11 @@ int OTF_WStream_writeFileOperationSummaryKV( OTF_WStream* wstream, uint64_t time OTF_WBuffer* buffer= OTF_WStream_getStatsBuffer( wstream ); - - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -3829,9 +3936,11 @@ int OTF_WStream_writeFileGroupOperationSummaryKV( OTF_WStream* wstream, uint64_t OTF_WBuffer* buffer= OTF_WStream_getStatsBuffer( wstream ); - - if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; + + if ( 0 == OTF_WBuffer_setTimeAndProcess( buffer, time, process ) ) return 0; if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { @@ -3898,46 +4007,46 @@ int OTF_WStream_writeFileGroupOperationSummary( OTF_WStream* wstream, uint64_t t /** Write a def marker record to stream 'wstream'. \ingroup wstream */ -int OTF_WStream_writeDefMarkerKV( OTF_WStream* wstream, - uint32_t token, const char* name, uint32_t type, +int OTF_WStream_writeDefMarkerKV( OTF_WStream* wstream, + uint32_t token, const char* name, uint32_t type, OTF_KeyValueList* list ) { - OTF_WBuffer* buffer= OTF_WStream_getMarkerBuffer( wstream ); + OTF_WBuffer* buffer= OTF_WStream_getMarkerBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; - if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { + if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { - OTF_WBuffer_writeKeyValueList_short(buffer, list); - - OTF_WBuffer_writeKeyword( buffer, - OTF_KEYWORD_S_MARKER_PREFIX - OTF_KEYWORD_S_MARKER_DEFMARKER ); - OTF_WBuffer_writeUint32( buffer, token ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_NAME ); - OTF_WBuffer_writeString( buffer, name ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_TYPE ); - OTF_WBuffer_writeUint32( buffer, type ); + OTF_WBuffer_writeKeyValueList_short(buffer, list); - OTF_WBuffer_writeNewline( buffer ); - - } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_MARKER_PREFIX + OTF_KEYWORD_S_MARKER_DEFMARKER ); + OTF_WBuffer_writeUint32( buffer, token ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_NAME ); + OTF_WBuffer_writeString( buffer, name ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_TYPE ); + OTF_WBuffer_writeUint32( buffer, type ); - OTF_WBuffer_writeKeyValueList_long(buffer, list); + OTF_WBuffer_writeNewline( buffer ); - OTF_WBuffer_writeKeyword( buffer, - OTF_KEYWORD_L_MARKER_PREFIX - OTF_KEYWORD_L_MARKER_DEFMARKER " " ); - OTF_WBuffer_writeUint32( buffer, token ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_NAME " " ); - OTF_WBuffer_writeString( buffer, name ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_TYPE " " ); - OTF_WBuffer_writeUint32( buffer, type ); + } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { - OTF_WBuffer_writeNewline( buffer ); - } + OTF_WBuffer_writeKeyValueList_long(buffer, list); - return 1; + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_L_MARKER_PREFIX + OTF_KEYWORD_L_MARKER_DEFMARKER " " ); + OTF_WBuffer_writeUint32( buffer, token ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_NAME " " ); + OTF_WBuffer_writeString( buffer, name ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_TYPE " " ); + OTF_WBuffer_writeUint32( buffer, type ); + + OTF_WBuffer_writeNewline( buffer ); + } + + return 1; } int OTF_WStream_writeDefMarker( OTF_WStream* wstream, @@ -3953,48 +4062,48 @@ int OTF_WStream_writeMarkerKV( OTF_WStream* wstream, OTF_KeyValueList* list ) { - OTF_WBuffer* buffer= OTF_WStream_getMarkerBuffer( wstream ); + OTF_WBuffer* buffer= OTF_WStream_getMarkerBuffer( wstream ); + /* buffer can be NULL if file-open fails */ + if ( NULL == buffer ) return 0; - /* time and process are written directly, - this is completely different from event records! */ + /* time and process are written directly, + this is completely different from event records! */ - if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { + if ( OTF_WSTREAM_FORMAT_SHORT == wstream->format ) { - OTF_WBuffer_writeKeyValueList_short(buffer, list); + OTF_WBuffer_writeKeyValueList_short(buffer, list); - OTF_WBuffer_writeKeyword( buffer, - OTF_KEYWORD_S_MARKER_PREFIX - OTF_KEYWORD_S_MARKER_MARKERSPOT ); - OTF_WBuffer_writeUint32( buffer, token ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_TIME ); - OTF_WBuffer_writeUint64( buffer, time ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_PROCESS ); - OTF_WBuffer_writeUint32( buffer, process ); - OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_VALUE ); - OTF_WBuffer_writeString( buffer, text ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_MARKER_PREFIX + OTF_KEYWORD_S_MARKER_MARKERSPOT ); + OTF_WBuffer_writeUint32( buffer, token ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_TIME ); + OTF_WBuffer_writeUint64( buffer, time ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_PROCESS ); + OTF_WBuffer_writeUint32( buffer, process ); + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_S_LOCAL_VALUE ); + OTF_WBuffer_writeString( buffer, text ); - OTF_WBuffer_writeNewline( buffer ); - - } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { + OTF_WBuffer_writeNewline( buffer ); - OTF_WBuffer_writeKeyValueList_long(buffer, list); + } else if ( OTF_WSTREAM_FORMAT_LONG == wstream->format ) { - OTF_WBuffer_writeKeyword( buffer, - OTF_KEYWORD_L_MARKER_PREFIX - OTF_KEYWORD_L_MARKER_MARKERSPOT " " ); - OTF_WBuffer_writeUint32( buffer, token ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_TIME " " ); - OTF_WBuffer_writeUint64( buffer, time ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_PROCESS " " ); - OTF_WBuffer_writeUint32( buffer, process ); - OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_VALUE " " ); - OTF_WBuffer_writeString( buffer, text ); + OTF_WBuffer_writeKeyValueList_long(buffer, list); - OTF_WBuffer_writeNewline( buffer ); - } + OTF_WBuffer_writeKeyword( buffer, OTF_KEYWORD_L_MARKER_PREFIX + OTF_KEYWORD_L_MARKER_MARKERSPOT " " ); + OTF_WBuffer_writeUint32( buffer, token ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_TIME " " ); + OTF_WBuffer_writeUint64( buffer, time ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_PROCESS " " ); + OTF_WBuffer_writeUint32( buffer, process ); + OTF_WBuffer_writeKeyword( buffer, " " OTF_KEYWORD_L_LOCAL_VALUE " " ); + OTF_WBuffer_writeString( buffer, text ); - return 1; + OTF_WBuffer_writeNewline( buffer ); + } + + return 1; } int OTF_WStream_writeMarker( OTF_WStream* wstream, diff --git a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs.cc b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs.cc index a89c398327..05d2be9ffb 100644 --- a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs.cc +++ b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs.cc @@ -395,14 +395,14 @@ DefinitionsC::readLocal( const std::vector & streamIds ) const VT_MPI_INT msg_tag = 100; // minimum message size - const VT_MPI_INT min_msg_size = 1024 * 1024; + const VT_MPI_INT min_msg_size = 100 * 1024 * 1024; #endif // VT_MPI // read local definitions of each given stream // // vector of local definitions - std::vector loc_defs; + LargeVectorC loc_defs; for( uint32_t i = 0; i < streamIds.size(); i++ ) { @@ -825,7 +825,7 @@ DefinitionsC::readLocal( const std::vector & streamIds ) bool DefinitionsC::readLocal( const uint32_t & streamId, - std::vector & locDefs ) + LargeVectorC & locDefs ) { bool error = false; @@ -1022,7 +1022,7 @@ DefinitionsC::readLocal( const uint32_t & streamId, } bool -DefinitionsC::processLocal( const std::vector & locDefs ) +DefinitionsC::processLocal( const LargeVectorC & locDefs ) { bool error = false; @@ -1034,7 +1034,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) { case DEF_REC_TYPE__DefComment: { - // get reference to local definition entry + // get local definition entry const DefRec_DefCommentS * loc_def_entry = static_cast( locDefs[i] ); @@ -1045,7 +1045,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefCreator: { - // get reference to local definition entry + // get local definition entry const DefRec_DefCreatorS * loc_def_entry = static_cast( locDefs[i] ); @@ -1062,7 +1062,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefTimerResolution: { - // get reference to local definitions entry + // get local definitions entry const DefRec_DefTimerResolutionS * loc_def_entry = static_cast( locDefs[i] ); @@ -1079,7 +1079,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefTimeRange: { - // get reference to local definitions entry + // get local definitions entry const DefRec_DefTimeRangeS * loc_def_entry = static_cast( locDefs[i] ); @@ -1091,7 +1091,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefProcess: { - // get reference to local definition entry + // get local definition entry const DefRec_DefProcessS * loc_def_entry = static_cast( locDefs[i] ); @@ -1103,7 +1103,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefProcessGroup: { - // get reference to local definition entry + // get local definition entry DefRec_DefProcessGroupS * loc_def_entry = static_cast( locDefs[i] ); @@ -1114,7 +1114,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefSclFile: { - // get reference to local definition entry + // get local definition entry const DefRec_DefSclFileS * loc_def_entry = static_cast( locDefs[i] ); @@ -1129,7 +1129,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefScl: { - // get reference to local definition entry + // get local definition entry DefRec_DefSclS * loc_def_entry = static_cast( locDefs[i] ); @@ -1156,7 +1156,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefFileGroup: { - // get reference to local definition entry + // get local definition entry const DefRec_DefFileGroupS * loc_def_entry = static_cast( locDefs[i] ); @@ -1171,7 +1171,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefFile: { - // get reference to local definition entry + // get local definition entry DefRec_DefFileS * loc_def_entry = static_cast( locDefs[i] ); @@ -1198,7 +1198,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefFunctionGroup: { - // get reference to local definition entry + // get local definition entry const DefRec_DefFunctionGroupS * loc_def_entry = static_cast( locDefs[i] ); @@ -1213,7 +1213,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefFunction: { - // get reference to local definition entry + // get local definition entry DefRec_DefFunctionS * loc_def_entry = static_cast( locDefs[i] ); @@ -1255,7 +1255,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefCollOp: { - // get reference to local definition entry + // get local definition entry const DefRec_DefCollOpS * loc_def_entry = static_cast( locDefs[i] ); @@ -1270,7 +1270,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefCounterGroup: { - // get reference to local definition entry + // get local definition entry const DefRec_DefCounterGroupS * loc_def_entry = static_cast( locDefs[i] ); @@ -1285,7 +1285,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefCounter: { - // get reference to local definition entry + // get local definition entry DefRec_DefCounterS * loc_def_entry = static_cast( locDefs[i] ); @@ -1312,7 +1312,7 @@ DefinitionsC::processLocal( const std::vector & locDefs ) } case DEF_REC_TYPE__DefKeyValue: { - // get reference to local definition entry + // get local definition entry const DefRec_DefKeyValueS * loc_def_entry = static_cast( locDefs[i] ); @@ -1335,6 +1335,18 @@ DefinitionsC::processLocal( const std::vector & locDefs ) return !error; } +// function for resorting global definitions based on T::SortS +template +static void resort_glob_defs( const std::set & in, + std::set & out ) +{ + for( typename std::set::const_iterator it = + in.begin(); it != in.end(); it++ ) + { + out.insert( &(*it) ); + } +} + bool DefinitionsC::writeGlobal() { @@ -1438,16 +1450,28 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefComment: { + // resort definition comments + // + + typedef + std::set + resorted_comments_t; + + resorted_comments_t resorted_comments; + + resort_glob_defs( + m_globDefs.comments, resorted_comments ); + // iterate over all definition comments - for( std::set::const_iterator it = - m_globDefs.comments.begin(); - it != m_globDefs.comments.end() && !error; it++ ) + for( resorted_comments_t::const_iterator it = + resorted_comments.begin(); it != resorted_comments.end(); + it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefCommentS record = *it; + DefRec_DefCommentS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( @@ -1464,16 +1488,27 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefProcess: { + // resort process definitions + // + + typedef + std::set + resorted_procs_t; + + resorted_procs_t resorted_procs; + + resort_glob_defs( + m_globDefs.procs, resorted_procs ); + // iterate over all process definitions - for( std::set::const_iterator it = - m_globDefs.procs.begin(); - it != m_globDefs.procs.end() && !error; it++ ) + for( resorted_procs_t::const_iterator it = + resorted_procs.begin(); it != resorted_procs.end(); it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefProcessS record = *it; + DefRec_DefProcessS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( HooksC::Record_DefProcess, @@ -1491,16 +1526,28 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefProcessGroup: { + // resort process group definitions + // + + typedef + std::set + resorted_proc_grps_t; + + resorted_proc_grps_t resorted_proc_grps; + + resort_glob_defs( + m_globDefs.procGrps, resorted_proc_grps ); + // iterate over all process group definitions - for( std::set::const_iterator it = - m_globDefs.procGrps.begin(); - it != m_globDefs.procGrps.end() && !error; it++ ) + for( resorted_proc_grps_t::const_iterator it = + resorted_proc_grps.begin(); it != resorted_proc_grps.end(); + it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefProcessGroupS record = *it; + DefRec_DefProcessGroupS record = **it; // inflate group members m_procGrps->inflateMembers( record.members ); @@ -1535,16 +1582,28 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefSclFile: { + // resort scl file definitions + // + + typedef + std::set + resorted_scl_files_t; + + resorted_scl_files_t resorted_scl_files; + + resort_glob_defs( + m_globDefs.sclFiles, resorted_scl_files ); + // iterate over all scl file definitions - for( std::set::const_iterator it = - m_globDefs.sclFiles.begin(); - it != m_globDefs.sclFiles.end() && !error; it++ ) + for( resorted_scl_files_t::const_iterator it = + resorted_scl_files.begin(); it != resorted_scl_files.end(); + it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefSclFileS record = *it; + DefRec_DefSclFileS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( HooksC::Record_DefSclFile, @@ -1562,16 +1621,28 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefScl: { + // resort scl definitions + // + + typedef + std::set + resorted_scls_t; + + resorted_scls_t resorted_scls; + + resort_glob_defs( + m_globDefs.scls, resorted_scls ); + // iterate over all scl definitions - for( std::set::const_iterator it = - m_globDefs.scls.begin(); - it != m_globDefs.scls.end() && !error; it++ ) + for( resorted_scls_t::const_iterator it = + resorted_scls.begin(); it != resorted_scls.end(); + it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefSclS record = *it; + DefRec_DefSclS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( HooksC::Record_DefScl, 5, @@ -1589,16 +1660,28 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefFileGroup: { + // resort file group definitions + // + + typedef + std::set + resorted_file_grps_t; + + resorted_file_grps_t resorted_file_grps; + + resort_glob_defs( + m_globDefs.fileGrps, resorted_file_grps ); + // iterate over all file group definitions - for( std::set::const_iterator it = - m_globDefs.fileGrps.begin(); - it != m_globDefs.fileGrps.end() && !error; it++ ) + for( resorted_file_grps_t::const_iterator it = + resorted_file_grps.begin(); it != resorted_file_grps.end(); + it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefFileGroupS record = *it; + DefRec_DefFileGroupS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( HooksC::Record_DefFileGroup, @@ -1615,16 +1698,27 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefFile: { + // resort file definitions + // + + typedef + std::set + resorted_files_t; + + resorted_files_t resorted_files; + + resort_glob_defs( + m_globDefs.files, resorted_files ); + // iterate over all file definitions - for( std::set::const_iterator it = - m_globDefs.files.begin(); - it != m_globDefs.files.end() && !error; it++ ) + for( resorted_files_t::const_iterator it = + resorted_files.begin(); it != resorted_files.end(); it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefFileS record = *it; + DefRec_DefFileS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( HooksC::Record_DefFile, 5, @@ -1642,16 +1736,28 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefFunctionGroup: { + // resort function group definitions + // + + typedef + std::set + resorted_func_grps_t; + + resorted_func_grps_t resorted_func_grps; + + resort_glob_defs( + m_globDefs.funcGrps, resorted_func_grps ); + // iterate over all function group definitions - for( std::set::const_iterator - it = m_globDefs.funcGrps.begin(); - it != m_globDefs.funcGrps.end() && !error; it++ ) + for( resorted_func_grps_t::const_iterator it = + resorted_func_grps.begin(); it != resorted_func_grps.end(); + it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefFunctionGroupS record = *it; + DefRec_DefFunctionGroupS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( @@ -1668,16 +1774,28 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefFunction: { + // resort function definitions + // + + typedef + std::set + resorted_funcs_t; + + resorted_funcs_t resorted_funcs; + + resort_glob_defs( + m_globDefs.funcs, resorted_funcs ); + // iterate over all function definitions - for( std::set::const_iterator it = - m_globDefs.funcs.begin(); - it != m_globDefs.funcs.end() && !error; it++ ) + for( resorted_funcs_t::const_iterator it = + resorted_funcs.begin(); it != resorted_funcs.end(); + it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefFunctionS record = *it; + DefRec_DefFunctionS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( HooksC::Record_DefFunction, @@ -1695,16 +1813,28 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefCollOp: { + // resort collop. definitions + // + + typedef + std::set + resorted_collops_t; + + resorted_collops_t resorted_collops; + + resort_glob_defs( + m_globDefs.collops, resorted_collops ); + // iterate over all collop. definitions - for( std::set::const_iterator - it = m_globDefs.collops.begin(); - it != m_globDefs.collops.end() && !error; it++ ) + for( resorted_collops_t::const_iterator it = + resorted_collops.begin(); it != resorted_collops.end(); + it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefCollOpS record = *it; + DefRec_DefCollOpS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( HooksC::Record_DefCollOp, 5, @@ -1722,16 +1852,28 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefCounterGroup: { + // resort counter group definitions + // + + typedef + std::set + resorted_cntr_grps_t; + + resorted_cntr_grps_t resorted_cntr_grps; + + resort_glob_defs( + m_globDefs.cntrGrps, resorted_cntr_grps ); + // iterate over all counter group definitions - for( std::set::const_iterator - it = m_globDefs.cntrGrps.begin(); - it != m_globDefs.cntrGrps.end() && !error; it++ ) + for( resorted_cntr_grps_t::const_iterator it = + resorted_cntr_grps.begin(); it != resorted_cntr_grps.end(); + it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefCounterGroupS record = *it; + DefRec_DefCounterGroupS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( @@ -1748,16 +1890,28 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefCounter: { + // resort counter definitions + // + + typedef + std::set + resorted_cntrs_t; + + resorted_cntrs_t resorted_cntrs; + + resort_glob_defs( + m_globDefs.cntrs, resorted_cntrs ); + // iterate over all counter definitions - for( std::set::const_iterator it = - m_globDefs.cntrs.begin(); - it != m_globDefs.cntrs.end() && !error; it++ ) + for( resorted_cntrs_t::const_iterator it = + resorted_cntrs.begin(); it != resorted_cntrs.end(); + it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefCounterS record = *it; + DefRec_DefCounterS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( HooksC::Record_DefCounter, @@ -1777,16 +1931,28 @@ DefinitionsC::writeGlobal() } case DEF_REC_TYPE__DefKeyValue: { - // iterate over all function definitions - for( std::set::const_iterator it = - m_globDefs.keyVals.begin(); - it != m_globDefs.keyVals.end() && !error; it++ ) + // resort key-value definitions + // + + typedef + std::set + resorted_keyvals_t; + + resorted_keyvals_t resorted_keyvals; + + resort_glob_defs( + m_globDefs.keyVals, resorted_keyvals ); + + // iterate over all key-value definitions + for( resorted_keyvals_t::const_iterator it = + resorted_keyvals.begin(); it != resorted_keyvals.end(); + it++ ) { bool do_write = true; // get copy of definition record in order that hook(s) can // modify it - DefRec_DefKeyValueS record = *it; + DefRec_DefKeyValueS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( HooksC::Record_DefKeyValue, @@ -1940,8 +2106,7 @@ DefinitionsC::CommentsC::processLocal( // search for already created global definition comment std::set::const_iterator it = - std::find( glob_comments.begin(), glob_comments.end(), - new_comment ); + glob_comments.find( new_comment ); // add global definition comment to set, if not found if( it == glob_comments.end() ) diff --git a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs.h b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs.h index f349d676cc..d6995c292e 100644 --- a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs.h +++ b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs.h @@ -14,6 +14,7 @@ #define _VT_UNIFY_DEFS_H_ #include "vt_unify_defs_recs.h" +#include "vt_unify_lvector.hh" #include "vt_unify_usrcom.h" #include "vt_inttypes.h" @@ -341,11 +342,11 @@ private: // read local definitions of certain single stream bool readLocal( const uint32_t & streamId, - std::vector & locDefs ); + LargeVectorC & locDefs ); // process local definitions // (i.e. create global tokens) - bool processLocal( const std::vector & locDefs ); + bool processLocal( const LargeVectorC & locDefs ); // write global definitions bool writeGlobal(); diff --git a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs_recs.h b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs_recs.h index 478621364f..595ba35b59 100644 --- a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs_recs.h +++ b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs_recs.h @@ -52,6 +52,18 @@ typedef enum // struct DefRec_BaseS { + // + // compare structure for final sort + // + struct SortS + { + bool operator()( const DefRec_BaseS * a, const DefRec_BaseS * b ) const + { + return a->deftoken < b->deftoken; + } + + }; + DefRec_BaseS( DefRecTypeT _dtype ) : dtype( _dtype ), loccpuid( 0 ), deftoken( 0 ) {} DefRec_BaseS( const DefRecTypeT & _dtype, const uint32_t & _loccpuid, @@ -67,11 +79,6 @@ struct DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator<( const DefRec_BaseS & a ) const - { - return deftoken < a.deftoken; - } - DefRecTypeT dtype; uint32_t loccpuid; uint32_t deftoken; @@ -83,6 +90,22 @@ struct DefRec_BaseS // struct DefRec_DefCommentS : DefRec_BaseS { + // + // compare structure for final sort + // + struct SortS + { + bool operator()( const DefRec_DefCommentS * a, + const DefRec_DefCommentS * b ) const + { + if( a->type == b->type ) + return a->deftoken < b->deftoken; // order index + else + return a->type < b->type; + } + + }; + typedef enum { TYPE_START_TIME, TYPE_STOP_TIME, TYPE_VT, TYPE_USER, @@ -104,16 +127,11 @@ struct DefRec_DefCommentS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefCommentS & a ) const - { - return ( type == a.type && - comment.compare( a.comment ) == 0 ); - } - + // operator for searching bool operator<( const DefRec_DefCommentS & a ) const { if( type == a.type ) - return deftoken < a.deftoken; // order index + return comment < a.comment; else return type < a.type; } @@ -201,6 +219,24 @@ struct DefRec_DefTimeRangeS : DefRec_BaseS // struct DefRec_DefProcessS : DefRec_BaseS { + // + // compare structure for final sort + // + struct SortS + { + bool operator()( const DefRec_DefProcessS * a, + const DefRec_DefProcessS * b ) const + { + if( ( a->deftoken & VT_TRACEID_BITMASK ) == + ( b->deftoken & VT_TRACEID_BITMASK ) ) + return a->deftoken < b->deftoken; + else + return ( a->deftoken & VT_TRACEID_BITMASK ) < + ( b->deftoken & VT_TRACEID_BITMASK ); + } + + }; + DefRec_DefProcessS() : DefRec_BaseS( DEF_REC_TYPE__DefProcess ), parent( 0 ) {} @@ -217,14 +253,13 @@ struct DefRec_DefProcessS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI + // operator for searching bool operator<( const DefRec_DefProcessS & a ) const { - if( ( deftoken & VT_TRACEID_BITMASK ) == - ( a.deftoken & VT_TRACEID_BITMASK ) ) - return deftoken < a.deftoken; + if( parent == a.parent ) + return name < a.name; else - return ( deftoken & VT_TRACEID_BITMASK ) < - ( a.deftoken & VT_TRACEID_BITMASK ); + return parent < a.parent; } std::string name; @@ -237,6 +272,22 @@ struct DefRec_DefProcessS : DefRec_BaseS // struct DefRec_DefProcessGroupS : DefRec_BaseS { + // + // compare structure for final sort + // + struct SortS + { + bool operator()( const DefRec_DefProcessGroupS * a, + const DefRec_DefProcessGroupS * b ) const + { + if( a->type == b->type ) + return a->deftoken < b->deftoken; + else + return a->type < b->type; + } + + }; + typedef enum { TYPE_NODE, TYPE_MPI_COMM_WORLD, TYPE_MPI_COMM_SELF, TYPE_MPI_COMM_OTHER, @@ -273,19 +324,24 @@ struct DefRec_DefProcessGroupS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefProcessGroupS & a ) const - { - return ( type == a.type && - members == a.members && - name.compare( a.name ) == 0 ); - } - + // operator for searching bool operator<( const DefRec_DefProcessGroupS & a ) const { if( type == a.type ) - return deftoken < a.deftoken; + { + if( members == a.members ) + { + return name < a.name; + } + else + { + return members < a.members; + } + } else + { return type < a.type; + } } ProcessGroupTypeT type; @@ -314,9 +370,10 @@ struct DefRec_DefSclFileS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefSclFileS & a ) const + // operator for searching + bool operator<( const DefRec_DefSclFileS & a ) const { - return filename.compare( a.filename ) == 0; + return filename < a.filename; } std::string filename; @@ -344,10 +401,13 @@ struct DefRec_DefSclS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefSclS & a ) const + // operator for searching + bool operator<( const DefRec_DefSclS & a ) const { - return ( sclfile == a.sclfile && - sclline == a.sclline ); + if( sclfile == a.sclfile ) + return sclline < a.sclline; + else + return sclfile < a.sclfile; } uint32_t sclfile; @@ -375,9 +435,10 @@ struct DefRec_DefFileGroupS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefFileGroupS & a ) const + // operator for searching + bool operator<( const DefRec_DefFileGroupS & a ) const { - return name.compare( a.name ) == 0; + return name < a.name; } std::string name; @@ -405,10 +466,13 @@ struct DefRec_DefFileS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefFileS & a ) const + // operator for searching + bool operator<( const DefRec_DefFileS & a ) const { - return ( group == a.group && - name.compare( a.name ) == 0 ); + if( group == a.group ) + return name < a.name; + else + return group < a.group; } std::string name; @@ -436,9 +500,10 @@ struct DefRec_DefFunctionGroupS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefFunctionGroupS & a ) const + // operator for searching + bool operator<( const DefRec_DefFunctionGroupS & a ) const { - return name.compare( a.name ) == 0; + return name < a.name; } std::string name; @@ -467,11 +532,24 @@ struct DefRec_DefFunctionS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefFunctionS & a ) const + // operator for searching + bool operator<( const DefRec_DefFunctionS & a ) const { - return ( group == a.group && - scltoken == a.scltoken && - name.compare( a.name ) == 0 ); + if( group == a.group ) + { + if( scltoken == a.scltoken ) + { + return name < a.name; + } + else + { + return scltoken < a.scltoken; + } + } + else + { + return group < a.group; + } } std::string name; @@ -501,10 +579,13 @@ struct DefRec_DefCollOpS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefCollOpS & a ) const + // operator for searching + bool operator<( const DefRec_DefCollOpS & a ) const { - return ( type == a.type && - name.compare( a.name ) == 0 ); + if( type == a.type ) + return name < a.name; + else + return type < a.type; } std::string name; @@ -532,9 +613,10 @@ struct DefRec_DefCounterGroupS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefCounterGroupS & a ) const + // operator for searching + bool operator<( const DefRec_DefCounterGroupS & a ) const { - return name.compare( a.name ) == 0; + return name < a.name; } std::string name; @@ -564,12 +646,31 @@ struct DefRec_DefCounterS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefCounterS & a ) const + // operator for searching + bool operator<( const DefRec_DefCounterS & a ) const { - return ( properties == a.properties && - group == a.group && - name.compare( a.name ) == 0 && - unit.compare( a.unit ) == 0 ); + if( properties == a.properties ) + { + if( group == a.group ) + { + if( name == a.name ) + { + return unit < a.unit; + } + else + { + return name < a.name; + } + } + else + { + return group < a.group; + } + } + else + { + return properties < a.properties; + } } std::string name; @@ -600,10 +701,13 @@ struct DefRec_DefKeyValueS : DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefKeyValueS & a ) const + // operator for searching + bool operator<( const DefRec_DefKeyValueS & a ) const { - return ( type == a.type && - name.compare( a.name ) == 0 ); + if( type == a.type ) + return name < a.name; + else + return type < a.type; } OTF_Type type; @@ -616,6 +720,22 @@ struct DefRec_DefKeyValueS : DefRec_BaseS // struct DefRec_DefMarkerS: DefRec_BaseS { + // + // compare structure for final sort + // + struct SortS + { + bool operator()( const DefRec_DefMarkerS * a, + const DefRec_DefMarkerS * b ) const + { + if( a->type == b->type ) + return a->deftoken < b->deftoken; + else + return a->type < b->type; + } + + }; + DefRec_DefMarkerS() : DefRec_BaseS( DEF_REC_TYPE__DefMarker ), type( 0 ) {} @@ -632,16 +752,11 @@ struct DefRec_DefMarkerS: DefRec_BaseS VT_MPI_INT & bufferPos ); #endif // VT_MPI - bool operator==( const DefRec_DefMarkerS & a ) const - { - return ( type == a.type && - name.compare( a.name ) == 0 ); - } - + // operator for searching bool operator<( const DefRec_DefMarkerS & a ) const { if( type == a.type ) - return deftoken < a.deftoken; + return name < a.name; else return type < a.type; } diff --git a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_handlers.cc b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_handlers.cc index 11fd0b35a3..b4dd086272 100644 --- a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_handlers.cc +++ b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_handlers.cc @@ -58,7 +58,7 @@ Handle_KeyValueList( const uint32_t & proc, OTF_KeyValueList * kvs ) // int -Handle_DefComment( std::vector * locDefs, +Handle_DefComment( LargeVectorC * locDefs, uint32_t streamid, const char * comment ) { // get common string identifiers as std::string's for more convenient use @@ -148,7 +148,7 @@ Handle_DefComment( std::vector * locDefs, } int -Handle_DefCreator( std::vector * locDefs, +Handle_DefCreator( LargeVectorC * locDefs, uint32_t streamid, const char * creator ) { std::string _creator(creator); @@ -164,7 +164,7 @@ Handle_DefCreator( std::vector * locDefs, } int -Handle_DefTimerResolution( std::vector * locDefs, +Handle_DefTimerResolution( LargeVectorC * locDefs, uint32_t streamid, uint64_t ticksPerSecond ) { // trigger read record hook @@ -178,7 +178,7 @@ Handle_DefTimerResolution( std::vector * locDefs, } int -Handle_DefTimeRange( std::vector * locDefs, +Handle_DefTimeRange( LargeVectorC * locDefs, uint32_t streamid, uint64_t minTime, uint64_t maxTime ) { // trigger read record hook @@ -193,7 +193,7 @@ Handle_DefTimeRange( std::vector * locDefs, } int -Handle_DefProcess( std::vector * locDefs, +Handle_DefProcess( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name, uint32_t parent ) { std::string _name(name); @@ -209,7 +209,7 @@ Handle_DefProcess( std::vector * locDefs, } int -Handle_DefProcessGroup( std::vector * locDefs, +Handle_DefProcessGroup( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name, uint32_t n, uint32_t * array ) { @@ -302,7 +302,7 @@ Handle_DefProcessGroup( std::vector * locDefs, } int -Handle_DefSclFile( std::vector * locDefs, +Handle_DefSclFile( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * filename ) { std::string _filename(filename); @@ -319,7 +319,7 @@ Handle_DefSclFile( std::vector * locDefs, } int -Handle_DefScl( std::vector * locDefs, +Handle_DefScl( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, uint32_t sclfile, uint32_t sclline ) { // trigger read record hook @@ -334,7 +334,7 @@ Handle_DefScl( std::vector * locDefs, } int -Handle_DefFileGroup( std::vector * locDefs, +Handle_DefFileGroup( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name ) { std::string _name(name); @@ -351,7 +351,7 @@ Handle_DefFileGroup( std::vector * locDefs, } int -Handle_DefFile( std::vector * locDefs, +Handle_DefFile( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name, uint32_t group ) { std::string _name(name); @@ -368,7 +368,7 @@ Handle_DefFile( std::vector * locDefs, } int -Handle_DefFunctionGroup( std::vector * locDefs, +Handle_DefFunctionGroup( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name ) { std::string _name(name); @@ -385,7 +385,7 @@ Handle_DefFunctionGroup( std::vector * locDefs, } int -Handle_DefFunction( std::vector * locDefs, +Handle_DefFunction( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name, uint32_t group, uint32_t scltoken ) { @@ -404,7 +404,7 @@ Handle_DefFunction( std::vector * locDefs, } int -Handle_DefCollOp( std::vector * locDefs, +Handle_DefCollOp( LargeVectorC * locDefs, uint32_t streamid, uint32_t collOp, const char * name, uint32_t type ) { std::string _name(name); @@ -421,7 +421,7 @@ Handle_DefCollOp( std::vector * locDefs, } int -Handle_DefCounterGroup( std::vector * locDefs, +Handle_DefCounterGroup( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name ) { std::string _name(name); @@ -438,7 +438,7 @@ Handle_DefCounterGroup( std::vector * locDefs, } int -Handle_DefCounter( std::vector * locDefs, +Handle_DefCounter( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name, uint32_t properties, uint32_t countergroup, const char * unit ) { @@ -458,7 +458,7 @@ Handle_DefCounter( std::vector * locDefs, } int -Handle_DefKeyValue( std::vector * locDefs, +Handle_DefKeyValue( LargeVectorC * locDefs, uint32_t streamid, uint32_t key, OTF_Type type, const char * name, const char * description ) { @@ -479,7 +479,7 @@ Handle_DefKeyValue( std::vector * locDefs, // int -Handle_DefMarker( std::vector * locDefs, +Handle_DefMarker( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name, uint32_t type ) { @@ -497,7 +497,7 @@ Handle_DefMarker( std::vector * locDefs, } int -Handle_MarkerSpot( std::vector * locSpots, +Handle_MarkerSpot( LargeVectorC * locSpots, uint64_t time, uint32_t proc, uint32_t marker, const char * text ) { diff --git a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_handlers.h b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_handlers.h index a84de480ab..5fdd3d10b6 100644 --- a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_handlers.h +++ b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_handlers.h @@ -14,6 +14,7 @@ #define _VT_UNIFY_HANDLERS_H_ #include "vt_unify_defs_recs.h" +#include "vt_unify_lvector.hh" #include "vt_unify_markers.h" #include "otf.h" @@ -25,68 +26,68 @@ void Handle_KeyValueList( const uint32_t & proc, OTF_KeyValueList * kvs ); // definition record handlers // -int Handle_DefComment( std::vector * locDefs, +int Handle_DefComment( LargeVectorC * locDefs, uint32_t streamid, const char * comment ); -int Handle_DefCreator( std::vector * locDefs, +int Handle_DefCreator( LargeVectorC * locDefs, uint32_t streamid, const char * creator ); -int Handle_DefTimerResolution( std::vector * locDefs, +int Handle_DefTimerResolution( LargeVectorC * locDefs, uint32_t streamid, uint64_t ticksPerSecond ); -int Handle_DefTimeRange( std::vector * locDefs, +int Handle_DefTimeRange( LargeVectorC * locDefs, uint32_t streamid, uint64_t minTime, uint64_t maxTime ); -int Handle_DefProcess( std::vector * locDefs, +int Handle_DefProcess( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name, uint32_t parent ); -int Handle_DefProcessGroup( std::vector * locDefs, +int Handle_DefProcessGroup( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name, uint32_t n, uint32_t * array ); -int Handle_DefSclFile( std::vector * locDefs, +int Handle_DefSclFile( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * filename ); -int Handle_DefScl( std::vector * locDefs, +int Handle_DefScl( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, uint32_t sclfile, uint32_t sclline ); -int Handle_DefFileGroup( std::vector * locDefs, +int Handle_DefFileGroup( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name ); -int Handle_DefFile( std::vector * locDefs, +int Handle_DefFile( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name, uint32_t group ); -int Handle_DefFunctionGroup( std::vector * locDefs, +int Handle_DefFunctionGroup( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name ); -int Handle_DefFunction( std::vector * locDefs, +int Handle_DefFunction( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name, uint32_t group, uint32_t scltoken ); -int Handle_DefCollOp( std::vector * locDefs, +int Handle_DefCollOp( LargeVectorC * locDefs, uint32_t streamid, uint32_t collOp, const char * name, uint32_t type ); -int Handle_DefCounterGroup( std::vector * locDefs, +int Handle_DefCounterGroup( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name ); -int Handle_DefCounter( std::vector * locDefs, +int Handle_DefCounter( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name, uint32_t properties, uint32_t countergroup, const char * unit ); -int Handle_DefKeyValue( std::vector * locDefs, +int Handle_DefKeyValue( LargeVectorC * locDefs, uint32_t streamid, uint32_t key, OTF_Type type, const char * name, const char * description ); // marker record handlers // -int Handle_DefMarker( std::vector * locDefs, +int Handle_DefMarker( LargeVectorC * locDefs, uint32_t streamid, uint32_t deftoken, const char * name, uint32_t type ); -int Handle_MarkerSpot( std::vector * locSpots, +int Handle_MarkerSpot( LargeVectorC * locSpots, uint64_t time, uint32_t proc, uint32_t marker, const char * text ); // event record handlers diff --git a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_lvector.hh b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_lvector.hh index 93ea55a09b..1bc21f4399 100644 --- a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_lvector.hh +++ b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_lvector.hh @@ -26,6 +26,8 @@ class LargeVectorC public: typedef typename std::allocator::size_type size_type; + typedef typename std::vector::iterator iterator; + typedef typename std::vector::const_iterator const_iterator; // default chunk size (num. of elements to pre-allocate) static const size_type DEFAULT_CHUNK_SIZE = 100000; @@ -69,6 +71,21 @@ public: m_size = 0; } + // get iterator to the first element + typename std::vector::iterator begin() + { + return m_vector.begin(); + } + + // get iterator to the element following the last element + typename std::vector::iterator end() + { + if( m_size == 0 ) + return m_vector.end(); + else + return m_vector.begin() + m_size; + } + // access the first element T & front() { @@ -101,6 +118,13 @@ public: return m_vector[pos]; } + // get reference to element at specific location (const version) + const T & operator[]( size_type pos ) const + { + assert( pos < m_size ); + return m_vector[pos]; + } + private: // actual vector diff --git a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_markers.cc b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_markers.cc index a113538ca4..77b8d94bdf 100644 --- a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_markers.cc +++ b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_markers.cc @@ -194,10 +194,10 @@ MarkersC::readLocal() VPrint( 2, " Reading local markers\n" ); // vector of local marker definitions - std::vector loc_defs; + LargeVectorC loc_defs; // vector of local marker spots - std::vector loc_spots; + LargeVectorC loc_spots; do { @@ -316,8 +316,8 @@ MarkersC::readLocal() bool MarkersC::readLocal( const uint32_t & streamId, - std::vector & locDefs, - std::vector & locSpots ) + LargeVectorC & locDefs, + LargeVectorC & locSpots ) { bool error = false; @@ -432,16 +432,33 @@ MarkersC::writeGlobal() do { + // resort marker definitions + // + + typedef + std::set + resorted_markers_t; + + resorted_markers_t resorted_markers; + + for( std::set::const_iterator it = + m_globDefs.begin(); it != m_globDefs.end(); it++ ) + { + resorted_markers.insert( &(*it) ); + } + // write global marker definition records // - for( std::set::const_iterator it = - m_globDefs.begin(); it != m_globDefs.end() && !error; it++ ) + + // iterate over all marker definitions + for( resorted_markers_t::const_iterator it = resorted_markers.begin(); + it != resorted_markers.end(); it++ ) { bool do_write = true; // get copy of marker def. record in order that hook(s) can // modify it - DefRec_DefMarkerS record = *it; + DefRec_DefMarkerS record = **it; // trigger write record hook theHooks->triggerWriteRecordHook( HooksC::Record_DefMarker, 5, diff --git a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_markers.h b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_markers.h index e2cb87c39a..c42e47b1bb 100644 --- a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_markers.h +++ b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_markers.h @@ -17,10 +17,10 @@ #include "vt_unify.h" #include "vt_unify_defs_recs.h" +#include "vt_unify_lvector.hh" #include "vt_unify_tkfac.h" #include -#include // // MarkersC class @@ -87,8 +87,8 @@ private: // read local markers of certain stream bool readLocal( const uint32_t & streamId, - std::vector & locDefs, - std::vector & locSpots ); + LargeVectorC & locDefs, + LargeVectorC & locSpots ); // write global markers bool writeGlobal(); @@ -108,7 +108,7 @@ private: std::set m_globDefs; // global marker spots - std::vector m_globSpots; + LargeVectorC m_globSpots; }; diff --git a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_tkfac_scope.hh b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_tkfac_scope.hh index 3f1eb731e5..80ccaeffb8 100644 --- a/ompi/contrib/vt/vt/tools/vtunify/vt_unify_tkfac_scope.hh +++ b/ompi/contrib/vt/vt/tools/vtunify/vt_unify_tkfac_scope.hh @@ -41,8 +41,7 @@ TokenFactoryScopeC::create( const void * localDef ) uint32_t global_token; // search for already created global definition - typename std::set::const_iterator it = - std::find( m_globDefs->begin(), m_globDefs->end(), local_def ); + typename std::set::const_iterator it = m_globDefs->find( local_def ); // get its global token, if found // diff --git a/ompi/contrib/vt/vt/tools/vtwrapper/vt_wrapper.cc b/ompi/contrib/vt/vt/tools/vtwrapper/vt_wrapper.cc index a3a5f7e769..a5086e5f6e 100644 --- a/ompi/contrib/vt/vt/tools/vtwrapper/vt_wrapper.cc +++ b/ompi/contrib/vt/vt/tools/vtwrapper/vt_wrapper.cc @@ -748,7 +748,7 @@ Wrapper::parseCommandLine( int argc, char ** argv ) // -vt:inst, -vt:opari, -vt:tau, -vt:pdt // (processed above; ignore here) // - if( arg.compare("-vt:help") == 0 + if( arg.compare("-vt:help") == 0 || arg.compare("-vt:version") == 0 || arg.compare("-vt:show") == 0 || arg.compare("-vt:verbose") == 0 @@ -772,10 +772,13 @@ Wrapper::parseCommandLine( int argc, char ** argv ) i++; } // - // -vt: + // -vt: // - else if( (m_pConfig->m_eLangType == LANG_CC && arg.compare("-vt:cc") == 0) - || (m_pConfig->m_eLangType == LANG_CXX && arg.compare("-vt:cxx") == 0) + else if( ( m_pConfig->m_eLangType == LANG_CC && arg.compare("-vt:cc") == 0 ) + || ( m_pConfig->m_eLangType == LANG_CXX && + ( arg.compare("-vt:CC") == 0 + || arg.compare("-vt:c++") == 0 + || arg.compare("-vt:cxx") == 0 ) ) || (m_pConfig->m_eLangType == LANG_F77 && arg.compare("-vt:f77") == 0) || (m_pConfig->m_eLangType == LANG_F90 && arg.compare("-vt:f90") == 0) ) { diff --git a/ompi/contrib/vt/vt/vtlib/vt_cudart.c b/ompi/contrib/vt/vt/vtlib/vt_cudart.c index f1a7e49c3f..a7bd27d107 100644 --- a/ompi/contrib/vt/vt/vtlib/vt_cudart.c +++ b/ompi/contrib/vt/vt/vtlib/vt_cudart.c @@ -526,7 +526,7 @@ void vt_cudartwrap_init(void) maxEvtNum = 0; trace_events = 0; /*asyncBufSize = (sizeof(VTCUDAKernel) > sizeof(VTCUDAMemcpy)) ? sizeof(VTCUDAKernel) : sizeof(VTCUDAMemcpy);*/ - asyncBufSize = sizeof(VTCUDAKernel); + asyncBufSize = sizeof(VTCUDAKernel) + sizeof(VTCUDAknconf); } #endif @@ -896,7 +896,8 @@ static uint64_t VTCUDAsynchronizeEvt(cudaEvent_t syncEvt) { /* Record and synchronization events on stream 0 (prior to FERMI) - see NVIDIA CUDA Programming Guide 2.3, sections 3.2.6.1 and 3.2.6.2 + see NVIDIA CUDA Programming Guide (4.0), Chapter 3. -> CUDA C Runtime -> + subsection Events (3.2.5.6) -> "Events in stream zero are recorded after all preceding tasks/commands from all streams are completed by the device." */ cudaEventRecord_ptr(syncEvt, 0); @@ -907,14 +908,13 @@ static uint64_t VTCUDAsynchronizeEvt(cudaEvent_t syncEvt) /* error handling */ if(cudaSuccess != ret){ if(cudaErrorInvalidResourceHandle == ret){ - vt_warning("[CUDART] Synchronization stop event is invalid. Context has " - "been destroyed, \nbefore asynchronous tasks could be flushed! " + vt_warning("[CUDART] Synchronization stop event is invalid. Context has" + " been destroyed, \nbefore asynchronous tasks could be flushed! " "Traces might be incomplete!"); - return (uint64_t)-1; }else{ - vt_error_msg("[CUDA Error <%s>:%i] %s", __FILE__,__LINE__, - cudaGetErrorString_ptr(ret)); + checkCUDACall(ret, NULL); } + return (uint64_t)-1; } } @@ -2337,11 +2337,11 @@ cudaError_t cudaLaunch(const char *entry) /* get kernel element */ e = getKernelElement(entry); - if(e != NULL){ - - /* check if the kernel will be traced on the correct thread */ - vtDev = VTCUDAgetDevice(ptid); - + + /* get the active device */ + vtDev = VTCUDAgetDevice(ptid); + + if(e != NULL){ /* check the kernel configure stack for last configured kernel */ if(vtDev->conf_stack == vtDev->buf_size){ ret = VT_LIBWRAP_FUNC_CALL(vt_cudart_lw, (entry)); @@ -2360,8 +2360,6 @@ cudaError_t cudaLaunch(const char *entry) kernel->blocksPerGrid = vtKnconf->blocksPerGrid; kernel->threadsPerBlock = vtKnconf->threadsPerBlock; kernel->strm = vtKnconf->strm; - - vtDev->conf_stack = vtDev->conf_stack + sizeof(VTCUDAknconf); } vt_cntl_msg(3, "[CUDART] Launch '%s' (device %d, tid %d, rid %d, strm %d)", @@ -2404,8 +2402,13 @@ cudaError_t cudaLaunch(const char *entry) #endif checkCUDACall(cudaEventRecord_ptr(kernel->evt->strt, kernel->strm->stream), "cudaEventRecord(startEvt, strmOfLastKernel) failed!"); - } - } + + }/* e != NULL */ + + /* pop this kernel from configure stack */ + vtDev->conf_stack = vtDev->conf_stack + sizeof(VTCUDAknconf); + + } /* trace_kernels && do_trace */ } /* call cudaLaunch itself */