MPI_Is_thread_main

int MPI_Is_thread_main(int *);
Determines whether the calling thread is the thread that called MPI_INIT or MPI_INIT_THREAD.