Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <mpi.h>
- #include <stdio.h>
- #include <stdlib.h>
- #ifndef _EXTERN_C_
- #ifdef __cplusplus
- #define _EXTERN_C_ extern "C"
- #else /* __cplusplus */
- #define _EXTERN_C_
- #endif /* __cplusplus */
- #endif /* _EXTERN_C_ */
- #ifdef MPICH_HAS_C2F
- _EXTERN_C_ void *MPIR_ToPointer(int);
- #endif // MPICH_HAS_C2F
- #ifdef PIC
- /* For shared libraries, declare these weak and figure out which one was linked
- based on which init wrapper was called. See mpi_init wrappers. */
- #pragma weak pmpi_init
- #pragma weak PMPI_INIT
- #pragma weak pmpi_init_
- #pragma weak pmpi_init__
- #endif /* PIC */
- _EXTERN_C_ void pmpi_init(MPI_Fint *ierr);
- _EXTERN_C_ void PMPI_INIT(MPI_Fint *ierr);
- _EXTERN_C_ void pmpi_init_(MPI_Fint *ierr);
- _EXTERN_C_ void pmpi_init__(MPI_Fint *ierr);
- // #include <stdlib.h>
- // #include <stdio.h>
- #include <inttypes.h>
- // #include <mpi.h>
- #include <otf2/otf2.h>
- #if MPI_VERSION < 3
- #define OTF2_MPI_UINT64_T MPI_UNSIGNED_LONG
- #define OTF2_MPI_INT64_T MPI_LONG
- #endif
- #include <otf2/OTF2_MPI_Collectives.h>
- _EXTERN_C_ OTF2_Archive* OTF2_Archive_Open ( const char * archivePath,
- const char * archiveName,
- const OTF2_FileMode fileMode,
- const uint64_t chunkSizeEvents,
- const uint64_t chunkSizeDefs,
- const OTF2_FileSubstrate fileSubstrate,
- const OTF2_Compression compression
- );
- _EXTERN_C_ OTF2_ErrorCode OTF2_Archive_Close ( OTF2_Archive * archive );
- bool is_init = false;
- OTF2_Archive* archive;
- __attribute__((constructor)) void init(void)
- {
- if(!is_init)
- {
- archive = OTF2_Archive_Open( "./",
- "ArchiveTest",
- OTF2_FILEMODE_WRITE,
- 1024 * 1024 /* event chunk size */,
- 4 * 1024 * 1024 /* def chunk size */,
- OTF2_SUBSTRATE_POSIX,
- OTF2_COMPRESSION_NONE );
- is_init = true;
- }
- }
- __attribute__((destructor)) void fini(void)
- {
- if(is_init)
- {
- OTF2_Archive_Close( archive );
- is_init = false;
- }
- }
- /* ================== C Wrappers for MPI_Send ================== */
- _EXTERN_C_ int PMPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm);
- _EXTERN_C_ int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
- int _wrap_py_return_val = 0;
- {
- _wrap_py_return_val = PMPI_Send(buf, count, datatype, dest, tag, comm);
- }
- return _wrap_py_return_val;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement