Skip to content

bulk::world

Defined in header <bulk/world.hpp>.

class world;

bulk::world represents the world of a processor and its place within it, by providing information and mechanisms to communicate with other processors, or obtain information about the local processor.

Member functions

System information
active_processors returns the number of active processors
rank returns the id of the local processor
next_rank returns the id of the next logical processor
prev_rank returns the id of the previous logical processor
Communication and coordination
sync performs a bulk synchronization
barrier performs a bulk barrier
split split the world in subsets
Logging
log log a message
log_once log a message only with the first processor

Example

#include "bulk/bulk.hpp"

#include "set_backend.hpp"

int main() {
    environment env;

    env.spawn(env.available_processors(), [](bulk::world& world) {
        int s = world.rank();
        int p = world.active_processors();

        world.log("Hello, world! %d/%d", s, p);
    });

    return 0;
}