SimGrid  3.13
Versatile Simulation of Distributed Systems
smx_network.cpp File Reference
#include "src/surf/surf_interface.hpp"
#include "src/simix/smx_private.h"
#include "xbt/log.h"
#include "mc/mc.h"
#include "src/mc/mc_replay.h"
#include "xbt/dict.h"
#include "simgrid/s4u/mailbox.hpp"

Functions

 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (simix_network, simix,"SIMIX network-related synchronization")
 
static void SIMIX_mbox_free (void *data)
 
static void SIMIX_waitany_remove_simcall_from_actions (smx_simcall_t simcall)
 
static void SIMIX_comm_copy_data (smx_synchro_t comm)
 Copy the communication data from the sender's buffer to the receiver's one. More...
 
static smx_synchro_t SIMIX_comm_new (e_smx_comm_type_t type)
 Creates a new communicate synchro. More...
 
static void SIMIX_mbox_push (smx_mailbox_t mbox, smx_synchro_t comm)
 Pushes a communication synchro into a rendez-vous point. More...
 
static smx_synchro_t _find_matching_comm (std::deque< smx_synchro_t > *deque, e_smx_comm_type_t type, int(*match_fun)(void *, void *, smx_synchro_t), void *this_user_data, smx_synchro_t my_synchro, bool remove_matching)
 Checks if there is a communication synchro queued in a deque matching our needs. More...
 
static void SIMIX_comm_start (smx_synchro_t synchro)
 Starts the simulation of a communication synchro. More...
 
void SIMIX_mailbox_exit (void)
 
smx_mailbox_t SIMIX_mbox_create (const char *name)
 
smx_mailbox_t SIMIX_mbox_get_by_name (const char *name)
 
smx_synchro_t SIMIX_mbox_get_head (smx_mailbox_t mbox)
 
smx_process_t SIMIX_mbox_get_receiver (smx_mailbox_t mbox)
 get the receiver (process associated to the mailbox) More...
 
void SIMIX_mbox_set_receiver (smx_mailbox_t mbox, smx_process_t process)
 set the receiver of the rendez vous point to allow eager sends More...
 
void SIMIX_mbox_remove (smx_mailbox_t mbox, smx_synchro_t comm)
 Removes a communication synchro from a rendez-vous point. More...
 
void SIMIX_comm_destroy (smx_synchro_t synchro)
 Destroy a communicate synchro. More...
 
void SIMIX_comm_destroy_internal_actions (smx_synchro_t synchro)
 
void simcall_HANDLER_comm_send (smx_simcall_t simcall, smx_process_t src, smx_mailbox_t mbox, double task_size, double rate, void *src_buff, size_t src_buff_size, int(*match_fun)(void *, void *, smx_synchro_t), void(*copy_data_fun)(smx_synchro_t, void *, size_t), void *data, double timeout)
 
smx_synchro_t simcall_HANDLER_comm_isend (smx_simcall_t simcall, smx_process_t src_proc, smx_mailbox_t mbox, double task_size, double rate, void *src_buff, size_t src_buff_size, int(*match_fun)(void *, void *, smx_synchro_t), void(*clean_fun)(void *), void(*copy_data_fun)(smx_synchro_t, void *, size_t), void *data, int detached)
 
void simcall_HANDLER_comm_recv (smx_simcall_t simcall, smx_process_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size, int(*match_fun)(void *, void *, smx_synchro_t), void(*copy_data_fun)(smx_synchro_t, void *, size_t), void *data, double timeout, double rate)
 
smx_synchro_t simcall_HANDLER_comm_irecv (smx_simcall_t simcall, smx_process_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size, int(*match_fun)(void *, void *, smx_synchro_t), void(*copy_data_fun)(smx_synchro_t, void *, size_t), void *data, double rate)
 
smx_synchro_t SIMIX_comm_irecv (smx_process_t dst_proc, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size, int(*match_fun)(void *, void *, smx_synchro_t), void(*copy_data_fun)(smx_synchro_t, void *, size_t), void *data, double rate)
 
smx_synchro_t simcall_HANDLER_comm_iprobe (smx_simcall_t simcall, smx_mailbox_t mbox, int type, int src, int tag, int(*match_fun)(void *, void *, smx_synchro_t), void *data)
 
smx_synchro_t SIMIX_comm_iprobe (smx_process_t dst_proc, smx_mailbox_t mbox, int type, int src, int tag, int(*match_fun)(void *, void *, smx_synchro_t), void *data)
 
void simcall_HANDLER_comm_wait (smx_simcall_t simcall, smx_synchro_t synchro, double timeout)
 
void simcall_HANDLER_comm_test (smx_simcall_t simcall, smx_synchro_t synchro)
 
void simcall_HANDLER_comm_testany (smx_simcall_t simcall, xbt_dynar_t synchros)
 
void simcall_HANDLER_comm_waitany (smx_simcall_t simcall, xbt_dynar_t synchros)
 
