simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name("coordinator");
- while (1) {
+ while (true) {
m = static_cast<Message*>(mbox->get());
if (m->kind == Message::Kind::REQUEST) {
if (CS_used) {
simgrid::s4u::Mailbox* my_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id));
- while (1) {
+ while (true) {
XBT_INFO("Ask the request");
simgrid::s4u::Mailbox::by_name("coordinator")->put(new Message(Message::Kind::REQUEST, my_mailbox), 1000);
xbt_assert(argc == 2, "Expecting one parameter");
long id = xbt_str_parse_int(argv[1], "Invalid argument %s");
simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::string("worker-") + std::to_string(id));
- while (1) {
+ while (true) {
try {
XBT_INFO("Waiting a message on %s", mailbox->get_cname());
const double* payload = static_cast<double*>(mailbox->get());
XBT_CDEBUG(xbt_parmap, "New worker thread created");
/* Worker's main loop */
- while (1) {
+ while (true) {
round++; // New scheduling round
parmap.synchro->worker_wait(round);
if (parmap.destroying)
void* data, double timeout)
{
simgrid::kernel::activity::ActivityImplPtr 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, src, mbox, task_size, rate, src_buff, src_buff_size, match_fun, nullptr, copy_data_fun, data, false);
SIMCALL_SET_MC_VALUE(*simcall, 0);
simcall_HANDLER_comm_wait(simcall, static_cast<simgrid::kernel::activity::CommImpl*>(comm.get()), timeout);
}
{
add_route_check_params(src, dst, gw_src, gw_dst, link_list, symmetrical);
- new_edge(src->id(), dst->id(), new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1));
+ new_edge(src->id(), dst->id(),
+ new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, true));
if (symmetrical == true)
- new_edge(dst->id(), src->id(), new_extended_route(hierarchy_, dst, src, gw_dst, gw_src, link_list, symmetrical, 0));
+ new_edge(dst->id(), src->id(),
+ new_extended_route(hierarchy_, dst, src, gw_dst, gw_src, link_list, symmetrical, false));
}
void DijkstraZone::new_edge(int src_id, int dst_id, RouteCreationArgs* route)
dst->get_cname());
TO_FLOYD_LINK(src->id(), dst->id()) =
- new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1);
+ new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, true);
TO_FLOYD_PRED(src->id(), dst->id()) = src->id();
TO_FLOYD_COST(src->id(), dst->id()) = (TO_FLOYD_LINK(src->id(), dst->id()))->link_list.size();
src->get_cname(), gw_dst->get_cname());
TO_FLOYD_LINK(dst->id(), src->id()) =
- new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 0);
+ new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, false);
TO_FLOYD_PRED(dst->id(), src->id()) = dst->id();
TO_FLOYD_COST(dst->id(), src->id()) =
(TO_FLOYD_LINK(dst->id(), src->id()))->link_list.size(); /* count of links, old model assume 1 */
if (diff != NONE_DIFF) {
if (comm->type == PatternCommunicationType::send) {
- this->send_deterministic = 0;
+ this->send_deterministic = false;
if (this->send_diff != nullptr)
xbt_free(this->send_diff);
this->send_diff = print_determinism_result(diff, process, comm, list.index_comm + 1);
} else {
- this->recv_deterministic = 0;
+ this->recv_deterministic = false;
if (this->recv_diff != nullptr)
xbt_free(this->recv_diff);
this->recv_diff = print_determinism_result(diff, process, comm, list.index_comm + 1);
{
LocationList locations;
std::ptrdiff_t offset = 0;
- while (1) {
+ while (true) {
Dwarf_Addr base;
Dwarf_Addr start;
Dwarf_Addr end;
void AppSide::handle_messages()
{
- while (1) {
+ while (true) {
XBT_DEBUG("Waiting messages from model-checker");
char message_buffer[MC_MESSAGE_LENGTH];
void AppSide::main_loop()
{
- while (1) {
+ while (true) {
simgrid::mc::wait_for_requests();
xbt_assert(channel_.send(MC_MESSAGE_WAITING) == 0, "Could not send WAITING message to model-checker");
this->handle_messages();
std::vector<char> res(128);
off_t off = 0;
- while (1) {
+ while (true) {
ssize_t c = pread(this->memory_file, res.data() + off, res.size() - off, (off_t)address.address() + off);
if (c == -1 && errno == EINTR)
continue;
// TODO, check condition check (unw_init_local==0 means end of frame)
- while (1) {
+ while (true) {
s_mc_stack_frame_t stack_frame;
stack_frame.unw_cursor = c;
}
}();
- while (1) {
+ while (true) {
// Sleep *before* updating; important for startup (i.e., t = 0).
// In the beginning, we want to go with the pstates specified in the platform file
// (so we sleep first)
task->state= SD_NOT_SCHEDULED;
sd_global->initial_tasks.insert(task);
- task->marked = 0;
+ task->marked = false;
task->start_time = -1.0;
task->finish_time = -1.0;
task->surf_action = nullptr;
/* the model-checker wants two separate simcalls */
simgrid::kernel::activity::ActivityImplPtr comm =
nullptr; /* MC needs the comm to be set to nullptr during the simcall */
- comm = simcall_comm_isend(sender, mbox, task_size, rate,
- src_buff, src_buff_size, match_fun, nullptr, copy_data_fun, data, 0);
+ comm = simcall_comm_isend(sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, nullptr, copy_data_fun,
+ data, false);
simcall_comm_wait(comm.get(), timeout);
comm = nullptr;
}
inline static int simcall_BODY_execution_waitany_for(simgrid::kernel::activity::ExecImpl** execs, size_t count, double timeout)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_execution_waitany_for(&SIMIX_process_self()->simcall_, execs, count, timeout);
return simcall<int, simgrid::kernel::activity::ExecImpl**, size_t, double>(SIMCALL_EXECUTION_WAITANY_FOR, execs, count, timeout);
}
inline static void simcall_BODY_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_send(&SIMIX_process_self()->simcall_, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout);
return simcall<void, smx_actor_t, smx_mailbox_t, double, double, unsigned char*, size_t, simix_match_func_t, simix_copy_data_func_t, void*, double>(SIMCALL_COMM_SEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout);
}
inline static boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_BODY_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, bool detached)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_isend(&SIMIX_process_self()->simcall_, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, smx_actor_t, smx_mailbox_t, double, double, unsigned char*, size_t, simix_match_func_t, simix_clean_func_t, simix_copy_data_func_t, void*, bool>(SIMCALL_COMM_ISEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
}
inline static void simcall_BODY_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_recv(&SIMIX_process_self()->simcall_, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate);
return simcall<void, smx_actor_t, smx_mailbox_t, unsigned char*, size_t*, simix_match_func_t, simix_copy_data_func_t, void*, double, double>(SIMCALL_COMM_RECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate);
}
inline static boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_BODY_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_irecv(&SIMIX_process_self()->simcall_, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, smx_actor_t, smx_mailbox_t, unsigned char*, size_t*, simix_match_func_t, simix_copy_data_func_t, void*, double>(SIMCALL_COMM_IRECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
}
inline static int simcall_BODY_comm_waitany(simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_waitany(&SIMIX_process_self()->simcall_, comms, count, timeout);
return simcall<int, simgrid::kernel::activity::CommImpl**, size_t, double>(SIMCALL_COMM_WAITANY, comms, count, timeout);
}
inline static void simcall_BODY_comm_wait(simgrid::kernel::activity::CommImpl* comm, double timeout)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_wait(&SIMIX_process_self()->simcall_, comm, timeout);
return simcall<void, simgrid::kernel::activity::CommImpl*, double>(SIMCALL_COMM_WAIT, comm, timeout);
}
inline static bool simcall_BODY_comm_test(simgrid::kernel::activity::CommImpl* comm)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_test(&SIMIX_process_self()->simcall_, comm);
return simcall<bool, simgrid::kernel::activity::CommImpl*>(SIMCALL_COMM_TEST, comm);
}
inline static int simcall_BODY_comm_testany(simgrid::kernel::activity::CommImpl** comms, size_t count)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_testany(&SIMIX_process_self()->simcall_, comms, count);
return simcall<int, simgrid::kernel::activity::CommImpl**, size_t>(SIMCALL_COMM_TESTANY, comms, count);
}
inline static void simcall_BODY_mutex_lock(smx_mutex_t mutex)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_mutex_lock(&SIMIX_process_self()->simcall_, mutex);
return simcall<void, smx_mutex_t>(SIMCALL_MUTEX_LOCK, mutex);
}
inline static int simcall_BODY_mutex_trylock(smx_mutex_t mutex)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_mutex_trylock(&SIMIX_process_self()->simcall_, mutex);
return simcall<int, smx_mutex_t>(SIMCALL_MUTEX_TRYLOCK, mutex);
}
inline static void simcall_BODY_mutex_unlock(smx_mutex_t mutex)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_mutex_unlock(&SIMIX_process_self()->simcall_, mutex);
return simcall<void, smx_mutex_t>(SIMCALL_MUTEX_UNLOCK, mutex);
}
inline static void simcall_BODY_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_cond_wait(&SIMIX_process_self()->simcall_, cond, mutex);
return simcall<void, smx_cond_t, smx_mutex_t>(SIMCALL_COND_WAIT, cond, mutex);
}
inline static int simcall_BODY_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_cond_wait_timeout(&SIMIX_process_self()->simcall_, cond, mutex, timeout);
return simcall<int, smx_cond_t, smx_mutex_t, double>(SIMCALL_COND_WAIT_TIMEOUT, cond, mutex, timeout);
}
inline static void simcall_BODY_sem_acquire(smx_sem_t sem)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_sem_acquire(&SIMIX_process_self()->simcall_, sem);
return simcall<void, smx_sem_t>(SIMCALL_SEM_ACQUIRE, sem);
}
inline static int simcall_BODY_sem_acquire_timeout(smx_sem_t sem, double timeout)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_sem_acquire_timeout(&SIMIX_process_self()->simcall_, sem, timeout);
return simcall<int, smx_sem_t, double>(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem, timeout);
}
inline static int simcall_BODY_mc_random(int min, int max)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_mc_random(&SIMIX_process_self()->simcall_, min, max);
return simcall<int, int, int>(SIMCALL_MC_RANDOM, min, max);
}
inline static void simcall_BODY_run_kernel(std::function<void()> const* code)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
SIMIX_run_kernel(code);
return simcall<void, std::function<void()> const*>(SIMCALL_RUN_KERNEL, code);
}
inline static void simcall_BODY_run_blocking(std::function<void()> const* code)
{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
+ if (false) /* Go to that function to follow the code flow through the simcall barrier */
SIMIX_run_blocking(code);
return simcall<void, std::function<void()> const*>(SIMCALL_RUN_BLOCKING, code);
}
smx_timer_t timeout_cb_ = nullptr; // Callback to timeouts
simgrid::mc::SimcallInspector* inspector_ = nullptr; // makes that simcall observable by the MC
int mc_value_ = 0;
- u_smx_scalar args_[11] = {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}};
- u_smx_scalar result_ = {0};
+ u_smx_scalar args_[11] = {};
+ u_smx_scalar result_ = {};
};
#define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall).mc_value_ = (value))
self.name,
', '.join('%s %s' % (arg.rettype(), arg.name) for arg in self.args)))
res.append('{')
- res.append(' if (0) /* Go to that function to follow the code flow through the simcall barrier */')
+ res.append(' if (false) /* Go to that function to follow the code flow through the simcall barrier */')
if self.need_handler:
res.append(' simcall_HANDLER_%s(%s);' % (self.name,
', '.join(["&SIMIX_process_self()->simcall_"] + [arg.name for arg in self.args])))
Instance(int max_no_processes, MPI_Comm comm) : size_(max_no_processes), comm_world_(comm)
{
MPI_Group group = new simgrid::smpi::Group(size_);
- comm_world_ = new simgrid::smpi::Comm(group, nullptr, 0, -1);
+ comm_world_ = new simgrid::smpi::Comm(group, nullptr, false, -1);
// FIXME : using MPI_Attr_put with MPI_UNIVERSE_SIZE is forbidden and we make it a no-op (which triggers a warning
// as MPI_ERR_ARG is returned). Directly calling Comm::attr_put breaks for now, as MPI_UNIVERSE_SIZE,is <0
// instance.comm_world->attr_put<simgrid::smpi::Comm>(MPI_UNIVERSE_SIZE, reinterpret_cast<void*>(instance.size));
}
}
*leader=min_index;
- return new Comm(group_intra, nullptr, 1);
+ return new Comm(group_intra, nullptr, true);
}
void Comm::init_smp(){
//create leader_communicator
for (i=0; i< leader_group_size;i++)
leaders_group->set_mapping(s4u::Actor::by_pid(leader_list[i]).get(), i);
- leader_comm = new Comm(leaders_group, nullptr,1);
+ leader_comm = new Comm(leaders_group, nullptr, true);
this->set_leaders_comm(leader_comm);
this->set_intra_comm(comm_intra);
leaders_group->set_mapping(s4u::Actor::by_pid(leader_list[i]).get(), i);
if(this->get_leaders_comm()==MPI_COMM_NULL){
- leader_comm = new Comm(leaders_group, nullptr,1);
+ leader_comm = new Comm(leaders_group, nullptr, true);
this->set_leaders_comm(leader_comm);
}else{
leader_comm=this->get_leaders_comm();
L07Action::L07Action(kernel::resource::Model* model, const std::vector<s4u::Host*>& host_list,
const double* flops_amount, const double* bytes_amount, double rate)
- : CpuAction(model, 1, 0), computationAmount_(flops_amount), communicationAmount_(bytes_amount), rate_(rate)
+ : CpuAction(model, 1.0, false), computationAmount_(flops_amount), communicationAmount_(bytes_amount), rate_(rate)
{
size_t link_nb = 0;
size_t used_host_nb = 0; /* Only the hosts with something to compute (>0 flops) are counted) */
XBT_DEBUG("Looking for next trace event");
- while (1) { // Handle next occurring events until none remains
+ while (true) { // Handle next occurring events until none remains
double next_event_date = simgrid::kernel::profile::future_evt_set.next_date();
XBT_DEBUG("Next TRACE event: %f", next_event_date);
xbt_assert(static_cast<size_t>(ev->priority) < sizeof(xbt_log_priority_names)/sizeof(xbt_log_priority_names[0]),
"Priority %d is greater than the biggest allowed value", ev->priority);
- while (1) {
+ while (true) {
const s_xbt_log_appender_t* appender = cat->appender;
if (appender != nullptr) {
/* The static buffer was too small, use a dynamically expanded one */
ev->buffer_size = XBT_LOG_DYNAMIC_BUFFER_SIZE;
ev->buffer = static_cast<char*>(xbt_malloc(ev->buffer_size));
- while (1) {
+ while (true) {
va_start(ev->ap, fmt);
done = cat->layout->do_layout(cat->layout, ev, fmt);
va_end(ev->ap);
} else \
return 0
-#define set_sz_from_precision() \
- if (1) { \
- sz = rem_size; \
- if (precision != -1) { \
- if (precision < sz) \
- sz = precision + 1; /* +1 for the final '\0' */ \
- precision = -1; \
- } \
- } else (void)0
+#define set_sz_from_precision() \
+ if (true) { \
+ sz = rem_size; \
+ if (precision != -1) { \
+ if (precision < sz) \
+ sz = precision + 1; /* +1 for the final '\0' */ \
+ precision = -1; \
+ } \
+ } else \
+ (void)0
#define show_it(data, letter) \
- if (1) { \
+ if (true) { \
int len; \
int wd; \
if (length == -1) { \
} \
check_overflow(len); \
} else \
- (void)0
+ (void)0
-#define show_string(data) \
- if (1) { \
- const char *show_string_data = (data); \
- show_it(show_string_data ? show_string_data : "(null)", "s"); \
- } else (void)0
+#define show_string(data) \
+ if (true) { \
+ const char* show_string_data = (data); \
+ show_it(show_string_data ? show_string_data : "(null)", "s"); \
+ } else \
+ (void)0
#define show_int(data) show_it((data), "d")
#define show_double(data) show_it((data), "f")
xbt_abort();
}
break; /* done, continue normally */
- } while (1);
+ } while (true);
} else {
*p = *q;
check_overflow(1);
const std::string* payload;
simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name("jupi");
- while (1) {
+ while (true) {
try {
payload = static_cast<std::string*>(mailbox->get());
} catch (const simgrid::HostFailureException&) {
simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_cname());
XBT_INFO("Server waiting for transfers ...");
- while (1) {
+ while (true) {
const std::string* msg = static_cast<std::string*>(mailbox->get());
if (*msg == "finalize") { // Shutdown ...
delete msg;