On Sep 4, 2018, at 5:22 PM, Benjamin Brock <br...@cs.berkeley.edu> wrote:
> 
> Are MPI datatypes like MPI_INT and MPI_CHAR guaranteed to be compile-time 
> constants?  

No.  They are guaranteed to be link-time constants.

> Is this defined by the MPI standard, or in the Open MPI implementation?

MPI standard: 
https://www.mpi-forum.org/docs/mpi-3.1/mpi31-report/node28.htm#Node28

> All named constants, with the exceptions noted below for Fortran, can be used 
> in initialization expressions or assignments, but not necessarily in array 
> declarations or as labels in C switch or Fortran select/case statements. This 
> implies named constants to be link-time but not necessarily compile-time 
> constants. The named constants listed below are required to be compile-time 
> constants in both C and Fortran. These constants do not change values during 
> execution. Opaque objects accessed by constant handles are defined and do not 
> change value between MPI initialization (MPI_INIT) and MPI completion 
> (MPI_FINALIZE). The handles themselves are constants and can be also used in 
> initialization expressions or assignments.

The pre-defined datatypes -- such as MPI_INT and MPI_CHAR -- are not in the 
list of compile-time constants, so they are only guaranteed to be link-time 
constants.

Open MPI implements MPI_INT, MPI_CHAR, and other MPI handles as pointers.

> I've written some template code where MPI datatypes are constexpr members, 
> which requires that they be known at compile time.  This works in Open MPI 
> and MPICH, but not in Spectrum MPI--I'm not sure what they've done that 
> breaks this, but I'm trying to file a bug and any information you have about 
> whether these are compile-time constants would be useful.

Don't know why that works in Open MPI, because Spectrum MPI is derived from 
Open MPI, and AFAIK both use the same kinds of constructs for MPI_INT, 
MPI_CHAR, and others.

-- 
Jeff Squyres
jsquy...@cisco.com

_______________________________________________
users mailing list
users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/users

Reply via email to