9 template <
typename T,
typename inserterT>
16 void flush(
int owner) {
17 if (bins[owner].size())
22 void sorter(
const std::vector<T>& v) {
23 for(
typename std::vector<T>::const_iterator it = v.begin(); it != v.end(); ++it) {
39 , bins(new
std::vector<
T>[world.size()])
54 for (
int i=0; i<pworld->
size(); i++) {
55 MADNESS_ASSERT(bins[i].size() == 0);
62 for (
int i=0; i<pworld->
size(); i++) {
70 bins[p].push_back(value);
74 if (bins[p].size() >= bufsize) flush(p);
WorldGopInterface & gop
Global operations.
Definition: worldfwd.h:462
virtual ~BinSorter()
Definition: binsorter.h:53
void process_pending()
To be called from derived constructor to process pending messages.
Definition: worldobj.h:330
A parallel bin sort across MPI processes.
Definition: binsorter.h:10
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn) const
Definition: worldobj.h:388
void finish()
Invoke to complete the sort, flush all buffers, and ensure communication/processing is complete...
Definition: binsorter.h:61
Definition: mpreal.h:3066
ProcessID size() const
Returns the number of processes in this world (same as MPI_Comm_size())
Definition: worldfwd.h:533
This header should include pretty much everything needed for the parallel runtime.
const T1 &f1 return GTEST_2_TUPLE_() T(f0, f1)
const mpreal min(const mpreal &x, const mpreal &y)
Definition: mpreal.h:2675
Defines and implements WorldObject.
Implements most parts of a globally addressable object (via unique ID)
Definition: worldam.h:74
BinSorter(World &world, inserterT inserter, int bufsize=0)
Constructs the sorter object.
Definition: binsorter.h:34
A parallel world with full functionality wrapping an MPI communicator.
Definition: worldfwd.h:416
void fence()
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks.
Definition: worldgop.cc:52
static std::size_t max_msg_len()
Definition: worldrmi.h:247
int ProcessID
Used to clearly identify process number/rank.
Definition: worldtypes.h:37
void insert(ProcessID p, const T &value)
Application calls this to add a value to the bin for process p.
Definition: binsorter.h:69
Implements MadnessException.
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
World & world
Think globally act locally.
Definition: worldobj.h:171