2.0 (revision 4611)
OTF2_Callbacks.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Score-P software (http://www.score-p.org)
3  *
4  * Copyright (c) 2009-2012,
5  * RWTH Aachen University, Germany
6  *
7  * Copyright (c) 2009-2012,
8  * Gesellschaft fuer numerische Simulation mbH Braunschweig, Germany
9  *
10  * Copyright (c) 2009-2014,
11  * Technische Universitaet Dresden, Germany
12  *
13  * Copyright (c) 2009-2012,
14  * University of Oregon, Eugene, USA
15  *
16  * Copyright (c) 2009-2012,
17  * Forschungszentrum Juelich GmbH, Germany
18  *
19  * Copyright (c) 2009-2012,
20  * German Research School for Simulation Sciences GmbH, Juelich/Aachen, Germany
21  *
22  * Copyright (c) 2009-2012,
23  * Technische Universitaet Muenchen, Germany
24  *
25  * This software may be modified and distributed under the terms of
26  * a BSD-style license. See the COPYING file in the package base
27  * directory for details.
28  *
29  */
30 
31 
32 #ifndef OTF2_CALLBACKS_H
33 #define OTF2_CALLBACKS_H
34 
35 
43 #ifndef __cplusplus
44 #include <stdbool.h>
45 #endif
46 
47 
48 #include <otf2/OTF2_ErrorCodes.h>
49 
50 
52 
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif /* __cplusplus */
57 
58 
109 typedef OTF2_FlushType
110 ( *OTF2_PreFlushCallback )( void* userData,
111  OTF2_FileType fileType,
112  OTF2_LocationRef location,
113  void* callerData,
114  bool final );
115 
116 
132 typedef OTF2_TimeStamp
133 ( *OTF2_PostFlushCallback )( void* userData,
134  OTF2_FileType fileType,
135  OTF2_LocationRef location );
136 
137 
145 typedef struct OTF2_FlushCallbacks
146 {
152 
153 
196 typedef void*
197 ( *OTF2_MemoryAllocate )( void* userData,
198  OTF2_FileType fileType,
199  OTF2_LocationRef location,
200  void** perBufferData,
201  uint64_t chunkSize );
202 
203 
227 typedef void
228 ( *OTF2_MemoryFreeAll )( void* userData,
229  OTF2_FileType fileType,
230  OTF2_LocationRef location,
231  void** perBufferData,
232  bool final );
233 
234 
239 typedef struct OTF2_MemoryCallbacks
240 {
246 
247 
301 
302 
303 #define OTF2_COLLECTIVES_ROOT 0
304 
305 
313 typedef OTF2_CallbackCode
314 ( *OTF2_Collectives_GetSize )( void* userData,
315  OTF2_CollectiveContext* commContext,
316  uint32_t* size );
317 
318 
327 typedef OTF2_CallbackCode
328 ( *OTF2_Collectives_GetRank )( void* userData,
329  OTF2_CollectiveContext* commContext,
330  uint32_t* rank );
331 
332 
343 typedef OTF2_CallbackCode
344 ( *OTF2_Collectives_CreateLocalComm )( void* userData,
345  OTF2_CollectiveContext** localCommContext,
346  OTF2_CollectiveContext* globalCommContext,
347  uint32_t globalRank,
348  uint32_t globalSize,
349  uint32_t localRank,
350  uint32_t localSize,
351  uint32_t fileNumber,
352  uint32_t numberOfFiles );
353 
354 
362 typedef OTF2_CallbackCode
363 ( *OTF2_Collectives_FreeLocalComm )( void* userData,
364  OTF2_CollectiveContext* localCommContext );
365 
366 
373 typedef OTF2_CallbackCode
374 ( *OTF2_Collectives_Barrier )( void* userData,
375  OTF2_CollectiveContext* commContext );
376 
377 
384 typedef OTF2_CallbackCode
385 ( *OTF2_Collectives_Bcast )( void* userData,
386  OTF2_CollectiveContext* commContext,
387  void* data,
388  uint32_t numberElements,
389  OTF2_Type type,
390  uint32_t root );
391 
392 
401 typedef OTF2_CallbackCode
402 ( *OTF2_Collectives_Gather )( void* userData,
403  OTF2_CollectiveContext* commContext,
404  const void* inData,
405  void* outData,
406  uint32_t numberElements,
407  OTF2_Type type,
408  uint32_t root );
409 
410 
419 typedef OTF2_CallbackCode
420 ( *OTF2_Collectives_Gatherv )( void* userData,
421  OTF2_CollectiveContext* commContext,
422  const void* inData,
423  uint32_t inElements,
424  void* outData,
425  const uint32_t* outElements,
426  OTF2_Type type,
427  uint32_t root );
428 
429 
438 typedef OTF2_CallbackCode
439 ( *OTF2_Collectives_Scatter )( void* userData,
440  OTF2_CollectiveContext* commContext,
441  const void* inData,
442  void* outData,
443  uint32_t numberElements,
444  OTF2_Type type,
445  uint32_t root );
446 
447 
456 typedef OTF2_CallbackCode
457 ( *OTF2_Collectives_Scatterv )( void* userData,
458  OTF2_CollectiveContext* commContext,
459  const void* inData,
460  const uint32_t* inElements,
461  void* outData,
462  uint32_t outElements,
463  OTF2_Type type,
464  uint32_t root );
465 
466 
475 typedef void
476 ( *OTF2_Collectives_Release )( void* userData,
477  OTF2_CollectiveContext* globalCommContext,
478  OTF2_CollectiveContext* localCommContext );
479 
480 
486 {
487  OTF2_Collectives_Release otf2_release;
488  OTF2_Collectives_GetSize otf2_get_size;
489  OTF2_Collectives_GetRank otf2_get_rank;
490  OTF2_Collectives_CreateLocalComm otf2_create_local_comm;
491  OTF2_Collectives_FreeLocalComm otf2_free_local_comm;
492  OTF2_Collectives_Barrier otf2_barrier;
493  OTF2_Collectives_Bcast otf2_bcast;
494  OTF2_Collectives_Gather otf2_gather;
495  OTF2_Collectives_Gatherv otf2_gatherv;
496  OTF2_Collectives_Scatter otf2_scatter;
497  OTF2_Collectives_Scatterv otf2_scatterv;
499 
500 
540 typedef struct OTF2_LockObject* OTF2_Lock;
541 
542 
554 typedef OTF2_CallbackCode
555 ( *OTF2_Locking_Create )( void* userData,
556  OTF2_Lock* lock );
557 
558 
570 typedef OTF2_CallbackCode
571 ( *OTF2_Locking_Destroy )( void* userData,
572  OTF2_Lock lock );
573 
574 
586 typedef OTF2_CallbackCode
587 ( *OTF2_Locking_Lock )( void* userData,
588  OTF2_Lock lock );
589 
590 
602 typedef OTF2_CallbackCode
603 ( *OTF2_Locking_Unlock )( void* userData,
604  OTF2_Lock lock );
605 
606 
623 typedef void
624 ( *OTF2_Locking_Release )( void* userData );
625 
626 
631 typedef struct OTF2_LockingCallbacks
632 {
633  OTF2_Locking_Release otf2_release;
634  OTF2_Locking_Create otf2_create;
635  OTF2_Locking_Destroy otf2_destroy;
636  OTF2_Locking_Lock otf2_lock;
637  OTF2_Locking_Unlock otf2_unlock;
639 
640 
651 #ifdef __cplusplus
652 }
653 #endif /* __cplusplus */
654 
655 
656 #endif /* !OTF2_CALLBACKS_H */
OTF2_CallbackCode(* OTF2_Collectives_Bcast)(void *userData, OTF2_CollectiveContext *commContext, void *data, uint32_t numberElements, OTF2_Type type, uint32_t root)
Performs a broadcast collective on the given communication context.
Definition: OTF2_Callbacks.h:385
uint64_t OTF2_LocationRef
Type used to indicate a reference to a Location definition.
Definition: OTF2_GeneralDefinitions.h:125
uint8_t OTF2_Type
Wrapper for enum OTF2_Type_enum.
Definition: OTF2_GeneralDefinitions.h:525
uint8_t OTF2_FileType
Wrapper for enum OTF2_FileType_enum.
Definition: OTF2_GeneralDefinitions.h:401
OTF2_PostFlushCallback otf2_post_flush
Callback which is called after a flush.
Definition: OTF2_Callbacks.h:150
Struct which holds all collective callbacks.
Definition: OTF2_Callbacks.h:485
OTF2_CallbackCode(* OTF2_Locking_Destroy)(void *userData, OTF2_Lock lock)
Destroys a locking object.
Definition: OTF2_Callbacks.h:571
Structure holding the flush callbacks.
Definition: OTF2_Callbacks.h:145
This header file provides general definitions which should be accessible in all internal and external...
void(* OTF2_MemoryFreeAll)(void *userData, OTF2_FileType fileType, OTF2_LocationRef location, void **perBufferData, bool final)
Function pointer to release all allocated chunks.
Definition: OTF2_Callbacks.h:228
OTF2_CallbackCode(* OTF2_Collectives_Barrier)(void *userData, OTF2_CollectiveContext *commContext)
Performs a barrier collective on the given communication context.
Definition: OTF2_Callbacks.h:374
uint64_t OTF2_TimeStamp
OTF2 time stamp.
Definition: OTF2_GeneralDefinitions.h:95
uint8_t OTF2_FlushType
Defines whether the recorded data is flushed to a file or not. Please see OTF2_FlushType_enum for a d...
Definition: OTF2_GeneralDefinitions.h:341
void(* OTF2_Collectives_Release)(void *userData, OTF2_CollectiveContext *globalCommContext, OTF2_CollectiveContext *localCommContext)
Optionally called in OTF2_Archive_Close or OTF2_Reader_Close respectively.
Definition: OTF2_Callbacks.h:476
OTF2_CallbackCode
Return value to indicate that the record reading should be interrupted.
Definition: OTF2_GeneralDefinitions.h:318
struct OTF2_LockObject * OTF2_Lock
Opaque type for a locking object.
Definition: OTF2_Callbacks.h:540
OTF2_CallbackCode(* OTF2_Collectives_Scatterv)(void *userData, OTF2_CollectiveContext *commContext, const void *inData, const uint32_t *inElements, void *outData, uint32_t outElements, OTF2_Type type, uint32_t root)
Performs a scatter collective on the given communication context where each ranks contribute differen...
Definition: OTF2_Callbacks.h:457
OTF2_CallbackCode(* OTF2_Collectives_Gather)(void *userData, OTF2_CollectiveContext *commContext, const void *inData, void *outData, uint32_t numberElements, OTF2_Type type, uint32_t root)
Performs a gather collective on the given communication context where each ranks contribute the same ...
Definition: OTF2_Callbacks.h:402
Struct which holds all locking callbacks.
Definition: OTF2_Callbacks.h:631
OTF2_CallbackCode(* OTF2_Collectives_Gatherv)(void *userData, OTF2_CollectiveContext *commContext, const void *inData, uint32_t inElements, void *outData, const uint32_t *outElements, OTF2_Type type, uint32_t root)
Performs a gather collective on the given communication context where each ranks contribute different...
Definition: OTF2_Callbacks.h:420
OTF2_MemoryFreeAll otf2_free_all
Callback which is called to release all previous allocated chunks.
Definition: OTF2_Callbacks.h:244
OTF2_CallbackCode(* OTF2_Locking_Lock)(void *userData, OTF2_Lock lock)
Locks a locking object.
Definition: OTF2_Callbacks.h:587
OTF2_PreFlushCallback otf2_pre_flush
Callback which is called prior a flush.
Definition: OTF2_Callbacks.h:148
OTF2_CallbackCode(* OTF2_Collectives_FreeLocalComm)(void *userData, OTF2_CollectiveContext *localCommContext)
Destroys the communication context previous created by the OTF2_Collectives_CreateLocalComm callback...
Definition: OTF2_Callbacks.h:363
OTF2_MemoryAllocate otf2_allocate
Callback which is called to allocate a new chunk.
Definition: OTF2_Callbacks.h:242
OTF2_CallbackCode(* OTF2_Locking_Unlock)(void *userData, OTF2_Lock lock)
Unlocks a locking object.
Definition: OTF2_Callbacks.h:603
Structure holding the memory callbacks.
Definition: OTF2_Callbacks.h:239
OTF2_CallbackCode(* OTF2_Collectives_CreateLocalComm)(void *userData, OTF2_CollectiveContext **localCommContext, OTF2_CollectiveContext *globalCommContext, uint32_t globalRank, uint32_t globalSize, uint32_t localRank, uint32_t localSize, uint32_t fileNumber, uint32_t numberOfFiles)
Create a new disjoint partitioning of the the globalCommContext communication context. numberOfFiles denotes the number of the partitions. fileNumber denotes in which of the partitions this OTF2_Archive should belong. localSize is the size of this partition and localRank the rank of this OTF2_Archive in the partition.
Definition: OTF2_Callbacks.h:344
OTF2_TimeStamp(* OTF2_PostFlushCallback)(void *userData, OTF2_FileType fileType, OTF2_LocationRef location)
Definition for the post flush callback.
Definition: OTF2_Callbacks.h:133
struct OTF2_CollectiveContext OTF2_CollectiveContext
User provided type for collective groups.
Definition: OTF2_Callbacks.h:300
OTF2_CallbackCode(* OTF2_Locking_Create)(void *userData, OTF2_Lock *lock)
Creates a new locking object.
Definition: OTF2_Callbacks.h:555
OTF2_CallbackCode(* OTF2_Collectives_GetRank)(void *userData, OTF2_CollectiveContext *commContext, uint32_t *rank)
Returns the rank of this OTF2_Archive objects in this communication context. A number between 0 and o...
Definition: OTF2_Callbacks.h:328
void(* OTF2_Locking_Release)(void *userData)
Signals the end of life of the OTF2_Archive or OTF2_Reader object to the locking callbacks.
Definition: OTF2_Callbacks.h:624
void *(* OTF2_MemoryAllocate)(void *userData, OTF2_FileType fileType, OTF2_LocationRef location, void **perBufferData, uint64_t chunkSize)
Function pointer for allocating memory for chunks.
Definition: OTF2_Callbacks.h:197
Error codes and error handling.
OTF2_CallbackCode(* OTF2_Collectives_GetSize)(void *userData, OTF2_CollectiveContext *commContext, uint32_t *size)
Returns the number of OTF2_Archive objects operating in this communication context.
Definition: OTF2_Callbacks.h:314
OTF2_CallbackCode(* OTF2_Collectives_Scatter)(void *userData, OTF2_CollectiveContext *commContext, const void *inData, void *outData, uint32_t numberElements, OTF2_Type type, uint32_t root)
Performs a scatter collective on the given communication context where each ranks contribute the same...
Definition: OTF2_Callbacks.h:439
OTF2_FlushType(* OTF2_PreFlushCallback)(void *userData, OTF2_FileType fileType, OTF2_LocationRef location, void *callerData, bool final)
Definition for the pre flush callback.
Definition: OTF2_Callbacks.h:110