xbt_assert(argc == 3 || argc == 4, "Wrong number of arguments");
// Build peer object
- peer_t peer = peer_init(xbt_str_parse_int(argv[1], "Invalid ID: %s"), argc == 4 ? 1 : 0);
+ peer_t peer = peer_init((int)xbt_str_parse_int(argv[1], "Invalid ID: %s"), argc == 4 ? 1 : 0);
// Retrieve deadline
peer->deadline = xbt_str_parse_double(argv[2], "Invalid deadline: %s");
// Sending peers to the requesting peer
tracker_answer_t ta = tracker_answer_new(TRACKER_QUERY_INTERVAL);
int next_peer;
- int peers_length = xbt_dynar_length(peers_list);
+ int peers_length = (int)xbt_dynar_length(peers_list);
for (int i = 0; i < MAXIMUM_PEERS && i < peers_length; i++) {
do {
next_peer = xbt_dynar_get_as(peers_list, rand() % peers_length, int);
{
XBT_DEBUG("broadcaster");
xbt_assert(argc > 2);
- unsigned int host_count = xbt_str_parse_int(argv[1], "Invalid number of peers: %s");
+ unsigned int host_count = (unsigned int)xbt_str_parse_int(argv[1], "Invalid number of peers: %s");
sg_mailbox_t* mailboxes = xbt_malloc(sizeof(sg_mailbox_t) * host_count);
free(name);
}
- unsigned int piece_count = xbt_str_parse_int(argv[2], "Invalid number of pieces: %s");
+ unsigned int piece_count = (unsigned int)xbt_str_parse_int(argv[2], "Invalid number of pieces: %s");
broadcaster_t bc = broadcaster_init(mailboxes, host_count, piece_count);
xbt_assert(argc == 5, "The master function expects 4 arguments from the XML deployment file");
long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s"); /* - Number of tasks */
double comp_size = xbt_str_parse_double(argv[2], "Invalid computational size: %s"); /* - Compute cost */
- double comm_size = xbt_str_parse_double(argv[3], "Invalid communication size: %s"); /* - Communication size */
+ long comm_size = xbt_str_parse_int(argv[3], "Invalid communication size: %s"); /* - Communication size */
long workers_count = xbt_str_parse_int(argv[4], "Invalid amount of workers: %s"); /* - Number of workers */
XBT_INFO("Got %ld workers and %ld tasks to process", workers_count, number_of_tasks);
xbt_assert(argc == 0, "The relay_runner function does not accept any parameter from the XML deployment file");
const char* name = sg_actor_self_get_name();
- int rank = xbt_str_parse_int(name, "Any actor of this example must have a numerical name, not %s");
+ int rank = (int)xbt_str_parse_int(name, "Any actor of this example must have a numerical name, not %s");
sg_mailbox_t my_mailbox = sg_mailbox_by_name(name);
{
xbt_assert(argc == 4);
double computation_amount = xbt_str_parse_double(argv[1], "Invalid computation amount: %s");
- int use_bound = xbt_str_parse_int(argv[2], "Second parameter (use_bound) should be 0 or 1 but is: %s");
+ int use_bound = !!xbt_str_parse_int(argv[2], "Second parameter (use_bound) should be 0 or 1 but is: %s");
double bound = xbt_str_parse_double(argv[3], "Invalid bound: %s");
double clock_sta = simgrid_get_clock();
#define FINALIZE 221297 /* a magic number to tell people to stop working */
const double comp_size = 10000000;
-const double comm_size = 10000000;
+const long comm_size = 10000000;
static void send_tasks(int nb_workers)
{
{
xbt_assert(argc == 5, "The sender function expects 4 arguments from the XML deployment file");
long messages_count = xbt_str_parse_int(argv[1], "Invalid amount of messages: %s"); /* - number of messages */
- double message_size = xbt_str_parse_double(argv[2], "Invalid message size: %s"); /* - communication cost */
+ long message_size = xbt_str_parse_int(argv[2], "Invalid message size: %s"); /* - communication cost */
double sleep_start_time = xbt_str_parse_double(argv[3], "Invalid sleep start time: %s"); /* - start time */
double sleep_test_time = xbt_str_parse_double(argv[4], "Invalid test time: %s"); /* - test time */
static void receiver(int argc, char* argv[])
{
xbt_assert(argc == 2, "Expecting one parameter from the XML deployment file but got %d", argc);
- int id = xbt_str_parse_int(argv[1], "ID should be numerical, not %s");
+ int id = (int)xbt_str_parse_int(argv[1], "ID should be numerical, not %s");
char mailbox_name[80];
snprintf(mailbox_name, 79, "receiver-%d", id);
sg_mailbox_t mbox = sg_mailbox_by_name(mailbox_name);
static void receiver(int argc, char* argv[])
{
xbt_assert(argc == 2, "Expecting one parameter from the XML deployment file but got %d", argc);
- int id = xbt_str_parse_int(argv[1], "ID should be numerical, not %s");
+ int id = (int)xbt_str_parse_int(argv[1], "ID should be numerical, not %s");
char mailbox_name[80];
snprintf(mailbox_name, 79, "receiver-%d", id);
sg_mailbox_t mbox = sg_mailbox_by_name(mailbox_name);
double deadline;
xbt_assert(argc == 3 || argc == 4, "Wrong number of arguments");
/* Node initialization */
- unsigned int id = strtoul(argv[1], NULL, 0);
+ unsigned int id = (unsigned int)strtoul(argv[1], NULL, 0);
node_t node = node_init(id);
if (argc == 4) {
XBT_INFO("Hi, I'm going to join the network with id %s", sg_mailbox_get_name(node->mailbox));
- unsigned int id_known = strtoul(argv[2], NULL, 0);
+ unsigned int id_known = (unsigned int)strtoul(argv[2], NULL, 0);
join_success = join(node, id_known);
deadline = strtod(argv[3], NULL);
} else {
#include "xbt/str.h"
#include "xbt/sysdep.h"
-#include <math.h>
#include <stdio.h>
XBT_LOG_NEW_DEFAULT_CATEGORY(pastry, "Messages specific for this example");
static int domain(unsigned int a, unsigned int level)
{
if (domain_mask == 0)
- domain_mask = pow(2, DOMAIN_SIZE) - 1;
+ domain_mask = (1u << DOMAIN_SIZE) - 1;
unsigned int shift = (LEVELS_COUNT - level - 1) * DOMAIN_SIZE;
return (a >> shift) & domain_mask;
}
double deadline;
xbt_assert(argc == 3 || argc == 5, "Wrong number of arguments for this node");
s_node_t node = {0};
- node.id = xbt_str_parse_int(argv[1], "Invalid ID: %s");
+ node.id = (int)xbt_str_parse_int(argv[1], "Invalid ID: %s");
node.known_id = -1;
node.ready = -1;
node.pending_messages = xbt_dynar_new(sizeof(pastry_message_t), NULL);
XBT_DEBUG("Create a new Pastry ring...");
join_success = 1;
} else {
- node.known_id = xbt_str_parse_int(argv[2], "Invalid known ID: %s");
+ node.known_id = (int)xbt_str_parse_int(argv[2], "Invalid known ID: %s");
double sleep_time = xbt_str_parse_double(argv[3], "Invalid sleep time: %s");
deadline = xbt_str_parse_double(argv[4], "Invalid deadline: %s");
while (!strncmp(options[0], "-", 1)) {
int length = strlen("-nb_bits=");
if (!strncmp(options[0], "-nb_bits=", length) && strlen(options[0]) > length) {
- nb_bits = xbt_str_parse_int(options[0] + length, "Invalid nb_bits parameter: %s");
+ nb_bits = (int)xbt_str_parse_int(options[0] + length, "Invalid nb_bits parameter: %s");
XBT_DEBUG("Set nb_bits to %d", nb_bits);
} else {
length = strlen("-timeout=");
if (!strncmp(options[0], "-timeout=", length) && strlen(options[0]) > length) {
- timeout = xbt_str_parse_int(options[0] + length, "Invalid timeout parameter: %s");
+ timeout = (int)xbt_str_parse_int(options[0] + length, "Invalid timeout parameter: %s");
XBT_DEBUG("Set timeout to %d", timeout);
} else {
xbt_die("Invalid pastry option '%s'", options[0]);
static void runner(int argc, char* argv[])
{
/* Retrieve the list of all hosts as an array of hosts */
- int host_count = sg_host_count();
+ int host_count = (int)sg_host_count();
sg_host_t* hosts = sg_host_list();
XBT_INFO("First, build a classical parallel task, with 1 Gflop to execute on each node, "
xbt_assert(argc == 5);
long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
double task_comp_size = xbt_str_parse_double(argv[2], "Invalid computational size: %s");
- double task_comm_size = xbt_str_parse_double(argv[3], "Invalid communication size: %s");
+ long task_comm_size = xbt_str_parse_int(argv[3], "Invalid communication size: %s");
long workers_count = xbt_str_parse_int(argv[4], "Invalid amount of workers: %s");
XBT_INFO("Got %ld workers and %ld tasks to process", workers_count, number_of_tasks);
static void smpi_replay(int argc, char* argv[])
{
const char* instance_id = argv[1];
- int rank = xbt_str_parse_int(argv[2], "Cannot parse rank '%s'");
+ int rank = (int)xbt_str_parse_int(argv[2], "Cannot parse rank '%s'");
const char* trace_filename = argv[3];
double start_delay_flops = 0;
const char** line_char= xbt_dynar_to_array(elems);
instance_id = line_char[0];
- int instance_size = xbt_str_parse_int(line_char[2], "Invalid size: %s");
+ int instance_size = (int)xbt_str_parse_int(line_char[2], "Invalid size: %s");
XBT_INFO("Initializing instance %s of size %d", instance_id, instance_size);
SMPI_app_instance_register(instance_id, smpi_replay,instance_size);