Instead of using if(tid==0) you should use the fortran equivalent of: #pragma omp masked Or #pragma omp master For pre-omp-5.1 code
This way you don't need to rely on preprocessor magic using the _OPENMP macro. At the same time you better express your intended OpenMP semantics. - Joachim ________________________________ From: users <users-boun...@lists.open-mpi.org> on behalf of Angel de Vicente via users <users@lists.open-mpi.org> Sent: Friday, April 22, 2022 10:31:38 PM To: Keller, Rainer <rainer.kel...@hs-esslingen.de> Cc: Angel de Vicente <angel.de.vice...@iac.es>; Open MPI Users <users@lists.open-mpi.org> Subject: Re: [OMPI users] Help diagnosing MPI+OpenMP application segmentation fault only when run with --bind-to none Hello, "Keller, Rainer" <rainer.kel...@hs-esslingen.de> writes: > You’re using MPI_Probe() with Threads; that’s not safe. > Please consider using MPI_Mprobe() together with MPI_Mrecv(). many thanks for the suggestion. I will try with the M variants, though I was under the impression that mpi_probe() was OK as far as one made sure that the source and tag matched between the mpi_probe() and the mpi_recv() calls. As you can see below, I'm careful with that (in any case I'm not sure the problems lies there, since the error I get is about invalid reference in the mpi_probe call itself). ,---- | tid = 0 | #ifdef _OPENMP | tid = omp_get_thread_num() | #endif | | do | if (tid == 0) then | call mpi_send(my_rank, 1, mpi_integer, master, ask_job, & | mpi_comm_world, mpierror) | call mpi_probe(master,mpi_any_tag,mpi_comm_world,stat,mpierror) | | if (stat(mpi_tag) == stop_signal) then | call mpi_recv(b_,1,mpi_integer,master,stop_signal, & | mpi_comm_world,stat,mpierror) | else | call mpi_recv(iyax,1,mpi_integer,master,give_job, & | mpi_comm_world,stat,mpierror) | end if | end if | | !$omp barrier | | [... actual work...] `---- > So getting into valgrind may be of help, possibly recompiling Open MPI > enabling valgrind-checking together with debugging options. I was hoping to avoid this route, but it certainly is looking like I'll have to bite the bullet... Thanks, -- Ángel de Vicente Tel.: +34 922 605 747 Web.: http://research.iac.es/proyecto/polmag/ --------------------------------------------------------------------------------------------- AVISO LEGAL: Este mensaje puede contener información confidencial y/o privilegiada. Si usted no es el destinatario final del mismo o lo ha recibido por error, por favor notifíquelo al remitente inmediatamente. Cualquier uso no autorizadas del contenido de este mensaje está estrictamente prohibida. Más información en: https://www.iac.es/es/responsabilidad-legal DISCLAIMER: This message may contain confidential and / or privileged information. If you are not the final recipient or have received it in error, please notify the sender immediately. Any unauthorized use of the content of this message is strictly prohibited. More information: https://www.iac.es/en/disclaimer