#endif
}
-smx_context_t BoostContextFactory::create_context(std::function<void()> code,
- void_pfn_smxprocess_t cleanup_func, smx_actor_t process)
+smx_context_t BoostContextFactory::create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup_func,
+ smx_actor_t process)
{
BoostContext* context = nullptr;
if (BoostContext::parallel_)
: Context(std::move(code), cleanup_func, process)
{
- /* if the user provided a function for the process then use it,
- otherwise it is the context for maestro */
+ /* if the user provided a function for the process then use it, otherwise it is the context for maestro */
if (has_code()) {
this->stack_ = SIMIX_context_stack_new();
- // We need to pass the bottom of the stack to make_fcontext,
- // depending on the stack direction it may be the lower or higher address:
+// We need to pass the bottom of the stack to make_fcontext, depending on the stack direction it may be the lower
+// or higher address:
#if PTH_STACKGROWTH == -1
void* stack = static_cast<char*>(this->stack_) + smx_context_usable_stack_size - 1;
#else
{
/* determine the next context */
BoostSerialContext* next_context = nullptr;
- unsigned long int i = process_index_++;
+ unsigned long int i = process_index_;
+ process_index_++;
if (i < xbt_dynar_length(simix_global->process_to_run)) {
/* execute the next process */
XBT_DEBUG("Run next process");
- next_context = static_cast<BoostSerialContext*>(xbt_dynar_get_as(
- simix_global->process_to_run, i, smx_actor_t)->context);
- }
- else {
+ next_context =
+ static_cast<BoostSerialContext*>(xbt_dynar_get_as(simix_global->process_to_run, i, smx_actor_t)->context);
+ } else {
/* all processes were run, return to maestro */
XBT_DEBUG("No more process to run");
next_context = static_cast<BoostSerialContext*>(maestro_context_);
if (next_work != nullptr) {
XBT_DEBUG("Run next process");
next_context = static_cast<BoostParallelContext*>(next_work->context);
- }
- else {
+ } else {
XBT_DEBUG("No more processes to run");
- uintptr_t worker_id =
- (uintptr_t) xbt_os_thread_get_specific(worker_id_key_);
+ uintptr_t worker_id = (uintptr_t)xbt_os_thread_get_specific(worker_id_key_);
next_context = static_cast<BoostParallelContext*>(workers_context_[worker_id]);
}
#define COLL_APPLY(action, sig, name) action(sig, name)
#define COLL_COMMA ,
-#define COLL_NOsep
-#define COLL_NOTHING(...)
+#define COLL_NOsep
+#define COLL_NOTHING(...)
#define COLL_GATHER_SIG gather, int, \
(void *send_buff, int send_count, MPI_Datatype send_type, \
class Colls{
public:
-
static XBT_PUBLIC(void) coll_help(const char *category, s_mpi_coll_description_t * table);
static XBT_PUBLIC(int) find_coll_description(s_mpi_coll_description_t * table, const char *name, const char *desc);
static void set_collectives();
- // for each collective type, create the set_* prototype, the description array
- // and the function pointer
- COLL_APPLY(COLL_DEFS,COLL_GATHER_SIG,"");
- COLL_APPLY(COLL_DEFS,COLL_ALLGATHER_SIG,"");
- COLL_APPLY(COLL_DEFS,COLL_ALLGATHERV_SIG,"");
- COLL_APPLY(COLL_DEFS,COLL_REDUCE_SIG,"");
- COLL_APPLY(COLL_DEFS,COLL_ALLREDUCE_SIG,"");
- COLL_APPLY(COLL_DEFS,COLL_REDUCE_SCATTER_SIG,"");
- COLL_APPLY(COLL_DEFS,COLL_SCATTER_SIG,"");
- COLL_APPLY(COLL_DEFS,COLL_BARRIER_SIG,"");
- COLL_APPLY(COLL_DEFS,COLL_BCAST_SIG,"");
- COLL_APPLY(COLL_DEFS,COLL_ALLTOALL_SIG,"");
- COLL_APPLY(COLL_DEFS,COLL_ALLTOALLV_SIG,"");
-
-//These fairly unused collectives only have one implementation in SMPI
-
- static int gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm);
- static int scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
- static int scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
- static int exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
+ // for each collective type, create the set_* prototype, the description array and the function pointer
+ COLL_APPLY(COLL_DEFS, COLL_GATHER_SIG, "");
+ COLL_APPLY(COLL_DEFS, COLL_ALLGATHER_SIG, "");
+ COLL_APPLY(COLL_DEFS, COLL_ALLGATHERV_SIG, "");
+ COLL_APPLY(COLL_DEFS, COLL_REDUCE_SIG, "");
+ COLL_APPLY(COLL_DEFS, COLL_ALLREDUCE_SIG, "");
+ COLL_APPLY(COLL_DEFS, COLL_REDUCE_SCATTER_SIG, "");
+ COLL_APPLY(COLL_DEFS, COLL_SCATTER_SIG, "");
+ COLL_APPLY(COLL_DEFS, COLL_BARRIER_SIG, "");
+ COLL_APPLY(COLL_DEFS, COLL_BCAST_SIG, "");
+ COLL_APPLY(COLL_DEFS, COLL_ALLTOALL_SIG, "");
+ COLL_APPLY(COLL_DEFS, COLL_ALLTOALLV_SIG, "");
+
+ // These fairly unused collectives only have one implementation in SMPI
+ static int gatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int* recvcounts, int* displs,
+ MPI_Datatype recvtype, int root, MPI_Comm comm);
+ static int scatterv(void* sendbuf, int* sendcounts, int* displs, MPI_Datatype sendtype, void* recvbuf,
+ int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
+ static int scan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
+ static int exscan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
static void (*smpi_coll_cleanup_callback)();
};
* ALLTOALL *
************/
-
#define COLL_ALLTOALLS(action, COLL_sep) \
COLL_APPLY(action, COLL_ALLTOALL_SIG, default) COLL_sep \
COLL_APPLY(action, COLL_ALLTOALL_SIG, 2dmesh) COLL_sep \
COLL_BCASTS(COLL_PROTO, COLL_NOsep)
-
/**********
* REDUCE *
**********/
COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, impi) COLL_sep \
COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, automatic)
-
-
COLL_REDUCE_SCATTERS(COLL_PROTO, COLL_NOsep)
-
/*************
* SCATTER *
*************/
COLL_BARRIERS(COLL_PROTO, COLL_NOsep)
-
}
}
-
#endif
xbt_log_preinit();
xbt_os_thread_mod_preinit();
xbt_dict_preinit();
-
+
srand(seed);
#ifndef _WIN32
srand48(seed);
static void xbt_postexit(void)
{
- if(!_sg_do_clean_atexit) return;
+ if (!_sg_do_clean_atexit)
+ return;
xbt_initialized--;
xbt_dict_postexit();
xbt_os_thread_mod_postexit();
{
simgrid::xbt::installExceptionHandler();
- if (xbt_initialized++) {
- XBT_DEBUG("XBT was initialized %d times.", xbt_initialized);
+ if (xbt_initialized) {
+ xbt_initialized++;
+ XBT_DEBUG("XBT has been initialized %d times.", xbt_initialized);
return;
}
xbt_binary_name = xbt_strdup(argv[0]);
- xbt_cmdline = xbt_dynar_new(sizeof(char*),NULL);
- for (int i=0;i<*argc;i++)
+ xbt_cmdline = xbt_dynar_new(sizeof(char*), NULL);
+ for (int i = 0; i < *argc; i++)
xbt_dynar_push(xbt_cmdline,&(argv[i]));
xbt_log_init(argc, argv);
__gcov_flush();
#endif
#ifdef _WIN32
- /* It was said *in silence*. We don't want to see the error message printed
- * by the Microsoft's implementation of abort(). */
+ /* We said *in silence*. We don't want to see the error message printed by Microsoft's implementation of abort(). */
raise(SIGABRT);
signal(SIGABRT, SIG_DFL);
raise(SIGABRT);