void SIMIX_comm_finish (smx_synchro_t synchro)
 Answers the SIMIX simcalls associated to a communication synchro. More...
 
void SIMIX_post_comm (smx_synchro_t synchro)
 This function is called when a Surf communication synchro is finished. More...
 
void SIMIX_comm_cancel (smx_synchro_t synchro)
 
void SIMIX_comm_suspend (smx_synchro_t synchro)
 
void SIMIX_comm_resume (smx_synchro_t synchro)
 
double SIMIX_comm_get_remains (smx_synchro_t synchro)
 get the amount remaining from the communication More...
 
e_smx_state_t SIMIX_comm_get_state (smx_synchro_t synchro)
 
voidSIMIX_comm_get_src_data (smx_synchro_t synchro)
 Return the user data associated to the sender of the communication. More...
 
voidSIMIX_comm_get_dst_data (smx_synchro_t synchro)
 Return the user data associated to the receiver of the communication. More...
 
smx_process_t SIMIX_comm_get_src_proc (smx_synchro_t synchro)
 
smx_process_t SIMIX_comm_get_dst_proc (smx_synchro_t synchro)
 
void SIMIX_comm_set_copy_data_callback (void(*callback)(smx_synchro_t, void *, size_t))
 
void SIMIX_comm_copy_pointer_callback (smx_synchro_t comm, void *buff, size_t buff_size)
 
void SIMIX_comm_copy_buffer_callback (smx_synchro_t comm, void *buff, size_t buff_size)
 

Variables

static xbt_dict_t mailboxes = xbt_dict_new_homogeneous(SIMIX_mbox_free)
 
static void(* SIMIX_comm_copy_data_callback )(smx_synchro_t, void *, size_t)
 

Function Documentation

XBT_LOG_NEW_DEFAULT_SUBCATEGORY ( simix_network  ,
simix  ,
"SIMIX network-related synchronization"   
)
void SIMIX_mbox_free ( void data)
static
void SIMIX_waitany_remove_simcall_from_actions ( smx_simcall_t  simcall)
static
void SIMIX_comm_copy_data ( smx_synchro_t  comm)
static

Copy the communication data from the sender's buffer to the receiver's one.

Parameters
commThe communication
smx_synchro_t SIMIX_comm_new ( e_smx_comm_type_t  type)
static

Creates a new communicate synchro.

Parameters
typeThe direction of communication (comm_send, comm_recv)
Returns
The new communicate synchro
static void SIMIX_mbox_push ( smx_mailbox_t  mbox,
smx_synchro_t  comm 
)
inlinestatic

Pushes a communication synchro into a rendez-vous point.

