Skip to content

Provide a KokkosCommInitialize #82

@cedricchevalier19

Description

@cedricchevalier19

It must enforce a correct calling order for MPI_Init and Kokkos::initialize.

It should also handle special Kokkos arguments:

Another pretty annoying thing that we have to do is to avoid passing --help to non-zero ranks, as otherwise Kokkos would print help on all ranks. We do it like this:

  // Strip "--help" and "--kokkos-help" from the flags passed to Kokkos if we
  // are not on MPI rank 0 to prevent Kokkos from printing the help message
  // multiply.
  if (comm_rank != 0)
  {
    auto *help_it = std::find_if(argv, argv + argc, [](std::string const &x) {
      return x == "--help" || x == "--kokkos-help";
    });
    if (help_it != argv + argc)
    {
      std::swap(*help_it, *(argv + argc - 1));
      --argc;
    }
  }
  Kokkos::initialize(argc, argv);

Originally posted by @aprokop in #53 (comment)

Metadata

Metadata

Assignees

Labels

C-enhancementCategory: an enhancement or bug fix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions