Initialization & Miscellaneous Functions

To intialize the library, a call to diverge_init() is required. Correspondingly, the divERGe context must be cleaned up by calling diverge_finalize().

type MPI_Comm
[source]

MPI Communicator, might be typedef’ed to void* in case MPI is not compiled in

void diverge_init(int *pargc, char ***pargv)
[source]

useful if divERGe is the only MPI component, calls MPI_Init(); and other setup tasks; sets the internal communicator automatically.

void diverge_finalize(void)
[source]

call MPI_Finalize(); and other cleanup functions

void diverge_embed(MPI_Comm comm)
[source]

useful if divERGe should be called as a library with an existing MPI context

void diverge_reset(void)
[source]

reset the internal context, but do not clean up the MPI communicator

void diverge_mpi_exit(int status)
[source]

call MPI_Finalize(); and exit(status);

double diverge_mpi_wtime(void)
[source]

get current walltime in seconds

MPI_Comm diverge_mpi_get_comm(void)
[source]

get global MPI communicator

index_t *diverge_mpi_distribute(index_t sz)
[source]

returns array of length two times diverge_mpi_comm_size() that must be freed manually. First half is the count, second the displ. second half can be safely ignored.

index_t *diverge_distribute(index_t sz, index_t bins)
[source]

returns array of length two times bins that must be freed manually. First half is the count, second the displacement. second half can be safely ignored.

Actual MPI Functions

divERGe wraps several MPI functions, for a full list see the source. They all act on the MPI Communicator set on initialization through diverge_init() or diverge_embed().

void diverge_mpi_barrier(void)
[source]

wrapped MPI_Barrier();

int diverge_mpi_comm_size(void)
[source]

return the number of ranks in the communicator

int diverge_mpi_comm_rank(void)
[source]

return the rank

void diverge_mpi_alltoallv_bytes_packed(const void *s, const int *sc, const int *sd, void *r, const int *rc, const int *rd, index_t numbytes)
[source]

this version of alltoallv requires some explanation: since MPI typically only knows 32bit integers for any count/displ variables, we can trick it into operation on larger arrays by making packed datatypes. This is exactly what this function is here for. Note that the other version of alltoallv (undocumented) is restricted to 32bit bytes of communication.

Other miscellaneous (parallel) functions

int diverge_omp_num_threads(void)
[source]

get the number of threads to use in diverge’s OMP loops

int diverge_fftw_num_threads(void)
[source]

get the number of threads to use in diverge’s FFTWs

void diverge_force_thread_limit(int nthr)
[source]

limit the number of threads for every OMP/FFTW parallel region; except for cases where the number is specifically set higher.