SimGrid  3.14.159
Versatile Simulation of Distributed Systems
libsmx.cpp File Reference
#include <cmath>
#include <functional>
#include <xbt/functional.hpp>
#include <simgrid/s4u/VirtualMachine.hpp>
#include <simgrid/simix/blocking_simcall.hpp>
#include "mc/mc.h"
#include "smx_private.h"
#include "src/kernel/activity/SynchroComm.hpp"
#include "src/mc/mc_forward.hpp"
#include "src/mc/mc_replay.h"
#include "src/plugins/vm/VirtualMachineImpl.hpp"
#include "src/simix/smx_host_private.h"
#include "xbt/ex.h"
#include <simgrid/simix.hpp>
#include "popping_bodies.cpp"

Namespaces

 simgrid
 Host datatype from SIMIX POV.
 
 simgrid::simix
 

Functions

 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY (simix)
 
void simcall_call (smx_actor_t process)
 
smx_activity_t simcall_execution_start (const char *name, double flops_amount, double priority, double bound)
 Creates a synchro that executes some computation of an host. More...
 
smx_activity_t simcall_execution_parallel_start (const char *name, int host_nb, sg_host_t *host_list, double *flops_amount, double *bytes_amount, double amount, double rate, double timeout)
 Creates a synchro that may involve parallel computation on several hosts and communication between them. More...
 
void simcall_execution_cancel (smx_activity_t execution)
 Cancels an execution synchro. More...
 
void simcall_execution_set_priority (smx_activity_t execution, double priority)
 Changes the priority of an execution synchro. More...
 
void simcall_execution_set_bound (smx_activity_t execution, double bound)
 Changes the capping (the maximum CPU utilization) of an execution synchro. More...
 
e_smx_state_t simcall_execution_wait (smx_activity_t execution)
 Waits for the completion of an execution synchro and destroy it. More...
 
void simcall_process_kill (smx_actor_t process)
 Kills a SIMIX process. More...
 
void simcall_process_killall (int reset_pid)
 Kills all SIMIX processes. More...
 
void simcall_process_cleanup (smx_actor_t process)
 Cleans up a SIMIX process. More...
 
void simcall_process_set_host (smx_actor_t process, sg_host_t dest)
 Migrates an agent to another location. More...
 
void simcall_process_join (smx_actor_t process, double timeout)
 
void simcall_process_suspend (smx_actor_t process)
 Suspends a process. More...
 
void simcall_process_resume (smx_actor_t process)
 Resumes a suspended process. More...
 
int simcall_process_count ()
 Returns the amount of SIMIX processes in the system. More...
 
voidsimcall_process_get_data (smx_actor_t process)
 Return the user data of a smx_actor_t. More...
 
void simcall_process_set_data (smx_actor_t process, void *data)
 Set the user data of a smx_actor_t. More...
 
void simcall_process_set_kill_time (smx_actor_t process, double kill_time)
 Set the kill time of a process. More...
 
double simcall_process_get_kill_time (smx_actor_t process)
 Get the kill time of a process (or 0 if unset). More...
 
int simcall_process_is_suspended (smx_actor_t process)
 Returns true if the process is suspended . More...
 
xbt_dict_t simcall_process_get_properties (smx_actor_t process)
 Return the properties. More...
 
void simcall_process_on_exit (smx_actor_t process, int_f_pvoid_pvoid_t fun, void *data)
 Add an on_exit function Add an on_exit function which will be executed when the process exits/is killed. More...
 
void simcall_process_auto_restart_set (smx_actor_t process, int auto_restart)
 Sets the process to be auto-restarted or not by SIMIX when its host comes back up. More...
 
smx_actor_t simcall_process_restart (smx_actor_t process)
 Restarts the process, killing it and starting it again from scratch. More...
 
e_smx_state_t simcall_process_sleep (double duration)
 Creates a new sleep SIMIX synchro. More...
 
smx_mailbox_t simcall_mbox_create (const char *name)
 Creates a new rendez-vous point. More...
 
void simcall_mbox_set_receiver (smx_mailbox_t mbox, smx_actor_t process)
 
void simcall_comm_send (smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void *src_buff, size_t src_buff_size, int(*match_fun)(void *, void *, smx_activity_t), void(*copy_data_fun)(smx_activity_t, void *, size_t), void *data, double timeout)
 
smx_activity_t simcall_comm_isend (smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void *src_buff, size_t src_buff_size, int(*match_fun)(void *, void *, smx_activity_t), void(*clean_fun)(void *), void(*copy_data_fun)(smx_activity_t, void *, size_t), void *data, int detached)
 
void simcall_comm_recv (smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size, int(*match_fun)(void *, void *, smx_activity_t), void(*copy_data_fun)(smx_activity_t, void *, size_t), void *data, double timeout, double rate)
 
smx_activity_t simcall_comm_irecv (smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size, int(*match_fun)(void *, void *, smx_activity_t), void(*copy_data_fun)(smx_activity_t, void *, size_t), void *data, double rate)
 
smx_activity_t simcall_comm_iprobe (smx_mailbox_t mbox, int type, int src, int tag, int(*match_fun)(void *, void *, smx_activity_t), void *data)
 
void simcall_comm_cancel (smx_activity_t synchro)
 
unsigned int simcall_comm_waitany (xbt_dynar_t comms, double timeout)
 
int simcall_comm_testany (smx_activity_t *comms, size_t count)
 
void simcall_comm_wait (smx_activity_t comm, double timeout)
 
void simcall_set_category (smx_activity_t synchro, const char *category)
 Set the category of an synchro. More...
 
