[mpich-discuss] MPI_Init and MPI_COMM_WORLD

Palmer, Bruce J Bruce.Palmer at pnnl.gov
Wed Apr 13 12:29:01 CDT 2022


Does MPI_COMM_WORLD exist in any sense before MPI_Init is called? In particular, does this code violate the standard?

InitializeMyApp(MPI_Comm comm, int argc, char **argv)
  int initialized;
  if (!initialized) MPI_Init(&argc, &argv);
  /* call some function that uses comm */

int main(int argc, char **argv)
  MPI_Comm comm = MPI_COMM_WORLD;
  InitializeMyApp(comm, argc, argv);

My instinct is that this is wrong, but I would like to be sure before I complain about it. It appears to work with some existing implementations, but it looks sketchy to me.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20220413/5f355396/attachment.html>

More information about the discuss mailing list