Parameters
mboxThe mailbox
commThe communication synchro
static smx_synchro_t _find_matching_comm ( std::deque< smx_synchro_t > *  deque,
e_smx_comm_type_t  type,
int(*)(void *, void *, smx_synchro_t match_fun,
void this_user_data,
smx_synchro_t  my_synchro,
bool  remove_matching 
)
static

Checks if there is a communication synchro queued in a deque matching our needs.

Parameters
typeThe type of communication we are looking for (comm_send, comm_recv)
Returns
The communication synchro if found, NULL otherwise
static void SIMIX_comm_start ( smx_synchro_t  synchro)
inlinestatic

Starts the simulation of a communication synchro.

Parameters
synchrothe communication synchro
void SIMIX_mailbox_exit ( void  )
smx_mailbox_t SIMIX_mbox_create ( const char *  name)
smx_mailbox_t SIMIX_mbox_get_by_name ( const char *  name)
smx_synchro_t SIMIX_mbox_get_head ( smx_mailbox_t  mbox)
smx_process_t SIMIX_mbox_get_receiver ( smx_mailbox_t  mbox)

get the receiver (process associated to the mailbox)

Parameters
mboxThe rendez-vous point
Returns
process The receiving process (NULL if not set)
void SIMIX_mbox_set_receiver ( smx_mailbox_t  mbox,
smx_process_t  process 
)

set the receiver of the rendez vous point to allow eager sends

Parameters
mboxThe rendez-vous point
processThe receiving process
void SIMIX_mbox_remove ( smx_mailbox_t  mbox,
smx_synchro_t  comm 
)

Removes a communication synchro from a rendez-vous point.

Parameters
mboxThe rendez-vous point
commThe communication synchro
void SIMIX_comm_destroy ( smx_synchro_t  synchro)

Destroy a communicate synchro.

Parameters
synchroThe communicate synchro to be destroyed
void SIMIX_comm_destroy_internal_actions ( smx_synchro_t  synchro)
void simcall_HANDLER_comm_send ( smx_simcall_t  simcall,
smx_process_t  src,
smx_mailbox_t  mbox,
double  task_size,
double  rate,
void src_buff,
size_t  src_buff_size,
int(*)(void *, void *, smx_synchro_t match_fun,
void(*)(smx_synchro_t, void *, size_t)  copy_data_fun,
void data,
double  timeout 
)
smx_synchro_t simcall_HANDLER_comm_isend ( smx_simcall_t  simcall,
smx_process_t  src_proc,
smx_mailbox_t  mbox,
double  task_size,
double  rate,
void src_buff,
size_t  src_buff_size,
int(*)(void *, void *, smx_synchro_t match_fun,
void(*)(void *)  clean_fun,
void(*)(smx_synchro_t, void *, size_t)  copy_data_fun,
void data,
int  detached 
)
void simcall_HANDLER_comm_recv ( smx_simcall_t  simcall,
smx_process_t  receiver,
smx_mailbox_t  mbox,
void dst_buff,
size_t *  dst_buff_size,
int(*)(void *, void *, smx_synchro_t match_fun,
void(*)(smx_synchro_t, void *, size_t)  copy_data_fun,
void data,
double  timeout,
double  rate 
)
smx_synchro_t simcall_HANDLER_comm_irecv ( smx_simcall_t  simcall,
smx_process_t  receiver,
smx_mailbox_t  mbox,
void dst_buff,
size_t *  dst_buff_size,
int(*)(void *, void *, smx_synchro_t match_fun,
void(*)(smx_synchro_t, void *, size_t)  copy_data_fun,
void data,
double  rate 
)
smx_synchro_t SIMIX_comm_irecv ( smx_process_t  dst_proc,
smx_mailbox_t  mbox,
void dst_buff,
size_t *  dst_buff_size,
int(*)(void *, void *, smx_synchro_t match_fun,
void(*)(smx_synchro_t, void *, size_t)  copy_data_fun,
void data,
double  rate 
)
smx_synchro_t simcall_HANDLER_comm_iprobe ( smx_simcall_t  simcall,
smx_mailbox_t  mbox,
int  type,
int  src,
int  tag,
int(*)(void *, void *, smx_synchro_t match_fun,
void data 
)
smx_synchro_t SIMIX_comm_iprobe ( smx_process_t  dst_proc,
smx_mailbox_t  mbox,
int  type,
int  src,
int  tag,
int(*)(void *, void *, smx_synchro_t match_fun,
void data 
)
void simcall_HANDLER_comm_wait ( smx_simcall_t  simcall,
smx_synchro_t  synchro,
double  timeout 
)
void simcall_HANDLER_comm_test ( smx_simcall_t  simcall,
smx_synchro_t  synchro 
)
void simcall_HANDLER_comm_testany ( smx_simcall_t  simcall,
xbt_dynar_t  synchros 
)
void simcall_HANDLER_comm_waitany ( smx_simcall_t  simcall,
xbt_dynar_t  synchros 
)
void SIMIX_comm_finish ( smx_synchro_t  synchro)

Answers the SIMIX simcalls associated to a communication synchro.

Parameters
synchroa finished communication synchro
void SIMIX_post_comm ( smx_synchro_t  synchro)

This function is called when a Surf communication synchro is finished.

Parameters
synchrothe corresponding Simix communication
void SIMIX_comm_cancel ( smx_synchro_t  synchro)
void SIMIX_comm_suspend ( smx_synchro_t  synchro)
void SIMIX_comm_resume ( smx_synchro_t  synchro)
double SIMIX_comm_get_remains ( smx_synchro_t  synchro)

get the amount remaining from the communication

Parameters
synchroThe communication
e_smx_state_t SIMIX_comm_get_state ( smx_synchro_t  synchro)
void* SIMIX_comm_get_src_data ( smx_synchro_t  synchro)

Return the user data associated to the sender of the communication.

Parameters
synchroThe communication
Returns
the user data
void* SIMIX_comm_get_dst_data ( smx_synchro_t  synchro)

Return the user data associated to the receiver of the communication.

Parameters
synchroThe communication
Returns
the user data
smx_process_t SIMIX_comm_get_src_proc ( smx_synchro_t  synchro)
smx_process_t SIMIX_comm_get_dst_proc ( smx_synchro_t  synchro)
void SIMIX_comm_set_copy_data_callback ( void(*)(smx_synchro_t, void *, size_t)  callback)
void SIMIX_comm_copy_pointer_callback ( smx_synchro_t  comm,
void buff,
size_t  buff_size 
)
void SIMIX_comm_copy_buffer_callback ( smx_synchro_t  comm,
void buff,
size_t  buff_size 
)

Variable Documentation

boost::unordered_map< std::string, s4u::Mailbox * > * s4u::Mailbox::mailboxes = xbt_dict_new_homogeneous(SIMIX_mbox_free)
static
void(* SIMIX_comm_copy_data_callback) (smx_synchro_t, void *, size_t)
static
Initial value:
=
void SIMIX_comm_copy_pointer_callback(smx_synchro_t comm, void *buff, size_t buff_size)
Definition: smx_network.cpp:942