Last active
November 15, 2015 12:55
-
-
Save jsquyres/79cfeb3666476c0ed1c8 to your computer and use it in GitHub Desktop.
2015-12 December MPI Forum slides: sessions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void legacy_library_init(void) { | |
MPI_Initialized(&init); | |
MPI_Finalized(&finalized); | |
if (init && !finalized) { | |
MPI_Comm_dup(MPI_COMM_WORLD, &comm); | |
// Do MPI things | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void new_style_library_init(void) { | |
#if MPI_VERSION >= 4 | |
// MPI >= v4 allows Info/Errhandler before INIT | |
MPI_Info_create(...); | |
MPI_Errhandler_create(...); | |
// If MPI_INIT was not already called, make me a | |
// session and communicator. | |
// Otherwise, dup MPI_COMM_WORLD. | |
if (MPI_Session_create(..., &session) == MPI_SUCCESS) { | |
MPI_Comm_create_from_session(session, &comm); | |
} else { | |
MPI_Comm_dup(MPI_COMM_WORLD, &comm); | |
} | |
#else | |
legacy_library_init(); | |
#endif | |
// Do MPI things with comm | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment