SimGrid  3.18
Versatile Simulation of Distributed Systems
simgrid::simix Namespace Reference

Classes

class  ActorImpl
 
class  Future
 A blocking (wait()-based) future for SIMIX processes. More...
 
class  Global
 
class  Host
 
struct  marshal_t
 
class  MutexImpl
 
class  ProcessArg
 
class  type
 

Typedefs

typedef std::function< void()> ActorCode
 
typedef std::function< ActorCode(std::vector< std::string > args)> ActorCodeFactory
 
typedef boost::intrusive::list< ActorImpl, boost::intrusive::member_hook< ActorImpl, boost::intrusive::list_member_hook<>, &ActorImpl::smx_synchro_hook > > SynchroList
 

Functions

void unblock (smx_actor_t process)
 
template<class F >
auto kernelSync (F code) -> decltype(code().get())
 Execute some code in kernel mode and wakes up the actor when the result is available. More...
 
template<class F >
auto kernelAsync (F code) -> Future< decltype(code().get())>
 Start some asynchronous work. More...
 
template<class F >
std::result_of< F()>::type kernelImmediate (F &&code)
 Execute some code in the kernel/maestro. More...
 
const std::vector< smx_actor_t > & process_get_runnable ()
 Returns the list of processes to run. More...
 
void set_maestro (std::function< void()> code)
 
void create_maestro (std::function< void()> code)
 
void registerFunction (const char *name, ActorCodeFactory factory)
 
static int dying_daemon (void *exit_status, void *data)
 
 SIMIX_MARSHAL (char, c)
 
 SIMIX_MARSHAL (short, s)
 
 SIMIX_MARSHAL (int, i)
 
 SIMIX_MARSHAL (long, l)
 
 SIMIX_MARSHAL (unsigned char, uc)
 
 SIMIX_MARSHAL (unsigned short, us)
 
 SIMIX_MARSHAL (unsigned int, ui)
 
 SIMIX_MARSHAL (unsigned long, ul)
 
 SIMIX_MARSHAL (unsigned long long, ull)
 
 SIMIX_MARSHAL (long long, ll)
 
 SIMIX_MARSHAL (float, d)
 
 SIMIX_MARSHAL (double, d)
 
 SIMIX_MARSHAL (FPtr, fp)
 
void unmarshal (type< void >, u_smx_scalar const &simcall)
 
void unmarshal_raw (type< void >, u_smx_scalar const &simcall)
 
template<class T >
void marshal (type< T *>, u_smx_scalar &simcall, T *value)
 
template<class T >
T * unmarshal (type< T *>, u_smx_scalar const &simcall)
 
template<class T >
T * unmarshal_raw (type< T *>, u_smx_scalar const &simcall)
 
template<class T >
void marshal (type< boost::intrusive_ptr< T >>, u_smx_scalar &simcall, boost::intrusive_ptr< T > value)
 
template<class T >
boost::intrusive_ptr< T > unmarshal (type< boost::intrusive_ptr< T >>, u_smx_scalar const &simcall)
 
template<class T >
T * unmarshal_raw (type< boost::intrusive_ptr< T >>, u_smx_scalar const &simcall)
 
template<class R , class... T>
void marshal (type< R(*)(T...)>, u_smx_scalar &simcall, R(*value)(T...))
 
template<class R , class... T>
auto unmarshal (type< R(*)(T...)>, u_smx_scalar simcall) -> R(*)(T...)
 
template<class R , class... T>
auto unmarshal_raw (type< R(*)(T...)>, u_smx_scalar simcall) -> R(*)(T...)
 
template<class T >
void marshal (u_smx_scalar &simcall, T const &value)
 
template<class T >
std::remove_reference< T >::type unmarshal (u_smx_scalar &simcall)
 
template<class T >
std::remove_reference< T >::type unmarshal_raw (u_smx_scalar &simcall)
 
template<std::size_t I>
void marshalArgs (smx_simcall_t simcall)
 
template<std::size_t I, class A >
void marshalArgs (smx_simcall_t simcall, A const &a)
 
template<std::size_t I, class A , class... B>
void marshalArgs (smx_simcall_t simcall, A const &a, B const &... b)
 
template<class... A>
void marshal (smx_simcall_t simcall, e_smx_simcall_t call, A const &... a)
 Initialize the simcall. More...
 

Variables

simgrid::xbt::signal< void()> onDeadlock
 These functions will be called when we detect a deadlock: any remaining process is locked on an action. More...
 

Typedef Documentation

◆ ActorCode

◆ ActorCodeFactory

◆ SynchroList

typedef boost::intrusive::list<ActorImpl, boost::intrusive::member_hook<ActorImpl, boost::intrusive::list_member_hook<>, &ActorImpl::smx_synchro_hook> > simgrid::simix::SynchroList

Function Documentation

◆ unblock()

void simgrid::simix::unblock ( smx_actor_t  process)

◆ kernelSync()

template<class F >
auto simgrid::simix::kernelSync ( code) -> decltype(code().get())

Execute some code in kernel mode and wakes up the actor when the result is available.

It is given a callback which is executed in the SimGrid kernel and returns a simgrid::kernel::Future<T>. The kernel blocks the actor until the Future is ready and:

  • either returns the value wrapped in the future to the actor;
  • or raises the exception stored in the future in the actor.

This can be used to implement blocking calls without adding new simcalls. One downside of this approach is that we don't have any semantic on what the actor is waiting. This might be a problem for the model-checker and we'll have to devise a way to make it work.

Parameters
codeKernel code returning a simgrid::kernel::Future<T>
Returns
Value of the kernel future
Exceptions
Exceptionfrom the kernel future

◆ kernelAsync()

template<class F >
auto simgrid::simix::kernelAsync ( code) -> Future<decltype(code().get())>

Start some asynchronous work.

Parameters
codeSimGrid kernel code which returns a simgrid::kernel::Future
Returns
Actor future

◆ kernelImmediate()

template<class F >
std::result_of<F()>::type simgrid::simix::kernelImmediate ( F &&  code)

Execute some code in the kernel/maestro.

This can be used to enforce mutual exclusion with other simcall. More importantly, this enforces a deterministic/reproducible ordering of the operation with respect to other simcalls.

◆ process_get_runnable()

const std::vector< smx_actor_t > & simgrid::simix::process_get_runnable ( )

Returns the list of processes to run.

◆ set_maestro()

void simgrid::simix::set_maestro ( std::function< void()>  code)

◆ create_maestro()

void simgrid::simix::create_maestro ( std::function< void()>  code)

◆ registerFunction()

void simgrid::simix::registerFunction ( const char *  name,
ActorCodeFactory  factory 
)

◆ dying_daemon()

static int simgrid::simix::dying_daemon ( void exit_status,
void data 
)
static

◆ SIMIX_MARSHAL() [1/13]

simgrid::simix::SIMIX_MARSHAL ( char  ,
 
)

◆ SIMIX_MARSHAL() [2/13]

simgrid::simix::SIMIX_MARSHAL ( short  ,
 
)

◆ SIMIX_MARSHAL() [3/13]

simgrid::simix::SIMIX_MARSHAL ( int  ,
 
)

◆ SIMIX_MARSHAL() [4/13]

simgrid::simix::SIMIX_MARSHAL ( long  ,
 
)

◆ SIMIX_MARSHAL() [5/13]

simgrid::simix::SIMIX_MARSHAL ( unsigned  char,
uc   
)

◆ SIMIX_MARSHAL() [6/13]

simgrid::simix::SIMIX_MARSHAL ( unsigned  short,
us   
)

◆ SIMIX_MARSHAL() [7/13]

simgrid::simix::SIMIX_MARSHAL ( unsigned  int,
ui   
)

◆ SIMIX_MARSHAL() [8/13]

simgrid::simix::SIMIX_MARSHAL ( unsigned  long,
ul   
)

◆ SIMIX_MARSHAL() [9/13]

simgrid::simix::SIMIX_MARSHAL ( unsigned long  long,
ull   
)

◆ SIMIX_MARSHAL() [10/13]

simgrid::simix::SIMIX_MARSHAL ( long  long,
ll   
)

