[pooma-dev] Re: [PATCH] Support hybrid MPI/OpenMP if available

Jeffrey D. Oldham oldham at codesourcery.com
Thu Jan 8 21:59:09 UTC 2004


Richard Guenther wrote:
> On Thu, 8 Jan 2004, Jeffrey D. Oldham wrote:
> 
> 
>>Richard Guenther wrote:
>>
>>> #if POOMA_MPI
>>>+# ifdef _OPENMP
>>>+  int provided;
>>>+  MPI_Init_thread(&argc, &argv, MPI_THREAD_FUNNELED, &provided);
>>>+  PInsist(provided >= MPI_THREAD_FUNNELED, "No MPI support for OpenMP");
>>>+# else
>>>   MPI_Init(&argc, &argv);
>>>+# endif
>>> #elif POOMA_CHEETAH
>>>   controller_g = new Cheetah::Controller(argc, argv);
>>> #endif
>>
>>OpenMP does not support MPI_init?  I'd prefer to initialize OpenMP using
>>the same mechanism as for MPI implementations.
> 
> 
> It's somewhat difficult.  The MPI-1 standard does not support any sort of
> threading and has only MPI_Init.  The MPI-2 standard does support many
> levels of thread support which needs to be specified through
> MPI_Init_thread - though using MPI_Init is still possible, which is
> equivalent to initializing with no thread support.
> 
> Nearly all implementation support the MPI_Init_thread call as part of
> (usually incomplete) MPI-2 support.  To allow using OpenMP if MPI is used,
> too, we need at least make the MPI library aware of this.  So, if no
> OpenMP is used, MPI_Init suffices and allows for MPI-1 only
> implementations.  For OpenMP support we absolutely need MPI_Init_threads,
> so we use it.
> 
> 
>>Also, does finalization also need to change?
> 
> 
> No.
> 
> Ok with this explanation?

Yes.  I appreciate the education.

> Thanks,
> Richard.


-- 
Jeffrey D. Oldham
oldham at codesourcery.com




More information about the pooma-dev mailing list