src/h5core/private/h5_init.{c,h}

- initialize MPI if not yet done
This commit is contained in:
2016-07-01 16:10:37 +02:00
parent 5b57bedade
commit c9044d8e1b
2 changed files with 8 additions and 1 deletions
+7 -1
View File
@@ -666,11 +666,17 @@ h5_err_t
h5priv_initialize (
void
) {
h5_initialized = 1;
memset (&h5_call_stack, 0, sizeof (h5_call_stack));
// must be set here, otherwise next statement will fail!
h5_initialized = 1;
H5_CORE_API_ENTER (h5_err_t, "%s", "void");
ret_value = H5_SUCCESS;
#ifdef PARALLEL_IO
int mpi_is_initialized;
MPI_Initialized (&mpi_is_initialized);
if (!mpi_is_initialized) {
MPI_Init (NULL, NULL);
}
if (h5priv_mpi_comm_rank (MPI_COMM_WORLD, &h5_myproc) < 0) {
exit (42);
}
+1
View File
@@ -19,6 +19,7 @@
#if !defined (PARALLEL_IO)
typedef int MPI_Comm;
#define MPI_Init(argc, argv)
#define MPI_Initialized () (1)
#define MPI_Comm_size(comm, nprocs) {(void)comm; *nprocs = 1; }
#define MPI_Comm_rank(comm, myproc) {(void)comm; *myproc = 0; }
#define MPI_Finalize()