◆ SIMIX_MARSHAL() [11/13]

simgrid::simix::SIMIX_MARSHAL ( float  ,
 
)

◆ SIMIX_MARSHAL() [12/13]

simgrid::simix::SIMIX_MARSHAL ( double  ,
 
)

◆ SIMIX_MARSHAL() [13/13]

simgrid::simix::SIMIX_MARSHAL ( FPtr  ,
fp   
)

◆ unmarshal() [1/5]

void simgrid::simix::unmarshal ( type< void ,
u_smx_scalar const &  simcall 
)
inline

◆ unmarshal_raw() [1/5]

void simgrid::simix::unmarshal_raw ( type< void ,
u_smx_scalar const &  simcall 
)
inline

◆ marshal() [1/5]

template<class T >
void simgrid::simix::marshal ( type< T *>  ,
u_smx_scalar simcall,
T *  value 
)
inline

◆ unmarshal() [2/5]

template<class T >
T* simgrid::simix::unmarshal ( type< T *>  ,
u_smx_scalar const &  simcall 
)
inline

◆ unmarshal_raw() [2/5]

template<class T >
T* simgrid::simix::unmarshal_raw ( type< T *>  ,
u_smx_scalar const &  simcall 
)
inline

◆ marshal() [2/5]

template<class T >
void simgrid::simix::marshal ( type< boost::intrusive_ptr< T >>  ,
u_smx_scalar simcall,
boost::intrusive_ptr< T >  value 
)
inline

◆ unmarshal() [3/5]

template<class T >
boost::intrusive_ptr<T> simgrid::simix::unmarshal ( type< boost::intrusive_ptr< T >>  ,
u_smx_scalar const &  simcall 
)
inline

◆ unmarshal_raw() [3/5]

template<class T >
T* simgrid::simix::unmarshal_raw ( type< boost::intrusive_ptr< T >>  ,
u_smx_scalar const &  simcall 
)
inline

◆ marshal() [3/5]

template<class R , class... T>
void simgrid::simix::marshal ( type< R(*)(T...)>  ,
u_smx_scalar simcall,
R(*)(T...)  value 
)
inline

◆ unmarshal() [4/5]

template<class R , class... T>
auto simgrid::simix::unmarshal ( type< R(*)(T...)>  ,
u_smx_scalar  simcall 
) -> R (*)(T...)
inline

◆ unmarshal_raw() [4/5]

template<class R , class... T>
auto simgrid::simix::unmarshal_raw ( type< R(*)(T...)>  ,
u_smx_scalar  simcall 
) -> R (*)(T...)
inline

◆ marshal() [4/5]

template<class T >
void simgrid::simix::marshal ( u_smx_scalar simcall,
T const &  value 
)
inline

◆ unmarshal() [5/5]

template<class T >
std::remove_reference<T>::type simgrid::simix::unmarshal ( u_smx_scalar simcall)
inline

◆ unmarshal_raw() [5/5]

template<class T >
std::remove_reference<T>::type simgrid::simix::unmarshal_raw ( u_smx_scalar simcall)
inline

◆ marshalArgs() [1/3]

template<std::size_t I>
void simgrid::simix::marshalArgs ( smx_simcall_t  simcall)
inline

◆ marshalArgs() [2/3]

template<std::size_t I, class A >
void simgrid::simix::marshalArgs ( smx_simcall_t  simcall,
A const &  a 
)
inline

◆ marshalArgs() [3/3]

template<std::size_t I, class A , class... B>
void simgrid::simix::marshalArgs ( smx_simcall_t  simcall,
A const &  a,
B const &...  b 
)
inline

◆ marshal() [5/5]

template<class... A>
void simgrid::simix::marshal ( smx_simcall_t  simcall,
e_smx_simcall_t  call,
A const &...  a 
)
inline

Initialize the simcall.

Variable Documentation

◆ onDeadlock

simgrid::xbt::signal< void()> simgrid::simix::onDeadlock

These functions will be called when we detect a deadlock: any remaining process is locked on an action.

If these functions manage to unlock some of the processes, then the deadlock will be avoided.