Skip to content

Commit

Permalink
DAOS-16722 client: to intercept PMPI_Init() in libpil4dfs (#15387)
Browse files Browse the repository at this point in the history
Intercept PMPI_Init() to avoid calling daos_init() if MPI_Init() is intercepted by other library (like darshan and mpip).

Signed-off-by: Lei Huang <[email protected]>
  • Loading branch information
wiliamhuang authored Oct 28, 2024
1 parent c4cf4f7 commit eb95b55
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/client/dfuse/pil4dfs/int_dfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ static int (*next_tcgetattr)(int fd, void *termios_p);
/* end NOT supported by DAOS */

static int (*next_mpi_init)(int *argc, char ***argv);
static int (*next_pmpi_init)(int *argc, char ***argv);

/* to do!! */
/**
Expand Down Expand Up @@ -1041,6 +1042,22 @@ MPI_Init(int *argc, char ***argv)
return rc;
}

int
PMPI_Init(int *argc, char ***argv)
{
int rc;

if (next_pmpi_init == NULL) {
next_pmpi_init = dlsym(RTLD_NEXT, "PMPI_Init");
D_ASSERT(next_pmpi_init != NULL);
}

atomic_fetch_add_relaxed(&mpi_init_count, 1);
rc = next_pmpi_init(argc, argv);
atomic_fetch_add_relaxed(&mpi_init_count, -1);
return rc;
}

/** determine whether a path (both relative and absolute) is on DAOS or not. If yes,
* returns parent object, item name, full path of parent dir, full absolute path, and
* the pointer to struct dfs_mt.
Expand Down

0 comments on commit eb95b55

Please sign in to comment.