Menu ▾ ▴

#17 cgp_mpi_comm passes wrong type

v1.0_(example)
accepted
parallel (1)
7
2015-01-20
2015-01-20
No

using openmpi 1.8.4 and gfortran,gcc on the Mac cgp_mpi_comm segfaults.

ier = cgp_mpi_comm(int mpicomm);
should be
ier = cgp_mpi_comm(MPI_Comm mpicomm);

In the calls made by cgp_mpi_comm, we should not be converting MPI_comm variables to size_t and then back again to MPI_Comm.

We also need to check the warnings passing MPI_Comm from fortran (which is an integer) to C.

/Users/brtnfld/packages/cgns/trunk/src/cg_ftoc.c:3643:17: warning: cast to 'MPI_Comm' (aka 'struct ompi_communicator_t ') from smaller integer type
'int' [-Wint-to-pointer-cast]
mpi_comm_c = MPI_Comm_f2c((int)
mpi_comm_f);
^
/Users/brtnfld/packages/cgns/trunk/src/cg_ftoc.c:35:28: note: expanded from macro 'MPI_Comm_f2c'

define MPI_Comm_f2c(comm) (MPI_Comm)(comm)

                       ^

/Users/brtnfld/packages/cgns/trunk/src/cg_ftoc.c:3655:20: warning: cast to 'MPI_Info' (aka 'struct ompi_info_t ') from smaller integer type 'int'
[-Wint-to-pointer-cast]
pcg_mpi_info_c = MPI_Info_f2c((int)
pcg_mpi_info_f);
^
/Users/brtnfld/packages/cgns/trunk/src/cg_ftoc.c:36:28: note: expanded from macro 'MPI_Info_f2c'

define MPI_Info_f2c(info) (MPI_Info)(info)

Discussion


Log in to post a comment.