MADNESS 0.10.1
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
madness::World Class Reference

A parallel world class. More...

#include <world.h>

Inheritance diagram for madness::World:
Inheritance graph
[legend]
Collaboration diagram for madness::World:
Collaboration graph
[legend]

Classes

struct  hashuniqueT
 
struct  hashvoidp
 
struct  MpiRequestTester
 

Public Member Functions

 World (const SafeMPI::Intracomm &comm, bool fence=true)
 Constructs a World from a communicator.
 
 ~World ()
 
void args (int argc, char **argv)
 Processes command line arguments.
 
void clear_user_state ()
 Clears the user-defined state.
 
double drand ()
 Returns a CRUDE, LOW-QUALITY, random number (real) uniformly distributed in [0,1).
 
void * get_user_state ()
 Returns a pointer to the user-managed local state set by set_user_state().
 
unsigned long id () const
 
template<typename T >
std::optional< uniqueidTid_from_ptr (std::shared_ptr< T > &ptr) const
 Look up a unique ID from a local pointer.
 
template<typename T >
std::optional< uniqueidTid_from_ptr (T *ptr) const
 Look up an ID from a local pointer.
 
uniqueidT make_unique_obj_id ()
 Creates a new universe-wide unique ID for objects created in this World. No comms.
 
uniqueidT next_unique_obj_id () const
 Reports the next universe-wide unique ID generated by make_unique_obj_id() objects created in this World. No comms.
 
ProcessID nproc () const
 Returns the number of processes in this World (same as MPI_Comm_size()).
 
template<typename T >
std::optional< T * > ptr_from_id (uniqueidT id) const
 Look up a local pointer from a world-wide unique ID.
 
int rand ()
 Returns a CRUDE, LOW-QUALITY, random number (integer) uniformly distributed in [0,2**24).
 
ProcessID random_proc ()
 Returns a random process number; that is, an integer in [0,world.size()).
 
ProcessID random_proc_not_me ()
 Returns a random process number [0,world.size()) that is not the calling process.
 
ProcessID rank () const
 Returns the process rank in this World (same as MPI_Comm_rank()).
 
template<typename T >
uniqueidT register_ptr (T *ptr)
 Associate a local pointer with a universe-wide unique ID.
 
void set_user_state (void *state)
 Sets the user-managed local state.
 
template<typename T >
std::shared_ptr< Tshared_ptr_from_id (uniqueidT id) const
 Look up a local pointer from a world-wide unique ID.
 
ProcessID size () const
 Returns the number of processes in this World (same as MPI_Comm_size()).
 
void srand (unsigned long seed=0ul)
 Crude seed function for random number generation.
 
void unregister_ptr (const uniqueidT id)
 Unregister a global object via its the unique ID.
 

Static Public Member Functions

template<typename Probe >
static void await (const Probe &probe, bool dowork=true, bool sleep=false)
 Gracefully wait for a condition to become true.
 
static void await (SafeMPI::Request &request, bool dowork=true)
 Wait for a MPI request to complete.
 
static bool exists (World *world)
 Check if the World exists in the registry.
 
static Worldfind_instance (const SafeMPI::Intracomm &comm)
 Find the World (if it exists) corresponding to the given communicator.
 
static Worldget_default ()
 Default World object accessor.
 
static bool is_default (const SafeMPI::Intracomm &comm)
 Checks if the default World object corresponds to the given Intracomm.
 
static Worldworld_from_id (std::uint64_t id)
 Convert a World ID to a World pointer.
 

Public Attributes

WorldAmInterfaceam
 AM interface.
 
WorldGopInterfacegop
 Global operations.
 
WorldMpiInterfacempi
 MPI interface.
 
WorldTaskQueuetaskq
 Task queue.
 

Private Types

typedef madness::ConcurrentHashMap< uniqueidT, void *, hashuniqueTmap_id_to_ptrT
 
typedef madness::ConcurrentHashMap< void *, uniqueidT, hashvoidpmap_ptr_to_idT
 

Static Private Member Functions

static void initialize_world_id_range (int global_rank)
 
static std::uint64_t next_world_id ()
 

Private Attributes

std::uint64_t _id
 Universe wide unique ID of this world.
 
map_id_to_ptrT map_id_to_ptr
 
map_ptr_to_idT map_ptr_to_id
 inverse of map_id_to_ptr
 
unsigned int myrand_next
 State of crude internal random number generator.
 
unsigned long obj_id
 Counter for generating unique IDs within this world.
 
void * user_state
 Holds a user-defined and managed local state.
 

Static Private Attributes

static Worlddefault_world = nullptr
 Default world.
 
static std::pair< std::uint64_t, std::uint64_t > world_id__next_last {}
 Unique {next, last} world IDs to be used by this rank.
 
static std::list< World * > worlds
 Maintains list of active worlds, EXCLUDES default_world.
 

Friends

void finalize ()
 Call this once at the very end of your main program instead of MPI_Finalize().
 
Worldinitialize (int &, char **&, const SafeMPI::Intracomm &, int, bool)
 
class WorldAmInterface
 
class WorldGopInterface
 

Additional Inherited Members

- Private Member Functions inherited from NO_DEFAULTS
 NO_DEFAULTS ()
 
 NO_DEFAULTS (const NO_DEFAULTS &)=delete
 
 NO_DEFAULTS (NO_DEFAULTS &&)=delete
 
NO_DEFAULTSoperator= (const NO_DEFAULTS &)=delete
 
NO_DEFAULTSoperator= (NO_DEFAULTS &&)=delete
 

Detailed Description

A parallel world class.

World wraps a MPI communicator. Multiple worlds with different communicators can co-exist.

Here we use Pimpl to both hide implementation details and also to partition the namespace for users as world.mpi, world.am, etc. We also embed a reference to this instance in the am and task instances so that they have access to everything.

The downside is we cannot do much of anything here without using wrapper functions to forward the calls to the hidden class methods.

Member Typedef Documentation

◆ map_id_to_ptrT

Todo:
Brief description of typedef needed.

◆ map_ptr_to_idT

Todo:
Brief description of typedef needed.

Constructor & Destructor Documentation

◆ World()

madness::World::World ( const SafeMPI::Intracomm comm,
bool  fence = true 
)

Constructs a World from a communicator.

This function does not check if another World exists that uses the same communicator. Use instance() to check this.

Parameters
[in]commThe communicator.
[in]fenceif true, will synchronize ranks before exiting; setting to false removes the extra synchronization but may cause premature arrival of RMI messages that refer to this world while it's being registered

References _id, am, SafeMPI::Intracomm::Barrier(), madness::WorldMpiInterface::Bcast(), mpi, next_world_id(), rank(), madness::WorldAmInterface::worldid, and worlds.

◆ ~World()

madness::World::~World ( )

References _id, am, gop, mpi, taskq, and worlds.

Member Function Documentation

◆ args()

void madness::World::args ( int  argc,
char **  argv 
)

Processes command line arguments.

Mostly intended for World test codes, but also provides the -dx option to start x debugger.

Parameters
[in]argcThe number of command-line arguments.
[in,out]argvThe command-line arguments.

References madness::arg(), and madness::xterm_debug().

Referenced by main().

◆ await() [1/2]

