[Mpi-forum] Reserved MPI_ prefix & namespace in C and Fortran

Jeremiah Willcock jewillco at osl.iu.edu
Fri Aug 24 12:19:00 CDT 2012


What about wording to the effect of 'the name "MPI" and names beginning 
with "MPI_" are reserved to the MPI implementation, and names beginning 
with "PMPI_" are reserved to the MPI implementation when used as 
global-scope function names'; that suggests that they are reserved for all 
purposes (and thus can be used as macro names by the implementation, 
etc.)?  That also avoids needing to enumerate all of the cases (and there 
are a few missing on any of the lists we've been looking at so far) and 
looks more like the kind of wording that is in the language standards. 
You might want to also reserve "_MPI" for all purposes as well (even 
though that name is intended to be reserved to the compiler, not a 
library) because of the suggestion in the past that some preprocessor 
symbol be defined when compiling with MPI so that applications can detect 
it; _MPI follows the same pattern as _OMP and already seems to be used by 
some applications.

-- Jeremiah Willcock


On Fri, 24 Aug 2012, N.M. Maclaren wrote:

> On Aug 24 2012, William Gropp wrote:
>> 
>> The intent of the Forum has always been that all names that begin with MPI_ 
>> or PMPI_, and the MPI namespace, are reserved for MPI. The mistake (a 
>> common one) was to attempt to enumerate all of the items to which this 
>> applies. Rather than attempt to cover everything, I would prefer changing 
>> the text to match the indent; it can mention specific categories as 
>> examples but should not attempt to list them, as this is always error 
>> prone.
>
> While I think that is correct, I am afraid that the wording isn't, for
> any of the languages.
>
> If C++ is deleted, then the reference to namespaces should be, too;
> while C has such a concept, it's wildly different, and you don't want
> to go there :-)  If it isn't, it should be explicitly the namespaces
> MPI and PMPI, as at present.
>
>>> The solution is very simple, an MPI-2 errata ticket changing
>>> MPI-2.2, lines 15-16 into (addition marked with {...}):
>>>
>>>   "Programs must not declare variables, functions,    { constants, macros, 
>>> types, or namespaces }
>>>    with names beginning with the prefix MPI_."
>
> The killer is that is both too restrictive and too lax - you also have
> labels, tags and members (C99 6.2.3), and local names are a problem
> onbly together with the header.
>
>>> And for Fortran on p17:41-42 (addition marked with {...}):
>>>
>>>   "Programs must not declare variables, parameters, functions,    { 
>>> derived types, or abstract interfaces }
>>>    with names beginning with the prefix MPI_. 
>
> The same applies, in very different ways.  Fortran has a vast number
> of other classes of name, but declaring local ones will cause trouble
> only in combination with the header.
>
> Better wording might be, for C:
>
>   Other than by including the header "mpi.h", programs shall not
>   declare entities with external names beginning with the prefix
>   MPI_.  In a translation unit that includes the header "mpi.h",
>   programs shall not declare any other entities with names
>   beginning with the prefix MPI_.
>
> And for Fortran:
>
>   Other than by using one of the modules "mpi_f08" or "mpi" or
>   including the header "mpif.h", programs shall not declare
>   entities with external names beginning with the prefix MPI_.
>   In a program unit that uses one of the modules "mpi_f08" or "mpi"
>   or includes the header "mpif.h", programs shall not declare any
>   other entities with names beginning with the prefix MPI_.
>
>
> Regards,
> Nick Maclaren.
>
> _______________________________________________
> mpi-forum mailing list
> mpi-forum at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum
>



More information about the mpi-forum mailing list