SimGrid
3.21
Versatile Simulation of Distributed Systems
|
Communication async.
Represents all asynchronous communications, that you can test or wait onto.
#include <Comm.hpp>
Inherits simgrid::s4u::Activity.
Public Member Functions | |
virtual | ~Comm () |
Comm * | start () override |
Starts a previously created activity. More... | |
Comm * | wait () override |
Tests whether the given activity is terminated yet. More... | |
Comm * | wait_for (double timeout) override |
Blocks until the activity is terminated, or until the timeout is elapsed Raises: timeout exception. More... | |
bool | test () override |
Returns whether this activity is completed. More... | |
Comm * | detach () |
Start the comm, and ignore its result. More... | |
Comm * | detach (void(*clean_function)(void *)) |
Start the comm, and ignore its result. More... | |
Comm * | set_rate (double rate) |
Sets the maximal communication rate (in byte/sec). More... | |
Comm * | set_src_data (void *buff) |
Specify the data to send. More... | |
Comm * | set_src_data_size (size_t size) |
Specify the size of the data to send. More... | |
Comm * | set_src_data (void *buff, size_t size) |
Specify the data to send and its size. More... | |
Comm * | set_dst_data (void **buff) |
Specify where to receive the data. More... | |
Comm * | set_dst_data (void **buff, size_t size) |
Specify the buffer in which the data should be received. More... | |
size_t | get_dst_data_size () |
Retrieve the size of the received data. More... | |
Comm * | cancel () override |
Cancel that activity. More... | |
MailboxPtr | get_mailbox () |
Retrieve the mailbox on which this comm acts. More... | |
![]() | |
void | wait_until (double time_limit) |
Blocks until the activity is terminated, or until the time limit is reached Raises: timeout exception. More... | |
Activity::State | get_state () |
Retrieve the current state of the activity. More... | |
virtual double | get_remaining () |
Get the remaining amount of work that this Activity entails. More... | |
Activity * | set_remaining (double remains) |
Set the [remaining] amount of work that this Activity will entail. More... | |
Activity * | set_user_data (void *data) |
Put some user data onto the Activity. More... | |
void * | get_user_data () |
Retrieve the user data of the Activity. More... | |
Static Public Member Functions | |
static int | wait_any (std::vector< CommPtr > *comms) |
static int | wait_any_for (std::vector< CommPtr > *comms_in, double timeout) |
static void | wait_all (std::vector< CommPtr > *comms) |
static int | test_any (std::vector< CommPtr > *comms) |
Static Public Attributes | |
static simgrid::xbt::signal< void(simgrid::s4u::ActorPtr)> | on_sender_start |
static simgrid::xbt::signal< void(simgrid::s4u::ActorPtr)> | on_receiver_start |
static simgrid::xbt::signal< void(simgrid::s4u::ActorPtr)> | on_completion |
Friends | |
void | intrusive_ptr_release (simgrid::s4u::Comm *c) |
void | intrusive_ptr_add_ref (simgrid::s4u::Comm *c) |
Additional Inherited Members | |
![]() | |
enum | State { State::INITED = 0, State::STARTED, State::CANCELED, State::ERRORED, State::FINISHED } |
![]() | |
Activity ()=default | |
virtual | ~Activity ()=default |
|
virtual |
|
inlinestatic |
take a vector s4u::CommPtr and return when one of them is finished. The return value is the rank of the first finished CommPtr.
|
static |
Same as wait_any, but with a timeout. If the timeout occurs, parameter last is returned.
|
static |
take a vector s4u::CommPtr and return when all of them is finished.
|
static |
take a vector s4u::CommPtr and return the rank of the first finished one (or -1 if none is done).
|
overridevirtual |
Starts a previously created activity.
This function is optional: you can call wait() even if you didn't call start()
Implements simgrid::s4u::Activity.
|
overridevirtual |
Tests whether the given activity is terminated yet.
This is a pure function. Blocks until the activity is terminated
Implements simgrid::s4u::Activity.
|
overridevirtual |
Blocks until the activity is terminated, or until the timeout is elapsed Raises: timeout exception.
Implements simgrid::s4u::Activity.
|
overridevirtual |
Returns whether this activity is completed.
Implements simgrid::s4u::Activity.
Comm* simgrid::s4u::Comm::detach | ( | ) |
Start the comm, and ignore its result.
It can be completely forgotten after that.
|
inline |
Start the comm, and ignore its result.
It can be completely forgotten after that.
Comm* simgrid::s4u::Comm::set_rate | ( | double | rate | ) |
Sets the maximal communication rate (in byte/sec).
Must be done before start
Comm* simgrid::s4u::Comm::set_src_data | ( | void * | buff | ) |
Specify the data to send.
This is way will get actually copied over to the receiver. That's completely unrelated from the simulated size (given with Activity::set_remaining()): you can send a short buffer in your simulator, that represents a very large message in the simulated world, or the opposite.
Comm* simgrid::s4u::Comm::set_src_data_size | ( | size_t | size | ) |
Specify the size of the data to send.
Not to be mixed with Activity::set_remaining()
That's the size of the data to actually copy in the simulator (ie, the data passed with Activity::set_src_data()). That's completely unrelated from the simulated size (given with Activity::set_remaining()): you can send a short buffer in your simulator, that represents a very large message in the simulated world, or the opposite.
Comm* simgrid::s4u::Comm::set_src_data | ( | void * | buff, |
size_t | size | ||
) |
Specify the data to send and its size.
Don't mix the size with Activity::set_remaining()
This is way will get actually copied over to the receiver. That's completely unrelated from the simulated size (given with Activity::set_remaining()): you can send a short buffer in your simulator, that represents a very large message in the simulated world, or the opposite.
Comm* simgrid::s4u::Comm::set_dst_data | ( | void ** | buff | ) |
Specify where to receive the data.
That's a buffer where the sent data will be copied
Comm* simgrid::s4u::Comm::set_dst_data | ( | void ** | buff, |
size_t | size | ||
) |
Specify the buffer in which the data should be received.
That's a buffer where the sent data will be copied
size_t simgrid::s4u::Comm::get_dst_data_size | ( | ) |
Retrieve the size of the received data.
Not to be mixed with Activity::set_remaining()
|
overridevirtual |
Cancel that activity.
Implements simgrid::s4u::Activity.
MailboxPtr simgrid::s4u::Comm::get_mailbox | ( | ) |
Retrieve the mailbox on which this comm acts.
|
friend |
|
friend |
|
static |
|
static |
|
static |