template<typename Probe >
static void madness::World::await ( const Probe &  probe,
bool  dowork = true,
bool  sleep = false 
)
inlinestatic

Gracefully wait for a condition to become true.

In the mean time, execute any tasks in the queue.

Todo:
Descriptions needed.
Template Parameters
ProbeAn object that, when called, returns the status.
Parameters
[in]probeThe conditional's test.
doworkWork while waiting - default is true
sleepSleep instead of spin while waiting - default is false

References madness::ThreadPool::await().

◆ await() [2/2]

static void madness::World::await ( SafeMPI::Request request,
bool  dowork = true 
)
inlinestatic

Wait for a MPI request to complete.

Todo:
Descriptions needed.
Parameters
[in,out]requestThe MPI request on which to wait.
doworkWork while waiting - default is true

References madness::ThreadPool::await().

Referenced by madness::WorldGopInterface::broadcast(), madness::WorldGopInterface::concat0(), madness::SystolicMatrixAlgorithm< T >::cycle(), madness::WorldGopInterface::fence_impl(), madness::FutureImpl< T >::get(), madness::FutureImpl< T >::get(), main(), and madness::WorldGopInterface::reduce().

◆ clear_user_state()

void madness::World::clear_user_state ( )
inline

Clears the user-defined state.

This has the same effect as set_user_state(0).

References user_state.

◆ drand()

double madness::World::drand ( )
inline

Returns a CRUDE, LOW-QUALITY, random number (real) uniformly distributed in [0,1).

Each process has a distinct seed for the generator.

Returns
The random number.
Todo:
Since we're switching to C++11, would it be worth using the new C++11 random number generation capabilities?

References rand().

Referenced by Node::random_insert(), Node::random_insert(), and test11().

◆ exists()

static bool madness::World::exists ( World world)
inlinestatic

Check if the World exists in the registry.

Parameters
[in]worldpointer to a World object
Returns
true if world exists

References default_world, and worlds.

Referenced by madness::WorldObject< Derived >::~WorldObject().

◆ find_instance()

static World * madness::World::find_instance ( const SafeMPI::Intracomm comm)
inlinestatic

Find the World (if it exists) corresponding to the given communicator.

Parameters
[in]commThe communicator.
Returns
Pointer to the World that was constructed from comm; if such a World does not exist, return 0.

References madness::WorldMpiInterface::comm(), default_world, mpi, and worlds.

Referenced by is_default().

◆ get_default()

static World & madness::World::get_default ( )
inlinestatic

Default World object accessor.

This function returns a reference to the default world object; this is the same World object that is returned by madness::initialize().

Returns
A reference to the default World.
Exceptions
madness::Exceptionif the MADNESS_DISABLE_WORLD_GET_DEFAULT preprocessor macro is defined

References default_world, MADNESS_ASSERT, and MADNESS_EXCEPTION.

Referenced by allocator(), and madness::FunctionDefaults< NDIM >::get_pmap().

◆ get_user_state()

void * madness::World::get_user_state ( )
inline

Returns a pointer to the user-managed local state set by set_user_state().

Returns
A pointer to the user-managed local state; NULL if set_user_state() has not been invoked.

References user_state.

◆ id()

unsigned long madness::World::id ( ) const
inline

◆ id_from_ptr() [1/2]

template<typename T >
std::optional< uniqueidT > madness::World::id_from_ptr ( std::shared_ptr< T > &  ptr) const
inline

Look up a unique ID from a local pointer.

Template Parameters
TThe type of the data to look up.
Parameters
[in]ptrThe local pointer.
Returns
Optional containing the unique ID, if the pointer is registered, or a null optional, if the pointer is not registered.

References id_from_ptr().

◆ id_from_ptr() [2/2]

template<typename T >
std::optional< uniqueidT > madness::World::id_from_ptr ( T ptr) const
inline

Look up an ID from a local pointer.

Template Parameters
TThe type of the data to look up.
Parameters
[in]ptrThe local pointer.
Returns
Optional containing the unique ID if the pointer is registered, or a null optional if the pointer is not registered.

References madness::ConcurrentHashMap< keyT, valueT, hashfunT >::find(), and map_ptr_to_id.

Referenced by id_from_ptr(), and test6().

◆ initialize_world_id_range()

void madness::World::initialize_world_id_range ( int  global_rank)
staticprivate

initializes the value of world_id__next_last to {global_rank*2^32, (global_rank+1)*2^32-1}

Parameters
global_rankrank of this process in COMM_WORLD

References world_id__next_last.

◆ is_default()

static bool madness::World::is_default ( const SafeMPI::Intracomm comm)
inlinestatic

Checks if the default World object corresponds to the given Intracomm.

Parameters
[in]commThe communicator.
Returns
true if comm is the default World object's communicator
See also
World::get_default()

References default_world, and find_instance().

◆ make_unique_obj_id()

uniqueidT madness::World::make_unique_obj_id ( )
inline

Creates a new universe-wide unique ID for objects created in this World. No comms.

You should consider using register_ptr(), unregister_ptr(), id_from_ptr(), or ptr_from_id() rather than using this directly.

Currently relies on this being called in the same order on every process within the current World in order to avoid synchronization.

Unique IDs are created by increasing static counter. The value obj_id=0 is invalid.

Returns
A new universe-wide unique ID for objects created in this World.
Warning
This is not re-entrant, should be called from a single (typically, main) thread

References _id, and obj_id.

Referenced by register_ptr().

◆ next_unique_obj_id()

uniqueidT madness::World::next_unique_obj_id ( ) const
inline

Reports the next universe-wide unique ID generated by make_unique_obj_id() objects created in this World. No comms.

Returns
A the next universe-wide unique ID for objects created in this World.
Warning
This is not re-entrant, should be called from a single (typically, main) thread

References _id, and obj_id.

◆ next_world_id()

std::uint64_t madness::World::next_world_id ( )
staticprivate
Returns
next unique World id

References MADNESS_ASSERT, and world_id__next_last.

Referenced by World().

◆ nproc()

ProcessID madness::World::nproc ( ) const
inline

Returns the number of processes in this World (same as MPI_Comm_size()).

Returns
The number of processes in this World.

References mpi, and madness::WorldMpiInterface::nproc().

Referenced by Foo::Foo(), and test6().

◆ ptr_from_id()

template<typename T >
std::optional< T * > madness::World::ptr_from_id ( uniqueidT  id) const
inline

◆ rand()

int madness::World::rand ( )
inline

Returns a CRUDE, LOW-QUALITY, random number (integer) uniformly distributed in [0,2**24).

Each process has a distinct seed for the generator.

Returns
The random number.
Todo:
Since we're switching to C++11, would it be worth using the new C++11 random number generation capabilities?

References myrand_next.

Referenced by drand(), main(), random_proc(), random_proc_not_me(), and srand().

◆ random_proc()

ProcessID madness::World::random_proc ( )
inline

Returns a random process number; that is, an integer in [0,world.size()).

Returns
The random process number.

References rand(), and size().

Referenced by madness::FunctionImpl< T, NDIM >::apply(), and madness::FunctionImpl< T, NDIM >::apply_source_driven().

◆ random_proc_not_me()

