{ /* Task creation */
char sprintf_buffer[64];
- todo = calloc(number_of_tasks, sizeof(m_task_t));
+ todo = xbt_new0(m_task_t,number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
sprintf(sprintf_buffer, "Task_%d", i);
{ /* Process organisation */
slaves_count = argc - 4;
- slaves = calloc(slaves_count, sizeof(m_host_t));
+ slaves = xbt_new0(m_host_t,slaves_count);
for (i = 4; i < argc; i++) {
slaves[i-4] = MSG_get_host_by_name(argv[i]);
{ /* Process organisation */
slaves_count = argc - 4;
- slaves = calloc(slaves_count, sizeof(m_host_t));
+ slaves = xbt_new0(m_host_t,slaves_count);
for (i = 4; i < argc; i++) {
slaves[i-4] = MSG_get_host_by_name(argv[i]);
for (i = 0; i < number_of_tasks; i++) {
m_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size,
- calloc(1,sizeof(double)));
+ xbt_new0(double,1));
int a;
*((double*) task->data) = MSG_get_clock();
{ /* Task creation */
char sprintf_buffer[64];
- todo = calloc(number_of_tasks, sizeof(m_task_t));
+ todo = xbt_new0(m_task_t,number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
sprintf(sprintf_buffer, "Task_%d", i);
{ /* Process organisation */
slaves_count = argc - 4;
- slaves = calloc(slaves_count, sizeof(m_host_t));
+ slaves = xbt_new0(m_host_t,slaves_count);
for (i = 4; i < argc; i++) {
slaves[i-4] = MSG_get_host_by_name(argv[i]);
{ /* Process organisation */
slaves_count = argc - 1;
- slaves = calloc(slaves_count, sizeof(m_host_t));
+ slaves = xbt_new0(m_host_t,slaves_count);
for (i = 1; i < argc; i++) {
slaves[i-1] = MSG_get_host_by_name(argv[i]);
slaves_count = MSG_get_host_number();
slaves = MSG_get_host_table();
- computation_amount = calloc(slaves_count,sizeof(double));
- communication_amount = calloc(slaves_count*slaves_count,sizeof(double));
+ computation_amount = xbt_new0(double,slaves_count);
+ communication_amount = xbt_new0(double,slaves_count*slaves_count);
for(i=0;i<slaves_count;i++)
computation_amount[i]=task_comp_size;
INFO0("sender");
- host = calloc(1, sizeof(m_host_t));
+ /*host = xbt_new0(m_host_t,1);*/
INFO1("host = %s", argv[1]);
PtoPcomm2_hosts[1] = hosts[2];
/* parallel task without intra communications (1 sec duration) */
- ParComp_wocomm_table = (double*) calloc (25, sizeof(double));
+ ParComp_wocomm_table = xbt_new0(double,25);
for (i=0; i<5;i++){
ParComp_wocomm_hosts[i]=hosts[i];
/* redistribution within a cluster (small latencies) */
/* each host send (4*2.5Mb =) 10Mb */
/* bandwidth is shared between 5 flows (0.05sec duration) */
- IntraRedist_cost = (double*) calloc (5, sizeof(double));
- IntraRedist_table = (double*) calloc (25, sizeof(double));
+ IntraRedist_cost = xbt_new0(double,5);
+ IntraRedist_table = xbt_new0(double,25);
for (i=0;i<5;i++){
for (j=0;j<5;j++){
if (i==j)
/* parallel task with intra communications */
/* Computation domination (1 sec duration) */
- ParComp_wcomm1_table = (double*) calloc (25, sizeof(double));
+ ParComp_wcomm1_table = xbt_new0(double,25);
for (i=0; i<5;i++){
ParComp_wcomm1_hosts[i]=hosts[i];
/* inter cluster redistribution (big latency on the backbone) */
/* (0.5sec duration without latency impact)*/
- InterRedist_cost = (double*) calloc (10, sizeof(double));
- InterRedist_table = (double*) calloc (100, sizeof(double));
+ InterRedist_cost = xbt_new0(double,10);
+ InterRedist_table = xbt_new0(double,100);
for (i=0;i<5;i++){
InterRedist_table[i*10+i+5] = 1250000.; /* 10Mb */
}
/* parallel task with intra communications */
/* Communication domination (0.1 sec duration) */
- ParComp_wcomm2_table = (double*) calloc (25, sizeof(double));
+ ParComp_wcomm2_table = xbt_new0(double,25);
for (i=0; i<5;i++){
ParComp_wcomm2_hosts[i]=hosts[i+5];
exit(EXIT_FAILURE);\r
}\r
\r
- __argv = (char**)calloc(MAX_ARGS,sizeof(char*));\r
+ __argv = xbt_new0(char*,MAX_ARGS);\r
\r
for(i = 0; i < MAX_ARGS; i++)\r
{\r
ctx_t \r
ctx_new(job_t job)\r
{\r
- ctx_t ctx = (ctx_t)calloc(1,sizeof(s_ctx_t));\r
+ ctx_t ctx = xbt_new0(s_ctx_t,1);\r
ctx->index = ++__next_ctx_ID;\r
ctx->begin = xbt_os_sem_init(0);\r
ctx->end = xbt_os_sem_init(0);\r
return NULL;\r
}\r
\r
- sched = (sched_t)calloc(1,sizeof(s_sched_t));\r
+ sched = xbt_new0(s_sched_t,1);\r
\r
if(!sched)\r
{\r
return NULL;\r
}\r
\r
- sched->ctxs = (ctx_t*)calloc(size,sizeof(ctx_t));\r
+ sched->ctxs = xbt_new0(ctx_t,size);\r
\r
if(!(sched->ctxs))\r
{\r
int i;\r
\r
/* todo check the parameters */\r
- job = (job_t)calloc(1,sizeof(s_job_t));\r
+ job = xbt_new0(s_job_t,1);\r
\r
if(!job)\r
{\r
return NULL;\r
}\r
\r
- job->argv = (char**)calloc(argc,sizeof(char*));\r
+ job->argv = xbt_new0(char*,argc);\r
\r
if(!(job->argv))\r
{\r
shmurtz_t obj1, obj2, obj;
xbt_swag_t setA,setB;
- obj1 = calloc(1,sizeof(s_shmurtz_t));
- obj2 = calloc(1,sizeof(s_shmurtz_t));
+ obj1 = xbt_new0(s_shmurtz_t,1);
+ obj2 = xbt_new0(s_shmurtz_t,1);
obj1->name="Obj 1";
obj2->name="Obj 2";
1, 1, 1, 1, 1
};
-
- A = (double **) calloc(links + 5, sizeof(double));
+
+ /*A = xbt_new0(double*, links + 5);*/
+ A = xbt_new0(double*, links + 5);
for (i = 0; i < links + 5; i++) {
- A[i] = (double *) calloc(flows + 5, sizeof(double));
-
+ A[i] = xbt_new0(double, flows + 5);
for (j = 0; j < flows + 5; j++) {
A[i][j] = 0.0;
- tmp_name = (char **) calloc(31, sizeof(char *));
+ tmp_name = xbt_new0(char *,31);
/*
* Creates the constraints
*/
- tmp_cnst = calloc(15, sizeof(lmm_constraint_t));
+ tmp_cnst = xbt_new0(lmm_constraint_t,15);
for (i = 0; i < 15; i++) {
tmp_name[i] = bprintf("C_%03d", i);
tmp_cnst[i] = lmm_constraint_new(Sys, (void *) tmp_name[i], B[i]);
/*
* Creates the variables
*/
- tmp_var = calloc(16, sizeof(lmm_variable_t));
+ tmp_var = xbt_new0(lmm_variable_t,16);
for (j = 0; j < 16; j++) {
tmp_name[i + j] = bprintf("X_%03d", j);
tmp_var[j] =
void test(int nb_cnst, int nb_var, int nb_elem)
{
lmm_system_t Sys = NULL;
- lmm_constraint_t *cnst = calloc(nb_cnst, sizeof(lmm_constraint_t));
- lmm_variable_t *var = calloc(nb_var, sizeof(lmm_variable_t));
- int *used = calloc(nb_cnst, sizeof(int));
+ lmm_constraint_t *cnst = xbt_new0(lmm_constraint_t,nb_cnst);
+ lmm_variable_t *var = xbt_new0(lmm_variable_t,nb_var);
+ int *used = xbt_new0(int,nb_cnst);
int i, j, k;
Sys = lmm_system_new();
INFO0("---- Dumping Edge lengths ----");
adj = xbt_graph_get_length_matrix(graph);
- buf = calloc(n * 20, sizeof(char));
+ buf = xbt_new0(char,n * 20);
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
sprintf(buf + strlen(buf), "%le\t", adj[i * n + j]);
INFO0("---- Testing Shortest Paths ----");
route = xbt_graph_shortest_paths(graph);
- buf = calloc(n * 40, sizeof(char));
+ buf = xbt_new0(char,n * 40);
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
if (route[i * n + j])
void test_heap_validity(int size)
{
xbt_heap_t heap = xbt_heap_new(size, NULL);
- double *tab = (double*)calloc(size,sizeof(double));
+ double *tab = xbt_new0(double,size);
int i;