Quickstart

The ParallelZone class RuntimeView is an abstraction of the current runtime environment. The RuntimeView groups the process local resources (memory, processors, loggers, etc.) into objects of type ResourceSet. Users typically interact with RuntimeView and the ResourceSet object for the current process. As an example:

// 99.9% of the time you will be using an existing RuntimeView
auto& rt = get_runtime();

// Figure out how many resource sets there are total
const auto n_rs = rt.size();

// Get the resource set containing resources local to the current process
const auto& my_rs = rt.my_resource_set();

// Figure out the mpi rank of the current resource set
const auto my_rs_rank = my_rs.mpi_rank();

The RuntimeView also allows you to access other ResourceSet instances. Typically this is done to send or receive information. For example, say we wanted to copy data from each resource set into the RAM of the 0-th resource set:

// Have every resource set send its index to resource set 0
auto ranks_on_0 = rt.at(0).ram().gather(my_rs_rank);

if(ranks_on_0) { // Only resource set 0 will enter this block
    // TODO: This should be the logger
    std::cout << "Received indices from " << ranks_on_0->size()
              << " resource set(s)." << std::endl;
}

If we instead wanted every resource set to have a copy of the result, we do a RuntimeView-wide gather:

// Have every resource set send their rank to every other resource set
auto ranks = rt.gather(my_rs_rank);

Another major feature of parallelzone is introspection of the runtime environment. Say we wanted to know how much total RAM each resource set has:

// Figure out how much RAM the local process has access to
const auto my_ram = my_rs.ram().total_space();

To summarize:

  • System-wide runtime environment state lives in the RuntimeView.

  • Operations involving every resource set getting data go through RuntimeView.

  • Environment state local to a single resource set goes through ResourceSet, which is accessed via RuntimeView::at().

  • Operations involving every resource set sending/getting data to/from a single resource set happen in ResourceSet.

  • Use the logger to print.