Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit 189401d

Browse files
author
Ehsan Totoni
committed
check MPI if initialized
1 parent f74a7d6 commit 189401d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

hpat/_distributed.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ PyMODINIT_FUNC PyInit_hdist(void) {
8585

8686
int hpat_dist_get_rank()
8787
{
88-
MPI_Init(NULL,NULL);
88+
int is_initialized;
89+
MPI_Initialized(&is_initialized);
90+
if (!is_initialized)
91+
MPI_Init(NULL, NULL);
8992
int rank;
9093
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
9194
// printf("my_rank:%d\n", rank);

0 commit comments

Comments
 (0)