38#ifndef MADNESS_WORLD_WORLD_OBJECT_H__INCLUDED
39#define MADNESS_WORLD_WORLD_OBJECT_H__INCLUDED
54 template <
typename>
class WorldObject;
93 template <
typename memfunT>
129 template <
typename Archive>
139 template <
typename memfunT>
177 template <
typename Archive>
211 template <
typename objT,
typename memfnT,
typename Enabler =
void>
214 typedef typename std::conditional<memfunc_traits<memfnT>::constness,
250 return make_task_fn(
static_cast<const objT*
>(obj), memfn);
265#ifndef MADNESS_DISABLE_SHARED_FROM_THIS
275 template <
typename objT,
typename memfnT>
277 typename
std::enable_if< std::is_base_of<std::enable_shared_from_this<objT>, objT>::value >
::type>
280 typedef typename std::conditional<memfunc_traits<memfnT>::constness,
284 typedef typename std::conditional<memfunc_traits<memfnT>::constness,
298 return wrapperT(
const_cast<ptrT>(obj)->shared_from_this(), memfn);
309 return wrapperT(
const_cast<ptrT>(obj)->shared_from_this(), memfn);
320 return make_task_fn(
static_cast<const objT*
>(obj), memfn);
363 template <
class Derived>
412 std::optional<Derived *> opt_obj =
413 arg.get_world()->template ptr_from_id<Derived>(
id);
417 obj =
static_cast<objT *
>(*opt_obj);
422 if (obj->ready ||
arg.is_pending())
432 std::optional<Derived *> opt_obj =
433 arg.get_world()->template ptr_from_id<Derived>(
id);
437 obj =
static_cast<objT *
>(*opt_obj);
443 if (obj->ready ||
arg.is_pending())
446 const_cast<AmArg &
>(
arg).set_pending();
469 template <
typename memfnT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
470 typename arg5T,
typename arg6T,
typename arg7T,
typename arg8T,
typename arg9T>
475 am_handlerT ptr = handler<memfnT,arg1T,arg2T,arg3T,arg4T,arg5T,arg6T,arg7T,arg8T,arg9T>;
490 arg & info & arg1 & arg2 & arg3 & arg4 & arg5 & arg6 & arg7 & arg8 & arg9;
494 arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
504 template <
typename taskT>
507 typename taskT::functionT::memfn_type> task_helper;
512 am_handlerT ptr = & objT::template spawn_remote_task_handler<taskT>;
520 taskT*
task =
new taskT(
typename taskT::futureT(info.
ref),
521 task_helper::make_task_fn(obj, info.
memfun()), info.
attr, input_arch);
524 arg.get_world()->taskq.add(
task);
535 template <
typename T>
548 template <
typename T>
579 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
580 typename a4T,
typename a5T,
typename a6T,
typename a7T,
581 typename a8T,
typename a9T>
584 const a3T& a3,
const a4T& a4,
const a5T& a5,
const a6T& a6,
585 const a7T& a7,
const a8T& a8,
const a9T& a9)
const
591 a1,
a2, a3, a4, a5, a6, a7, a8, a9);
594 world.
am.
send(dest, & objT::template handler<memfnT, a1T, a2T, a3T, a4T, a5T, a6T, a7T, a8T, a9T>,
629 template <
typename taskT,
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
630 typename a4T,
typename a5T,
typename a6T,
typename a7T,
631 typename a8T,
typename a9T>
632 typename taskT::futureT
634 const a2T&
a2,
const a3T& a3,
const a4T& a4,
const a5T& a5,
635 const a6T& a6,
const a7T& a7,
const a8T& a8,
const a9T& a9,
638 typename taskT::futureT result;
640 world.
am.
send(dest, & objT::template spawn_remote_task_handler<taskT>,
641 new_am_arg(info,
a1,
a2, a3, a4, a5, a6, a7, a8, a9),
RMI::ATTR_UNORDERED);
669 for (pendingT::iterator it=nv.begin(); it!=nv.end();) {
679 if (tmp.size() == 0)
ready=
true;
685 tmp.front().invokehandler();
707 ,
objid(
world.register_ptr(static_cast<Derived*>(this))) {};
729 template <
typename memfnT>
747 template <
typename memfnT,
typename a1T>
767 template <
typename memfnT,
typename a1T,
typename a2T>
789 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T>
815 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
819 const a3T& a3,
const a4T& a4)
const
844 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
845 typename a4T,
typename a5T>
848 const a3T& a3,
const a4T& a4,
const a5T& a5)
const
875 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
876 typename a4T,
typename a5T,
typename a6T>
879 const a3T& a3,
const a4T& a4,
const a5T& a5,
const a6T& a6)
const
908 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
909 typename a4T,
typename a5T,
typename a6T,
typename a7T>
912 const a3T& a3,
const a4T& a4,
const a5T& a5,
const a6T& a6,
944 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
945 typename a4T,
typename a5T,
typename a6T,
typename a7T,
typename a8T>
948 const a3T& a3,
const a4T& a4,
const a5T& a5,
const a6T& a6,
949 const a7T& a7,
const a8T& a8)
const
982 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
983 typename a4T,
typename a5T,
typename a6T,
typename a7T,
typename a8T,
987 const a3T& a3,
const a4T& a4,
const a5T& a5,
const a6T& a6,
988 const a7T& a7,
const a8T& a8,
const a9T& a9)
const
1003 template <
typename memfnT>
1009 return world.
taskq.
add(task_helper::make_task_fn(
this, memfn), attr);
1026 template <
typename memfnT,
typename a1T>
1032 typedef TaskFn<
typename task_helper::wrapperT,
1035 return world.
taskq.
add(task_helper::make_task_fn(
this, memfn),
1055 template <
typename memfnT,
typename a1T,
typename a2T>
1061 typedef TaskFn<
typename task_helper::wrapperT,
1065 return world.
taskq.
add(task_helper::make_task_fn(
this, memfn),
1087 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T>
1093 typedef TaskFn<
typename task_helper::wrapperT,
1098 return world.
taskq.
add(task_helper::make_task_fn(
this, memfn),
1122 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
1129 typedef TaskFn<
typename task_helper::wrapperT,
1135 return world.
taskq.
add(task_helper::make_task_fn(
this, memfn),
1136 a1,
a2, a3, a4, attr);
1161 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
1162 typename a4T,
typename a5T>
1165 const a3T& a3,
const a4T& a4,
const a5T& a5,
1169 typedef TaskFn<
typename task_helper::wrapperT,
1176 return world.
taskq.
add(task_helper::make_task_fn(
this, memfn),
1177 a1,
a2, a3, a4, a5, attr);
1204 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
1205 typename a4T,
typename a5T,
typename a6T>
1208 const a3T& a3,
const a4T& a4,
const a5T& a5,
const a6T& a6,
1212 typedef TaskFn<
typename task_helper::wrapperT,
1220 return world.
taskq.
add(task_helper::make_task_fn(
this, memfn),
1221 a1,
a2, a3, a4, a5, a6, attr);
1251 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
1252 typename a4T,
typename a5T,
typename a6T,
typename a7T>
1255 const a3T& a3,
const a4T& a4,
const a5T& a5,
const a6T& a6,
1259 typedef TaskFn<
typename task_helper::wrapperT,
1268 return world.
taskq.
add(task_helper::make_task_fn(
this, memfn),
1269 a1,
a2, a3, a4, a5, a6, a7, attr);
1300 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
1301 typename a4T,
typename a5T,
typename a6T,
typename a7T,
typename a8T>
1304 const a3T& a3,
const a4T& a4,
const a5T& a5,
const a6T& a6,
1305 const a7T& a7,
const a8T& a8,
1309 typedef TaskFn<
typename task_helper::wrapperT,
1319 return world.
taskq.
add(task_helper::make_task_fn(
this, memfn),
1320 a1,
a2, a3, a4, a5, a6, a7, a8, attr);
1356 template <
typename memfnT,
typename a1T,
typename a2T,
typename a3T,
1357 typename a4T,
typename a5T,
typename a6T,
typename a7T,
typename a8T,
1361 const a3T& a3,
const a4T& a4,
const a5T& a5,
const a6T& a6,
1362 const a7T& a7,
const a8T& a8,
const a9T& a9,
1366 typedef TaskFn<
typename task_helper::wrapperT,
1377 return world.
taskq.
add(task_helper::make_task_fn(
this, memfn),
1378 a1,
a2, a3, a4, a5, a6, a7, a8, a9, attr);
1392#ifdef MADNESS_WORLDOBJECT_FUTURE_TRACE
1404 template <
typename T>
1405 std::enable_if_t<!std::is_same_v<T,void>,
void> trace(
Future<T>&
f)
const;
1409 static bool trace_futures(
const uniqueidT &
id);
1412 bool trace_futures()
const {
1413 return trace_futures(this->
id());
1418 static std::size_t trace_status_nfuture_registered(
const uniqueidT&
id);
1421 std::size_t trace_status_nfuture_registered()
const {
1422 return trace_status_nfuture_registered(this->
id());
1427 static std::size_t trace_status_nfuture_assigned(
const uniqueidT&
id);
1430 std::size_t trace_status_nfuture_assigned()
const {
1431 return trace_status_nfuture_assigned(this->
id());
1436#ifdef MADNESS_WORLDOBJECT_FUTURE_TRACE
1438 template <
typename Derived>
struct WorldObjectFutureTracer {
1440 constexpr static std::size_t world_id =
1441#ifndef MADNESS_WORLDOBJECT_FUTURE_TRACE_WORLD_ID
1444 MADNESS_WORLDOBJECT_FUTURE_TRACE_WORLD_ID
1448 constexpr static std::size_t max_object_id =
1449#ifndef MADNESS_WORLDOBJECT_FUTURE_TRACE_MAX_NOBJECTS
1452 MADNESS_WORLDOBJECT_FUTURE_TRACE_MAX_NOBJECTS
1456 static constexpr bool do_trace(
const uniqueidT&
id) {
1457 return id.get_world_id() == world_id &&
1458 id.get_obj_id() < max_object_id;
1461 static std::array<std::atomic<std::size_t>, max_object_id>
1463 static std::array<std::atomic<std::size_t>, max_object_id>
1466 struct Initializer {
1468 for (
auto &&
v : nfuture_registered) {
1471 for (
auto &&
v : nfuture_assigned) {
1476 static Initializer initializer;
1478 struct FutureTracer :
public CallbackInterface {
1479 FutureTracer(
const uniqueidT &
id) : id_(id) {
1480 if (do_trace(id_)) {
1481 nfuture_registered[id_.get_obj_id()]++;
1486 FutureTracer(
const FutureTracer &) =
delete;
1487 FutureTracer &operator=(
const FutureTracer &) =
delete;
1489 virtual ~FutureTracer() {}
1495 void notify()
override {
1496 if (do_trace(id_)) {
1497 nfuture_assigned[id_.get_obj_id()]++;
1507 template <
typename Derived>
1508 typename WorldObjectFutureTracer<Derived>::Initializer
1509 WorldObjectFutureTracer<Derived>::initializer;
1510 template <
typename Derived>
1511 std::array<std::atomic<std::size_t>, WorldObjectFutureTracer<Derived>::max_object_id>
1512 WorldObjectFutureTracer<Derived>::nfuture_registered;
1513 template <
typename Derived>
1514 std::array<std::atomic<std::size_t>, WorldObjectFutureTracer<Derived>::max_object_id>
1515 WorldObjectFutureTracer<Derived>::nfuture_assigned;
1518 template <
typename Derived>
1519 template <
typename T>
1520 std::enable_if_t<!std::is_same_v<T,void>,
void> WorldObject<Derived>::trace(Future<T>&
f)
const {
1521 f.register_callback(
1522 new typename detail::WorldObjectFutureTracer<Derived>::FutureTracer(
1526 template <
typename Derived>
1527 bool WorldObject<Derived>::trace_futures(
const uniqueidT&
id) {
1528 return detail::WorldObjectFutureTracer<Derived>::do_trace(
id);
1531 template <
typename Derived>
1532 std::size_t WorldObject<Derived>::trace_status_nfuture_registered(
const uniqueidT&
id) {
1533 if (detail::WorldObjectFutureTracer<
1534 Derived>::do_trace(
id)) {
1535 return detail::WorldObjectFutureTracer<
1536 Derived>::nfuture_registered[
id.get_obj_id()];
1541 template <
typename Derived>
1542 std::size_t WorldObject<Derived>::trace_status_nfuture_assigned(
const uniqueidT&
id) {
1543 if (detail::WorldObjectFutureTracer<
1544 Derived>::do_trace(
id)) {
1545 return detail::WorldObjectFutureTracer<
1546 Derived>::nfuture_assigned[
id.get_obj_id()];
1559 template <
class Derived>
1572 if (!ptr_opt)
MADNESS_EXCEPTION(
"WorldObj: remote operation attempting to use a locally uninitialized object",0);
1574 if (!ptr)
MADNESS_EXCEPTION(
"WorldObj: remote operation attempting to use a locally deregistered object",0);
1582 template <
class Derived>
1598 template <
class Derived>
1611 if (!ptr_opt)
MADNESS_EXCEPTION(
"WorldObj: remote operation attempting to use a locally uninitialized object",0);
1613 if (!ptr)
MADNESS_EXCEPTION(
"WorldObj: remote operation attempting to use a locally deregistered object",0);
1621 template <
class Derived>
World active message that extends an RMI message.
Definition worldam.h:80
Implements the functionality of futures.
Definition future.h:74
Specialization of Future<void> for internal convenience. This does nothing useful!
Definition future.h:736
static const Future< void > value
Definition future.h:742
A future is a possibly yet unevaluated value.
Definition future.h:373
static const attrT ATTR_UNORDERED
Definition worldrmi.h:180
Simple structure used to manage references/pointers to remote instances.
Definition worldref.h:395
Mutex that is applied/released at start/end of a scope.
Definition worldmutex.h:239
Spinlock using pthread spinlock operations.
Definition worldmutex.h:253
void lock() const
Acquire the spinlock waiting if necessary.
Definition worldmutex.h:277
void unlock() const
Free a spinlock owned by this thread.
Definition worldmutex.h:287
Contains attributes of a task.
Definition thread.h:323
void send(ProcessID dest, am_handlerT op, const AmArg *arg, const int attr=RMI::ATTR_ORDERED)
Sends a managed non-blocking active message.
Definition worldam.h:278
Implements most parts of a globally addressable object (via unique ID).
Definition world_object.h:364
World & get_world() const
Returns a reference to the world.
Definition world_object.h:717
detail::task_result_type< memfnT >::futureT task(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const TaskAttributes &attr=TaskAttributes()) const
Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5,a6).
Definition world_object.h:1207
WorldObject(World &world)
Constructor that associates an object (via the derived class) with a globally unique ID.
Definition world_object.h:703
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8) const
Definition world_object.h:947
static const T & am_arg(const T &t)
Definition world_object.h:549
static bool is_ready(const uniqueidT &id, objT *&obj, const AmArg &arg, am_handlerT ptr)
Definition world_object.h:411
static Spinlock pending_mutex
Definition world_object.h:389
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn, const a1T &a1) const
Definition world_object.h:749
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8, const a9T &a9) const
Definition world_object.h:986
WorldObject< Derived > objT
Definition world_object.h:367
WorldObject(const WorldObject &other)
Definition world_object.h:370
detail::task_result_type< memfnT >::futureT task(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const TaskAttributes &attr=TaskAttributes()) const
Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5).
Definition world_object.h:1164
detail::task_result_type< memfnT >::futureT task(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const TaskAttributes &attr=TaskAttributes()) const
Sends task to derived class method returnT (this->*memfn)(a1,a2).
Definition world_object.h:1057
World & world
The World this object belongs to. (Think globally, act locally).
Definition world_object.h:381
std::list< detail::PendingMsg > pendingT
Definition world_object.h:376
const uniqueidT & id() const
Returns the globally unique object ID.
Definition world_object.h:711
detail::task_result_type< memfnT >::futureT task(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const TaskAttributes &attr=TaskAttributes()) const
Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4).
Definition world_object.h:1125
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2) const
Definition world_object.h:769
void process_pending()
To be called from derived constructor to process pending messages.
Definition world_object.h:656
WorldObject & operator=(const WorldObject &)=delete
static void spawn_remote_task_handler(const AmArg &arg)
Handler for remote arguments.
Definition world_object.h:505
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3) const
Definition world_object.h:791
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7) const
Definition world_object.h:911
ProcessID me
Rank of self.
Definition world_object.h:385
detail::task_result_type< memfnT >::futureT task(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8, const TaskAttributes &attr=TaskAttributes()) const
Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5,a6,a7,a8).
Definition world_object.h:1303
detail::task_result_type< memfnT >::futureT task(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const TaskAttributes &attr=TaskAttributes()) const
Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5,a6,a7).
Definition world_object.h:1254
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn) const
Definition world_object.h:731
volatile bool ready
True if ready to rock 'n roll.
Definition world_object.h:384
virtual ~WorldObject()
Definition world_object.h:1385
detail::voidT voidT
Definition world_object.h:379
taskT::futureT send_task(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8, const a9T &a9, const TaskAttributes &attr) const
Definition world_object.h:633
detail::task_result_type< memfnT >::futureT task(ProcessID dest, memfnT memfn, const a1T &a1, const TaskAttributes &attr=TaskAttributes()) const
Sends task to derived class method returnT (this->*memfn)(a1).
Definition world_object.h:1028
detail::task_result_type< memfnT >::futureT task(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const TaskAttributes &attr=TaskAttributes()) const
Sends task to derived class method returnT (this->*memfn)(a1,a2,a3).
Definition world_object.h:1089
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4) const
Definition world_object.h:818
detail::task_result_type< memfnT >::futureT send_am(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8, const a9T &a9) const
Definition world_object.h:583
uniqueidT objid
Sense of self.
Definition world_object.h:386
static const T & am_arg(const Future< T > &f)
Definition world_object.h:536
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6) const
Definition world_object.h:878
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5) const
Definition world_object.h:847
detail::task_result_type< memfnT >::futureT task(ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8, const a9T &a9, const TaskAttributes &attr=TaskAttributes()) const
Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5,a6,a7,a8,...
Definition world_object.h:1360
static volatile pendingT pending
Buffer for pending messages.
Definition world_object.h:390
detail::task_result_type< memfnT >::futureT task(ProcessID dest, memfnT memfn, const TaskAttributes &attr=TaskAttributes()) const
Sends task to derived class method returnT (this->*memfn)().
Definition world_object.h:1005
static void handler(const AmArg &arg)
Handler for an incoming AM.
Definition world_object.h:471
void add(TaskInterface *t)
Add a new local task, taking ownership of the pointer.
Definition world_task_queue.h:466
A parallel world class.
Definition world.h:132
static World * world_from_id(std::uint64_t id)
Convert a World ID to a World pointer.
Definition world.h:474
WorldTaskQueue & taskq
Task queue.
Definition world.h:204
void unregister_ptr(const uniqueidT id)
Unregister a global object via its the unique ID.
Definition world.h:387
static bool exists(World *world)
Check if the World exists in the registry.
Definition world.h:247
std::optional< T * > ptr_from_id(uniqueidT id) const
Look up a local pointer from a world-wide unique ID.
Definition world.h:414
WorldAmInterface & am
AM interface.
Definition world.h:203
Wraps an archive around a memory buffer for output.
Definition buffer_archive.h:59
Functor wrapper for object and member function pointers.
Definition mem_func_wrapper.h:89
Class for unique global IDs.
Definition uniqueid.h:53
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition derivatives.cc:72
auto T(World &world, response_space &f) -> response_space
Definition global_functions.cc:34
archive_array< unsigned char > wrap_opaque(const T *, unsigned int)
Factory function to wrap a pointer to contiguous data as an opaque (uchar) archive_array.
Definition archive.h:925
auto to_rel_memfn_ptr(const T &fn)
converts nonstatic member function pointer to the relative equivalent
Definition archive.h:259
Tensor< typename Tensor< T >::scalar_type > arg(const Tensor< T > &t)
Return a new tensor holding the argument of each element of t (complex types only)
Definition tensor.h:2502
static const double v
Definition hatom_sf_dirac.cc:20
#define MADNESS_PRAGMA_CLANG(x)
Definition madness_config.h:200
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition madness_exception.h:134
#define MADNESS_ASSERT_NOEXCEPT(condition)
Same as MADNESS_ASSERT , but never throws.
Definition madness_exception.h:141
static const uniqueidT & peek(const AmArg &arg)
Extract the unique object ID from an incoming active message header.
Definition world_object.h:200
std::enable_if< std::is_void< typenamedetail::result_of< fnT >::type >::value >::type run_function(Future< void > &result, fnT fn, const voidT &, const voidT &, const voidT &, const voidT &, const voidT &, const voidT &, const voidT &, const voidT &, const voidT &)
Definition taskfn.h:317
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
AmArg * copy_am_arg(const AmArg &arg)
Definition worldam.h:170
AmArg * new_am_arg(const argT &... args)
Convenience template for serializing arguments into a new AmArg.
Definition worldam.h:194
bool initialized()
Check if the MADNESS runtime has been initialized (and not subsequently finalized).
Definition world.cc:74
static double pop(std::vector< double > &v)
Definition SCF.cc:113
void free_am_arg(AmArg *arg)
Frees an AmArg allocated with alloc_am_arg.
Definition worldam.h:177
NDIM & f
Definition mra.h:2416
void(* am_handlerT)(const AmArg &)
Type of AM handler functions.
Definition worldam.h:77
std::string type(const PairType &n)
Definition PNOParameters.h:18
Wrap a callable object and its arguments into a task function.
Definition taskfn.h:473
Base class for WorldObject, useful for introspection.
Definition world_object.h:340
virtual ~WorldObjectBase()=default
Default load of an object via serialize(ar, t).
Definition archive.h:666
static void store(const BufferOutputArchive &ar, WorldObject< Derived > *const &ptr)
Write a globally-addressable object to a BufferOutputArchive.
Definition world_object.h:1589
static void store(const BufferOutputArchive &ar, const WorldObject< Derived > *const &ptr)
Write a globally-addressable object to a BufferOutputArchive.
Definition world_object.h:1628
Default store of an object via serialize(ar, t).
Definition archive.h:611
Common base class for pending messages to ensure in-order processing.
Definition world_object.h:63
void invokehandler()
Definition world_object.h:71
uniqueidT id
Definition world_object.h:64
AmArg * arg
Definition world_object.h:66
am_handlerT handler
Definition world_object.h:65
PendingMsg(uniqueidT id, am_handlerT handler, const AmArg &arg)
Definition world_object.h:68
static wrapperT make_task_fn(WorldObject< objT > *obj, memfnT memfn)
Definition world_object.h:330
MemFuncWrapper< shared_ptrT, memfnT, typename result_of< memfnT >::type > wrapperT
Definition world_object.h:288
std::conditional< memfunc_traits< memfnT >::constness, std::shared_ptr< constobjT >, std::shared_ptr< objT > >::type shared_ptrT
Definition world_object.h:285
std::conditional< memfunc_traits< memfnT >::constness, constobjT *, objT * >::type ptrT
Definition world_object.h:281
static wrapperT make_task_fn(const objT *obj, memfnT memfn)
Definition world_object.h:297
static wrapperT make_task_fn(objT *obj, memfnT memfn)
Definition world_object.h:308
static wrapperT make_task_fn(const WorldObject< objT > *obj, memfnT memfn)
Definition world_object.h:319
Definition world_object.h:212
static wrapperT make_task_fn(const objT *obj, memfnT memfn)
Definition world_object.h:227
static wrapperT make_task_fn(WorldObject< objT > *obj, memfnT memfn)
Definition world_object.h:259
std::conditional< memfunc_traits< memfnT >::constness, constobjT *, objT * >::type ptrT
Definition world_object.h:215
static wrapperT make_task_fn(const WorldObject< objT > *obj, memfnT memfn)
Definition world_object.h:249
static wrapperT make_task_fn(objT *obj, memfnT memfn)
Definition world_object.h:238
MemFuncWrapper< ptrT, memfnT, typename result_of< memfnT >::type > wrapperT
Definition world_object.h:218
Definition world_object.h:94
TaskAttributes attr
Definition world_object.h:100
void serialize(const Archive &ar)
Serializes a info_base for I/O.
Definition world_object.h:130
ProcessID requestor
Definition world_object.h:98
memfunT_rel_ptr memfun_rel_ptr
Definition world_object.h:99
memfunT memfun() const
Definition world_object.h:103
uniqueidT id
Definition world_object.h:97
info_base()
Definition world_object.h:109
info_base(const uniqueidT &id, ProcessID requestor, memfunT memfun, const TaskAttributes &attr=TaskAttributes())
Definition world_object.h:118
decltype(archive::to_rel_memfn_ptr(std::declval< memfunT >())) memfunT_rel_ptr
Definition world_object.h:95
Definition world_object.h:140
Future< REMFUTURE(MEMFUN_RETURNT(memfunT)) > futureT
Future for a return value of the memory function.
Definition world_object.h:142
info()
Definition world_object.h:148
void serialize(const Archive &ar)
Serializes a info for I/O.
Definition world_object.h:178
info(const AmArg &arg)
Definition world_object.h:154
refT ref
Definition world_object.h:146
info(const uniqueidT &id, ProcessID requestor, memfunT memfun, const refT &ref, const TaskAttributes &attr=TaskAttributes())
Definition world_object.h:168
RemoteReference< FutureImpl< REMFUTURE(MEMFUN_RETURNT(memfunT)) > > refT
Definition world_object.h:144
T type
Definition taskfn.h:213
Future< resultT > futureT
Definition taskfn.h:244
Implements Dqueue, Thread, ThreadBase and ThreadPool.
#define REMFUTURE(T)
Macro to determine type of future (by removing wrapping Future template).
Definition type_traits.h:162
#define MEMFUN_RETURNT(MEMFUN)
Macro to make member function type traits easier to use.
Definition type_traits.h:704
const double a2
Definition vnucso.cc:86
const double a1
Definition vnucso.cc:85
Defines TaskInterface and implements WorldTaskQueue and associated stuff.
int ProcessID
Used to clearly identify process number/rank.
Definition worldtypes.h:43