32#ifndef MADNESS_WORLD_WORLDRMI_H__INCLUDED
33#define MADNESS_WORLD_WORLDRMI_H__INCLUDED
125 const auto a_src =
a.src;
126 const auto b_src =
b.src;
127 if (a_src == b_src) {
128 const auto a_count_bk =
a.count >> 14;
129 const auto b_count_bk =
b.count >> 14;
130 if (a_count_bk == 0b00 && b_count_bk == 0b11) {
132 }
else if (a_count_bk == 0b11 && b_count_bk == 0b00) {
135 return a.count <
b.count;
138 return a_src < b_src;
188 static std::list< std::unique_ptr<RMISendReq> >
send_req;
197 if ((*it)->TestAndFree())
220 std::list< std::tuple<int,size_t,int> >
hugeq;
235 std::unique_ptr<SafeMPI::Status[]>
status;
236 std::unique_ptr<int[]>
ind;
237 std::unique_ptr<qmsg[]>
q;
358 "!! MADNESS RMI error: Attempting to send a message when the RMI thread is not running\n"
359 "!! MADNESS RMI error: This typically occurs when an active message is sent or a remote task is spawned after calling madness::finalize()\n");
Interface templates for the archives (serialization).
Wrapper around MPI_Comm. Has a shallow copy constructor; use Create(Get_group()) for deep copy.
Definition safempi.h:490
Mutex using pthread mutex operations.
Definition worldmutex.h:131
Definition worldrmi.h:210
void post_pending_huge_msg()
Definition worldrmi.cc:180
const ProcessID rank
Definition worldrmi.h:224
std::size_t maxq_
Definition worldrmi.h:231
std::unique_ptr< counterT[]> recv_counters
Definition worldrmi.h:227
std::unique_ptr< void *[]> recv_buf
Definition worldrmi.h:232
std::unique_ptr< SafeMPI::Status[]> status
Definition worldrmi.h:235
std::atomic< bool > finished
Definition worldrmi.h:225
static bool is_ordered(attrT attr)
Definition worldrmi.h:240
int n_in_q
Definition worldrmi.h:238
void run()
Definition worldrmi.h:250
std::unique_ptr< counterT[]> send_counters
Definition worldrmi.h:226
std::unique_ptr< qmsg[]> q
Definition worldrmi.h:237
std::unique_ptr< int[]> ind
Definition worldrmi.h:236
static void huge_msg_handler(void *buf, size_t nbytein)
Definition worldrmi.cc:325
long nssend_
Definition worldrmi.h:230
static constexpr int unique_tag_period()
Definition worldrmi.h:304
void post_recv_buf(int i)
Definition worldrmi.cc:201
int unique_tag() const
Definition worldrmi.cc:488
std::size_t nrecv_
Definition worldrmi.h:229
Request isend(const void *buf, size_t nbyte, ProcessID dest, rmi_handlerT func, attrT attr)
SafeMPI::Intracomm comm
Definition worldrmi.h:222
std::unique_ptr< SafeMPI::Request[]> recv_req
Definition worldrmi.h:233
virtual ~RmiTask()
Definition worldrmi.cc:215
std::list< std::tuple< int, size_t, int > > hugeq
q of huge messages, each msg = {source,nbytes,tag}
Definition worldrmi.h:220
std::size_t max_msg_len_
Definition worldrmi.h:228
const int nproc
Definition worldrmi.h:223
void exit()
Definition worldrmi.h:279
void process_some()
Definition worldrmi.cc:61
static void set_rmi_task_is_running(bool flag=true)
Definition worldrmi.cc:411
This class implements the communications server thread and provides the only send interface.
Definition worldrmi.h:165
static const attrT ATTR_UNORDERED
Definition worldrmi.h:180
static void begin(const SafeMPI::Intracomm &comm=SafeMPI::COMM_WORLD)
Definition worldrmi.cc:374
static int testsome_backoff_us
Definition worldrmi.h:183
qmsg::counterT counterT
Definition worldrmi.h:166
static bool & is_server_thread_accessor()
Definition worldrmi.cc:55
static void clear_send_req()
Definition worldrmi.h:192
static std::size_t nrecv()
Returns the number of recv buffers.
Definition worldrmi.h:341
static std::size_t maxq()
Definition worldrmi.h:331
static std::size_t max_msg_len()
Returns the size of recv buffers, in bytes.
Definition worldrmi.h:327
static bool debugging
Definition worldrmi.h:311
static bool get_this_thread_is_server()
Definition worldrmi.h:186
static void set_debug(bool status)
Definition worldrmi.h:380
static const size_t HEADER_LEN
Definition worldrmi.h:179
static const attrT ATTR_ORDERED
Definition worldrmi.h:181
static void assert_aslr_off(const SafeMPI::Intracomm &comm=SafeMPI::COMM_WORLD)
Definition worldrmi.cc:359
static std::list< std::unique_ptr< RMISendReq > > send_req
Definition worldrmi.h:188
static const size_t DEFAULT_MAX_MSG_LEN
the default size of recv buffers, in bytes; the actual size can be configured by the user via envvar ...
Definition worldrmi.h:313
static const int DEFAULT_NRECV
the default # of recv buffers; the actual number can be configured by the user via envvar MAD_RECV_BU...
Definition worldrmi.h:314
static bool get_debug()
Definition worldrmi.h:382
static void end()
Definition worldrmi.h:372
static void set_this_thread_is_server(bool flag=true)
Definition worldrmi.h:185
qmsg::attrT attrT
Definition worldrmi.h:167
static std::unique_ptr< RmiTask > task_ptr
Definition worldrmi.h:309
RMI & operator=(const RMI &)
static const size_t ALIGNMENT
Definition worldrmi.h:178
static const RMIStats & get_stats()
Definition worldrmi.h:384
static RMIStats stats
Definition worldrmi.h:310
SafeMPI::Request Request
Definition worldrmi.h:174
static Request isend(const void *buf, size_t nbyte, ProcessID dest, rmi_handlerT func, unsigned int attr=ATTR_UNORDERED)
Send a remote method invocation (again you should probably be looking at worldam.h instead)
Definition worldrmi.h:355
Simplified thread wrapper to hide pthread complexity.
Definition thread.h:164
void bind()
Definition thread.h:137
#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
Intracomm COMM_WORLD
Definition safempi.cc:67
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
std::ptrdiff_t rel_fn_ptr_t
Definition worldrmi.h:105
ThreadBinder binder
Definition thread.cc:71
static void myusleep(unsigned int us)
Sleep or spin for specified number of microseconds.
Definition timers.h:164
std::shared_ptr< FunctionFunctorInterface< double, 3 > > func(new opT(g))
void(* rmi_handlerT)(void *buf, size_t nbyte)
This is the generic low-level interface for a message handler.
Definition worldrmi.h:104
void print_error(const T &t, const Ts &... ts)
Print items to std::cerr (items separated by spaces) and terminate with a new line.
Definition print.h:241
static const double b
Definition nonlinschro.cc:119
static const double a
Definition nonlinschro.cc:118
Defines simple templates for printing to std::cout "a la Python".
Serializes calls to MPI in case it does not support THREAD_MULTIPLE.
This for RMI server thread to manage lifetime of WorldAM messages that it is sending.
Definition worldrmi.h:159
virtual bool TestAndFree()=0
virtual ~RMISendReq()
Definition worldrmi.h:161
Definition worldrmi.h:147
uint64_t nbyte_recv
Definition worldrmi.h:151
uint64_t nbyte_sent
Definition worldrmi.h:149
uint64_t nmsg_recv
Definition worldrmi.h:150
RMIStats()
Definition worldrmi.h:154
uint64_t nmsg_sent
Definition worldrmi.h:148
uint64_t max_serv_send_q
Definition worldrmi.h:152
Definition worldrmi.h:107
rmi_handlerT func
Definition worldrmi.h:111
uint32_t attrT
attributes of the message; high 16 bits are the counter
Definition worldrmi.h:109
uint16_t counterT
counter for ordered messages
Definition worldrmi.h:108
friend bool operator<(const qmsg &a, const qmsg &b)
Definition worldrmi.h:124
qmsg()
Definition worldrmi.h:142
size_t len
Definition worldrmi.h:110
qmsg(size_t len, rmi_handlerT func, int i, int src, attrT attr, counterT count)
Definition worldrmi.h:117
attrT attr
Definition worldrmi.h:114
ProcessID src
Definition worldrmi.h:113
int i
Definition worldrmi.h:112
counterT count
Definition worldrmi.h:115
const char * status[2]
Definition testperiodic.cc:43
Implements Dqueue, Thread, ThreadBase and ThreadPool.
Defines types used by the parallel runtime.
int ProcessID
Used to clearly identify process number/rank.
Definition worldtypes.h:43