3.0-rc2 (revision 337012f1)
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, 2021,
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 
116 typedef OTF2_FlushType
117 ( * OTF2_PreFlushCallback )( void* userData,
118  OTF2_FileType fileType,
119  OTF2_LocationRef location,
120  void* callerData,
121  bool final );
122 
123 
139 typedef OTF2_TimeStamp
140 ( * OTF2_PostFlushCallback )( void* userData,
141  OTF2_FileType fileType,
142  OTF2_LocationRef location );
143 
144 
152 typedef struct OTF2_FlushCallbacks
153 {
159 
160 
203 typedef void*
204 ( * OTF2_MemoryAllocate )( void* userData,
205  OTF2_FileType fileType,
206  OTF2_LocationRef location,
207  void** perBufferData,
208  uint64_t chunkSize );
209 
210 
234 typedef void
235 ( * OTF2_MemoryFreeAll )( void* userData,
236  OTF2_FileType fileType,
237  OTF2_LocationRef location,
238  void** perBufferData,
239  bool final );
240 
241 
246 typedef struct OTF2_MemoryCallbacks
247 {
253 
254 
311 
315 #define OTF2_COLLECTIVES_ROOT 0
316 
317 
325 typedef OTF2_CallbackCode
326 ( * OTF2_Collectives_GetSize )( void* userData,
327  OTF2_CollectiveContext* commContext,
328  uint32_t* size );
329 
330 
339 typedef OTF2_CallbackCode
340 ( * OTF2_Collectives_GetRank )( void* userData,
341  OTF2_CollectiveContext* commContext,
342  uint32_t* rank );
343 
344 
355 typedef OTF2_CallbackCode
356 ( * OTF2_Collectives_CreateLocalComm )( void* userData,
357  OTF2_CollectiveContext** localCommContext,
358  OTF2_CollectiveContext* globalCommContext,
359  uint32_t globalRank,
360  uint32_t globalSize,
361  uint32_t localRank,
362  uint32_t localSize,
363  uint32_t fileNumber,
364  uint32_t numberOfFiles );
365 
366 
374 typedef OTF2_CallbackCode
375 ( * OTF2_Collectives_FreeLocalComm )( void* userData,
376  OTF2_CollectiveContext* localCommContext );
377 
378 
385 typedef OTF2_CallbackCode
386 ( * OTF2_Collectives_Barrier )( void* userData,
387  OTF2_CollectiveContext* commContext );
388 
389 
396 typedef OTF2_CallbackCode
397 ( * OTF2_Collectives_Bcast )( void* userData,
398  OTF2_CollectiveContext* commContext,
399  void* data,
400  uint32_t numberElements,
401  OTF2_Type type,
402  uint32_t root );
403 
404 
413 typedef OTF2_CallbackCode
414 ( * OTF2_Collectives_Gather )( void* userData,
415  OTF2_CollectiveContext* commContext,
416  const void* inData,
417  void* outData,
418  uint32_t numberElements,
419  OTF2_Type type,
420  uint32_t root );
421 
422 
431 typedef OTF2_CallbackCode
432 ( * OTF2_Collectives_Gatherv )( void* userData,
433  OTF2_CollectiveContext* commContext,
434  const void* inData,
435  uint32_t inElements,
436  void* outData,
437  const uint32_t* outElements,
438  OTF2_Type type,
439  uint32_t root );
440 
441 
450 typedef OTF2_CallbackCode
451 ( * OTF2_Collectives_Scatter )( void* userData,
452  OTF2_CollectiveContext* commContext,
453  const void* inData,
454  void* outData,
455  uint32_t numberElements,
456  OTF2_Type type,
457  uint32_t root );
458 
459 
468 typedef OTF2_CallbackCode
469 ( * OTF2_Collectives_Scatterv )( void* userData,
470  OTF2_CollectiveContext* commContext,
471  const void* inData,
472  const uint32_t* inElements,
473  void* outData,
474  uint32_t outElements,
475  OTF2_Type type,
476  uint32_t root );
477 
478 
487 typedef void
488 ( * OTF2_Collectives_Release )( void* userData,
489  OTF2_CollectiveContext* globalCommContext,
490  OTF2_CollectiveContext* localCommContext );
491 
492 
498 {
499  OTF2_Collectives_Release otf2_release;
500  OTF2_Collectives_GetSize otf2_get_size;
501  OTF2_Collectives_GetRank otf2_get_rank;
502  OTF2_Collectives_CreateLocalComm otf2_create_local_comm;
503  OTF2_Collectives_FreeLocalComm otf2_free_local_comm;
504  OTF2_Collectives_Barrier otf2_barrier;
505  OTF2_Collectives_Bcast otf2_bcast;
506  OTF2_Collectives_Gather otf2_gather;
507  OTF2_Collectives_Gatherv otf2_gatherv;
508  OTF2_Collectives_Scatter otf2_scatter;
509  OTF2_Collectives_Scatterv otf2_scatterv;
511 
512 
552 typedef struct OTF2_LockObject* OTF2_Lock;
553 
554 
566 typedef OTF2_CallbackCode
567 ( * OTF2_Locking_Create )( void* userData,
568  OTF2_Lock* lock );
569 
570 
582 typedef OTF2_CallbackCode
583 ( * OTF2_Locking_Destroy )( void* userData,
584  OTF2_Lock lock );
585 
586 
598 typedef OTF2_CallbackCode
599 ( * OTF2_Locking_Lock )( void* userData,
600  OTF2_Lock lock );
601 
602 
614 typedef OTF2_CallbackCode
615 ( * OTF2_Locking_Unlock )( void* userData,
616  OTF2_Lock lock );
617 
618 
635 typedef void
636 ( * OTF2_Locking_Release )( void* userData );
637 
638 
643 typedef struct OTF2_LockingCallbacks
644 {
645  OTF2_Locking_Release otf2_release;
646  OTF2_Locking_Create otf2_create;
647  OTF2_Locking_Destroy otf2_destroy;
648  OTF2_Locking_Lock otf2_lock;
649  OTF2_Locking_Unlock otf2_unlock;
651 
652 
663 #ifdef __cplusplus
664 }
665 #endif /* __cplusplus */
666 
667 
668 #endif /* !OTF2_CALLBACKS_H */
uint64_t OTF2_LocationRef
Type used to indicate a reference to a Location definition.
Definition: OTF2_GeneralDefinitions.h:142
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:488
uint8_t OTF2_Type
Wrapper for enum OTF2_Type_enum.
Definition: OTF2_GeneralDefinitions.h:596
uint8_t OTF2_FileType
Wrapper for enum OTF2_FileType_enum.
Definition: OTF2_GeneralDefinitions.h:433
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:340
OTF2_PostFlushCallback otf2_post_flush
Callback which is called after a flush.
Definition: OTF2_Callbacks.h:157
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:432
OTF2_CallbackCode(* OTF2_Collectives_Barrier)(void *userData, OTF2_CollectiveContext *commContext)
Performs a barrier collective on the given communication context.
Definition: OTF2_Callbacks.h:386
Struct which holds all collective callbacks.
Definition: OTF2_Callbacks.h:497
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:375
Structure holding the flush callbacks.
Definition: OTF2_Callbacks.h:152
This header file provides general definitions which should be accessible in all internal and external...
OTF2_CallbackCode(* OTF2_Locking_Destroy)(void *userData, OTF2_Lock lock)
Destroys a locking object.
Definition: OTF2_Callbacks.h:583
uint64_t OTF2_TimeStamp
OTF2 time stamp.
Definition: OTF2_GeneralDefinitions.h:106
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:356
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:372
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:204
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:235
OTF2_CallbackCode
Return value to indicate that the record reading should be interrupted.
Definition: OTF2_GeneralDefinitions.h:349
struct OTF2_LockObject * OTF2_Lock
Opaque type for a locking object.
Definition: OTF2_Callbacks.h:552
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:397
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:326
Struct which holds all locking callbacks.
Definition: OTF2_Callbacks.h:643
OTF2_MemoryFreeAll otf2_free_all
Callback which is called to release all previous allocated chunks.
Definition: OTF2_Callbacks.h:251
OTF2_PreFlushCallback otf2_pre_flush
Callback which is called prior a flush.
Definition: OTF2_Callbacks.h:155
OTF2_CallbackCode(* OTF2_Locking_Unlock)(void *userData, OTF2_Lock lock)
Unlocks a locking object.
Definition: OTF2_Callbacks.h:615
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:469
OTF2_MemoryAllocate otf2_allocate
Callback which is called to allocate a new chunk.
Definition: OTF2_Callbacks.h:249
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:414
Structure holding the memory callbacks.
Definition: OTF2_Callbacks.h:246
struct OTF2_CollectiveContext OTF2_CollectiveContext
User provided type for collective groups.
Definition: OTF2_Callbacks.h:310
OTF2_CallbackCode(* OTF2_Locking_Lock)(void *userData, OTF2_Lock lock)
Locks a locking object.
Definition: OTF2_Callbacks.h:599
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:636
OTF2_CallbackCode(* OTF2_Locking_Create)(void *userData, OTF2_Lock *lock)
Creates a new locking object.
Definition: OTF2_Callbacks.h:567
Error codes and error handling.
OTF2_TimeStamp(* OTF2_PostFlushCallback)(void *userData, OTF2_FileType fileType, OTF2_LocationRef location)
Definition for the post flush callback.
Definition: OTF2_Callbacks.h:140
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:117
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:451