clustering  0.12
Clustering suite for molecular dynamics trajectories.
 All Classes Namespaces Files Functions Variables Typedefs
Functions
Clustering::Density::MPI::anonymous_namespace{density_clustering_mpi.cpp} Namespace Reference

Functions

std::vector< std::size_t > triangular_load_balance (std::size_t n_rows, std::size_t n_nodes)
 

Function Documentation

std::vector<std::size_t> Clustering::Density::MPI::anonymous_namespace{density_clustering_mpi.cpp}::triangular_load_balance ( std::size_t  n_rows,
std::size_t  n_nodes 
)

use no. of rows and no. of MPI nodes to calculate the optimal indices for equal load balancing on all machines to calculate an upper triangular matrix by a nested loop of the form

FOR i=0 TO n_rows

FOR j=i+1 TO n_rows

[...]

the returned indices are for the initial index of the outer loop. the inner loop will be local. i.e. on every MPI node, the loop will be of the form

FOR i=indices[node_id] TO (is_last_node ? n_rows : indices[next_node])

FOR j=i+1 TO n_rows

[...]

computation of optimal indices is heavily based on triangular summation (please recall the 'algorithm of young C.F. Gauss').

Definition at line 60 of file density_clustering_mpi.cpp.