Does anyone know if it is illegal to call mpi routines (specifically MPI_ALLGATHER) inside a openmp parallel region (for example PARALLEL DO)? The structure I'm trying to describe is like this:
!$OMP PARALLEL DO ...
!$OMP END PARALLEL DO
end subroutine mysub
Some code like the above gave a bug. Eventually I figured out if I commented the !$OMP pragmas that the error disappeared. (Btw, I thought using -openmp-stubs would cause the same behavior as commenting the pragmas, but that wasn't the case.)
It's "illegal" to mix threading with MPI, unless you use MPI_Init_thread() to ask your MPI to support the type of threading you intend to use. It would hardly be "weird" to encounter an assertion failure when you mix threading with MPI in a way different from what you announced.