-/* Copyright (c) 2009-2016. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include "simgrid/msg.h"
-#include "simgrid/simix.h" /* semaphores for the barrier */
+#include <simgrid/msg.h>
#include <xbt/replay.hpp>
XBT_LOG_NEW_DEFAULT_CATEGORY(actions, "Messages specific for this msg example");
-/* Copyright (c) 2004-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#ifndef SG_PLATF_TYPES_H
-#define SG_PLATF_TYPES_H
+#ifndef SIMGRID_TYPES_H
+#define SIMGRID_TYPES_H
#ifdef __cplusplus
namespace simgrid {
namespace kernel {
+namespace context {
+class Context;
+class ContextFactory;
+}
namespace activity {
class ActivityImpl;
using ActivityImplPtr = boost::intrusive_ptr<ActivityImpl>;
using RawImplPtr = boost::intrusive_ptr<RawImpl>;
class SleepImpl;
using SleepImplPtr = boost::intrusive_ptr<SleepImpl>;
+
+ class MailboxImpl;
}
+
namespace routing {
class NetPoint;
}
class ActorImpl;
using ActorImplPtr = boost::intrusive_ptr<ActorImpl>;
class Host;
+
+ class MutexImpl;
}
namespace surf {
class Resource;
typedef simgrid::surf::Resource surf_Resource;
typedef simgrid::trace_mgr::trace tmgr_Trace;
+typedef simgrid::kernel::context::Context* smx_context_t;
+typedef simgrid::simix::ActorImpl* smx_actor_t;
+typedef simgrid::simix::MutexImpl* smx_mutex_t;
+typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
+
#else
typedef struct s4u_Actor s4u_Actor;
typedef struct surf_Resource surf_Resource;
typedef struct Trace tmgr_Trace;
+typedef struct s_smx_context* smx_context_t;
+typedef struct s_smx_actor* smx_actor_t;
+typedef struct s_smx_mutex* smx_mutex_t;
+typedef struct s_smx_mailbox* smx_mailbox_t;
+
#endif
typedef s4u_NetZone* sg_netzone_t;
typedef unsigned long aid_t;
-#endif
+#endif /* SIMGRID_TYPES_H */
#ifndef MSG_H
#define MSG_H
+#include "simgrid/datatypes.h"
#include "simgrid/forward.h"
-#include "simgrid/simix.h"
+#include "simgrid/host.h"
+
+#include "xbt/base.h"
+#include "xbt/dict.h"
+#include "xbt/dynar.h"
#ifdef __cplusplus
+#include "simgrid/simix.h"
namespace simgrid {
namespace msg {
class Comm;
XBT_PUBLIC(msg_comm_t) MSG_task_isend(msg_task_t task, const char *alias);
XBT_PUBLIC(msg_comm_t) MSG_task_isend_bounded(msg_task_t task, const char *alias, double maxrate);
-XBT_PUBLIC(msg_comm_t) MSG_task_isend_with_matching(msg_task_t task, const char *alias,
- int (*match_fun)(void*,void*, smx_activity_t), void *match_data);
+XBT_PUBLIC(msg_comm_t)
+MSG_task_isend_with_matching(msg_task_t task, const char* alias, int (*match_fun)(void*, void*, void*),
+ void* match_data);
XBT_PUBLIC(void) MSG_task_dsend(msg_task_t task, const char *alias, void_f_pvoid_t cleanup);
XBT_PUBLIC(void) MSG_task_dsend_bounded(msg_task_t task, const char *alias, void_f_pvoid_t cleanup, double maxrate);
/* FIXME: expose these elements in the API */
int detached_ = 0;
- int (*matchFunction_)(void*, void*, smx_activity_t) = nullptr;
+ int (*matchFunction_)(void*, void*, simgrid::kernel::activity::CommImpl*) = nullptr;
void (*cleanFunction_)(void*) = nullptr;
void (*copyDataFunction_)(smx_activity_t, void*, size_t) = nullptr;
#include "xbt/ex.h"
#include "xbt/parmap.h"
-#ifdef __cplusplus
-
-namespace simgrid {
-namespace kernel {
-namespace context {
- class Context;
- class ContextFactory;
- }
- namespace activity {
- class MailboxImpl;
- }
- }
-
- namespace simix {
-
- class MutexImpl;
-}
-}
-
-typedef simgrid::kernel::context::Context* smx_context_t;
-typedef simgrid::simix::ActorImpl* smx_actor_t;
-typedef simgrid::simix::MutexImpl* smx_mutex_t;
-typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
-
-#else
-
-typedef struct s_smx_context *smx_context_t;
-typedef struct s_smx_actor *smx_actor_t;
-typedef struct s_smx_mutex *smx_mutex_t;
-typedef struct s_smx_mailbox *smx_mailbox_t;
-
-#endif
/* ******************************** Host ************************************ */
/** @brief Host datatype
/************************** Comunication simcalls *****************************/
-XBT_PUBLIC(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);
-
-XBT_PUBLIC(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);
-
-XBT_PUBLIC(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);
-
-XBT_PUBLIC(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);
-
-XBT_PUBLIC(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);
+XBT_PUBLIC(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*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double timeout);
+
+XBT_PUBLIC(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*, simgrid::kernel::activity::CommImpl*),
+ void (*clean_fun)(void*), void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+ int detached);
+
+XBT_PUBLIC(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*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double timeout, double rate);
+
+XBT_PUBLIC(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*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double rate);
+
+XBT_PUBLIC(smx_activity_t)
+simcall_comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag,
+ int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void* data);
XBT_PUBLIC(void) simcall_comm_cancel(smx_activity_t comm);
/* FIXME: waitany is going to be a vararg function, and should take a timeout */
#ifndef MC_MC_H
#define MC_MC_H
+#include <simgrid/forward.h>
#include <simgrid/modelchecker.h> /* our public interface (and definition of SIMGRID_HAVE_MC) */
-#include <simgrid/simix.h>
/* Maximum size of the application heap.
*
bool detached = false; /* If detached or not */
void (*clean_fun)(void*) = nullptr; /* Function to clean the detached src_buf if something goes wrong */
- int (*match_fun)(void*, void*, smx_activity_t) = nullptr; /* Filter function used by the other side. It is used when
- looking if a given communication matches my needs. For that, myself must match the
- expectations of the other side, too. See */
+ int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*) =
+ nullptr; /* Filter function used by the other side. It is used when
+looking if a given communication matches my needs. For that, myself must match the
+expectations of the other side, too. See */
void (*copy_data_fun)(smx_activity_t, void*, size_t) = nullptr;
/* Surf action data */
}
/* Internal function used to factorize code between MSG_task_isend_with_matching() and MSG_task_dsend(). */
-static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *alias,
- int (*match_fun)(void*,void*, smx_activity_t),
- void *match_data, void_f_pvoid_t cleanup, int detached)
+static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char* alias,
+ int (*match_fun)(void*, void*, void*), void* match_data,
+ void_f_pvoid_t cleanup, int detached)
{
simdata_task_t t_simdata = nullptr;
msg_process_t myself = MSG_process_self();
msg_global->sent_msg++;
/* Send it by calling SIMIX network layer */
- smx_activity_t act = simcall_comm_isend(myself->getImpl(), mailbox->getImpl(), t_simdata->bytes_amount, t_simdata->rate,
- task, sizeof(void *), match_fun, cleanup, nullptr, match_data,detached);
+ smx_activity_t act =
+ simcall_comm_isend(myself->getImpl(), mailbox->getImpl(), t_simdata->bytes_amount, t_simdata->rate, task,
+ sizeof(void*), (simix_match_func_t)match_fun, cleanup, nullptr, match_data, detached);
t_simdata->comm = boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(act);
msg_comm_t comm = nullptr;
* \param match_data user provided data passed to match_fun
* \return the msg_comm_t communication created
*/
-msg_comm_t MSG_task_isend_with_matching(msg_task_t task, const char *alias,
- int (*match_fun)(void*, void*, smx_activity_t), void *match_data)
+msg_comm_t MSG_task_isend_with_matching(msg_task_t task, const char* alias, int (*match_fun)(void*, void*, void*),
+ void* match_data)
{
return MSG_task_isend_internal(task, alias, match_fun, match_data, nullptr, 0);
}
/**
* \ingroup simix_comm_management
*/
-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)
+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*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double timeout)
{
/* checking for infinite values */
xbt_assert(std::isfinite(task_size), "task_size is not finite!");
/**
* \ingroup simix_comm_management
*/
-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)
+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*, simgrid::kernel::activity::CommImpl*),
+ void (*clean_fun)(void*), void (*copy_data_fun)(smx_activity_t, void*, size_t),
+ void* data, int detached)
{
/* checking for infinite values */
xbt_assert(std::isfinite(task_size), "task_size is not finite!");
/**
* \ingroup simix_comm_management
*/
-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)
+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*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double timeout, double rate)
{
xbt_assert(std::isfinite(timeout), "timeout is not finite!");
xbt_assert(mbox, "No rendez-vous point defined for recv");
/**
* \ingroup simix_comm_management
*/
-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_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
+ int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double rate)
{
xbt_assert(mbox, "No rendez-vous point defined for irecv");
* \ingroup simix_comm_management
*/
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)
+ int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void* data)
{
xbt_assert(mbox, "No rendez-vous point defined for iprobe");
#include "popping_enum.h" /* Definition of e_smx_simcall_t, with one value per simcall */
-typedef int (*simix_match_func_t)(void *, void *, smx_activity_t);
+typedef int (*simix_match_func_t)(void*, void*, simgrid::kernel::activity::CommImpl*);
typedef void (*simix_copy_data_func_t)(smx_activity_t, void*, size_t);
typedef void (*simix_clean_func_t)(void *);
typedef void (*FPtr)(void); // Hide the ugliness
*/
static simgrid::kernel::activity::CommImplPtr
_find_matching_comm(boost::circular_buffer_space_optimized<smx_activity_t>* deque, e_smx_comm_type_t type,
- int (*match_fun)(void*, void*, smx_activity_t), void* this_user_data, smx_activity_t my_synchro,
- bool remove_matching)
+ int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void* this_user_data,
+ simgrid::kernel::activity::CommImplPtr my_synchro, bool remove_matching)
{
void* other_user_data = nullptr;
} else if (comm->type == SIMIX_COMM_RECEIVE) {
other_user_data = comm->dst_data;
}
- if (comm->type == type && (match_fun == nullptr || match_fun(this_user_data, other_user_data, comm)) &&
- (not comm->match_fun || comm->match_fun(other_user_data, this_user_data, my_synchro))) {
+ if (comm->type == type && (match_fun == nullptr || match_fun(this_user_data, other_user_data, comm.get())) &&
+ (not comm->match_fun || comm->match_fun(other_user_data, this_user_data, my_synchro.get()))) {
XBT_DEBUG("Found a matching communication synchro %p", comm.get());
if (remove_matching)
deque->erase(it);
/******************************************************************************/
/* Communication synchros */
/******************************************************************************/
-XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_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_activity_t),
- void (*copy_data_fun)(smx_activity_t, void*, size_t),
- void *data, double timeout){
+XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t src, smx_mailbox_t mbox, double task_size,
+ double rate, void* src_buff, size_t src_buff_size,
+ int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+ double timeout)
+{
smx_activity_t comm = simcall_HANDLER_comm_isend(simcall, src, mbox, task_size, rate,
src_buff, src_buff_size, match_fun, nullptr, copy_data_fun,
data, 0);
SIMCALL_SET_MC_VALUE(simcall, 0);
simcall_HANDLER_comm_wait(simcall, comm, timeout);
}
-XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_actor_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_activity_t),
- void (*clean_fun)(void *), // used to free the synchro in case of problem after a detached send
- void (*copy_data_fun)(smx_activity_t, void*, size_t),// used to copy data if not default one
- void *data, int detached)
+XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_isend(
+ smx_simcall_t simcall, smx_actor_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*, simgrid::kernel::activity::CommImpl*),
+ void (*clean_fun)(void*), // used to free the synchro in case of problem after a detached send
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), // used to copy data if not default one
+ void* data, int detached)
{
XBT_DEBUG("send from mailbox %p", mbox);
}
XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, 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)
+ void* dst_buff, size_t* dst_buff_size,
+ int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+ double timeout, double rate)
{
smx_activity_t comm = SIMIX_comm_irecv(receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
SIMCALL_SET_MC_VALUE(simcall, 0);
}
XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_irecv(smx_simcall_t simcall, 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)
+ void* dst_buff, size_t* dst_buff_size,
+ simix_match_func_t match_fun,
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+ double rate)
{
return SIMIX_comm_irecv(receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
}
-smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, 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), // used to copy data if not default one
- void *data, double rate)
+smx_activity_t
+SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
+ int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), // used to copy data if not default one
+ void* data, double rate)
{
simgrid::kernel::activity::CommImplPtr this_synchro =
simgrid::kernel::activity::CommImplPtr(new simgrid::kernel::activity::CommImpl(SIMIX_COMM_RECEIVE));
return other_comm;
}
-smx_activity_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_activity_t),
- void *data){
+smx_activity_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_mailbox_t mbox, int type, int src, int tag,
+ simix_match_func_t match_fun, void* data)
+{
return SIMIX_comm_iprobe(simcall->issuer, mbox, type, src, tag, match_fun, data);
}
-smx_activity_t SIMIX_comm_iprobe(smx_actor_t dst_proc, smx_mailbox_t mbox, int type, int src,
- int tag, int (*match_fun)(void *, void *, smx_activity_t), void *data)
+smx_activity_t SIMIX_comm_iprobe(smx_actor_t dst_proc, smx_mailbox_t mbox, int type, int src, int tag,
+ simix_match_func_t match_fun, void* data)
{
XBT_DEBUG("iprobe from %p %p", mbox, &mbox->comm_queue);
simgrid::kernel::activity::CommImplPtr this_comm;
#include "src/kernel/activity/MailboxImpl.hpp"
#include "src/simix/ActorImpl.hpp"
-XBT_PRIVATE smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, 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);
-XBT_PRIVATE smx_activity_t SIMIX_comm_iprobe(smx_actor_t dst_proc, smx_mailbox_t mbox, int type, int src,
- int tag, int (*match_fun)(void *, void *, smx_activity_t), void *data);
+XBT_PRIVATE smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void* dst_buff,
+ size_t* dst_buff_size,
+ int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+ double rate);
+XBT_PRIVATE smx_activity_t SIMIX_comm_iprobe(smx_actor_t dst_proc, smx_mailbox_t mbox, int type, int src, int tag,
+ simix_match_func_t match_fun, void* data);
#endif
}
}
-int Request::match_recv(void* a, void* b, smx_activity_t ignored) {
+int Request::match_recv(void* a, void* b, simgrid::kernel::activity::CommImpl* ignored)
+{
MPI_Request ref = static_cast<MPI_Request>(a);
MPI_Request req = static_cast<MPI_Request>(b);
XBT_DEBUG("Trying to match a recv of src %d against %d, tag %d against %d",ref->src_,req->src_, ref->tag_, req->tag_);
}else return 0;
}
-int Request::match_send(void* a, void* b,smx_activity_t ignored) {
+int Request::match_send(void* a, void* b, simgrid::kernel::activity::CommImpl* ignored)
+{
MPI_Request ref = static_cast<MPI_Request>(a);
MPI_Request req = static_cast<MPI_Request>(b);
XBT_DEBUG("Trying to match a send of src %d against %d, tag %d against %d",ref->src_,req->src_, ref->tag_, req->tag_);
static int waitall(int count, MPI_Request requests[], MPI_Status status[]);
static int waitsome(int incount, MPI_Request requests[], int *indices, MPI_Status status[]);
- static int match_send(void* a, void* b,smx_activity_t ignored);
- static int match_recv(void* a, void* b,smx_activity_t ignored);
+ static int match_send(void* a, void* b, simgrid::kernel::activity::CommImpl* ignored);
+ static int match_recv(void* a, void* b, simgrid::kernel::activity::CommImpl* ignored);
int add_f();
static void free_f(int id);
#include "xbt/ex.h"
#include "xbt/synchro.h"
-#include "simgrid/simix.h" /* used implementation */
+#include "simgrid/simix.h" /* used implementation */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync, xbt, "Synchronization mechanism");
/****** mutex related functions ******/
xbt_mutex_t xbt_mutex_init(void)
{
- return (xbt_mutex_t) simcall_mutex_init();
+ return (xbt_mutex_t)simcall_mutex_init();
}
void xbt_mutex_acquire(xbt_mutex_t mutex)
{
- simcall_mutex_lock((smx_mutex_t) mutex);
+ simcall_mutex_lock((smx_mutex_t)mutex);
}
int xbt_mutex_try_acquire(xbt_mutex_t mutex)
{
- return simcall_mutex_trylock((smx_mutex_t) mutex);
+ return simcall_mutex_trylock((smx_mutex_t)mutex);
}
void xbt_mutex_release(xbt_mutex_t mutex)
{
- simcall_mutex_unlock((smx_mutex_t) mutex);
+ simcall_mutex_unlock((smx_mutex_t)mutex);
}
void xbt_mutex_destroy(xbt_mutex_t mutex)
{
- SIMIX_mutex_unref((smx_mutex_t) mutex);
+ SIMIX_mutex_unref((smx_mutex_t)mutex);
}
/***** condition related functions *****/
xbt_cond_t xbt_cond_init(void)
{
- return (xbt_cond_t) simcall_cond_init();
+ return (xbt_cond_t)simcall_cond_init();
}
void xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex)
{
- simcall_cond_wait((smx_cond_t) cond, (smx_mutex_t) mutex);
+ simcall_cond_wait((smx_cond_t)cond, (smx_mutex_t)mutex);
}
void xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay)
{
- simcall_cond_wait_timeout((smx_cond_t) cond, (smx_mutex_t) mutex, delay);
+ simcall_cond_wait_timeout((smx_cond_t)cond, (smx_mutex_t)mutex, delay);
}
void xbt_cond_signal(xbt_cond_t cond)
{
- simcall_cond_signal((smx_cond_t) cond);
+ simcall_cond_signal((smx_cond_t)cond);
}
void xbt_cond_broadcast(xbt_cond_t cond)
{
- simcall_cond_broadcast((smx_cond_t) cond);
+ simcall_cond_broadcast((smx_cond_t)cond);
}
void xbt_cond_destroy(xbt_cond_t cond)
{
- SIMIX_cond_unref((smx_cond_t) cond);
+ SIMIX_cond_unref((smx_cond_t)cond);
}
-foreach(x check_defaults stack_overflow)
- add_executable (${x} ${x}/${x}.c)
- target_link_libraries(${x} simgrid)
- set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
-
- set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
-endforeach()
-
-foreach(x generic_simcalls)
+foreach(x check_defaults generic_simcalls stack_overflow)
add_executable (${x} ${x}/${x}.cpp)
target_link_libraries(${x} simgrid)
set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
#include "simgrid/simix.h"
#include "xbt/log.h"
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
xbt_log_control_set("root.fmt:[%c/%p]%e%m%n");
xbt_log_control_set("simix_context.threshold:verbose");
return x;
}
-static int master(int argc, char *argv[])
+static int master(int argc, char* argv[])
{
XBT_INFO("Launching our nice bugged recursive function...");
unsigned i = 1;
return 0;
}
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
SIMIX_global_init(&argc, argv);
-/* Copyright (c) 2012-2014. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include "simgrid/msg.h"
+#include "src/internal_config.h" /* HAVE_FUTEX_H */
+#include "xbt/xbt_os_time.h"
#include <stdio.h>
#include <stdlib.h>
#include <xbt/dynar.h>
#include <xbt/parmap.h>
#include <xbt/sysdep.h>
-#include "src/internal_config.h" /* HAVE_FUTEX_H */
-#include "simgrid/simix.h"
-#include "xbt/xbt_os_time.h"
#define MODES_DEFAULT 0x7
#define TIMEOUT 10.0
int nthreads;
unsigned modes = MODES_DEFAULT;
- SIMIX_global_init(&argc, argv);
+ MSG_init(&argc, argv);
if (argc != 2 && argc != 3) {
fprintf(stderr, "Usage: %s nthreads [modes]\n"
/* parmap_test -- test parmap */
-/* Copyright (c) 2007-2010, 2013-2014. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include "simgrid/simix.h"
+#include "simgrid/msg.h"
+#include "src/internal_config.h"
#include "xbt.h"
#include "xbt/ex.h"
#include "xbt/xbt_os_time.h"
-#include "src/internal_config.h"
XBT_LOG_NEW_DEFAULT_CATEGORY(parmap_test, "Test for parmap");
int main(int argc, char** argv)
{
int status = 0;
- SIMIX_global_init(&argc, argv);
+ MSG_init(&argc, argv);
XBT_INFO("Basic testing posix");
status += test_parmap_basic(XBT_PARMAP_POSIX);
src/xbt/xbt_log_layout_simple.c
src/xbt/xbt_main.cpp
src/xbt/xbt_os_file.c
- src/xbt/xbt_os_synchro.c
+ src/xbt/xbt_os_synchro.cpp
src/xbt/xbt_os_time.c
src/xbt/xbt_replay.cpp
src/xbt/xbt_str.cpp