PARCEL SYCL v1.2 / API Reference User Guide API Reference Search Download 日本語

5 parcel::comm

The MPI communicator class for the SYCL version of PARCEL. It holds a pair of an MPI communicator and a sycl::queue.

5.1 Constructor

Description Creates a parcel::comm from an MPI communicator and a SYCL queue.

Synopsis

parcel::comm::comm(MPI_Comm comm, sycl::queue *q);   // build with MPI (default)
parcel::comm::comm(sycl::queue *q);                  // build without MPI (-DPARCEL_MPI=0)

Arguments

Name In/Out Type Description Default
comm In MPI_Comm MPI communicator. Communicators other than MPI_COMM_WORLD may be given none
q In sycl::queue * SYCL queue used for computation none

Requirements Call after MPI_Init() (it calls MPI_Comm_size / MPI_Comm_rank internally). q must be the same in-order queue as that of the matrix and the vectors (created with sycl::property::queue::in_order). The queue of comm is not checked (it is used to synchronize halo exchange). The in-order check is performed on the queue of the matrix by set_crsMat() and by solver() of each solver.

MPI Not a collective operation. Create it on all ranks belonging to comm.

Notes In a build with MPI (the default), this object is required even when running with a single process. In a build without MPI (-DPARCEL_MPI=0; see “Build without MPI” in the User Guide) it is created with parcel::comm comm(&q);; mpi_rank() / rank() return 0, mpi_size() / size() return 1, barrier() does nothing, and mpi_comm() does not exist. parcel::matrix::set_crsMat() keeps a pointer to this object, so it must not be destroyed until you have finished using the matrix and the solvers.

See Also set_crsMat()

Example

sycl::queue q{sycl::default_selector_v, sycl::property::queue::in_order{}};
parcel::comm comm(MPI_COMM_WORLD, &q);

5.2 mpi_rank() / mpi_size() / mpi_comm() / rank() / size()

Description Return the rank number, the number of processes, and the MPI communicator. rank() / size() are aliases of mpi_rank() / mpi_size().

Synopsis

int      mpi_rank();      // int rank();
int      mpi_size();      // int size();
MPI_Comm mpi_comm();

Return Value The rank number (starting from 0) in the communicator passed to the constructor, the number of processes, and the communicator. In a build without MPI, mpi_rank() returns 0 and mpi_size() returns 1, and mpi_comm() does not exist.

MPI Local operation.

Example

const int myrank = comm.mpi_rank(), nproc = comm.mpi_size();