ProcessID madness::World::random_proc_not_me ( )
inline

Returns a random process number [0,world.size()) that is not the calling process.

It doesn't make any sense to call this with just one process, but just in case, this returns -1 in the hope that you won't actually use the result.

Returns
The random process number, or -1.

References p(), rand(), rank(), and size().

◆ rank()

ProcessID madness::World::rank ( ) const
inline

Returns the process rank in this World (same as MPI_Comm_rank()).

Returns
The process rank in this World.

References mpi, and madness::WorldMpiInterface::rank().

Referenced by madness::AC< NDIM >::AC(), madness::AdhocNuclearCorrelationFactor::AdhocNuclearCorrelationFactor(), madness::BSHApply< T, NDIM >::BSHApply(), Calculation::Calculation(), DF::DF(), madness::DFT< T, NDIM >::DFT(), EwaldNuclearPotentialFunctor::EwaldNuclearPotentialFunctor(), madness::F12Potentials::F12Potentials(), madness::GaussSlater::GaussSlater(), madness::GradientalGaussSlater::GradientalGaussSlater(), madness::Group::Impl::Impl(), madness::LinearSlater::LinearSlater(), madness::Molecule::Molecule(), madness::MP2::MP2(), madness::MP2::Parameters::Parameters(), madness::poly4erfc::poly4erfc(), madness::Polynomial< N >::Polynomial(), madness::PseudoNuclearCorrelationFactor::PseudoNuclearCorrelationFactor(), madness::SCF::SCF(), madness::Slater::Slater(), World(), madness::Znemo::Znemo(), A(), A2(), madness::PNO::adaptive_solver(), madness::MP2::add_local_coupling(), madness::MacroTaskQ::add_tasks(), madness::WorldGopInterface::all_reduce(), madness::Znemo::analyze(), madness::TDHF::analyze(), madness::SCF::analyze_vectors(), madness::apply(), madness::FunctionImpl< T, NDIM >::apply_1d_realspace_push(), madness::Solver< T, NDIM >::apply_potential(), madness::SCF::apply_potential(), madness::F12Potentials::apply_regularized_potential(), apply_U_mix(), apply_U_ncf(), madness::MP2::asymmetry(), madness::WorldGopInterface::barrier(), madness::WorldGopInterface::bcast(), madness::WorldGopInterface::bcast_internal(), madness::FunctionImpl< T, NDIM >::binaryXX(), madness::WorldGopInterface::broadcast_serializable(), madness::BSHOperator(), madness::BSHOperatorPtr(), madness::Solver< T, NDIM >::build_fock_matrix(), Calculation::calc_optimal_coeffs(), check(), madness::ACParameters< NDIM >::check(), madness::NemoBase::check_convergence(), madness::LowRankFunction< T, NDIM, LDIM >::check_orthonormality(), madness::PNO::check_orthonormality(), check_vector(), chin_chen(), chin_chen(), madness::archive::ContainerRecordOutputArchive::close(), compare(), madness::Nemo::compute_all_cphf(), madness::Znemo::compute_energy(), madness::OEP::compute_energy(), madness::MP2::compute_energy(), compute_energy(), compute_energy(), compute_energy(), compute_energy(), madness::Nemo::compute_energy_regularized(), compute_energy_simple(), compute_energy_with_U(), madness::F12Potentials::compute_f12_energies(), madness::F12Potentials::compute_f12_energies(), madness::F12Potentials::compute_f12_pair_energy(), madness::PNO::compute_fluctuation_matrix(), madness::F12Potentials::compute_fQc_integrals_ij(), madness::F12Potentials::compute_fQU_integrals(), madness::MP2::compute_gQf(), compute_madelung_energy(), compute_madelung_energy_PWSCF(), compute_R2f2_psi(), madness::Solver< T, NDIM >::compute_residual(), madness::SCF::compute_residual(), madness::Znemo::compute_residuals(), madness::Solver< T, NDIM >::compute_rho(), madness::Solver< T, NDIM >::compute_rho_slow(), converge(), converge(), converge2s(), madness::F12Potentials::convolve_with_fU(), madness::PotentialManager::core_projection(), madness::create_nuclear_correlation_factor(), madness::MacroTaskQ::create_worlds(), TTT::dave(), madness::SCF::derivatives(), DF::DF_load_balance(), DF::diagonalize(), madness::SCF::dipole(), dipole_generator(), madness::FunctionImpl< T, NDIM >::do_apply_kernel(), madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::do_print_timings(), madness::Solver< T, NDIM >::do_rhs(), madness::Solver< T, NDIM >::do_rhs_simple(), madness::Znemo::do_step_restriction(), madness::SCF::do_step_restriction(), MiniDFT::doit(), doit(), doplot(), madness::Znemo::timer::end(), molresponse::end_timer(), molresponse::end_timer(), END_TIMER(), END_TIMER(), END_TIMER(), madness::Solver< T, NDIM >::END_TIMER(), madness::END_TIMER(), madness::MP2::END_TIMER(), energy(), energy(), energy(), madness::CC2::enforce_core_valence_separation(), madness::CCConvolutionOperator< T, NDIM >::error(), madness::CCParameters::error(), GygiPot::ESP(), DF::exchange(), exchange_anchor_test(), madness::archive::BaseParallelArchive< Archive >::exists(), madness::WorldGopInterface::fence_impl(), madness::QCCalculationParametersBase::file_exists(), fixphases(), fixphases(), madness::DerivativeBase< T, NDIM >::forward_do_diff1(), madness::FunctionImpl< T, NDIM >::forward_traverse(), madness::FunctionImpl< T, NDIM >::gaxpy_ext(), madness::FunctionImpl< T, NDIM >::gaxpy_inplace_reconstructed(), generate_G_vectors(), generate_R_vectors(), madness::MP2::get_fock_matrix(), madness::MP2::get_residue(), madness::MacroTaskQ::get_scheduled_task_number(), madness::MacroTaskQ::get_scheduled_task_number_local(), madness::GMRES(), madness::Nemo::gradient(), madness::Znemo::gradient(), gradPbarA(), ground_exchange(), madness::SCF::group_orbital_sets(), madness::MP2::guess_mp1_3(), madness::BasisFunctions::guess_virtuals_from_file(), madness::BasisFunctions::guess_virtuals_internal(), madness::BasisFunctions::guess_with_exop(), madness::hartree_product(), madness::FunctionImpl< T, NDIM >::hartree_product(), madness::Nemo::hessian(), madness::MP2::increment(), madness::CCPair::info(), madness::CCTimer::info(), madness::ElectronPair::info(), madness::CCFunction< T, NDIM >::info(), madness::CCParameters::information(), madness::Solver< T, NDIM >::init(), madness::Solver< T, NDIM >::initial_guess(), madness::SCF::initial_guess(), initial_guess(), initial_loadbal(), madness::SCFProtocol::initialize(), initialize_calc_params(), madness::CC2::initialize_pairs(), madness::PNO::initialize_pairs(), madness::CC2::initialize_singles(), madness::archive::BaseParallelArchive< Archive >::is_io_node(), madness::Znemo::iterate(), madness::OEP::iterate(), iterate(), iterate(), iterate(), DF::iterate(), iterate(), iterate(), iterate(), iterate_excite(), iterate_excite(), iterate_ground(), iterate_ground(), madness::CC2::iterate_lrcc2_pairs(), madness::CC2::iterate_pair(), madness::PNO::iterate_pairs_internal(), madness::CC2::iterate_singles(), iterate_xy(), TTT::kate(), madness::LowRankFunction< T, NDIM, LDIM >::l2error(), madness::WorldGopInterface::lazy_sync_internal(), line_plot(), madness::LoadBalanceDeux< NDIM >::load_balance(), load_balance(), madness::load_coeffs(), madness::Cloud::load_from_cache(), madness::MP2::load_function(), madness::Nemo::load_function(), load_function(), madness::load_function(), madness::SCF::load_mos(), madness::CCPair::load_pair(), madness::ElectronPair::load_pair(), madness::GTHPseudopotential< Q >::load_pseudo_from_file(), madness::load_quadrature(), madness::OEP::load_restartdata(), loadbal(), loadbal(), loadbal(), madness::detail::WorldPtr< T >::local_rank(), madness::Localizer::localize_boys(), madness::Localizer::localize_new(), main(), madness::main(), main(), main(), madness::Solver< T, NDIM >::make_bsh_operators(), madness::SCF::make_bsh_operators(), DF::make_component_lineplots(), DF::make_component_logplots(), DF::make_density_lineplots(), DF::make_fermi_potential(), DF::make_gaussian_potential(), DF::make_gaussian_potential(), madness::Zcis::make_guess(), madness::TDHF::make_guess_from_initial_diagonalization(), madness::MP2::make_KffKphi0(), madness::Solver< T, NDIM >::make_nuclear_charge_density_impl(), madness::Solver< T, NDIM >::make_nuclear_potential(), madness::MP2::make_pair(), madness::MP2::make_Uphi0(), madness::TDHF::make_virtuals(), madness::FunctionImpl< T, NDIM >::make_Vphi_only(), MiniDFT::makeao(), makeao(), moments(), madness::FunctionImpl< T, NDIM >::multiply(), madness::FunctionImpl< T, NDIM >::mulXX(), madness::FunctionImpl< T, NDIM >::mulXXvec(), madness::FunctionImpl< T, NDIM >::mulXXveca(), madness::archive::BaseParallelArchive< Archive >::my_io_node(), madness::archive::BaseParallelArchive< Archive >::open(), madness::FunctionImpl< T, NDIM >::recursive_apply_op< opT, LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::recursive_apply_op2< opT >::operator()(), MicroTask::operator()(), BoysLocalization::operator()(), madness::CCMessenger::operator<<(), madness::DistributedMatrixDistribution::operator==(), madness::SCF::orthonormalize(), madness::SCF::orthonormalize(), madness::smooth< T, NDIM >::output(), madness::CCMessenger::output(), madness::SCF::output_calc_info_schema(), madness::CC2::output_calc_info_schema(), Pbar(), PbarA(), SurfaceMoleculeInteraction::perturbed_molecular_pot(), madness::plot_along(), madness::plot_along(), madness::plot_line(), madness::plot_line(), madness::plot_line(), madness::plot_line(), madness::plot_line(), madness::plot_line(), Calculation::plot_p(), madness::plot_plane(), madness::plot_plane(), madness::plot_plane(), madness::plotdx(), madness::plotpovray(), madness::plotvtk_begin(), madness::plotvtk_data(), madness::plotvtk_data(), madness::plotvtk_end(), madness::PNO::pno_compress(), preloadbal(), madness::MyTimer::print(), madness::CCTimer::print(), madness::MyTimer::print(), madness::timer::print(), madness::ACParameters< NDIM >::print(), madness::WorldProfile::print(), madness::WorldDCPmapInterface< keyT >::print_data_sizes(), FermiNucDistFunctor::print_details(), madness::ElectronPair::print_energy(), madness::Solver< T, NDIM >::print_fock_matrix_eigs(), madness::MolecularOrbitals< T, NDIM >::print_frozen_orbitals(), madness::projector_irrep::print_info(), print_info(), print_info(), DF::print_molecule(), madness::F12Potentials::print_pair_energies(), madness::F12Potentials::print_pair_energies(), madness::Solver< T, NDIM >::print_potential_matrix_eigs(), madness::print_seq(), madness::print_seq(), madness::print_seq(), madness::print_seq(), madness::Cloud::print_size(), madness::print_size(), DF::print_sizes(), madness::print_stats(), print_stats(), print_stats(), print_stats_header(), madness::MacroTaskQ::print_taskq(), madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::print_timer(), madness::Cloud::print_timings(), madness::CCMessenger::print_warnings(), madness::TDHF::print_xfunctions(), printfunc(), madness::MacroTaskQ::printtimings(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::project(), madness::FunctionImpl< T, NDIM >::project_out(), madness::FunctionImpl< T, NDIM >::project_out2(), propagate(), propagate(), propagate(), q_c(), random_proc_not_me(), Array::read(), GroundStateCalculation::read(), madness::InitParameters::read(), madness::F12Potentials::read_cabs_from_file(), madness::QCCalculationParametersBase::read_commandline_options(), madness::QCCalculationParametersBase::read_input(), madness::QCCalculationParametersBase::read_internal(), madness::InitParameters::readnw(), reconstruct_psi(), madness::FunctionImpl< T, NDIM >::recursive_apply(), madness::FunctionImpl< T, NDIM >::recursive_apply(), madness::WorldGopInterface::reduce_internal(), madness::FunctionImpl< T, NDIM >::refine(), madness::archive::BaseParallelArchive< Archive >::remove(), madness::WorldContainerImpl< keyT, valueT, hashfunT >::replicate(), madness::Cloud::replicate(), madness::Solver< T, NDIM >::reproject(), madness::SCF::restart_aos(), madness::TaskInterface::run(), run(), madness::MacroTaskQ::run_all(), madness::CCParameters::sanity_check(), madness::MP2::save_function(), madness::save_function(), madness::Nemo::save_function(), save_function(), save_function(), madness::SCF::save_mos(), madness::MolecularOrbitals< T, NDIM >::save_restartaodata(), madness::OEP::save_restartdata(), DF::saveDF(), madness::CCMessenger::section(), madness::WorldGopInterface::send(), madness::WorldGopInterface::send_internal(), madness::WorldGopInterface::send_internal(), madness::MacroTaskQ::set_complete_local(), madness::XCOperator< T, NDIM >::set_extra_truncation(), madness::archive::BaseParallelArchive< Archive >::set_nclient(), madness::Solver< T, NDIM >::set_occs2(), Calculation::set_protocol(), madness::SCF::set_protocol(), simple_example(), madness::Solver< T, NDIM >::solve(), madness::CC2::solve(), madness::Nemo::solve(), madness::PNO::solve(), DF::solve(), madness::SCF::solve(), solve(), madness::CC2::solve_cc2(), madness::TDHF::solve_cis(), madness::CC2::solve_cispd(), madness::PNO::solve_cispd(), madness::MP2::solve_coupled_equations(), madness::Nemo::solve_cphf(), madness::CC2::solve_lrcc2(), madness::PNO::solve_mp2(), madness::CC2::solve_mp2_coupled(), DF::solve_occupied(), madness::MP2::solve_residual_equations(), srand(), madness::startup(), madness::Solver< T, NDIM >::step_restriction(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< ContainerRecordOutputArchive >, WorldContainer< keyT, valueT > >::store(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::store(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< VectorOutputArchive >, WorldContainer< keyT, valueT > >::store(), madness::archive::ContainerRecordOutputArchive::store(), madness::Cloud::store_other(), madness::CCPair::store_pair(), madness::ElectronPair::store_pair(), madness::CCMessenger::subsection(), madness::LoadBalanceDeux< NDIM >::sum(), madness::PNO::t_solve(), madness::Znemo::timer::tag(), Tbar(), test(), madness::TDHF::test(), test0(), test0GaussLobatto(), test1(), test10(), test11(), test12(), test13(), test14(), test15(), test2(), test2(), test5(), test6(), test6a(), test7(), test8(), test9(), test_2d_partitioning(), test_adaptive_tree(), test_apply_push_1d(), test_basic(), test_bsh(), test_conv(), test_convolution(), test_coulomb(), test_cross(), test_custom_worldobject(), test_deferred(), test_diff(), test_dnuclear(), test_dot(), madness::test_exchange(), test_exchange(), test_exchange(), test_florian(), test_fock(), test_G_R_vectors(), test_gaussian_num_coeffs(), test_gconv(), test_he(), test_hf_be(), test_hf_he(), test_hydro(), test_immediate(), test_inner(), test_inner(), test_io(), test_kinetic(), test_local(), test_lowrank_function(), test_math(), test_matrix_mul_sparse(), test_modified(), test_multi_to_multi_op(), test_multi_world(), test_nemo(), test_nuclear(), test_nuclear_energy(), test_nuclear_potential(), test_nuclear_potential2(), test_nuclear_potential3(), test_nuclear_potential_big_unit_cell(), test_op(), test_opdir(), test_plot(), test_proj(), test_qm(), test_recursive_application(), test_rot(), test_scalar_task(), test_task1(), test_twice(), test_U_el(), test_unaryop(), test_vector_of_scalar_task(), test_xc2(), test_XCOperator(), testgradG(), testNavierStokes(), trotter(), trotter(), trotter(), madness::NuclearCorrelationFactor::U2X_spherical(), madness::FunctionImpl< T, NDIM >::unaryXX(), madness::FunctionImpl< T, NDIM >::unaryXXvalues(), update(), update(), madness::PNO::update_pno(), madness::SubspaceK< T, NDIM >::update_subspace(), madness::Subspace< T, NDIM >::update_subspace(), madness::SCF::update_subspace(), madness::MP2::value(), madness::Nemo::value(), madness::MolecularEnergy::value(), madness::CCParameters::warning(), madness::archive::ArchiveImpl< ParallelInputArchive< localarchiveT >, archive_array< T > >::wrap_load(), madness::archive::ArchiveImpl< ParallelInputArchive< localarchiveT >, T >::wrap_load(), madness::archive::ArchiveImpl< ParallelOutputArchive< localarchiveT >, archive_array< T > >::wrap_store(), madness::archive::ArchiveImpl< ParallelOutputArchive< localarchiveT >, T >::wrap_store(), and Array::write().

◆ register_ptr()

template<typename T >
uniqueidT madness::World::register_ptr ( T ptr)
inline

Associate a local pointer with a universe-wide unique ID.

Use the routines register_ptr(), unregister_ptr(), id_from_ptr(), ptr_from_id() to map distributed data structures identified by the unique ID to/from process-local data.

Note
The pointer will be internally cast to a (void *), so don't use member pointers here.
All unique objects of any type within a World must presently be created in the same order on all processes so as to guarantee the uniqueness without global communication.
Template Parameters
TThe type of data to be associated.
Parameters
[in]ptrPointer to the data that will be associated with a unique ID.
Returns
The unique ID associated with the supplied data.

References id(), madness::ConcurrentHashMap< keyT, valueT, hashfunT >::insert(), MADNESS_ASSERT, make_unique_obj_id(), map_id_to_ptr, map_ptr_to_id, and T().

◆ set_user_state()

void madness::World::set_user_state ( void *  state)
inline

Sets the user-managed local state.

Rather than having all remotely invoked actions carry all of their data with them, they can access local state through their World instance. The user is responsible for consistently managing and freeing this data.

A more PC C++ style would be for the app to put state in a singleton.

Parameters
[in]stateThe user-managed local state.

References user_state.

◆ shared_ptr_from_id()

template<typename T >
std::shared_ptr< T > madness::World::shared_ptr_from_id ( uniqueidT  id) const
inline

Look up a local pointer from a world-wide unique ID.

Template Parameters
TThe type of the data to look up.
Parameters
[in]idThe unique ID.
Returns
The pointer or a default constructed std::shared_ptr if the ID is not found.

References MADNESS_ASSERT.

◆ size()

ProcessID madness::World::size ( ) const
inline

Returns the number of processes in this World (same as MPI_Comm_size()).

Returns
The number of processes in this World.

References mpi, and madness::WorldMpiInterface::size().

Referenced by madness::BinSorter< T, inserterT >::BinSorter(), madness::Group::Impl::Impl(), madness::MyPmap< D >::MyPmap(), madness::BinSorter< T, inserterT >::~BinSorter(), madness::WorldGopInterface::all_reduce(), madness::Znemo::analyze(), madness::CCPairFunction< T, NDIM >::apply(), madness::apply(), madness::Diamagnetic_potential_factor::apply_potential(), madness::SCF::apply_potential(), madness::F12Potentials::apply_regularized_potential(), madness::projector_irrep::apply_symmetry_operators(), madness::WorldGopInterface::barrier(), madness::WorldGopInterface::bcast(), madness::WorldGopInterface::bcast_internal(), madness::WorldGopInterface::broadcast_serializable(), madness::Zcis::compare_to_file(), madness::Nemo::compute_nemo_potentials(), madness::Znemo::compute_potentials(), madness::F12Potentials::convolve_with_fU(), madness::F12Potentials::convolve_with_nonlocal_U(), madness::Solver< T, NDIM >::do_rhs(), madness::Solver< T, NDIM >::do_rhs_simple(), madness::BinSorter< T, inserterT >::finish(), madness::SCF::initial_guess(), initial_loadbal(), madness::LRFunctorF12< T, NDIM, LDIM >::inner(), madness::innerXX(), madness::Znemo::iterate(), madness::OEP::iterate(), iterate(), madness::Zcis::iterate(), madness::WorldGopInterface::lazy_sync(), line_plot(), madness::LoadBalanceDeux< NDIM >::load_balance(), madness::SCF::loadbal(), loadbal(), loadbal(), loadbal(), main(), main(), madness::SCF::make_fock_matrix(), madness::TDHF::make_perturbed_fock_matrix(), madness::archive::BaseParallelArchive< Archive >::open(), madness::MacroTaskMp2ConstantPart::operator()(), madness::MacroTaskConstantPart::operator()(), madness::MacroTaskIteratePair::operator()(), madness::MacroTaskMp2UpdatePair::operator()(), madness::Fock< T, NDIM >::operator()(), VectorOfScalarTask::operator()(), madness::MacroTask< taskT >::operator()(), madness::ParametrizedExchange::operator()(), madness::FunctionImpl< T, NDIM >::do_check_symmetry_local::operator()(), madness::plot_cubefile(), madness::plot_plane(), madness::plot_plane(), madness::plot_plane(), preloadbal(), madness::MyPmap< D >::prepare_not_so_simple_map(), madness::WorldDCPmapInterface< keyT >::print_data_sizes(), madness::print_seq(), madness::print_seq(), madness::print_seq(), madness::print_seq(), madness::Cloud::print_size(), madness::print_stats(), madness::print_tree_jsonfile(), madness::projector_irrep::project_on_irreps(), random_proc(), random_proc_not_me(), Array::read(), madness::WorldProfile::recv_stats(), madness::WorldGopInterface::reduce(), madness::archive::BaseParallelArchive< Archive >::remove(), madness::WorldContainerImpl< keyT, valueT, hashfunT >::replicate(), madness::Cloud::replicate(), madness::MacroTaskQ::run_all(), madness::archive::BaseParallelArchive< Archive >::set_nclient(), simple_example(), madness::Solver< T, NDIM >::solve(), madness::CC2::solve(), madness::Nemo::solve(), madness::Nemo::solve_cphf(), madness::CC2::solve_mp2_coupled(), madness::startup(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::store(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< VectorOutputArchive >, WorldContainer< keyT, valueT > >::store(), madness::Cloud::store_other(), test10(), test12(), test13(), test14(), test15(), test2(), test5(), test6a(), test7(), test_2d_partitioning(), test_deferred(), test_io(), test_multi_world(), test_plot(), test_twice(), madness::to_conjugate_X_space(), madness::to_X_space(), madness::SubspaceK< T, NDIM >::update_subspace(), madness::Subspace< T, NDIM >::update_subspace(), madness::SCF::update_subspace(), and vector_to_PQ().

◆ srand()

void madness::World::srand ( unsigned long  seed = 0ul)
inline

Crude seed function for random number generation.

Parameters
[in]seedThe seed.
Todo:
Since we're switching to C++11, would it be worth using the new C++11 random number generation capabilities?

References myrand_next, rand(), and rank().

Referenced by test11(), and test6().

◆ unregister_ptr()

void madness::World::unregister_ptr ( const uniqueidT  id)
inline

◆ world_from_id()

static World * madness::World::world_from_id ( std::uint64_t  id)
inlinestatic

Friends And Related Symbol Documentation

◆ finalize

void finalize ( )
friend

Call this once at the very end of your main program instead of MPI_Finalize().

◆ initialize

World & initialize ( int &  ,
char **&  ,
const SafeMPI::Intracomm ,
int  ,
bool   
)
friend

Initializes the MADNESS runtime with the given MPI communicator and the given number of compute threads Call this once at the very top of your main program to initialize the MADNESS runtime. This function should be called instead of MPI_Init() or MPI_Init_thread().

Parameters
[in,out]argcApplication argument count.
[in,out]argvApplication argument values.
commThe communicator that should be used to construct the World object.
[in]nthreadThe total number of compute threads to create (the main thread is counted among the compute threads); if a negative value is given then the default number of compute threads will be used.
[in]quietIf false, will announce to std::cout on rank 0 when the runtime has been initialized.
Returns
A reference to the World constructed with comm.
Note
The default number of compute threads is read from the environment variable MAD_NUM_THREADS; if the environment variable is not given the number of compute thread is set to the system-defined number of hardware threads.

◆ WorldAmInterface

friend class WorldAmInterface
friend

◆ WorldGopInterface

friend class WorldGopInterface
friend

Member Data Documentation

◆ _id

std::uint64_t madness::World::_id
private

Universe wide unique ID of this world.

Referenced by World(), ~World(), id(), make_unique_obj_id(), and next_unique_obj_id().

◆ am

WorldAmInterface& madness::World::am

◆ default_world

World * madness::World::default_world = nullptr
staticprivate

Default world.

The default World.

Referenced by exists(), find_instance(), get_default(), is_default(), and world_from_id().

◆ gop

WorldGopInterface& madness::World::gop

Global operations.

Referenced by madness::AC< NDIM >::AC(), Calculation::Calculation(), DF::DF(), madness::FunctionImpl< T, NDIM >::FunctionImpl(), madness::LoadBalanceDeux< NDIM >::LoadBalanceDeux(), madness::Molecule::Molecule(), madness::SCF::SCF(), madness::Znemo::timer::timer(), madness::timer::timer(), ~World(), madness::abssq(), madness::add(), madness::add(), madness::add(), madness::add(), madness::MP2::add_local_coupling(), madness::apply(), madness::apply(), madness::FunctionImpl< T, NDIM >::apply(), madness::apply(), madness::apply(), madness::apply(), madness::apply(), madness::apply(), madness::apply(), madness::apply(), madness::FunctionImpl< T, NDIM >::apply_1d_realspace_push(), apply_BSH(), apply_BSH_new(), madness::MP2::apply_exchange_vector(), madness::TDHF::apply_excitation_operators(), madness::TDHF::apply_G(), madness::GTHPseudopotential< Q >::apply_potential(), apply_potential(), madness::SCF::apply_potential(), madness::FunctionImpl< T, NDIM >::apply_source_driven(), madness::projector_irrep::apply_symmetry_operators(), madness::FunctionImpl< T, NDIM >::binaryXX(), madness::archive::BaseParallelArchive< Archive >::broadcast(), madness::Solver< T, NDIM >::build_fock_matrix(), Calculation::calc_optimal_coeffs(), madness::change_tree_state(), madness::Function< T, NDIM >::clear(), madness::Cloud::clear_cache(), madness::compress(), madness::Localizer::compute_core_valence_separation_transformation_matrix(), madness::PNO::compute_fluctuation_matrix(), madness::F12Potentials::compute_fQc_integrals_ij(), madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::compute_K_tile(), madness::NemoBase::compute_kinetic_energy(), madness::CC2::compute_local_coupling(), madness::Nemo::compute_nemo_potentials(), madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::MacroTaskExchangeSimple::compute_offdiagonal_batch_in_symmetric_matrix(), madness::F12Potentials::compute_regularized_fluctuation_matrix(), madness::F12Potentials::compute_regularized_fluctuation_matrix(), madness::SCF::compute_residual(), Calculation::compute_residuals(), madness::Solver< T, NDIM >::compute_rho(), madness::Solver< T, NDIM >::compute_rho_slow(), madness::conj(), madness::convert(), madness::response_space::copy(), madness::copy(), madness::copy(), madness::copy(), madness::FunctionImpl< T, NDIM >::copy_coeffs(), madness::DistributedMatrix< T >::copy_to_replicated(), madness::DistributedMatrix< T >::copy_to_replicated_patch(), madness::PotentialManager::core_projection(), madness::MacroTaskQ::create_worlds(), madness::cross(), madness::SCF::derivatives(), dipole_generator(), madness::div(), madness::FunctionImpl< T, NDIM >::do_dirac_convolution(), madness::Znemo::do_step_restriction(), madness::SCF::do_step_restriction(), doit(), dostuff(), madness::Znemo::timer::end(), madness::SystolicFixOrbitalOrders::end_iteration_hook(), madness::SystolicPMOrbitalLocalize::end_iteration_hook(), molresponse::end_timer(), molresponse::end_timer(), energy(), energy(), madness::archive::BaseParallelArchive< Archive >::exists(), madness::QCCalculationParametersBase::file_exists(), madness::BinSorter< T, inserterT >::finish(), madness::FunctionImpl< T, NDIM >::flo_unary_op_node_inplace(), madness::FunctionImpl< T, NDIM >::flo_unary_op_node_inplace(), madness::FunctionImpl< T, NDIM >::gaxpy(), madness::gaxpy(), madness::gaxpy(), gaxpy1(), madness::FunctionImpl< T, NDIM >::gaxpy_ext(), madness::FunctionImpl< T, NDIM >::gaxpy_inplace(), madness::FunctionImpl< T, NDIM >::gaxpy_inplace_reconstructed(), madness::ScalarResult< T >::get(), get_fock_transformation(), madness::SCF::get_fock_transformation(), madness::MacroTaskQ::get_scheduled_task_number(), madness::StrongOrthogonalityProjector< T, NDIM >::get_vectors_for_outer_product(), madness::WorldDCPmapInterface< keyT >::global_size(), madness::grad(), madness::grad_ble_one(), madness::grad_ble_two(), madness::grad_bpsline_two(), madness::grad_bspline_one(), madness::grad_bspline_three(), CoreFittingTarget::gradient(), ground_exchange(), ground_exchange_multiworld(), madness::BasisFunctions::guess_with_exop(), madness::hartree_product(), madness::FunctionImpl< T, NDIM >::hartree_product(), madness::Solver< T, NDIM >::init(), madness::Solver< T, NDIM >::initial_guess(), initial_loadbal(), initialize_calc_params(), madness::inner(), madness::inner(), madness::innerXX(), madness::timer::interrupt(), madness::CC2::iterate_singles(), madness::SCF::kinetic_energy_matrix(), madness::Kinetic< T, NDIM >::kinetic_energy_matrix(), madness::Kinetic< T, NDIM >::kinetic_energy_matrix(), line_plot(), madness::FunctionImpl< T, NDIM >::load(), madness::archive::ArchiveLoadImpl< ParallelInputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::load(), madness::LoadBalanceDeux< NDIM >::load_balance(), madness::load_coeffs(), madness::SCF::load_mos(), Calculation::load_mos(), madness::Solver< T, NDIM >::load_orbitals(), madness::load_quadrature(), madness::SCF::loadbal(), loadbal(), loadbal(), loadbal(), madness::Localizer::localize_boys(), madness::Localizer::localize_new(), main(), madness::main(), main(), main(), DF::make_component_lineplots(), DF::make_component_logplots(), madness::Nemo::make_density(), madness::SCF::make_density(), madness::SCF::make_density(), MiniDFT::make_density(), DF::make_density_lineplots(), madness::SCF::make_fock_matrix(), madness::Zcis::make_guess(), madness::TDHF::make_perturbed_fock_matrix(), madness::CompositeFunctorInterface< T, NDIM, MDIM >::make_redundant(), Calculation::make_reference(), Calculation::make_Upsi(), madness::TDHF::make_virtuals(), madness::FunctionImpl< T, NDIM >::make_Vphi(), madness::FunctionImpl< T, NDIM >::make_Vphi_only(), MiniDFT::makeao(), makeao_slow(), madness::matrix_dot(), madness::matrix_inner(), madness::matrix_inner_old(), madness::matrix_mul_sparse(), madness::FunctionImpl< T, NDIM >::merge_trees(), madness::mul(), madness::mul(), madness::mul(), madness::mul(), madness::mul_sparse(), madness::mul_sparse(), madness::EigSolverOp< T, NDIM >::multi_op_o(), madness::EigSolverOp< T, NDIM >::multi_op_r(), madness::FunctionImpl< T, NDIM >::multi_to_multi_op_values(), madness::Function< T, NDIM >::multiop_values(), madness::FunctionImpl< T, NDIM >::multiop_values(), madness::multiply(), madness::MP2::multiply_with_0th_order_Hamiltonian(), madness::FunctionImpl< T, NDIM >::mulXX(), madness::FunctionImpl< T, NDIM >::mulXXvec(), madness::nonstandard(), madness::norm2(), madness::X_space::norm2s(), madness::norm2s(), madness::norm2s(), madness::norm2s_T(), madness::norm_tree(), madness::norm_tree(), madness::normalize(), madness::WorldGopInterface::DelayedSend< keyT, valueT >::notify(), madness::archive::BaseParallelArchive< Archive >::open(), madness::pg_operator::operator()(), MyDerivativeOperator< T, NDIM >::operator()(), madness::DerivativeOperator< T, NDIM >::operator()(), BoysLocalization::operator()(), madness::partial_mul(), madness::plot_along(), madness::plot_along(), madness::plot_line(), madness::plot_line(), madness::plot_line(), madness::plot_line(), madness::plot_line(), madness::plot_line(), Calculation::plot_p(), madness::plotdx(), madness::plotvtk_begin(), madness::plotvtk_data(), madness::plotvtk_data(), madness::plotvtk_end(), madness::MolecularOrbitals< T, NDIM >::post_process_mos(), preloadbal(), madness::XCOperator< T, NDIM >::prep_xc_args(), madness::XCOperator< T, NDIM >::prep_xc_args_response(), madness::WorldProfile::print(), madness::WorldDCPmapInterface< keyT >::print_data_sizes(), madness::Solver< T, NDIM >::print_fock_matrix_eigs(), madness::Solver< T, NDIM >::print_potential_matrix_eigs(), madness::Cloud::print_size(), madness::print_stats(), madness::MacroTaskQ::print_taskq(), madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::print_timer(), madness::Cloud::print_timings(), madness::SCF::project(), madness::Solver< T, NDIM >::project_ao_basis(), madness::SCF::project_ao_basis_only(), madness::projector_irrep::project_on_irreps(), madness::Function< T, NDIM >::project_out(), madness::FunctionImpl< T, NDIM >::project_out(), propagate(), propagate(), GroundStateCalculation::read(), madness::QCCalculationParametersBase::read_commandline_options(), madness::QCCalculationParametersBase::read_input(), realmain(), madness::reconstruct(), madness::FunctionImpl< T, NDIM >::recursive_apply(), madness::FunctionImpl< T, NDIM >::recursive_apply(), madness::WorldDCPmapInterface< keyT >::redistribute(), madness::FunctionImpl< T, NDIM >::refine(), madness::refine(), madness::WorldContainerImpl< keyT, valueT, hashfunT >::replicate(), madness::Cloud::replicate(), madness::CompositeFunctorInterface< T, NDIM, MDIM >::replicate_low_dim_functions(), madness::Solver< T, NDIM >::reproject(), response_exchange_multiworld(), madness::SCF::restart_aos(), madness::timer::resume(), madness::rot(), madness::Znemo::rotate_subspace(), madness::SCF::rotate_subspace(), madness::Nemo::rotate_subspace(), madness::SCF::rotate_subspace(), madness::MacroTaskQ::run_all(), madness::scale(), madness::scale(), madness::scale(), madness::scale(), madness::FunctionImpl< T, NDIM >::scale_oop(), madness::Function< T, NDIM >::set_impl(), madness::set_thresh(), simple_example(), madness::standard(), madness::MyTimer::start(), molresponse::start_timer(), DF::start_timer(), START_TIMER(), START_TIMER(), START_TIMER(), madness::Solver< T, NDIM >::START_TIMER(), madness::START_TIMER(), madness::MP2::START_TIMER(), madness::startup(), madness::FunctionImpl< T, NDIM >::store(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::store(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< VectorOutputArchive >, WorldContainer< keyT, valueT > >::store(), madness::Cloud::store(), madness::Cloud::store_other(), madness::Cloud::store_other(), madness::sub(), madness::sub(), madness::LoadBalanceDeux< NDIM >::sum(), madness::sum(), madness::sygvp(), madness::Znemo::timer::tag(), madness::timer::tag(), test(), test0(), test1(), test10(), test11(), test12(), test13(), test14(), test15(), test2(), test2(), test5(), test6(), test6a(), test7(), test_apply_push_1d(), test_basic(), test_bsh(), TEST_CASE(), test_conv(), test_conversion(), test_convolution(), test_diff(), test_florian(), test_gconv(), test_io(), test_local(), test_math(), test_multi(), test_multi_world(), test_opdir(), test_periodic(), test_periodic1(), test_periodic2(), test_periodic_bsh(), test_plot(), test_qm(), test_transform(), test_unaryop(), madness::time_transform(), madness::transform(), madness::transform(), madness::transform(), madness::transform(), madness::Zcis::transform(), transform(), madness::transform_reconstructed(), madness::truncate(), madness::truncate(), madness::SCF::twoint(), madness::FunctionImpl< T, NDIM >::unary_op_coeff_inplace(), madness::FunctionImpl< T, NDIM >::unary_op_node_inplace(), madness::FunctionImpl< T, NDIM >::unary_op_value_inplace(), madness::FunctionImpl< T, NDIM >::unaryXX(), madness::FunctionImpl< T, NDIM >::unaryXXvalues(), madness::SubspaceK< T, NDIM >::update_subspace(), madness::Subspace< T, NDIM >::update_subspace(), madness::SCF::update_subspace(), madness::MolecularEnergy::value(), CoreFittingTarget::value(), madness::Function< T, NDIM >::vmulXX(), madness::FunctionImpl< T, NDIM >::vtransform(), work_even(), work_odd(), madness::zero_functions(), madness::X_space::zero_functions(), and madness::zero_functions_compressed().

◆ map_id_to_ptr

map_id_to_ptrT madness::World::map_id_to_ptr
private

Maps unique ID of a global object to its local pointer

Note
Unique IDs are created by increasing obj_id. To be able to assign unique IDs to objects created in different worlds, they must be created in exactly the same sequence in every process. Hence in general object construction happens in main thread. Object construction first updates obj_id, then inserts ID into this. The rest of code only knows about this object once it's been added to this map, hence this map (NOT obj_id) defines the known objects. The only writers to map_id_to_ptr are {register,unregister}_ptr().

Referenced by ptr_from_id(), register_ptr(), and unregister_ptr().

◆ map_ptr_to_id

map_ptr_to_idT madness::World::map_ptr_to_id
private

inverse of map_id_to_ptr

Todo:
Verify: Map from a pointer to its unique hash ID.

Referenced by id_from_ptr(), register_ptr(), and unregister_ptr().

◆ mpi

WorldMpiInterface& madness::World::mpi

◆ myrand_next

unsigned int madness::World::myrand_next
private

State of crude internal random number generator.

Referenced by rand(), and srand().

◆ obj_id

unsigned long madness::World::obj_id
private

Counter for generating unique IDs within this world.

Referenced by make_unique_obj_id(), and next_unique_obj_id().

◆ taskq

WorldTaskQueue& madness::World::taskq

Task queue.

Referenced by madness::CubicInterpolationTable< T >::CubicInterpolationTable(), ~World(), madness::CoeffTracker< T, NDIM >::activate(), madness::FunctionImpl< T, NDIM >::multiply_op< LDIM >::activate(), madness::FunctionImpl< T, NDIM >::hartree_op< LDIM, leaf_opT >::activate(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::activate(), madness::FunctionImpl< T, NDIM >::recursive_apply_op< opT, LDIM >::activate(), madness::FunctionImpl< T, NDIM >::recursive_apply_op2< opT >::activate(), madness::WorldGopInterface::bcast_internal(), madness::WorldGopInterface::bcast_internal(), madness::distributed_localize_PM(), madness::FunctionImpl< T, NDIM >::errsq_local(), madness::WorldGopInterface::fence_impl(), madness::FunctionImpl< T, NDIM >::flo_unary_op_node_inplace(), madness::FunctionImpl< T, NDIM >::flo_unary_op_node_inplace(), madness::FunctionImpl< T, NDIM >::gaxpy_inplace(), madness::inner(), madness::inner(), madness::FunctionImpl< T, NDIM >::inner_adaptive_local(), madness::FunctionImpl< T, NDIM >::inner_ext_local(), madness::WorldGopInterface::lazy_sync(), madness::WorldGopInterface::lazy_sync(), madness::WorldGopInterface::lazy_sync_internal(), main(), main(), madness::FunctionImpl< T, NDIM >::multi_to_multi_op_values(), madness::FunctionImpl< T, NDIM >::multiop_values(), madness::WorldContainerImpl< keyT, valueT, hashfunT >::redistribute_phase2(), madness::WorldGopInterface::reduce_internal(), Task::run(), madness::WorldGopInterface::send_internal(), madness::WorldGopInterface::send_internal(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< VectorOutputArchive >, WorldContainer< keyT, valueT > >::store(), madness::WorldObject< Derived >::task(), madness::WorldObject< Derived >::task(), madness::WorldObject< Derived >::task(), madness::WorldObject< Derived >::task(), madness::WorldObject< Derived >::task(), madness::WorldObject< Derived >::task(), madness::WorldObject< Derived >::task(), madness::WorldObject< Derived >::task(), madness::WorldObject< Derived >::task(), madness::WorldObject< Derived >::task(), test10(), test5(), test9(), test_multi(), madness::FunctionImpl< T, NDIM >::unary_op_value_inplace(), and madness::FunctionImpl< T, NDIM >::vtransform().

◆ user_state

void* madness::World::user_state
private

Holds a user-defined and managed local state.

Referenced by clear_user_state(), get_user_state(), and set_user_state().

◆ world_id__next_last

std::pair< std::uint64_t, std::uint64_t > madness::World::world_id__next_last {}
staticprivate

Unique {next, last} world IDs to be used by this rank.

Referenced by initialize_world_id_range(), and next_world_id().

◆ worlds

std::list< World * > madness::World::worlds
staticprivate

Maintains list of active worlds, EXCLUDES default_world.

List of World pointers in the parallel runtime EXCEPT the default World.

Referenced by World(), ~World(), exists(), find_instance(), and world_from_id().


The documentation for this class was generated from the following files: