Oh great Open MPI Gurus,

I'm slowly trying to learn and transition to 'use mpi_f08'. So, I'm writing
various things and I noticed that this triggers an error:

program hello_world
   use mpi_f08
   implicit none
   type(MPI_Comm) :: comm = MPI_COMM_NULL
end program hello_world

when compiled (Open MPI 2.0.0 with GCC 6.1):

(380) $ mpifort test1.F90
test1.F90:7:27:

    type(MPI_Comm) :: comm = MPI_COMM_NULL
                           1
Error: Parameter ‘mpi_comm_null’ at (1) has not been declared or is a
variable, which does not reduce to a constant expression

Why is that? Obviously, I can just do:

   type(MPI_Comm) :: comm
   comm = MPI_COMM_NULL

and that works just fine (note MPI_COMM_NULL doesn't seem to be special as
MPI_COMM_WORLD triggers the same error).

I'm just wondering why the first doesn't work, for my own edification. I
tried reading through the Standard, but my eyes started watering after a
bit (though that might have been the neon green cover). Is it related to
the fact that when one declares:

   type(MPI_Comm) :: comm

that the comm == MPI_COMM_WORLD evaluates to .TRUE.? I discovered that once
when I was printing some stuff.

Thanks for helping me learn,
Matt

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

Reply via email to