int simcall_comm_test (smx_activity_t comm)
 
smx_mutex_t simcall_mutex_init ()
 
void simcall_mutex_lock (smx_mutex_t mutex)
 
int simcall_mutex_trylock (smx_mutex_t mutex)
 
void simcall_mutex_unlock (smx_mutex_t mutex)
 
smx_cond_t simcall_cond_init ()
 
void simcall_cond_signal (smx_cond_t cond)
 
void simcall_cond_wait (smx_cond_t cond, smx_mutex_t mutex)
 
void simcall_cond_wait_timeout (smx_cond_t cond, smx_mutex_t mutex, double timeout)
 
void simcall_cond_broadcast (smx_cond_t cond)
 
smx_sem_t simcall_sem_init (int capacity)
 
void simcall_sem_release (smx_sem_t sem)
 
int simcall_sem_would_block (smx_sem_t sem)
 
void simcall_sem_acquire (smx_sem_t sem)
 
void simcall_sem_acquire_timeout (smx_sem_t sem, double timeout)
 
int simcall_sem_get_capacity (smx_sem_t sem)
 
sg_size_t simcall_file_read (smx_file_t fd, sg_size_t size, sg_host_t host)
 
sg_size_t simcall_file_write (smx_file_t fd, sg_size_t size, sg_host_t host)
 
smx_file_t simcall_file_open (const char *fullpath, sg_host_t host)
 
int simcall_file_close (smx_file_t fd, sg_host_t host)
 
int simcall_file_unlink (smx_file_t fd, sg_host_t host)
 
sg_size_t simcall_file_get_size (smx_file_t fd)
 
sg_size_t simcall_file_tell (smx_file_t fd)
 
xbt_dynar_t simcall_file_get_info (smx_file_t fd)
 
int simcall_file_seek (smx_file_t fd, sg_offset_t offset, int origin)
 
int simcall_file_move (smx_file_t fd, const char *fullpath)
 Move a file to another location on the same mount point. More...
 
sg_size_t simcall_storage_get_free_size (smx_storage_t storage)
 Returns the free space size on a given storage element. More...
 
sg_size_t simcall_storage_get_used_size (smx_storage_t storage)
 Returns the used space size on a given storage element. More...
 
xbt_dict_t simcall_storage_get_properties (smx_storage_t storage)
 Returns a dict of the properties assigned to a storage element. More...
 
xbt_dict_t simcall_storage_get_content (smx_storage_t storage)
 Returns a dict containing the content of a storage element. More...
 
void simcall_run_kernel (std::function< void()> const &code)
 
void simcall_run_blocking (std::function< void()> const &code)
 Execute some code in the kernel and block. More...
 
int simcall_mc_random (int min, int max)
 
const char * SIMIX_simcall_name (e_smx_simcall_t kind)
 returns a printable string representing a simcall More...
 
void simgrid::simix::unblock (smx_actor_t process)
 

Function Documentation

◆ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY()

XBT_LOG_EXTERNAL_DEFAULT_CATEGORY ( simix  )

◆ simcall_call()

void simcall_call ( smx_actor_t  process)

◆ simcall_process_join()

void simcall_process_join ( smx_actor_t  process,
double  timeout 
)

◆ simcall_mbox_create()

smx_mailbox_t simcall_mbox_create ( const char *  name)

Creates a new rendez-vous point.

Parameters
nameThe name of the rendez-vous point
Returns
The created rendez-vous point

◆ simcall_mbox_set_receiver()

void simcall_mbox_set_receiver ( smx_mailbox_t  mbox,
smx_actor_t  process 
)

◆ simcall_set_category()

void simcall_set_category ( smx_activity_t  synchro,
const char *  category 
)

Set the category of an synchro.

This functions changes the category only. It calls a surf function.

Parameters
synchroThe execution synchro
categoryThe tracing category

◆ simcall_storage_get_free_size()

sg_size_t simcall_storage_get_free_size ( smx_storage_t  storage)

Returns the free space size on a given storage element.

Parameters
storagea storage
Returns
Return the free space size on a given storage element (as sg_size_t)

◆ simcall_storage_get_used_size()

sg_size_t simcall_storage_get_used_size ( smx_storage_t  storage)

Returns the used space size on a given storage element.

Parameters
storagea storage
Returns
Return the used space size on a given storage element (as sg_size_t)

◆ simcall_storage_get_properties()

xbt_dict_t simcall_storage_get_properties ( smx_storage_t  storage)

Returns a dict of the properties assigned to a storage element.

Parameters
storageA storage element
Returns
The properties of this storage element

◆ simcall_storage_get_content()

xbt_dict_t simcall_storage_get_content ( smx_storage_t  storage)

Returns a dict containing the content of a storage element.

Parameters
storageA storage element
Returns
The content of this storage element as a dict (full path file => size)

◆ simcall_run_kernel()

void simcall_run_kernel ( std::function< void()> const &  code)

◆ simcall_run_blocking()

void simcall_run_blocking ( std::function< void()> const &  code)

Execute some code in the kernel and block.

run_blocking() is a generic blocking simcall. It is given a callback which is executed immediately in the SimGrid kernel. The callback is responsible for setting the suitable logic for waking up the process when needed.

simix::kernelSync() is a higher level wrapper for this.

◆ simcall_mc_random()

int simcall_mc_random ( int  min,
int  max 
)

◆ SIMIX_simcall_name()

const char* SIMIX_simcall_name ( e_smx_simcall_t  kind)

returns a printable string representing a simcall