From: Martin Quinson Date: Wed, 20 Jun 2012 09:30:00 +0000 (+0200) Subject: sed -i -e 's/\t/ /g' *.[ch] Please people, stop using tabs in your source X-Git-Tag: v3_8~563^2~2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/272ccad1b68b6d9c17069f3c934886925bb15b5d sed -i -e 's/\t/ /g' *.[ch] Please people, stop using tabs in your source --- diff --git a/buildtools/Cmake/test_prog/prog_sem_open.c b/buildtools/Cmake/test_prog/prog_sem_open.c index e9f04456bd..2295b0ee43 100644 --- a/buildtools/Cmake/test_prog/prog_sem_open.c +++ b/buildtools/Cmake/test_prog/prog_sem_open.c @@ -16,9 +16,9 @@ int main(void) { #ifdef WIN32 - int s; + int s; #else - sem_t * s; + sem_t * s; #endif s = sem_open("/0", O_CREAT, 0644, 10); if (s == SEM_FAILED){ diff --git a/doc/HelloWorld/HelloWorld.c b/doc/HelloWorld/HelloWorld.c index 1399ea9265..ae6a7fbcbf 100644 --- a/doc/HelloWorld/HelloWorld.c +++ b/doc/HelloWorld/HelloWorld.c @@ -4,5 +4,5 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(HelloWorld, "Messages specific for this Hello World example"); void main() { - XBT_INFO("Hello World !!!"); + XBT_INFO("Hello World !!!"); } diff --git a/examples/msg/actions/actions.c b/examples/msg/actions/actions.c index 6c63e71310..6d7361559d 100644 --- a/examples/msg/actions/actions.c +++ b/examples/msg/actions/actions.c @@ -296,105 +296,105 @@ static void action_barrier(const char *const *action) static void action_reduce(const char *const *action) { - int i; - char *reduce_identifier; - char mailbox[80]; - double comm_size = parse_double(action[2]); - double comp_size = parse_double(action[3]); - m_task_t comp_task = NULL; - const char *process_name; - double clock = MSG_get_clock(); - - process_globals_t counters = (process_globals_t) MSG_process_get_data(MSG_process_self()); - - xbt_assert(communicator_size, "Size of Communicator is not defined, " - "can't use collective operations"); - - process_name = MSG_process_get_name(MSG_process_self()); - - reduce_identifier = bprintf("reduce_%d", counters->reduce_counter++); - - if (!strcmp(process_name, "p0")) { - XBT_DEBUG("%s: %s is the Root", reduce_identifier, process_name); - - msg_comm_t *comms = xbt_new0(msg_comm_t,communicator_size-1); - m_task_t *tasks = xbt_new0(m_task_t,communicator_size-1); - for (i = 1; i < communicator_size; i++) { - sprintf(mailbox, "%s_p%d_p0", reduce_identifier, i); - comms[i-1] = MSG_task_irecv(&(tasks[i-1]),mailbox); - } - MSG_comm_waitall(comms,communicator_size-1,-1); - for (i = 1; i < communicator_size; i++) { - MSG_comm_destroy(comms[i-1]); - MSG_task_destroy(tasks[i-1]); - } - free(tasks); - - comp_task = MSG_task_create("reduce_comp", comp_size, 0, NULL); - XBT_DEBUG("%s: computing 'reduce_comp'", reduce_identifier); - MSG_task_execute(comp_task); - MSG_task_destroy(comp_task); - XBT_DEBUG("%s: computed", reduce_identifier); - - } else { - XBT_DEBUG("%s: %s sends", reduce_identifier, process_name); - sprintf(mailbox, "%s_%s_p0", reduce_identifier, process_name); - XBT_DEBUG("put on %s", mailbox); - MSG_task_send(MSG_task_create(reduce_identifier, 0, comm_size, NULL), - mailbox); - } - - XBT_VERB("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock); - free(reduce_identifier); + int i; + char *reduce_identifier; + char mailbox[80]; + double comm_size = parse_double(action[2]); + double comp_size = parse_double(action[3]); + m_task_t comp_task = NULL; + const char *process_name; + double clock = MSG_get_clock(); + + process_globals_t counters = (process_globals_t) MSG_process_get_data(MSG_process_self()); + + xbt_assert(communicator_size, "Size of Communicator is not defined, " + "can't use collective operations"); + + process_name = MSG_process_get_name(MSG_process_self()); + + reduce_identifier = bprintf("reduce_%d", counters->reduce_counter++); + + if (!strcmp(process_name, "p0")) { + XBT_DEBUG("%s: %s is the Root", reduce_identifier, process_name); + + msg_comm_t *comms = xbt_new0(msg_comm_t,communicator_size-1); + m_task_t *tasks = xbt_new0(m_task_t,communicator_size-1); + for (i = 1; i < communicator_size; i++) { + sprintf(mailbox, "%s_p%d_p0", reduce_identifier, i); + comms[i-1] = MSG_task_irecv(&(tasks[i-1]),mailbox); + } + MSG_comm_waitall(comms,communicator_size-1,-1); + for (i = 1; i < communicator_size; i++) { + MSG_comm_destroy(comms[i-1]); + MSG_task_destroy(tasks[i-1]); + } + free(tasks); + + comp_task = MSG_task_create("reduce_comp", comp_size, 0, NULL); + XBT_DEBUG("%s: computing 'reduce_comp'", reduce_identifier); + MSG_task_execute(comp_task); + MSG_task_destroy(comp_task); + XBT_DEBUG("%s: computed", reduce_identifier); + + } else { + XBT_DEBUG("%s: %s sends", reduce_identifier, process_name); + sprintf(mailbox, "%s_%s_p0", reduce_identifier, process_name); + XBT_DEBUG("put on %s", mailbox); + MSG_task_send(MSG_task_create(reduce_identifier, 0, comm_size, NULL), + mailbox); + } + + XBT_VERB("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock); + free(reduce_identifier); } static void action_bcast(const char *const *action) { - int i; - char *bcast_identifier; - char mailbox[80]; - double comm_size = parse_double(action[2]); - m_task_t task = NULL; - const char *process_name; - double clock = MSG_get_clock(); - - process_globals_t counters = (process_globals_t) MSG_process_get_data(MSG_process_self()); - - xbt_assert(communicator_size, "Size of Communicator is not defined, " - "can't use collective operations"); - - process_name = MSG_process_get_name(MSG_process_self()); - - bcast_identifier = bprintf("bcast_%d", counters->bcast_counter++); - - if (!strcmp(process_name, "p0")) { - XBT_DEBUG("%s: %s is the Root", bcast_identifier, process_name); - - msg_comm_t *comms = xbt_new0(msg_comm_t,communicator_size-1); - - for (i = 1; i < communicator_size; i++) { - sprintf(mailbox, "%s_p0_p%d", bcast_identifier, i); - comms[i-1] = - MSG_task_isend(MSG_task_create(mailbox,0,comm_size,NULL), - mailbox); - } - MSG_comm_waitall(comms,communicator_size-1,-1); - for (i = 1; i < communicator_size; i++) - MSG_comm_destroy(comms[i-1]); - free(comms); - - XBT_DEBUG("%s: all messages sent by %s have been received", - bcast_identifier, process_name); - - } else { - sprintf(mailbox, "%s_p0_%s", bcast_identifier, process_name); - MSG_task_receive(&task, mailbox); - MSG_task_destroy(task); - XBT_DEBUG("%s: %s has received", bcast_identifier, process_name); - } - - XBT_VERB("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock); - free(bcast_identifier); + int i; + char *bcast_identifier; + char mailbox[80]; + double comm_size = parse_double(action[2]); + m_task_t task = NULL; + const char *process_name; + double clock = MSG_get_clock(); + + process_globals_t counters = (process_globals_t) MSG_process_get_data(MSG_process_self()); + + xbt_assert(communicator_size, "Size of Communicator is not defined, " + "can't use collective operations"); + + process_name = MSG_process_get_name(MSG_process_self()); + + bcast_identifier = bprintf("bcast_%d", counters->bcast_counter++); + + if (!strcmp(process_name, "p0")) { + XBT_DEBUG("%s: %s is the Root", bcast_identifier, process_name); + + msg_comm_t *comms = xbt_new0(msg_comm_t,communicator_size-1); + + for (i = 1; i < communicator_size; i++) { + sprintf(mailbox, "%s_p0_p%d", bcast_identifier, i); + comms[i-1] = + MSG_task_isend(MSG_task_create(mailbox,0,comm_size,NULL), + mailbox); + } + MSG_comm_waitall(comms,communicator_size-1,-1); + for (i = 1; i < communicator_size; i++) + MSG_comm_destroy(comms[i-1]); + free(comms); + + XBT_DEBUG("%s: all messages sent by %s have been received", + bcast_identifier, process_name); + + } else { + sprintf(mailbox, "%s_p0_%s", bcast_identifier, process_name); + MSG_task_receive(&task, mailbox); + MSG_task_destroy(task); + XBT_DEBUG("%s: %s has received", bcast_identifier, process_name); + } + + XBT_VERB("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock); + free(bcast_identifier); } diff --git a/examples/msg/masterslave/masterslave_bypass.c b/examples/msg/masterslave/masterslave_bypass.c index 343c92fcaa..b600d07af7 100644 --- a/examples/msg/masterslave/masterslave_bypass.c +++ b/examples/msg/masterslave/masterslave_bypass.c @@ -72,7 +72,7 @@ static int surf_parse_bypass_platform(void) SURFXML_BUFFER_SET(route_dst, "host B"); A_surfxml_route_symmetrical = A_surfxml_route_symmetrical_YES; SURFXML_START_TAG(route); - XBT_DEBUG(" "); + XBT_DEBUG(" "); SURFXML_BUFFER_SET(link_ctn_id, "LinkA"); A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE; SURFXML_START_TAG(link_ctn); @@ -220,7 +220,7 @@ int master(int argc, char *argv[]) ("All tasks have been dispatched. Let's tell everybody the computation is over."); for (i = 0; i < slaves_count; i++) MSG_task_send(MSG_task_create("finalize", 0, 0, FINALIZE), - MSG_host_get_name(slaves[i])); + MSG_host_get_name(slaves[i])); XBT_INFO("Goodbye now!"); free(slaves); diff --git a/examples/msg/masterslave/masterslave_cluster.c b/examples/msg/masterslave/masterslave_cluster.c index 1e54f5e73b..e45876fe47 100644 --- a/examples/msg/masterslave/masterslave_cluster.c +++ b/examples/msg/masterslave/masterslave_cluster.c @@ -90,7 +90,7 @@ int master(int argc, char *argv[]) ("All tasks have been dispatched. Let's tell everybody the computation is over."); for (i = 0; i < slaves_count; i++) MSG_task_send(MSG_task_create("finalize", 0, 0, FINALIZE), - MSG_host_get_name(slaves[i])); + MSG_host_get_name(slaves[i])); XBT_INFO("Goodbye now!"); free(slaves); @@ -119,7 +119,7 @@ int slave(int argc, char *argv[]) } else { XBT_INFO("Hey ?! What's up ? "); xbt_die("Unexpected behavior"); - } + } } XBT_INFO("I'm done. See you!"); return 0; @@ -129,101 +129,101 @@ int slave(int argc, char *argv[]) /** Bypass deployment **/ static int bypass_deployment(void) { - int nb_host,i; - static int AX_ptr; - static int surfxml_bufferstack_size = 2048; - static int surfxml_buffer_stack_stack_ptr = 0; - static int surfxml_buffer_stack_stack[1024]; - xbt_dynar_t hosts = MSG_hosts_as_dynar(); - /* allocating memory to the buffer, I think 2MB should be enough */ - surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size); - - nb_host = xbt_dynar_length(hosts); - xbt_dynar_free(&hosts); - - /* */ - SURFXML_BUFFER_SET(platform_version, "3"); - SURFXML_START_TAG(platform); - XBT_DEBUG(""); - - XBT_DEBUG(" "); - SURFXML_BUFFER_SET(process_host, "c-0.me"); - SURFXML_BUFFER_SET(process_function, "master"); - SURFXML_BUFFER_SET(process_start_time, "-1.0"); - SURFXML_BUFFER_SET(process_kill_time, "-1.0"); - SURFXML_START_TAG(process); - - XBT_DEBUG(" ",bprintf("%d",nb_host-1)); - SURFXML_BUFFER_SET(argument_value, bprintf("%d",nb_host-1)); - SURFXML_START_TAG(argument); - SURFXML_END_TAG(argument); - - XBT_DEBUG(" "); - SURFXML_BUFFER_SET(argument_value, "5000000"); - SURFXML_START_TAG(argument); - SURFXML_END_TAG(argument); - - XBT_DEBUG(" "); - SURFXML_BUFFER_SET(argument_value, "100000"); - SURFXML_START_TAG(argument); - SURFXML_END_TAG(argument); - - for(i=1 ; i",bprintf("c-%d",i)); - SURFXML_BUFFER_SET(argument_value, bprintf("c-%d.me",i)); - SURFXML_START_TAG(argument); - SURFXML_END_TAG(argument); - } - XBT_DEBUG(" "); - SURFXML_END_TAG(process); - - for(i=1 ; i",bprintf("c-%d",i)); - SURFXML_BUFFER_SET(process_host, bprintf("c-%d.me",i)); - SURFXML_BUFFER_SET(process_function, "slave"); - SURFXML_BUFFER_SET(process_start_time, "-1.0"); - SURFXML_BUFFER_SET(process_kill_time, "-1.0"); - SURFXML_START_TAG(process); - SURFXML_END_TAG(process); - } - - XBT_DEBUG(""); - SURFXML_END_TAG(platform); - - free(surfxml_bufferstack); - return 0; + int nb_host,i; + static int AX_ptr; + static int surfxml_bufferstack_size = 2048; + static int surfxml_buffer_stack_stack_ptr = 0; + static int surfxml_buffer_stack_stack[1024]; + xbt_dynar_t hosts = MSG_hosts_as_dynar(); + /* allocating memory to the buffer, I think 2MB should be enough */ + surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size); + + nb_host = xbt_dynar_length(hosts); + xbt_dynar_free(&hosts); + + /* */ + SURFXML_BUFFER_SET(platform_version, "3"); + SURFXML_START_TAG(platform); + XBT_DEBUG(""); + + XBT_DEBUG(" "); + SURFXML_BUFFER_SET(process_host, "c-0.me"); + SURFXML_BUFFER_SET(process_function, "master"); + SURFXML_BUFFER_SET(process_start_time, "-1.0"); + SURFXML_BUFFER_SET(process_kill_time, "-1.0"); + SURFXML_START_TAG(process); + + XBT_DEBUG(" ",bprintf("%d",nb_host-1)); + SURFXML_BUFFER_SET(argument_value, bprintf("%d",nb_host-1)); + SURFXML_START_TAG(argument); + SURFXML_END_TAG(argument); + + XBT_DEBUG(" "); + SURFXML_BUFFER_SET(argument_value, "5000000"); + SURFXML_START_TAG(argument); + SURFXML_END_TAG(argument); + + XBT_DEBUG(" "); + SURFXML_BUFFER_SET(argument_value, "100000"); + SURFXML_START_TAG(argument); + SURFXML_END_TAG(argument); + + for(i=1 ; i",bprintf("c-%d",i)); + SURFXML_BUFFER_SET(argument_value, bprintf("c-%d.me",i)); + SURFXML_START_TAG(argument); + SURFXML_END_TAG(argument); + } + XBT_DEBUG(" "); + SURFXML_END_TAG(process); + + for(i=1 ; i",bprintf("c-%d",i)); + SURFXML_BUFFER_SET(process_host, bprintf("c-%d.me",i)); + SURFXML_BUFFER_SET(process_function, "slave"); + SURFXML_BUFFER_SET(process_start_time, "-1.0"); + SURFXML_BUFFER_SET(process_kill_time, "-1.0"); + SURFXML_START_TAG(process); + SURFXML_END_TAG(process); + } + + XBT_DEBUG(""); + SURFXML_END_TAG(platform); + + free(surfxml_bufferstack); + return 0; } /** Test function */ MSG_error_t test_all(const char *platform_file) { - MSG_error_t res = MSG_OK; - MSG_create_environment(platform_file); - MSG_function_register("master", master); - MSG_function_register("slave", slave); - surf_parse = bypass_deployment; - MSG_launch_application(NULL); + MSG_error_t res = MSG_OK; + MSG_create_environment(platform_file); + MSG_function_register("master", master); + MSG_function_register("slave", slave); + surf_parse = bypass_deployment; + MSG_launch_application(NULL); - res = MSG_main(); + res = MSG_main(); - XBT_INFO("Simulation time %g", MSG_get_clock()); - return res; + XBT_INFO("Simulation time %g", MSG_get_clock()); + return res; } /* end_of_test_all */ /** Main function */ int main(int argc, char *argv[]) { - MSG_error_t res = MSG_OK; + MSG_error_t res = MSG_OK; - MSG_global_init(&argc, argv); - res = test_all(argv[1]); - MSG_clean(); + MSG_global_init(&argc, argv); + res = test_all(argv[1]); + MSG_clean(); - if (res == MSG_OK) - return 0; - else - return 1; + if (res == MSG_OK) + return 0; + else + return 1; } /* end_of_main */ diff --git a/examples/msg/masterslave/masterslave_forwarder.c b/examples/msg/masterslave/masterslave_forwarder.c index 4ebb580d8d..3e3560e5aa 100644 --- a/examples/msg/masterslave/masterslave_forwarder.c +++ b/examples/msg/masterslave/masterslave_forwarder.c @@ -160,7 +160,7 @@ int forwarder(int argc, char *argv[]) ("All tasks have been dispatched. Let's tell everybody the computation is over."); for (i = 0; i < slaves_count; i++) MSG_task_send(MSG_task_create("finalize", 0, 0, FINALIZE), - MSG_host_get_name(slaves[i])); + MSG_host_get_name(slaves[i])); MSG_task_destroy(task); break; } diff --git a/examples/msg/mc/bugged1_for_liveness.c b/examples/msg/mc/bugged1_for_liveness.c index 10cda7e9f3..0a5983d072 100644 --- a/examples/msg/mc/bugged1_for_liveness.c +++ b/examples/msg/mc/bugged1_for_liveness.c @@ -42,28 +42,28 @@ int coordinator(int argc, char *argv[]) XBT_INFO("CS already used. Queue the request of client %d", atoi(req) +1); xbt_dynar_push(requests, &req); } else { // can serve it immediatly - if(strcmp(req, "2") == 0){ - m_task_t answer = MSG_task_create("grant", 0, 1000, NULL); - MSG_task_send(answer, req); - CS_used = 1; - XBT_INFO("CS idle. Grant immediatly"); - } + if(strcmp(req, "2") == 0){ + m_task_t answer = MSG_task_create("grant", 0, 1000, NULL); + MSG_task_send(answer, req); + CS_used = 1; + XBT_INFO("CS idle. Grant immediatly"); + } } } else { // that's a release. Check if someone was waiting for the lock if (xbt_dynar_length(requests) > 0) { XBT_INFO("CS release. Grant to queued requests (queue size: %lu)", xbt_dynar_length(requests)); char *req ; - xbt_dynar_get_cpy(requests, (xbt_dynar_length(requests) - 1), &req); - if(strcmp(req, "2") == 0){ - xbt_dynar_pop(requests, &req); - MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req); - todo--; - }else{ - xbt_dynar_pop(requests, &req); - MSG_task_send(MSG_task_create("notgrant", 0, 1000, NULL), req); - CS_used = 0; - todo--; - } + xbt_dynar_get_cpy(requests, (xbt_dynar_length(requests) - 1), &req); + if(strcmp(req, "2") == 0){ + xbt_dynar_pop(requests, &req); + MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req); + todo--; + }else{ + xbt_dynar_pop(requests, &req); + MSG_task_send(MSG_task_create("notgrant", 0, 1000, NULL), req); + CS_used = 0; + todo--; + } } else { // nobody wants it XBT_INFO("CS release. resource now idle"); CS_used = 0; diff --git a/examples/msg/mc/bugged1_while_liveness.c b/examples/msg/mc/bugged1_while_liveness.c index 23ddc734da..f26749c847 100644 --- a/examples/msg/mc/bugged1_while_liveness.c +++ b/examples/msg/mc/bugged1_while_liveness.c @@ -37,26 +37,26 @@ int coordinator(int argc, char *argv[]) XBT_INFO("CS already used. Queue the request of client %d", atoi(req) +1); xbt_dynar_push(requests, &req); } else { // can serve it immediatly - if(strcmp(req, "2") == 0){ - m_task_t answer = MSG_task_create("grant", 0, 1000, NULL); - MSG_task_send(answer, req); - CS_used = 1; - XBT_INFO("CS idle. Grant immediatly"); - } + if(strcmp(req, "2") == 0){ + m_task_t answer = MSG_task_create("grant", 0, 1000, NULL); + MSG_task_send(answer, req); + CS_used = 1; + XBT_INFO("CS idle. Grant immediatly"); + } } } else { // that's a release. Check if someone was waiting for the lock if (xbt_dynar_length(requests) > 0) { XBT_INFO("CS release. Grant to queued requests (queue size: %lu)", xbt_dynar_length(requests)); char *req ; - xbt_dynar_get_cpy(requests, (xbt_dynar_length(requests) - 1), &req); - if(strcmp(req, "2") == 0){ - xbt_dynar_pop(requests, &req); - MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req); - }else{ - xbt_dynar_pop(requests, &req); - MSG_task_send(MSG_task_create("notgrant", 0, 1000, NULL), req); - CS_used = 0; - } + xbt_dynar_get_cpy(requests, (xbt_dynar_length(requests) - 1), &req); + if(strcmp(req, "2") == 0){ + xbt_dynar_pop(requests, &req); + MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req); + }else{ + xbt_dynar_pop(requests, &req); + MSG_task_send(MSG_task_create("notgrant", 0, 1000, NULL), req); + CS_used = 0; + } } else { // nobody wants it XBT_INFO("CS release. resource now idle"); CS_used = 0; diff --git a/examples/msg/mc/bugged2_liveness.c b/examples/msg/mc/bugged2_liveness.c index 09ec963ce4..5a2dd19e80 100644 --- a/examples/msg/mc/bugged2_liveness.c +++ b/examples/msg/mc/bugged2_liveness.c @@ -46,23 +46,23 @@ int coordinator(int argc, char *argv[]) if (!strcmp(kind, "request")) { char *req = MSG_task_get_data(task); if (CS_used) { - XBT_INFO("CS already used. Queue the request"); - xbt_dynar_push(requests, &req); + XBT_INFO("CS already used. Queue the request"); + xbt_dynar_push(requests, &req); } else { - m_task_t answer = MSG_task_create("grant", 0, 1000, NULL); - MSG_task_send(answer, req); - CS_used = 1; - XBT_INFO("CS idle. Grant immediatly"); + m_task_t answer = MSG_task_create("grant", 0, 1000, NULL); + MSG_task_send(answer, req); + CS_used = 1; + XBT_INFO("CS idle. Grant immediatly"); } } else { if (xbt_dynar_length(requests) > 0) { - XBT_INFO("CS release. Grant to queued requests"); - char *req; - xbt_dynar_pop(requests, &req); - MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req); + XBT_INFO("CS release. Grant to queued requests"); + char *req; + xbt_dynar_pop(requests, &req); + MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req); } else { - XBT_INFO("CS_realase, ressource now idle"); - CS_used = 0; + XBT_INFO("CS_realase, ressource now idle"); + CS_used = 0; } } diff --git a/examples/msg/mc/centralized_liveness.c b/examples/msg/mc/centralized_liveness.c index b1438e2775..395d4c2814 100644 --- a/examples/msg/mc/centralized_liveness.c +++ b/examples/msg/mc/centralized_liveness.c @@ -1,6 +1,6 @@ /***************** Centralized Mutual Exclusion Algorithm *********************/ /* This example implements a centralized mutual exclusion algorithm. */ -/* LTL property checked : !(GFcs) */ +/* LTL property checked : !(GFcs) */ /******************************************************************************/ #include "msg/msg.h" @@ -32,7 +32,7 @@ int coordinator(int argc, char *argv[]) char *req = MSG_task_get_data(task); if (CS_used) { XBT_INFO("CS already used."); - m_task_t answer = MSG_task_create("not grant", 0, 1000, NULL); + m_task_t answer = MSG_task_create("not grant", 0, 1000, NULL); MSG_task_send(answer, req); } else { // can serve it immediatly XBT_INFO("CS idle. Grant immediatly"); @@ -72,15 +72,15 @@ int client(int argc, char *argv[]) XBT_INFO("Client (%s) got the answer (grant). Sleep a bit and release it", my_mailbox); if(!strcmp(my_mailbox, "1")) - cs = 1; + cs = 1; /*MSG_process_sleep(my_pid); MSG_task_send(MSG_task_create("release", 0, 1000, NULL), - "coordinator"); - XBT_INFO("Client (%s) releases the CS", my_mailbox); + "coordinator"); + XBT_INFO("Client (%s) releases the CS", my_mailbox); if(!strcmp(my_mailbox, "1")) - cs = 0;*/ + cs = 0;*/ }else{ diff --git a/examples/msg/mc/centralized_liveness_deadlock.c b/examples/msg/mc/centralized_liveness_deadlock.c index e58364ed43..d73624fea8 100644 --- a/examples/msg/mc/centralized_liveness_deadlock.c +++ b/examples/msg/mc/centralized_liveness_deadlock.c @@ -1,6 +1,6 @@ /***************** Centralized Mutual Exclusion Algorithm *********************/ /* This example implements a centralized mutual exclusion algorithm. */ -/* LTL property checked : !(GFcs) */ +/* LTL property checked : !(GFcs) */ /******************************************************************************/ #include "msg/msg.h" diff --git a/examples/msg/mc/lex.yy.c b/examples/msg/mc/lex.yy.c index 78d770306f..d90a4cfe19 100644 --- a/examples/msg/mc/lex.yy.c +++ b/examples/msg/mc/lex.yy.c @@ -92,15 +92,15 @@ typedef unsigned int flex_uint32_t; /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const @@ -173,17 +173,17 @@ extern FILE *yyin, *yyout; /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) @@ -195,66 +195,66 @@ typedef size_t yy_size_t; #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; - int yy_buffer_status; + int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; + }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ @@ -279,13 +279,13 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... @@ -317,24 +317,24 @@ void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ + YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ + { \ + if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ + YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) @@ -365,21 +365,21 @@ static void yy_fatal_error (yyconst char msg[] ); * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 25 #define YY_END_OF_BUFFER 26 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; static yyconst flex_int16_t yy_accept[54] = { 0, 0, 0, 26, 24, 18, 23, 8, 24, 24, 9, @@ -612,33 +612,33 @@ static int input (void ); */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ \ #endif @@ -687,208 +687,208 @@ extern int yylex (void); #endif #define YY_RULE_SETUP \ - YY_USER_ACTION + YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; #line 29 "parserPromela.lex" #line 704 "lex.yy.c" - if ( !(yy_init) ) - { - (yy_init) = 1; + if ( !(yy_init) ) + { + (yy_init) = 1; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! yyout ) + yyout = stdout; - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } - yy_load_buffer_state( ); - } + yy_load_buffer_state( ); + } - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); - /* Support of yytext. */ - *yy_cp = (yy_hold_char); + /* Support of yytext. */ + *yy_cp = (yy_hold_char); - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = (yy_start); + yy_current_state = (yy_start); yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 54 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 90 ); + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 54 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 90 ); yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; case 1: YY_RULE_SETUP #line 31 "parserPromela.lex" { printf("%s", yytext); return (NEVER); } - YY_BREAK + YY_BREAK case 2: YY_RULE_SETUP #line 32 "parserPromela.lex" { printf("%s", yytext); return (IF); } - YY_BREAK + YY_BREAK case 3: YY_RULE_SETUP #line 33 "parserPromela.lex" { printf("%s", yytext); return (FI); } - YY_BREAK + YY_BREAK case 4: YY_RULE_SETUP #line 35 "parserPromela.lex" { printf("%s", yytext); return (IMPLIES); } - YY_BREAK + YY_BREAK case 5: YY_RULE_SETUP #line 36 "parserPromela.lex" { printf("%s", yytext); return (GOTO); } - YY_BREAK + YY_BREAK case 6: YY_RULE_SETUP #line 37 "parserPromela.lex" { printf("%s", yytext); return (AND); } - YY_BREAK + YY_BREAK case 7: YY_RULE_SETUP #line 38 "parserPromela.lex" { printf("%s", yytext); return (OR); } - YY_BREAK + YY_BREAK case 8: YY_RULE_SETUP #line 39 "parserPromela.lex" { printf("%s", yytext); return (NOT); } - YY_BREAK + YY_BREAK case 9: YY_RULE_SETUP #line 40 "parserPromela.lex" { printf("%s", yytext); return (LEFT_PAR); } - YY_BREAK + YY_BREAK case 10: YY_RULE_SETUP #line 41 "parserPromela.lex" { printf("%s", yytext); return (RIGHT_PAR); } - YY_BREAK + YY_BREAK case 11: YY_RULE_SETUP #line 42 "parserPromela.lex" { printf("%s", yytext); return (CASE); } - YY_BREAK + YY_BREAK case 12: YY_RULE_SETUP #line 43 "parserPromela.lex" { printf("%s", yytext); return (COLON); } - YY_BREAK + YY_BREAK case 13: YY_RULE_SETUP #line 44 "parserPromela.lex" { printf("%s", yytext); return (SEMI_COLON); } - YY_BREAK + YY_BREAK case 14: YY_RULE_SETUP #line 45 "parserPromela.lex" { printf("%s", yytext); return (CASE_TRUE); } - YY_BREAK + YY_BREAK case 15: YY_RULE_SETUP #line 46 "parserPromela.lex" { printf("%s", yytext); return (LEFT_BRACE); } - YY_BREAK + YY_BREAK case 16: YY_RULE_SETUP #line 47 "parserPromela.lex" { printf("%s", yytext); return (RIGHT_BRACE); } - YY_BREAK + YY_BREAK case 17: /* rule 17 can match eol */ YY_RULE_SETUP #line 50 "parserPromela.lex" { printf(" ");} - YY_BREAK + YY_BREAK case 18: YY_RULE_SETUP #line 52 "parserPromela.lex" { printf("%s",yytext); } - YY_BREAK + YY_BREAK case 19: YY_RULE_SETUP #line 55 "parserPromela.lex" { printf("%s",yytext); sscanf(yytext,"%lf",&yylval.real); return (LITT_REEL); } - YY_BREAK + YY_BREAK case 20: YY_RULE_SETUP #line 59 "parserPromela.lex" { printf("%s",yytext); sscanf(yytext,"%d",&yylval.integer); return (LITT_ENT); } - YY_BREAK + YY_BREAK case 21: /* rule 21 can match eol */ YY_RULE_SETUP @@ -897,395 +897,395 @@ YY_RULE_SETUP yylval.string=(char *)malloc(strlen(yytext)+1); sscanf(yytext,"%s",yylval.string); return (LITT_CHAINE); } - YY_BREAK + YY_BREAK case 22: YY_RULE_SETUP #line 68 "parserPromela.lex" { printf("%s",yytext); - yylval.string=(char *)malloc(strlen(yytext)+1); - sscanf(yytext,"%s",yylval.string); - return (ID); } - YY_BREAK + yylval.string=(char *)malloc(strlen(yytext)+1); + sscanf(yytext,"%s",yylval.string); + return (ID); } + YY_BREAK case 23: /* rule 23 can match eol */ YY_RULE_SETUP #line 73 "parserPromela.lex" { printf("\n"); } - YY_BREAK + YY_BREAK case 24: YY_RULE_SETUP #line 75 "parserPromela.lex" { printf("caractère inconnu\n"); } - YY_BREAK + YY_BREAK case 25: YY_RULE_SETUP #line 77 "parserPromela.lex" ECHO; - YY_BREAK + YY_BREAK #line 926 "lex.yy.c" case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } - return ret_val; + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + register yy_state_type yy_current_state; + register char *yy_cp; - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 54 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 54 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis - * next_state = yy_try_NUL_trans( current_state ); + * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 54 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 53); - - return yy_is_jam ? 0 : yy_current_state; + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 54 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 53); + + return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { - register char *yy_cp; + register char *yy_cp; yy_cp = (yy_c_buf_p); - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - *--yy_cp = (char) c; + *--yy_cp = (char) c; - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT @@ -1296,71 +1296,71 @@ static int yy_get_next_buffer (void) #endif { - int c; + int c; - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; #ifdef __cplusplus - return yyinput(); + return yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); - return c; + return c; } -#endif /* ifndef YY_NO_INPUT */ +#endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. @@ -1370,14 +1370,14 @@ static int yy_get_next_buffer (void) void yyrestart (FILE * input_file ) { - if ( ! YY_CURRENT_BUFFER ){ + if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = + YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); - } + } - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. @@ -1387,40 +1387,40 @@ static int yy_get_next_buffer (void) void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. @@ -1431,26 +1431,26 @@ static void yy_load_buffer_state (void) */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = size; - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_is_our_buffer = 1; + b->yy_is_our_buffer = 1; - yy_init_buffer(b,file ); + yy_init_buffer(b,file ); - return b; + return b; } /** Destroy the buffer. @@ -1460,16 +1460,16 @@ static void yy_load_buffer_state (void) void yy_delete_buffer (YY_BUFFER_STATE b ) { - if ( ! b ) - return; + if ( ! b ) + return; - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); - yyfree((void *) b ); + yyfree((void *) b ); } #ifndef __cplusplus @@ -1483,12 +1483,12 @@ extern int isatty (int ); static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { - int oerrno = errno; + int oerrno = errno; - yy_flush_buffer(b ); + yy_flush_buffer(b ); - b->yy_input_file = file; - b->yy_fill_buffer = 1; + b->yy_input_file = file; + b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. @@ -1501,7 +1501,7 @@ extern int isatty (int ); b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - errno = oerrno; + errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. @@ -1510,25 +1510,25 @@ extern int isatty (int ); */ void yy_flush_buffer (YY_BUFFER_STATE b ) { - if ( ! b ) - return; + if ( ! b ) + return; - b->yy_n_chars = 0; + b->yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -1539,28 +1539,28 @@ extern int isatty (int ); */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. @@ -1569,18 +1569,18 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) */ void yypop_buffer_state (void) { - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } } /* Allocates the stack if it does not exist. @@ -1588,45 +1588,45 @@ void yypop_buffer_state (void) */ static void yyensure_buffer_stack (void) { - int num_to_alloc; + int num_to_alloc; - if (!(yy_buffer_stack)) { + if (!(yy_buffer_stack)) { - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } } /** Setup the input buffer state to scan directly from a user-specified character buffer. @@ -1637,31 +1637,31 @@ static void yyensure_buffer_stack (void) */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will @@ -1675,7 +1675,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { - return yy_scan_bytes(yystr,strlen(yystr) ); + return yy_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will @@ -1687,32 +1687,32 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) */ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - return b; + return b; } #ifndef YY_EXIT_FAILURE @@ -1721,26 +1721,26 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) static void yy_fatal_error (yyconst char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ @@ -1855,15 +1855,15 @@ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ @@ -1879,43 +1879,43 @@ int yylex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - register int n; - for ( n = 0; s[n]; ++n ) - ; + register int n; + for ( n = 0; s[n]; ++n ) + ; - return n; + return n; } #endif void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return (void *) malloc( size ); } void *yyrealloc (void * ptr, yy_size_t size ) { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); } void yyfree (void * ptr ) { - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" diff --git a/examples/msg/ns3/ns3.c b/examples/msg/ns3/ns3.c index 6b509d2045..81ee74b98a 100644 --- a/examples/msg/ns3/ns3.c +++ b/examples/msg/ns3/ns3.c @@ -168,8 +168,8 @@ int slave(int argc, char *argv[]) elapsed_time = MSG_get_clock() - start_time; XBT_INFO("FLOW[%d] : Receive %.0f bytes from %s to %s", - id, - MSG_task_get_data_size(task), + id, + MSG_task_get_data_size(task), masternames[id], slavenames[id]); // MSG_task_execute(task); diff --git a/examples/msg/pmm/msg_pmm.c b/examples/msg/pmm/msg_pmm.c index 75d0e6e448..243657dde1 100644 --- a/examples/msg/pmm/msg_pmm.c +++ b/examples/msg/pmm/msg_pmm.c @@ -27,8 +27,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_pmm, /* This example should always be executed using a deployment of * GRID_SIZE * GRID_SIZE nodes. */ -#define GRID_SIZE 3 /* Modify to adjust the grid's size */ -#define NODE_MATRIX_SIZE 300 /* Ammount of work done by each node*/ +#define GRID_SIZE 3 /* Modify to adjust the grid's size */ +#define NODE_MATRIX_SIZE 300 /* Ammount of work done by each node*/ #define GRID_NUM_NODES GRID_SIZE * GRID_SIZE #define MATRIX_SIZE NODE_MATRIX_SIZE * GRID_SIZE diff --git a/examples/simdag/scheduling/minmin_test.c b/examples/simdag/scheduling/minmin_test.c index d0f137d12e..41310892db 100644 --- a/examples/simdag/scheduling/minmin_test.c +++ b/examples/simdag/scheduling/minmin_test.c @@ -53,17 +53,17 @@ static void SD_workstation_set_available_at(SD_workstation_t workstation, } static SD_task_t SD_workstation_get_last_scheduled_task( SD_workstation_t workstation){ - WorkstationAttribute attr = - (WorkstationAttribute) SD_workstation_get_data(workstation); - return attr->last_scheduled_task; + WorkstationAttribute attr = + (WorkstationAttribute) SD_workstation_get_data(workstation); + return attr->last_scheduled_task; } static void SD_workstation_set_last_scheduled_task(SD_workstation_t workstation, - SD_task_t task){ - WorkstationAttribute attr = - (WorkstationAttribute) SD_workstation_get_data(workstation); - attr->last_scheduled_task=task; - SD_workstation_set_data(workstation, attr); + SD_task_t task){ + WorkstationAttribute attr = + (WorkstationAttribute) SD_workstation_get_data(workstation); + attr->last_scheduled_task=task; + SD_workstation_set_data(workstation, attr); } static xbt_dynar_t get_ready_tasks(xbt_dynar_t dax) @@ -347,13 +347,13 @@ int main(int argc, char **argv) last_scheduled_task = SD_workstation_get_last_scheduled_task(selected_workstation); if (last_scheduled_task && - (SD_task_get_state(last_scheduled_task) != SD_DONE) && - (SD_task_get_state(last_scheduled_task) != SD_FAILED) && - !SD_task_dependency_exists( - SD_workstation_get_last_scheduled_task(selected_workstation), - selected_task)) + (SD_task_get_state(last_scheduled_task) != SD_DONE) && + (SD_task_get_state(last_scheduled_task) != SD_FAILED) && + !SD_task_dependency_exists( + SD_workstation_get_last_scheduled_task(selected_workstation), + selected_task)) SD_task_dependency_add("resource", NULL, - last_scheduled_task, selected_task); + last_scheduled_task, selected_task); SD_workstation_set_last_scheduled_task(selected_workstation, selected_task); diff --git a/examples/simdag/sd_comm_throttling.c b/examples/simdag/sd_comm_throttling.c index 4313e01d86..aa81fe6a8c 100644 --- a/examples/simdag/sd_comm_throttling.c +++ b/examples/simdag/sd_comm_throttling.c @@ -66,9 +66,9 @@ int main(int argc, char **argv) XBT_INFO("Simulation stopped after %.4f seconds", SD_get_clock()); xbt_dynar_foreach(changed_tasks, ctr, task) { XBT_INFO("Task '%s' start time: %f, finish time: %f", - SD_task_get_name(task), - SD_task_get_start_time(task), - SD_task_get_finish_time(task)); + SD_task_get_name(task), + SD_task_get_start_time(task), + SD_task_get_finish_time(task)); } /* let throttle the communication for taskD if its parent is SD_DONE */ diff --git a/examples/simdag/sd_seq_access.c b/examples/simdag/sd_seq_access.c index d3c41ba882..42039d7288 100644 --- a/examples/simdag/sd_seq_access.c +++ b/examples/simdag/sd_seq_access.c @@ -39,8 +39,8 @@ int main(int argc, char **argv) /* Change the access mode of the workstations */ workstations = SD_workstation_get_list(); for (i = 0; i < 2; i++) { - SD_workstation_dump(workstations[i]); - + SD_workstation_dump(workstations[i]); + SD_workstation_set_access_mode(workstations[i], SD_WORKSTATION_SEQUENTIAL_ACCESS); XBT_INFO(" Change access mode of %s to %s", @@ -70,9 +70,9 @@ int main(int argc, char **argv) /* let's launch the simulation! */ while (!xbt_dynar_is_empty(changed_tasks = SD_simulate(-1.0))) { - XBT_INFO(" Simulation was suspended, check workstation states"); + XBT_INFO(" Simulation was suspended, check workstation states"); for (i = 0; i < 2; i++) { - SD_workstation_dump(workstations[i]); + SD_workstation_dump(workstations[i]); } xbt_dynar_free(&changed_tasks); } diff --git a/examples/simdag/sd_typed_tasks_test.c b/examples/simdag/sd_typed_tasks_test.c index dda4a509ec..9326823e3f 100644 --- a/examples/simdag/sd_typed_tasks_test.c +++ b/examples/simdag/sd_typed_tasks_test.c @@ -45,7 +45,7 @@ int main(int argc, char **argv) for (i=0;iid,nd->name,nd->inDegree,nd->outDegree); + nd->id,nd->name,nd->inDegree,nd->outDegree); /* if(nd->verified==1) fprintf(stderr,"%ld.%s\t: usable.",nd->id,nd->name); else if(nd->verified==0) fprintf(stderr,"%ld.%s\t: unusable.",nd->id,nd->name); @@ -56,103 +56,103 @@ int AttachNode(DGraph* dg, DGNode* nd) { DGNode **nds =NULL, *tmpnd=NULL; DGArc **ar=NULL; - if (dg->numNodes == dg->maxNodes-1 ) { - dg->maxNodes += BLOCK_SIZE; + if (dg->numNodes == dg->maxNodes-1 ) { + dg->maxNodes += BLOCK_SIZE; nds =(DGNode **) calloc(dg->maxNodes,sizeof(DGNode*)); - memcpy(nds,dg->node,(dg->maxNodes-BLOCK_SIZE)*sizeof(DGNode*)); - free(dg->node); - dg->node=nds; - } + memcpy(nds,dg->node,(dg->maxNodes-BLOCK_SIZE)*sizeof(DGNode*)); + free(dg->node); + dg->node=nds; + } len = strlen( nd->name); - for (i = 0; i < dg->numNodes; i++) { - tmpnd =dg->node[ i]; - ar=NULL; - if ( strlen( tmpnd->name) != len ) continue; - if ( strncmp( nd->name, tmpnd->name, len) ) continue; - if ( nd->inDegree > 0 ) { - tmpnd->maxInDegree += nd->maxInDegree; + for (i = 0; i < dg->numNodes; i++) { + tmpnd =dg->node[ i]; + ar=NULL; + if ( strlen( tmpnd->name) != len ) continue; + if ( strncmp( nd->name, tmpnd->name, len) ) continue; + if ( nd->inDegree > 0 ) { + tmpnd->maxInDegree += nd->maxInDegree; ar =(DGArc **) calloc(tmpnd->maxInDegree,sizeof(DGArc*)); - memcpy(ar,tmpnd->inArc,(tmpnd->inDegree)*sizeof(DGArc*)); - free(tmpnd->inArc); - tmpnd->inArc=ar; - for (j = 0; j < nd->inDegree; j++ ) { - nd->inArc[ j]->head = tmpnd; - } - memcpy( &(tmpnd->inArc[ tmpnd->inDegree]), nd->inArc, nd->inDegree*sizeof( DGArc *)); - tmpnd->inDegree += nd->inDegree; - } - if ( nd->outDegree > 0 ) { - tmpnd->maxOutDegree += nd->maxOutDegree; + memcpy(ar,tmpnd->inArc,(tmpnd->inDegree)*sizeof(DGArc*)); + free(tmpnd->inArc); + tmpnd->inArc=ar; + for (j = 0; j < nd->inDegree; j++ ) { + nd->inArc[ j]->head = tmpnd; + } + memcpy( &(tmpnd->inArc[ tmpnd->inDegree]), nd->inArc, nd->inDegree*sizeof( DGArc *)); + tmpnd->inDegree += nd->inDegree; + } + if ( nd->outDegree > 0 ) { + tmpnd->maxOutDegree += nd->maxOutDegree; ar =(DGArc **) calloc(tmpnd->maxOutDegree,sizeof(DGArc*)); - memcpy(ar,tmpnd->outArc,(tmpnd->outDegree)*sizeof(DGArc*)); - free(tmpnd->outArc); - tmpnd->outArc=ar; - for (j = 0; j < nd->outDegree; j++ ) { - nd->outArc[ j]->tail = tmpnd; - } - memcpy( &(tmpnd->outArc[tmpnd->outDegree]),nd->outArc,nd->outDegree*sizeof( DGArc *)); - tmpnd->outDegree += nd->outDegree; - } - free(nd); - return i; - } - nd->id = dg->numNodes; - dg->node[dg->numNodes] = nd; - dg->numNodes++; + memcpy(ar,tmpnd->outArc,(tmpnd->outDegree)*sizeof(DGArc*)); + free(tmpnd->outArc); + tmpnd->outArc=ar; + for (j = 0; j < nd->outDegree; j++ ) { + nd->outArc[ j]->tail = tmpnd; + } + memcpy( &(tmpnd->outArc[tmpnd->outDegree]),nd->outArc,nd->outDegree*sizeof( DGArc *)); + tmpnd->outDegree += nd->outDegree; + } + free(nd); + return i; + } + nd->id = dg->numNodes; + dg->node[dg->numNodes] = nd; + dg->numNodes++; return nd->id; } int AttachArc(DGraph *dg,DGArc* nar){ -int arcId = -1; +int arcId = -1; int i=0,newNumber=0; -DGNode *head = nar->head, - *tail = nar->tail; +DGNode *head = nar->head, + *tail = nar->tail; DGArc **ars=NULL,*probe=NULL; /*fprintf(stderr,"AttachArc %ld\n",dg->numArcs); */ - if ( !tail || !head ) return arcId; - if ( dg->numArcs == dg->maxArcs-1 ) { - dg->maxArcs += BLOCK_SIZE; + if ( !tail || !head ) return arcId; + if ( dg->numArcs == dg->maxArcs-1 ) { + dg->maxArcs += BLOCK_SIZE; ars =(DGArc **) calloc(dg->maxArcs,sizeof(DGArc*)); - memcpy(ars,dg->arc,(dg->maxArcs-BLOCK_SIZE)*sizeof(DGArc*)); - free(dg->arc); - dg->arc=ars; - } - for(i = 0; i < tail->outDegree; i++ ) { /* parallel arc */ - probe = tail->outArc[ i]; - if(probe->head == head - && - probe->length == nar->length + memcpy(ars,dg->arc,(dg->maxArcs-BLOCK_SIZE)*sizeof(DGArc*)); + free(dg->arc); + dg->arc=ars; + } + for(i = 0; i < tail->outDegree; i++ ) { /* parallel arc */ + probe = tail->outArc[ i]; + if(probe->head == head + && + probe->length == nar->length ){ free(nar); - return probe->id; - } - } - - nar->id = dg->numArcs; - arcId=dg->numArcs; - dg->arc[dg->numArcs] = nar; - dg->numArcs++; - - head->inArc[ head->inDegree] = nar; - head->inDegree++; - if ( head->inDegree >= head->maxInDegree ) { - newNumber = head->maxInDegree + SMALL_BLOCK_SIZE; + return probe->id; + } + } + + nar->id = dg->numArcs; + arcId=dg->numArcs; + dg->arc[dg->numArcs] = nar; + dg->numArcs++; + + head->inArc[ head->inDegree] = nar; + head->inDegree++; + if ( head->inDegree >= head->maxInDegree ) { + newNumber = head->maxInDegree + SMALL_BLOCK_SIZE; ars =(DGArc **) calloc(newNumber,sizeof(DGArc*)); - memcpy(ars,head->inArc,(head->inDegree)*sizeof(DGArc*)); - free(head->inArc); - head->inArc=ars; - head->maxInDegree = newNumber; - } - tail->outArc[ tail->outDegree] = nar; - tail->outDegree++; - if(tail->outDegree >= tail->maxOutDegree ) { - newNumber = tail->maxOutDegree + SMALL_BLOCK_SIZE; + memcpy(ars,head->inArc,(head->inDegree)*sizeof(DGArc*)); + free(head->inArc); + head->inArc=ars; + head->maxInDegree = newNumber; + } + tail->outArc[ tail->outDegree] = nar; + tail->outDegree++; + if(tail->outDegree >= tail->maxOutDegree ) { + newNumber = tail->maxOutDegree + SMALL_BLOCK_SIZE; ars =(DGArc **) calloc(newNumber,sizeof(DGArc*)); - memcpy(ars,tail->outArc,(tail->outDegree)*sizeof(DGArc*)); - free(tail->outArc); - tail->outArc=ars; - tail->maxOutDegree = newNumber; - } + memcpy(ars,tail->outArc,(tail->outDegree)*sizeof(DGArc*)); + free(tail->outArc); + tail->outArc=ars; + tail->maxOutDegree = newNumber; + } /*fprintf(stderr,"AttachArc: head->in=%d tail->out=%ld\n",head->inDegree,tail->outDegree);*/ return arcId; } @@ -164,8 +164,8 @@ void graphShow(DGraph *dg,int DetailsLevel){ DGNode *focusNode = dg->node[ i]; if(DetailsLevel >= 2) { for (j = 0; j < focusNode->inDegree; j++ ) { - fprintf(stderr,"\t "); - nodeShow(focusNode->inArc[ j]->tail); + fprintf(stderr,"\t "); + nodeShow(focusNode->inArc[ j]->tail); } } nodeShow(focusNode); @@ -173,7 +173,7 @@ void graphShow(DGraph *dg,int DetailsLevel){ for (j = 0; j < focusNode->outDegree; j++ ) { fprintf(stderr, "\t "); nodeShow(focusNode->outArc[ j]->head); - } + } fprintf(stderr, "---\n"); } fprintf(stderr,"----------------------------------------\n"); diff --git a/examples/smpi/NAS/DT-folding/dt.c b/examples/smpi/NAS/DT-folding/dt.c index d080bde52b..b088fbd5c8 100644 --- a/examples/smpi/NAS/DT-folding/dt.c +++ b/examples/smpi/NAS/DT-folding/dt.c @@ -2,7 +2,7 @@ * * * N A S P A R A L L E L B E N C H M A R K S 3.3 * * * - * D T * + * D T * * * ************************************************************************* * * @@ -33,7 +33,7 @@ * * ************************************************************************* * * - * Author: M. Frumkin * * + * Author: M. Frumkin * * * * *************************************************************************/ @@ -62,7 +62,7 @@ void c_print_results( char *name, int nprocs_total, double t, double mops, - char *optype, + char *optype, int passed_verification, char *npbversion, char *compiletime, @@ -72,7 +72,7 @@ void c_print_results( char *name, char *cmpi_inc, char *cflags, char *clinkflags ); - + void timer_clear( int n ); void timer_start( int n ); void timer_stop( int n ); @@ -98,55 +98,55 @@ int verify(char *bmname,double rnm2){ verified = 0; }else if(cls=='W') { if(strstr(bmname,"BH")){ - verify_value = 4102461.0; + verify_value = 4102461.0; }else if(strstr(bmname,"WH")){ - verify_value = 204280762.0; + verify_value = 204280762.0; }else if(strstr(bmname,"SH")){ - verify_value = 186944764.0; + verify_value = 186944764.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); } verified = 0; }else if(cls=='A') { if(strstr(bmname,"BH")){ - verify_value = 17809491.0; + verify_value = 17809491.0; }else if(strstr(bmname,"WH")){ - verify_value = 1289925229.0; + verify_value = 1289925229.0; }else if(strstr(bmname,"SH")){ - verify_value = 610856482.0; + verify_value = 610856482.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); } - verified = 0; + verified = 0; }else if(cls=='B') { if(strstr(bmname,"BH")){ - verify_value = 4317114.0; + verify_value = 4317114.0; }else if(strstr(bmname,"WH")){ - verify_value = 7877279917.0; + verify_value = 7877279917.0; }else if(strstr(bmname,"SH")){ - verify_value = 1836863082.0; + verify_value = 1836863082.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); - verified = 0; + verified = 0; } }else if(cls=='C') { if(strstr(bmname,"BH")){ - verify_value = 0.0; + verify_value = 0.0; }else if(strstr(bmname,"WH")){ - verify_value = 0.0; + verify_value = 0.0; }else if(strstr(bmname,"SH")){ - verify_value = 0.0; + verify_value = 0.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); - verified = -1; + verified = -1; } }else if(cls=='D') { if(strstr(bmname,"BH")){ - verify_value = 0.0; + verify_value = 0.0; }else if(strstr(bmname,"WH")){ - verify_value = 0.0; + verify_value = 0.0; }else if(strstr(bmname,"SH")){ - verify_value = 0.0; + verify_value = 0.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); } @@ -156,15 +156,15 @@ int verify(char *bmname,double rnm2){ } fprintf(stderr," %s L2 Norm = %f\n",bmname,rnm2); if(verified==-1){ - fprintf(stderr," No verification was performed.\n"); + fprintf(stderr," No verification was performed.\n"); }else if( rnm2 - verify_value < epsilon && rnm2 - verify_value > -epsilon) { /* abs here does not work on ALTIX */ - verified = 1; - fprintf(stderr," Deviation = %f\n",(rnm2 - verify_value)); + verified = 1; + fprintf(stderr," Deviation = %f\n",(rnm2 - verify_value)); }else{ - verified = 0; - fprintf(stderr," The correct verification value = %f\n",verify_value); - fprintf(stderr," Got value = %f\n",rnm2); + verified = 0; + fprintf(stderr," The correct verification value = %f\n",verify_value); + fprintf(stderr," Got value = %f\n",rnm2); } }else{ verified = -1; @@ -297,7 +297,7 @@ DGraph *buildWH(char cls){ id=AttachNode(dg,nd); for(j=0;j=numPrevLayerNodes) break; + if(sid>=numPrevLayerNodes) break; snd=dg->node[firstLayerNode+sid]; ar=newArc(dg->node[id],snd); AttachArc(dg,ar); @@ -357,7 +357,7 @@ DGraph *buildBH(char cls){ id=AttachNode(dg,nd); for(j=0;j=numPrevLayerNodes) break; + if(sid>=numPrevLayerNodes) break; snd=dg->node[firstLayerNode+sid]; ar=newArc(snd,dg->node[id]); AttachArc(dg,ar); @@ -486,19 +486,19 @@ Arr* WindowFilter(Arr *a, Arr* b,int w){ if(a->len>b->len) Resample(b,a->len); for(i=fielddim;ilen-fielddim;i+=fielddim){ rms0=(a->val[i]-b->val[i])*(a->val[i]-b->val[i]) - +(a->val[i+1]-b->val[i+1])*(a->val[i+1]-b->val[i+1]) - +(a->val[i+2]-b->val[i+2])*(a->val[i+2]-b->val[i+2]) - +(a->val[i+3]-b->val[i+3])*(a->val[i+3]-b->val[i+3]); + +(a->val[i+1]-b->val[i+1])*(a->val[i+1]-b->val[i+1]) + +(a->val[i+2]-b->val[i+2])*(a->val[i+2]-b->val[i+2]) + +(a->val[i+3]-b->val[i+3])*(a->val[i+3]-b->val[i+3]); j=i+fielddim; rms1=(a->val[j]-b->val[j])*(a->val[j]-b->val[j]) - +(a->val[j+1]-b->val[j+1])*(a->val[j+1]-b->val[j+1]) - +(a->val[j+2]-b->val[j+2])*(a->val[j+2]-b->val[j+2]) - +(a->val[j+3]-b->val[j+3])*(a->val[j+3]-b->val[j+3]); + +(a->val[j+1]-b->val[j+1])*(a->val[j+1]-b->val[j+1]) + +(a->val[j+2]-b->val[j+2])*(a->val[j+2]-b->val[j+2]) + +(a->val[j+3]-b->val[j+3])*(a->val[j+3]-b->val[j+3]); j=i-fielddim; rmsm1=(a->val[j]-b->val[j])*(a->val[j]-b->val[j]) - +(a->val[j+1]-b->val[j+1])*(a->val[j+1]-b->val[j+1]) - +(a->val[j+2]-b->val[j+2])*(a->val[j+2]-b->val[j+2]) - +(a->val[j+3]-b->val[j+3])*(a->val[j+3]-b->val[j+3]); + +(a->val[j+1]-b->val[j+1])*(a->val[j+1]-b->val[j+1]) + +(a->val[j+2]-b->val[j+2])*(a->val[j+2]-b->val[j+2]) + +(a->val[j+3]-b->val[j+3])*(a->val[j+3]-b->val[j+3]); k=0; if(rms1val[i+1]=weight*b->val[j+1]; a->val[i+2]=weight*b->val[j+2]; a->val[i+3]=weight*b->val[j+3]; - } + } } if(timer_on){ timer_stop(w); @@ -734,25 +734,25 @@ int main(int argc,char **argv ){ timer_stop(0); tot_time=timer_read(0); c_print_results( dg->name, - CLASS, - featnum, - 0, - 0, - dg->numNodes, - 0, - comm_size, - tot_time, - bytes_sent/tot_time, - "bytes transmitted", - verified, - NPBVERSION, - COMPILETIME, - MPICC, - CLINK, - CMPI_LIB, - CMPI_INC, - CFLAGS, - CLINKFLAGS ); + CLASS, + featnum, + 0, + 0, + dg->numNodes, + 0, + comm_size, + tot_time, + bytes_sent/tot_time, + "bytes transmitted", + verified, + NPBVERSION, + COMPILETIME, + MPICC, + CLINK, + CMPI_LIB, + CMPI_INC, + CFLAGS, + CLINKFLAGS ); } MPI_Finalize(); return 1; diff --git a/examples/smpi/NAS/DT-trace/DGraph.c b/examples/smpi/NAS/DT-trace/DGraph.c index 5d5839df19..f573786db8 100644 --- a/examples/smpi/NAS/DT-trace/DGraph.c +++ b/examples/smpi/NAS/DT-trace/DGraph.c @@ -32,7 +32,7 @@ DGNode *newNode(char *nm){ } void nodeShow(DGNode* nd){ fprintf( stderr,"%3d.%s: (%d,%d)\n", - nd->id,nd->name,nd->inDegree,nd->outDegree); + nd->id,nd->name,nd->inDegree,nd->outDegree); /* if(nd->verified==1) fprintf(stderr,"%ld.%s\t: usable.",nd->id,nd->name); else if(nd->verified==0) fprintf(stderr,"%ld.%s\t: unusable.",nd->id,nd->name); @@ -56,103 +56,103 @@ int AttachNode(DGraph* dg, DGNode* nd) { DGNode **nds =NULL, *tmpnd=NULL; DGArc **ar=NULL; - if (dg->numNodes == dg->maxNodes-1 ) { - dg->maxNodes += BLOCK_SIZE; + if (dg->numNodes == dg->maxNodes-1 ) { + dg->maxNodes += BLOCK_SIZE; nds =(DGNode **) calloc(dg->maxNodes,sizeof(DGNode*)); - memcpy(nds,dg->node,(dg->maxNodes-BLOCK_SIZE)*sizeof(DGNode*)); - free(dg->node); - dg->node=nds; - } + memcpy(nds,dg->node,(dg->maxNodes-BLOCK_SIZE)*sizeof(DGNode*)); + free(dg->node); + dg->node=nds; + } len = strlen( nd->name); - for (i = 0; i < dg->numNodes; i++) { - tmpnd =dg->node[ i]; - ar=NULL; - if ( strlen( tmpnd->name) != len ) continue; - if ( strncmp( nd->name, tmpnd->name, len) ) continue; - if ( nd->inDegree > 0 ) { - tmpnd->maxInDegree += nd->maxInDegree; + for (i = 0; i < dg->numNodes; i++) { + tmpnd =dg->node[ i]; + ar=NULL; + if ( strlen( tmpnd->name) != len ) continue; + if ( strncmp( nd->name, tmpnd->name, len) ) continue; + if ( nd->inDegree > 0 ) { + tmpnd->maxInDegree += nd->maxInDegree; ar =(DGArc **) calloc(tmpnd->maxInDegree,sizeof(DGArc*)); - memcpy(ar,tmpnd->inArc,(tmpnd->inDegree)*sizeof(DGArc*)); - free(tmpnd->inArc); - tmpnd->inArc=ar; - for (j = 0; j < nd->inDegree; j++ ) { - nd->inArc[ j]->head = tmpnd; - } - memcpy( &(tmpnd->inArc[ tmpnd->inDegree]), nd->inArc, nd->inDegree*sizeof( DGArc *)); - tmpnd->inDegree += nd->inDegree; - } - if ( nd->outDegree > 0 ) { - tmpnd->maxOutDegree += nd->maxOutDegree; + memcpy(ar,tmpnd->inArc,(tmpnd->inDegree)*sizeof(DGArc*)); + free(tmpnd->inArc); + tmpnd->inArc=ar; + for (j = 0; j < nd->inDegree; j++ ) { + nd->inArc[ j]->head = tmpnd; + } + memcpy( &(tmpnd->inArc[ tmpnd->inDegree]), nd->inArc, nd->inDegree*sizeof( DGArc *)); + tmpnd->inDegree += nd->inDegree; + } + if ( nd->outDegree > 0 ) { + tmpnd->maxOutDegree += nd->maxOutDegree; ar =(DGArc **) calloc(tmpnd->maxOutDegree,sizeof(DGArc*)); - memcpy(ar,tmpnd->outArc,(tmpnd->outDegree)*sizeof(DGArc*)); - free(tmpnd->outArc); - tmpnd->outArc=ar; - for (j = 0; j < nd->outDegree; j++ ) { - nd->outArc[ j]->tail = tmpnd; - } - memcpy( &(tmpnd->outArc[tmpnd->outDegree]),nd->outArc,nd->outDegree*sizeof( DGArc *)); - tmpnd->outDegree += nd->outDegree; - } - free(nd); - return i; - } - nd->id = dg->numNodes; - dg->node[dg->numNodes] = nd; - dg->numNodes++; + memcpy(ar,tmpnd->outArc,(tmpnd->outDegree)*sizeof(DGArc*)); + free(tmpnd->outArc); + tmpnd->outArc=ar; + for (j = 0; j < nd->outDegree; j++ ) { + nd->outArc[ j]->tail = tmpnd; + } + memcpy( &(tmpnd->outArc[tmpnd->outDegree]),nd->outArc,nd->outDegree*sizeof( DGArc *)); + tmpnd->outDegree += nd->outDegree; + } + free(nd); + return i; + } + nd->id = dg->numNodes; + dg->node[dg->numNodes] = nd; + dg->numNodes++; return nd->id; } int AttachArc(DGraph *dg,DGArc* nar){ -int arcId = -1; +int arcId = -1; int i=0,newNumber=0; -DGNode *head = nar->head, - *tail = nar->tail; +DGNode *head = nar->head, + *tail = nar->tail; DGArc **ars=NULL,*probe=NULL; /*fprintf(stderr,"AttachArc %ld\n",dg->numArcs); */ - if ( !tail || !head ) return arcId; - if ( dg->numArcs == dg->maxArcs-1 ) { - dg->maxArcs += BLOCK_SIZE; + if ( !tail || !head ) return arcId; + if ( dg->numArcs == dg->maxArcs-1 ) { + dg->maxArcs += BLOCK_SIZE; ars =(DGArc **) calloc(dg->maxArcs,sizeof(DGArc*)); - memcpy(ars,dg->arc,(dg->maxArcs-BLOCK_SIZE)*sizeof(DGArc*)); - free(dg->arc); - dg->arc=ars; - } - for(i = 0; i < tail->outDegree; i++ ) { /* parallel arc */ - probe = tail->outArc[ i]; - if(probe->head == head - && - probe->length == nar->length + memcpy(ars,dg->arc,(dg->maxArcs-BLOCK_SIZE)*sizeof(DGArc*)); + free(dg->arc); + dg->arc=ars; + } + for(i = 0; i < tail->outDegree; i++ ) { /* parallel arc */ + probe = tail->outArc[ i]; + if(probe->head == head + && + probe->length == nar->length ){ free(nar); - return probe->id; - } - } - - nar->id = dg->numArcs; - arcId=dg->numArcs; - dg->arc[dg->numArcs] = nar; - dg->numArcs++; - - head->inArc[ head->inDegree] = nar; - head->inDegree++; - if ( head->inDegree >= head->maxInDegree ) { - newNumber = head->maxInDegree + SMALL_BLOCK_SIZE; + return probe->id; + } + } + + nar->id = dg->numArcs; + arcId=dg->numArcs; + dg->arc[dg->numArcs] = nar; + dg->numArcs++; + + head->inArc[ head->inDegree] = nar; + head->inDegree++; + if ( head->inDegree >= head->maxInDegree ) { + newNumber = head->maxInDegree + SMALL_BLOCK_SIZE; ars =(DGArc **) calloc(newNumber,sizeof(DGArc*)); - memcpy(ars,head->inArc,(head->inDegree)*sizeof(DGArc*)); - free(head->inArc); - head->inArc=ars; - head->maxInDegree = newNumber; - } - tail->outArc[ tail->outDegree] = nar; - tail->outDegree++; - if(tail->outDegree >= tail->maxOutDegree ) { - newNumber = tail->maxOutDegree + SMALL_BLOCK_SIZE; + memcpy(ars,head->inArc,(head->inDegree)*sizeof(DGArc*)); + free(head->inArc); + head->inArc=ars; + head->maxInDegree = newNumber; + } + tail->outArc[ tail->outDegree] = nar; + tail->outDegree++; + if(tail->outDegree >= tail->maxOutDegree ) { + newNumber = tail->maxOutDegree + SMALL_BLOCK_SIZE; ars =(DGArc **) calloc(newNumber,sizeof(DGArc*)); - memcpy(ars,tail->outArc,(tail->outDegree)*sizeof(DGArc*)); - free(tail->outArc); - tail->outArc=ars; - tail->maxOutDegree = newNumber; - } + memcpy(ars,tail->outArc,(tail->outDegree)*sizeof(DGArc*)); + free(tail->outArc); + tail->outArc=ars; + tail->maxOutDegree = newNumber; + } /*fprintf(stderr,"AttachArc: head->in=%d tail->out=%ld\n",head->inDegree,tail->outDegree);*/ return arcId; } @@ -164,8 +164,8 @@ void graphShow(DGraph *dg,int DetailsLevel){ DGNode *focusNode = dg->node[ i]; if(DetailsLevel >= 2) { for (j = 0; j < focusNode->inDegree; j++ ) { - fprintf(stderr,"\t "); - nodeShow(focusNode->inArc[ j]->tail); + fprintf(stderr,"\t "); + nodeShow(focusNode->inArc[ j]->tail); } } nodeShow(focusNode); @@ -173,7 +173,7 @@ void graphShow(DGraph *dg,int DetailsLevel){ for (j = 0; j < focusNode->outDegree; j++ ) { fprintf(stderr, "\t "); nodeShow(focusNode->outArc[ j]->head); - } + } fprintf(stderr, "---\n"); } fprintf(stderr,"----------------------------------------\n"); diff --git a/examples/smpi/NAS/DT-trace/dt.c b/examples/smpi/NAS/DT-trace/dt.c index f649670947..862cf26a17 100644 --- a/examples/smpi/NAS/DT-trace/dt.c +++ b/examples/smpi/NAS/DT-trace/dt.c @@ -2,7 +2,7 @@ * * * N A S P A R A L L E L B E N C H M A R K S 3.3 * * * - * D T * + * D T * * * ************************************************************************* * * @@ -33,7 +33,7 @@ * * ************************************************************************* * * - * Author: M. Frumkin * * + * Author: M. Frumkin * * * * *************************************************************************/ @@ -64,7 +64,7 @@ void c_print_results( char *name, int nprocs_total, double t, double mops, - char *optype, + char *optype, int passed_verification, char *npbversion, char *compiletime, @@ -74,7 +74,7 @@ void c_print_results( char *name, char *cmpi_inc, char *cflags, char *clinkflags ); - + void timer_clear( int n ); void timer_start( int n ); void timer_stop( int n ); @@ -100,55 +100,55 @@ int verify(char *bmname,double rnm2){ verified = 0; }else if(cls=='W') { if(strstr(bmname,"BH")){ - verify_value = 4102461.0; + verify_value = 4102461.0; }else if(strstr(bmname,"WH")){ - verify_value = 204280762.0; + verify_value = 204280762.0; }else if(strstr(bmname,"SH")){ - verify_value = 186944764.0; + verify_value = 186944764.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); } verified = 0; }else if(cls=='A') { if(strstr(bmname,"BH")){ - verify_value = 17809491.0; + verify_value = 17809491.0; }else if(strstr(bmname,"WH")){ - verify_value = 1289925229.0; + verify_value = 1289925229.0; }else if(strstr(bmname,"SH")){ - verify_value = 610856482.0; + verify_value = 610856482.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); } - verified = 0; + verified = 0; }else if(cls=='B') { if(strstr(bmname,"BH")){ - verify_value = 4317114.0; + verify_value = 4317114.0; }else if(strstr(bmname,"WH")){ - verify_value = 7877279917.0; + verify_value = 7877279917.0; }else if(strstr(bmname,"SH")){ - verify_value = 1836863082.0; + verify_value = 1836863082.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); - verified = 0; + verified = 0; } }else if(cls=='C') { if(strstr(bmname,"BH")){ - verify_value = 0.0; + verify_value = 0.0; }else if(strstr(bmname,"WH")){ - verify_value = 0.0; + verify_value = 0.0; }else if(strstr(bmname,"SH")){ - verify_value = 0.0; + verify_value = 0.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); - verified = -1; + verified = -1; } }else if(cls=='D') { if(strstr(bmname,"BH")){ - verify_value = 0.0; + verify_value = 0.0; }else if(strstr(bmname,"WH")){ - verify_value = 0.0; + verify_value = 0.0; }else if(strstr(bmname,"SH")){ - verify_value = 0.0; + verify_value = 0.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); } @@ -158,15 +158,15 @@ int verify(char *bmname,double rnm2){ } fprintf(stderr," %s L2 Norm = %f\n",bmname,rnm2); if(verified==-1){ - fprintf(stderr," No verification was performed.\n"); + fprintf(stderr," No verification was performed.\n"); }else if( rnm2 - verify_value < epsilon && rnm2 - verify_value > -epsilon) { /* abs here does not work on ALTIX */ - verified = 1; - fprintf(stderr," Deviation = %f\n",(rnm2 - verify_value)); + verified = 1; + fprintf(stderr," Deviation = %f\n",(rnm2 - verify_value)); }else{ - verified = 0; - fprintf(stderr," The correct verification value = %f\n",verify_value); - fprintf(stderr," Got value = %f\n",rnm2); + verified = 0; + fprintf(stderr," The correct verification value = %f\n",verify_value); + fprintf(stderr," Got value = %f\n",rnm2); } }else{ verified = -1; @@ -299,7 +299,7 @@ DGraph *buildWH(char cls){ id=AttachNode(dg,nd); for(j=0;j=numPrevLayerNodes) break; + if(sid>=numPrevLayerNodes) break; snd=dg->node[firstLayerNode+sid]; ar=newArc(dg->node[id],snd); AttachArc(dg,ar); @@ -359,7 +359,7 @@ DGraph *buildBH(char cls){ id=AttachNode(dg,nd); for(j=0;j=numPrevLayerNodes) break; + if(sid>=numPrevLayerNodes) break; snd=dg->node[firstLayerNode+sid]; ar=newArc(snd,dg->node[id]); AttachArc(dg,ar); @@ -488,19 +488,19 @@ Arr* WindowFilter(Arr *a, Arr* b,int w){ if(a->len>b->len) Resample(b,a->len); for(i=fielddim;ilen-fielddim;i+=fielddim){ rms0=(a->val[i]-b->val[i])*(a->val[i]-b->val[i]) - +(a->val[i+1]-b->val[i+1])*(a->val[i+1]-b->val[i+1]) - +(a->val[i+2]-b->val[i+2])*(a->val[i+2]-b->val[i+2]) - +(a->val[i+3]-b->val[i+3])*(a->val[i+3]-b->val[i+3]); + +(a->val[i+1]-b->val[i+1])*(a->val[i+1]-b->val[i+1]) + +(a->val[i+2]-b->val[i+2])*(a->val[i+2]-b->val[i+2]) + +(a->val[i+3]-b->val[i+3])*(a->val[i+3]-b->val[i+3]); j=i+fielddim; rms1=(a->val[j]-b->val[j])*(a->val[j]-b->val[j]) - +(a->val[j+1]-b->val[j+1])*(a->val[j+1]-b->val[j+1]) - +(a->val[j+2]-b->val[j+2])*(a->val[j+2]-b->val[j+2]) - +(a->val[j+3]-b->val[j+3])*(a->val[j+3]-b->val[j+3]); + +(a->val[j+1]-b->val[j+1])*(a->val[j+1]-b->val[j+1]) + +(a->val[j+2]-b->val[j+2])*(a->val[j+2]-b->val[j+2]) + +(a->val[j+3]-b->val[j+3])*(a->val[j+3]-b->val[j+3]); j=i-fielddim; rmsm1=(a->val[j]-b->val[j])*(a->val[j]-b->val[j]) - +(a->val[j+1]-b->val[j+1])*(a->val[j+1]-b->val[j+1]) - +(a->val[j+2]-b->val[j+2])*(a->val[j+2]-b->val[j+2]) - +(a->val[j+3]-b->val[j+3])*(a->val[j+3]-b->val[j+3]); + +(a->val[j+1]-b->val[j+1])*(a->val[j+1]-b->val[j+1]) + +(a->val[j+2]-b->val[j+2])*(a->val[j+2]-b->val[j+2]) + +(a->val[j+3]-b->val[j+3])*(a->val[j+3]-b->val[j+3]); k=0; if(rms1val[i+1]=weight*b->val[j+1]; a->val[i+2]=weight*b->val[j+2]; a->val[i+3]=weight*b->val[j+3]; - } + } } if(timer_on){ timer_stop(w); @@ -752,25 +752,25 @@ int main(int argc,char **argv ){ timer_stop(0); tot_time=timer_read(0); c_print_results( dg->name, - CLASS, - featnum, - 0, - 0, - dg->numNodes, - 0, - comm_size, - tot_time, - bytes_sent/tot_time, - "bytes transmitted", - verified, - NPBVERSION, - COMPILETIME, - MPICC, - CLINK, - CMPI_LIB, - CMPI_INC, - CFLAGS, - CLINKFLAGS ); + CLASS, + featnum, + 0, + 0, + dg->numNodes, + 0, + comm_size, + tot_time, + bytes_sent/tot_time, + "bytes transmitted", + verified, + NPBVERSION, + COMPILETIME, + MPICC, + CLINK, + CMPI_LIB, + CMPI_INC, + CFLAGS, + CLINKFLAGS ); } MPI_Finalize(); return 1; diff --git a/examples/smpi/NAS/DT/DGraph.c b/examples/smpi/NAS/DT/DGraph.c index 5d5839df19..f573786db8 100644 --- a/examples/smpi/NAS/DT/DGraph.c +++ b/examples/smpi/NAS/DT/DGraph.c @@ -32,7 +32,7 @@ DGNode *newNode(char *nm){ } void nodeShow(DGNode* nd){ fprintf( stderr,"%3d.%s: (%d,%d)\n", - nd->id,nd->name,nd->inDegree,nd->outDegree); + nd->id,nd->name,nd->inDegree,nd->outDegree); /* if(nd->verified==1) fprintf(stderr,"%ld.%s\t: usable.",nd->id,nd->name); else if(nd->verified==0) fprintf(stderr,"%ld.%s\t: unusable.",nd->id,nd->name); @@ -56,103 +56,103 @@ int AttachNode(DGraph* dg, DGNode* nd) { DGNode **nds =NULL, *tmpnd=NULL; DGArc **ar=NULL; - if (dg->numNodes == dg->maxNodes-1 ) { - dg->maxNodes += BLOCK_SIZE; + if (dg->numNodes == dg->maxNodes-1 ) { + dg->maxNodes += BLOCK_SIZE; nds =(DGNode **) calloc(dg->maxNodes,sizeof(DGNode*)); - memcpy(nds,dg->node,(dg->maxNodes-BLOCK_SIZE)*sizeof(DGNode*)); - free(dg->node); - dg->node=nds; - } + memcpy(nds,dg->node,(dg->maxNodes-BLOCK_SIZE)*sizeof(DGNode*)); + free(dg->node); + dg->node=nds; + } len = strlen( nd->name); - for (i = 0; i < dg->numNodes; i++) { - tmpnd =dg->node[ i]; - ar=NULL; - if ( strlen( tmpnd->name) != len ) continue; - if ( strncmp( nd->name, tmpnd->name, len) ) continue; - if ( nd->inDegree > 0 ) { - tmpnd->maxInDegree += nd->maxInDegree; + for (i = 0; i < dg->numNodes; i++) { + tmpnd =dg->node[ i]; + ar=NULL; + if ( strlen( tmpnd->name) != len ) continue; + if ( strncmp( nd->name, tmpnd->name, len) ) continue; + if ( nd->inDegree > 0 ) { + tmpnd->maxInDegree += nd->maxInDegree; ar =(DGArc **) calloc(tmpnd->maxInDegree,sizeof(DGArc*)); - memcpy(ar,tmpnd->inArc,(tmpnd->inDegree)*sizeof(DGArc*)); - free(tmpnd->inArc); - tmpnd->inArc=ar; - for (j = 0; j < nd->inDegree; j++ ) { - nd->inArc[ j]->head = tmpnd; - } - memcpy( &(tmpnd->inArc[ tmpnd->inDegree]), nd->inArc, nd->inDegree*sizeof( DGArc *)); - tmpnd->inDegree += nd->inDegree; - } - if ( nd->outDegree > 0 ) { - tmpnd->maxOutDegree += nd->maxOutDegree; + memcpy(ar,tmpnd->inArc,(tmpnd->inDegree)*sizeof(DGArc*)); + free(tmpnd->inArc); + tmpnd->inArc=ar; + for (j = 0; j < nd->inDegree; j++ ) { + nd->inArc[ j]->head = tmpnd; + } + memcpy( &(tmpnd->inArc[ tmpnd->inDegree]), nd->inArc, nd->inDegree*sizeof( DGArc *)); + tmpnd->inDegree += nd->inDegree; + } + if ( nd->outDegree > 0 ) { + tmpnd->maxOutDegree += nd->maxOutDegree; ar =(DGArc **) calloc(tmpnd->maxOutDegree,sizeof(DGArc*)); - memcpy(ar,tmpnd->outArc,(tmpnd->outDegree)*sizeof(DGArc*)); - free(tmpnd->outArc); - tmpnd->outArc=ar; - for (j = 0; j < nd->outDegree; j++ ) { - nd->outArc[ j]->tail = tmpnd; - } - memcpy( &(tmpnd->outArc[tmpnd->outDegree]),nd->outArc,nd->outDegree*sizeof( DGArc *)); - tmpnd->outDegree += nd->outDegree; - } - free(nd); - return i; - } - nd->id = dg->numNodes; - dg->node[dg->numNodes] = nd; - dg->numNodes++; + memcpy(ar,tmpnd->outArc,(tmpnd->outDegree)*sizeof(DGArc*)); + free(tmpnd->outArc); + tmpnd->outArc=ar; + for (j = 0; j < nd->outDegree; j++ ) { + nd->outArc[ j]->tail = tmpnd; + } + memcpy( &(tmpnd->outArc[tmpnd->outDegree]),nd->outArc,nd->outDegree*sizeof( DGArc *)); + tmpnd->outDegree += nd->outDegree; + } + free(nd); + return i; + } + nd->id = dg->numNodes; + dg->node[dg->numNodes] = nd; + dg->numNodes++; return nd->id; } int AttachArc(DGraph *dg,DGArc* nar){ -int arcId = -1; +int arcId = -1; int i=0,newNumber=0; -DGNode *head = nar->head, - *tail = nar->tail; +DGNode *head = nar->head, + *tail = nar->tail; DGArc **ars=NULL,*probe=NULL; /*fprintf(stderr,"AttachArc %ld\n",dg->numArcs); */ - if ( !tail || !head ) return arcId; - if ( dg->numArcs == dg->maxArcs-1 ) { - dg->maxArcs += BLOCK_SIZE; + if ( !tail || !head ) return arcId; + if ( dg->numArcs == dg->maxArcs-1 ) { + dg->maxArcs += BLOCK_SIZE; ars =(DGArc **) calloc(dg->maxArcs,sizeof(DGArc*)); - memcpy(ars,dg->arc,(dg->maxArcs-BLOCK_SIZE)*sizeof(DGArc*)); - free(dg->arc); - dg->arc=ars; - } - for(i = 0; i < tail->outDegree; i++ ) { /* parallel arc */ - probe = tail->outArc[ i]; - if(probe->head == head - && - probe->length == nar->length + memcpy(ars,dg->arc,(dg->maxArcs-BLOCK_SIZE)*sizeof(DGArc*)); + free(dg->arc); + dg->arc=ars; + } + for(i = 0; i < tail->outDegree; i++ ) { /* parallel arc */ + probe = tail->outArc[ i]; + if(probe->head == head + && + probe->length == nar->length ){ free(nar); - return probe->id; - } - } - - nar->id = dg->numArcs; - arcId=dg->numArcs; - dg->arc[dg->numArcs] = nar; - dg->numArcs++; - - head->inArc[ head->inDegree] = nar; - head->inDegree++; - if ( head->inDegree >= head->maxInDegree ) { - newNumber = head->maxInDegree + SMALL_BLOCK_SIZE; + return probe->id; + } + } + + nar->id = dg->numArcs; + arcId=dg->numArcs; + dg->arc[dg->numArcs] = nar; + dg->numArcs++; + + head->inArc[ head->inDegree] = nar; + head->inDegree++; + if ( head->inDegree >= head->maxInDegree ) { + newNumber = head->maxInDegree + SMALL_BLOCK_SIZE; ars =(DGArc **) calloc(newNumber,sizeof(DGArc*)); - memcpy(ars,head->inArc,(head->inDegree)*sizeof(DGArc*)); - free(head->inArc); - head->inArc=ars; - head->maxInDegree = newNumber; - } - tail->outArc[ tail->outDegree] = nar; - tail->outDegree++; - if(tail->outDegree >= tail->maxOutDegree ) { - newNumber = tail->maxOutDegree + SMALL_BLOCK_SIZE; + memcpy(ars,head->inArc,(head->inDegree)*sizeof(DGArc*)); + free(head->inArc); + head->inArc=ars; + head->maxInDegree = newNumber; + } + tail->outArc[ tail->outDegree] = nar; + tail->outDegree++; + if(tail->outDegree >= tail->maxOutDegree ) { + newNumber = tail->maxOutDegree + SMALL_BLOCK_SIZE; ars =(DGArc **) calloc(newNumber,sizeof(DGArc*)); - memcpy(ars,tail->outArc,(tail->outDegree)*sizeof(DGArc*)); - free(tail->outArc); - tail->outArc=ars; - tail->maxOutDegree = newNumber; - } + memcpy(ars,tail->outArc,(tail->outDegree)*sizeof(DGArc*)); + free(tail->outArc); + tail->outArc=ars; + tail->maxOutDegree = newNumber; + } /*fprintf(stderr,"AttachArc: head->in=%d tail->out=%ld\n",head->inDegree,tail->outDegree);*/ return arcId; } @@ -164,8 +164,8 @@ void graphShow(DGraph *dg,int DetailsLevel){ DGNode *focusNode = dg->node[ i]; if(DetailsLevel >= 2) { for (j = 0; j < focusNode->inDegree; j++ ) { - fprintf(stderr,"\t "); - nodeShow(focusNode->inArc[ j]->tail); + fprintf(stderr,"\t "); + nodeShow(focusNode->inArc[ j]->tail); } } nodeShow(focusNode); @@ -173,7 +173,7 @@ void graphShow(DGraph *dg,int DetailsLevel){ for (j = 0; j < focusNode->outDegree; j++ ) { fprintf(stderr, "\t "); nodeShow(focusNode->outArc[ j]->head); - } + } fprintf(stderr, "---\n"); } fprintf(stderr,"----------------------------------------\n"); diff --git a/examples/smpi/NAS/DT/dt.c b/examples/smpi/NAS/DT/dt.c index ed8cfeb55d..d210b16424 100644 --- a/examples/smpi/NAS/DT/dt.c +++ b/examples/smpi/NAS/DT/dt.c @@ -2,7 +2,7 @@ * * * N A S P A R A L L E L B E N C H M A R K S 3.3 * * * - * D T * + * D T * * * ************************************************************************* * * @@ -33,7 +33,7 @@ * * ************************************************************************* * * - * Author: M. Frumkin * * + * Author: M. Frumkin * * * * *************************************************************************/ @@ -62,7 +62,7 @@ void c_print_results( char *name, int nprocs_total, double t, double mops, - char *optype, + char *optype, int passed_verification, char *npbversion, char *compiletime, @@ -72,7 +72,7 @@ void c_print_results( char *name, char *cmpi_inc, char *cflags, char *clinkflags ); - + void timer_clear( int n ); void timer_start( int n ); void timer_stop( int n ); @@ -98,55 +98,55 @@ int verify(char *bmname,double rnm2){ verified = 0; }else if(cls=='W') { if(strstr(bmname,"BH")){ - verify_value = 4102461.0; + verify_value = 4102461.0; }else if(strstr(bmname,"WH")){ - verify_value = 204280762.0; + verify_value = 204280762.0; }else if(strstr(bmname,"SH")){ - verify_value = 186944764.0; + verify_value = 186944764.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); } verified = 0; }else if(cls=='A') { if(strstr(bmname,"BH")){ - verify_value = 17809491.0; + verify_value = 17809491.0; }else if(strstr(bmname,"WH")){ - verify_value = 1289925229.0; + verify_value = 1289925229.0; }else if(strstr(bmname,"SH")){ - verify_value = 610856482.0; + verify_value = 610856482.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); } - verified = 0; + verified = 0; }else if(cls=='B') { if(strstr(bmname,"BH")){ - verify_value = 4317114.0; + verify_value = 4317114.0; }else if(strstr(bmname,"WH")){ - verify_value = 7877279917.0; + verify_value = 7877279917.0; }else if(strstr(bmname,"SH")){ - verify_value = 1836863082.0; + verify_value = 1836863082.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); - verified = 0; + verified = 0; } }else if(cls=='C') { if(strstr(bmname,"BH")){ - verify_value = 0.0; + verify_value = 0.0; }else if(strstr(bmname,"WH")){ - verify_value = 0.0; + verify_value = 0.0; }else if(strstr(bmname,"SH")){ - verify_value = 0.0; + verify_value = 0.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); - verified = -1; + verified = -1; } }else if(cls=='D') { if(strstr(bmname,"BH")){ - verify_value = 0.0; + verify_value = 0.0; }else if(strstr(bmname,"WH")){ - verify_value = 0.0; + verify_value = 0.0; }else if(strstr(bmname,"SH")){ - verify_value = 0.0; + verify_value = 0.0; }else{ fprintf(stderr,"No such benchmark as %s.\n",bmname); } @@ -156,15 +156,15 @@ int verify(char *bmname,double rnm2){ } fprintf(stderr," %s L2 Norm = %f\n",bmname,rnm2); if(verified==-1){ - fprintf(stderr," No verification was performed.\n"); + fprintf(stderr," No verification was performed.\n"); }else if( rnm2 - verify_value < epsilon && rnm2 - verify_value > -epsilon) { /* abs here does not work on ALTIX */ - verified = 1; - fprintf(stderr," Deviation = %f\n",(rnm2 - verify_value)); + verified = 1; + fprintf(stderr," Deviation = %f\n",(rnm2 - verify_value)); }else{ - verified = 0; - fprintf(stderr," The correct verification value = %f\n",verify_value); - fprintf(stderr," Got value = %f\n",rnm2); + verified = 0; + fprintf(stderr," The correct verification value = %f\n",verify_value); + fprintf(stderr," Got value = %f\n",rnm2); } }else{ verified = -1; @@ -297,7 +297,7 @@ DGraph *buildWH(char cls){ id=AttachNode(dg,nd); for(j=0;j=numPrevLayerNodes) break; + if(sid>=numPrevLayerNodes) break; snd=dg->node[firstLayerNode+sid]; ar=newArc(dg->node[id],snd); AttachArc(dg,ar); @@ -357,7 +357,7 @@ DGraph *buildBH(char cls){ id=AttachNode(dg,nd); for(j=0;j=numPrevLayerNodes) break; + if(sid>=numPrevLayerNodes) break; snd=dg->node[firstLayerNode+sid]; ar=newArc(snd,dg->node[id]); AttachArc(dg,ar); @@ -486,19 +486,19 @@ Arr* WindowFilter(Arr *a, Arr* b,int w){ if(a->len>b->len) Resample(b,a->len); for(i=fielddim;ilen-fielddim;i+=fielddim){ rms0=(a->val[i]-b->val[i])*(a->val[i]-b->val[i]) - +(a->val[i+1]-b->val[i+1])*(a->val[i+1]-b->val[i+1]) - +(a->val[i+2]-b->val[i+2])*(a->val[i+2]-b->val[i+2]) - +(a->val[i+3]-b->val[i+3])*(a->val[i+3]-b->val[i+3]); + +(a->val[i+1]-b->val[i+1])*(a->val[i+1]-b->val[i+1]) + +(a->val[i+2]-b->val[i+2])*(a->val[i+2]-b->val[i+2]) + +(a->val[i+3]-b->val[i+3])*(a->val[i+3]-b->val[i+3]); j=i+fielddim; rms1=(a->val[j]-b->val[j])*(a->val[j]-b->val[j]) - +(a->val[j+1]-b->val[j+1])*(a->val[j+1]-b->val[j+1]) - +(a->val[j+2]-b->val[j+2])*(a->val[j+2]-b->val[j+2]) - +(a->val[j+3]-b->val[j+3])*(a->val[j+3]-b->val[j+3]); + +(a->val[j+1]-b->val[j+1])*(a->val[j+1]-b->val[j+1]) + +(a->val[j+2]-b->val[j+2])*(a->val[j+2]-b->val[j+2]) + +(a->val[j+3]-b->val[j+3])*(a->val[j+3]-b->val[j+3]); j=i-fielddim; rmsm1=(a->val[j]-b->val[j])*(a->val[j]-b->val[j]) - +(a->val[j+1]-b->val[j+1])*(a->val[j+1]-b->val[j+1]) - +(a->val[j+2]-b->val[j+2])*(a->val[j+2]-b->val[j+2]) - +(a->val[j+3]-b->val[j+3])*(a->val[j+3]-b->val[j+3]); + +(a->val[j+1]-b->val[j+1])*(a->val[j+1]-b->val[j+1]) + +(a->val[j+2]-b->val[j+2])*(a->val[j+2]-b->val[j+2]) + +(a->val[j+3]-b->val[j+3])*(a->val[j+3]-b->val[j+3]); k=0; if(rms1val[i+1]=weight*b->val[j+1]; a->val[i+2]=weight*b->val[j+2]; a->val[i+3]=weight*b->val[j+3]; - } + } } if(timer_on){ timer_stop(w); @@ -734,25 +734,25 @@ int main(int argc,char **argv ){ timer_stop(0); tot_time=timer_read(0); c_print_results( dg->name, - CLASS, - featnum, - 0, - 0, - dg->numNodes, - 0, - comm_size, - tot_time, - bytes_sent/tot_time, - "bytes transmitted", - verified, - NPBVERSION, - COMPILETIME, - MPICC, - CLINK, - CMPI_LIB, - CMPI_INC, - CFLAGS, - CLINKFLAGS ); + CLASS, + featnum, + 0, + 0, + dg->numNodes, + 0, + comm_size, + tot_time, + bytes_sent/tot_time, + "bytes transmitted", + verified, + NPBVERSION, + COMPILETIME, + MPICC, + CLINK, + CMPI_LIB, + CMPI_INC, + CFLAGS, + CLINKFLAGS ); } MPI_Finalize(); return 1; diff --git a/examples/smpi/NAS/EP-sampling/ep.c b/examples/smpi/NAS/EP-sampling/ep.c index 71e0f89146..04b0c1b396 100644 --- a/examples/smpi/NAS/EP-sampling/ep.c +++ b/examples/smpi/NAS/EP-sampling/ep.c @@ -46,7 +46,7 @@ { int i; long i246m1=0x00003FFFFFFFFFFF; - long LLx, Lx, La; + long LLx, Lx, La; double d2m46; // This doesn't work, because the compiler does the calculation in 32 @@ -70,21 +70,21 @@ La = (long)a; //fprintf(stdout,("================== Vranlc ================"); //fprintf(stdout,("Before Loop: Lx = " + Lx + ", La = " + La); - LLx = Lx; - for (i=0; i< n; i++) { - Lx = Lx*La & i246m1 ; - LLx = Lx; - y[i] = d2m46 * (double)LLx; - /* - if(i == 0) { - fprintf(stdout,("After loop 0:"); - fprintf(stdout,("Lx = " + Lx + ", La = " + La); - fprintf(stdout,("d2m46 = " + d2m46); - fprintf(stdout,("LLX(Lx) = " + LLX.doubleValue()); - fprintf(stdout,("Y[0]" + y[0]); - } - */ - } + LLx = Lx; + for (i=0; i< n; i++) { + Lx = Lx*La & i246m1 ; + LLx = Lx; + y[i] = d2m46 * (double)LLx; + /* + if(i == 0) { + fprintf(stdout,("After loop 0:"); + fprintf(stdout,("Lx = " + Lx + ", La = " + La); + fprintf(stdout,("d2m46 = " + d2m46); + fprintf(stdout,("LLX(Lx) = " + LLX.doubleValue()); + fprintf(stdout,("Y[0]" + y[0]); + } + */ + } x = (double)LLx; /* @@ -98,75 +98,75 @@ //-------------- the core (unique function) ----------- void doTest(int argc, char **argv) { - double dum[3] = {1.,1.,1.}; - double x1, x2, sx, sy, tm, an, tt, gc; - double Mops; - double epsilon=1.0E-8, a = 1220703125., s=271828183.; - double t1, t2, t3, t4; - double sx_verify_value, sy_verify_value, sx_err, sy_err; + double dum[3] = {1.,1.,1.}; + double x1, x2, sx, sy, tm, an, tt, gc; + double Mops; + double epsilon=1.0E-8, a = 1220703125., s=271828183.; + double t1, t2, t3, t4; + double sx_verify_value, sy_verify_value, sx_err, sy_err; #include "npbparams.h" - int mk=16, - // --> set by make : in npbparams.h - //m=28, // for CLASS=A - //m=30, // for CLASS=B - //npm=2, // NPROCS - mm = m-mk, - nn = (int)(pow(2,mm)), - nk = (int)(pow(2,mk)), - nq=10, - np, - node, - no_nodes, - i, - ik, - kk, - l, - k, nit, no_large_nodes, - np_add, k_offset, j; - int me, nprocs, root=0, dp_type; - int verified, - timers_enabled=true; - char size[500]; // mind the size of the string to represent a big number - - //Use in randlc.. - int KS = 0; - double R23, R46, T23, T46; - - double *qq = (double *) malloc (10000*sizeof(double)); - double *start = (double *) malloc (64*sizeof(double)); - double *elapsed = (double *) malloc (64*sizeof(double)); - - double *x = (double *) malloc (2*nk*sizeof(double)); - double *q = (double *) malloc (nq*sizeof(double)); - - MPI_Init( &argc, &argv ); - MPI_Comm_size( MPI_COMM_WORLD, &no_nodes); - MPI_Comm_rank( MPI_COMM_WORLD, &node); + int mk=16, + // --> set by make : in npbparams.h + //m=28, // for CLASS=A + //m=30, // for CLASS=B + //npm=2, // NPROCS + mm = m-mk, + nn = (int)(pow(2,mm)), + nk = (int)(pow(2,mk)), + nq=10, + np, + node, + no_nodes, + i, + ik, + kk, + l, + k, nit, no_large_nodes, + np_add, k_offset, j; + int me, nprocs, root=0, dp_type; + int verified, + timers_enabled=true; + char size[500]; // mind the size of the string to represent a big number + + //Use in randlc.. + int KS = 0; + double R23, R46, T23, T46; + + double *qq = (double *) malloc (10000*sizeof(double)); + double *start = (double *) malloc (64*sizeof(double)); + double *elapsed = (double *) malloc (64*sizeof(double)); + + double *x = (double *) malloc (2*nk*sizeof(double)); + double *q = (double *) malloc (nq*sizeof(double)); + + MPI_Init( &argc, &argv ); + MPI_Comm_size( MPI_COMM_WORLD, &no_nodes); + MPI_Comm_rank( MPI_COMM_WORLD, &node); #ifdef USE_MPE MPE_Init_log(); #endif - root = 0; - if (node == root ) { - - /* Because the size of the problem is too large to store in a 32-bit - * integer for some classes, we put it into a string (for printing). - * Have to strip off the decimal point put in there by the floating - * point print statement (internal file) - */ - fprintf(stdout," NAS Parallel Benchmarks 3.2 -- EP Benchmark"); - sprintf(size,"%d",pow(2,m+1)); - //size = size.replace('.', ' '); - fprintf(stdout," Number of random numbers generated: %s\n",size); - fprintf(stdout," Number of active processes: %d\n",no_nodes); - - } - verified = false; - - /* c Compute the number of "batches" of random number pairs generated - c per processor. Adjust if the number of processors does not evenly - c divide the total number + root = 0; + if (node == root ) { + + /* Because the size of the problem is too large to store in a 32-bit + * integer for some classes, we put it into a string (for printing). + * Have to strip off the decimal point put in there by the floating + * point print statement (internal file) + */ + fprintf(stdout," NAS Parallel Benchmarks 3.2 -- EP Benchmark"); + sprintf(size,"%d",pow(2,m+1)); + //size = size.replace('.', ' '); + fprintf(stdout," Number of random numbers generated: %s\n",size); + fprintf(stdout," Number of active processes: %d\n",no_nodes); + + } + verified = false; + + /* c Compute the number of "batches" of random number pairs generated + c per processor. Adjust if the number of processors does not evenly + c divide the total number */ np = nn / no_nodes; @@ -187,22 +187,22 @@ c sure these initializations cannot be eliminated as dead code. */ - //call vranlc(0, dum[1], dum[2], dum[3]); - // Array indexes start at 1 in Fortran, 0 in Java - vranlc(0, dum[0], dum[1], &(dum[2])); - - dum[0] = randlc(&(dum[1]),&(dum[2])); - ///////////////////////////////// - for (i=0;i<2*nk;i++) { - x[i] = -1e99; - } - Mops = log(sqrt(abs(1))); - - /* - c--------------------------------------------------------------------- - c Synchronize before placing time stamp - c--------------------------------------------------------------------- - */ + //call vranlc(0, dum[1], dum[2], dum[3]); + // Array indexes start at 1 in Fortran, 0 in Java + vranlc(0, dum[0], dum[1], &(dum[2])); + + dum[0] = randlc(&(dum[1]),&(dum[2])); + ///////////////////////////////// + for (i=0;i<2*nk;i++) { + x[i] = -1e99; + } + Mops = log(sqrt(abs(1))); + + /* + c--------------------------------------------------------------------- + c Synchronize before placing time stamp + c--------------------------------------------------------------------- + */ MPI_Barrier( MPI_COMM_WORLD ); timer_clear(&(elapsed[1])); @@ -211,21 +211,21 @@ timer_start(&(start[1])); t1 = a; - //fprintf(stdout,("(ep.f:160) t1 = " + t1); + //fprintf(stdout,("(ep.f:160) t1 = " + t1); t1 = vranlc(0, t1, a, x); - //fprintf(stdout,("(ep.f:161) t1 = " + t1); - + //fprintf(stdout,("(ep.f:161) t1 = " + t1); + /* c Compute AN = A ^ (2 * NK) (mod 2^46). */ t1 = a; - //fprintf(stdout,("(ep.f:165) t1 = " + t1); + //fprintf(stdout,("(ep.f:165) t1 = " + t1); for (i=1; i <= mk+1; i++) { t2 = randlc(&t1, &t1); - //fprintf(stdout,("(ep.f:168)[loop i=" + i +"] t1 = " + t1); + //fprintf(stdout,("(ep.f:168)[loop i=" + i +"] t1 = " + t1); } an = t1; - //fprintf(stdout,("(ep.f:172) s = " + s); + //fprintf(stdout,("(ep.f:172) s = " + s); tt = s; gc = 0.; sx = 0.; @@ -257,7 +257,7 @@ for (i=1;i<=100 && !stop;i++) { ik = kk / 2; - //fprintf(stdout,("(ep.f:199) ik = " +ik+", kk = " + kk); + //fprintf(stdout,("(ep.f:199) ik = " +ik+", kk = " + kk); if (2 * ik != kk) { t3 = randlc(&t1, &t2); //fprintf(stdout,("(ep.f:200) t1= " +t1 ); @@ -272,34 +272,34 @@ // Compute uniform pseudorandom numbers. //if (timers_enabled) timer_start(3); - timer_start(&(start[3])); + timer_start(&(start[3])); //call vranlc(2 * nk, t1, a, x) --> t1 and y are modified - //fprintf(stdout,">>>>>>>>>>>Before vranlc(l.210)<<<<<<<<<<<<<"); - //fprintf(stdout,"2*nk = " + (2*nk)); - //fprintf(stdout,"t1 = " + t1); - //fprintf(stdout,"a = " + a); - //fprintf(stdout,"x[0] = " + x[0]); - //fprintf(stdout,">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<"); + //fprintf(stdout,">>>>>>>>>>>Before vranlc(l.210)<<<<<<<<<<<<<"); + //fprintf(stdout,"2*nk = " + (2*nk)); + //fprintf(stdout,"t1 = " + t1); + //fprintf(stdout,"a = " + a); + //fprintf(stdout,"x[0] = " + x[0]); + //fprintf(stdout,">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<"); - t1 = vranlc(2 * nk, t1, a, x); - - //fprintf(stdout,(">>>>>>>>>>>After Enter vranlc (l.210)<<<<<<"); - //fprintf(stdout,("2*nk = " + (2*nk)); - //fprintf(stdout,("t1 = " + t1); - //fprintf(stdout,("a = " + a); - //fprintf(stdout,("x[0] = " + x[0]); - //fprintf(stdout,(">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<"); + t1 = vranlc(2 * nk, t1, a, x); + + //fprintf(stdout,(">>>>>>>>>>>After Enter vranlc (l.210)<<<<<<"); + //fprintf(stdout,("2*nk = " + (2*nk)); + //fprintf(stdout,("t1 = " + t1); + //fprintf(stdout,("a = " + a); + //fprintf(stdout,("x[0] = " + x[0]); + //fprintf(stdout,(">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<"); //if (timers_enabled) timer_stop(3); - timer_stop(3,elapsed,start); + timer_stop(3,elapsed,start); /* Compute Gaussian deviates by acceptance-rejection method and * tally counts in concentric square annuli. This loop is not * vectorizable. */ //if (timers_enabled) timer_start(2); - timer_start(&(start[2])); + timer_start(&(start[2])); for(i=1; i<=nk;i++) { x1 = 2. * x[2*i-2] -1.0; x2 = 2. * x[2*i-1] - 1.0; @@ -313,8 +313,8 @@ sx = sx + t3; sy = sy + t4; } - /* - if(i == 1) { + /* + if(i == 1) { fprintf(stdout,"x1 = " + x1); fprintf(stdout,"x2 = " + x2); fprintf(stdout,"t1 = " + t1); @@ -325,109 +325,109 @@ fprintf(stdout,"q[l] = " + q[l]); fprintf(stdout,"sx = " + sx); fprintf(stdout,"sy = " + sy); - } - */ + } + */ } //if (timers_enabled) timer_stop(2); - timer_stop(2,elapsed,start); + timer_stop(2,elapsed,start); } //int MPI_Allreduce(void *sbuf, void *rbuf, int count, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm) - MPI_Allreduce(&sx, x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - sx = x[0]; //FIXME : x[0] or x[1] => x[0] because fortran starts with 1 + MPI_Allreduce(&sx, x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + sx = x[0]; //FIXME : x[0] or x[1] => x[0] because fortran starts with 1 MPI_Allreduce(&sy, x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); sy = x[0]; MPI_Allreduce(q, x, nq, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); for(i = 0; i < nq; i++) { - q[i] = x[i]; - } - for(i = 0; i < nq; i++) { - gc += q[i]; - } + q[i] = x[i]; + } + for(i = 0; i < nq; i++) { + gc += q[i]; + } - timer_stop(1,elapsed,start); + timer_stop(1,elapsed,start); tm = timer_read(1,elapsed); - MPI_Allreduce(&tm, x, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - tm = x[0]; - - if(node == root) { - nit = 0; - verified = true; - - if(m == 24) { - sx_verify_value = -3.247834652034740E3; - sy_verify_value = -6.958407078382297E3; - } else if(m == 25) { - sx_verify_value = -2.863319731645753E3; - sy_verify_value = -6.320053679109499E3; - } else if(m == 28) { - sx_verify_value = -4.295875165629892E3; - sy_verify_value = -1.580732573678431E4; - } else if(m == 30) { - sx_verify_value = 4.033815542441498E4; - sy_verify_value = -2.660669192809235E4; - } else if(m == 32) { - sx_verify_value = 4.764367927995374E4; - sy_verify_value = -8.084072988043731E4; - } else if(m == 36) { - sx_verify_value = 1.982481200946593E5; - sy_verify_value = -1.020596636361769E5; - } else { - verified = false; - } - - /* - fprintf(stdout,("sx = " + sx); - fprintf(stdout,("sx_verify = " + sx_verify_value); - fprintf(stdout,("sy = " + sy); - fprintf(stdout,("sy_verify = " + sy_verify_value); - */ - if(verified) { - sx_err = abs((sx - sx_verify_value)/sx_verify_value); - sy_err = abs((sy - sy_verify_value)/sy_verify_value); - /* - fprintf(stdout,("sx_err = " + sx_err); - fprintf(stdout,("sy_err = " + sx_err); - fprintf(stdout,("epsilon= " + epsilon); - */ - verified = ((sx_err < epsilon) && (sy_err < epsilon)); - } - - Mops = (pow(2.0, m+1))/tm/1000; - - fprintf(stdout,"EP Benchmark Results:\n"); - fprintf(stdout,"CPU Time=%d\n",tm); - fprintf(stdout,"N = 2^%d\n",m); - fprintf(stdout,"No. Gaussain Pairs =%d\n",gc); - fprintf(stdout,"Sum = %lf %ld\n",sx,sy); - fprintf(stdout,"Count:"); - for(i = 0; i < nq; i++) { - fprintf(stdout,"%d\t %ld\n",i,q[i]); - } - - /* - print_results("EP", _class, m+1, 0, 0, nit, npm, no_nodes, tm, Mops, - "Random numbers generated", verified, npbversion, - compiletime, cs1, cs2, cs3, cs4, cs5, cs6, cs7) */ - fprintf(stdout,"\nEP Benchmark Completed\n"); + MPI_Allreduce(&tm, x, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + tm = x[0]; + + if(node == root) { + nit = 0; + verified = true; + + if(m == 24) { + sx_verify_value = -3.247834652034740E3; + sy_verify_value = -6.958407078382297E3; + } else if(m == 25) { + sx_verify_value = -2.863319731645753E3; + sy_verify_value = -6.320053679109499E3; + } else if(m == 28) { + sx_verify_value = -4.295875165629892E3; + sy_verify_value = -1.580732573678431E4; + } else if(m == 30) { + sx_verify_value = 4.033815542441498E4; + sy_verify_value = -2.660669192809235E4; + } else if(m == 32) { + sx_verify_value = 4.764367927995374E4; + sy_verify_value = -8.084072988043731E4; + } else if(m == 36) { + sx_verify_value = 1.982481200946593E5; + sy_verify_value = -1.020596636361769E5; + } else { + verified = false; + } + + /* + fprintf(stdout,("sx = " + sx); + fprintf(stdout,("sx_verify = " + sx_verify_value); + fprintf(stdout,("sy = " + sy); + fprintf(stdout,("sy_verify = " + sy_verify_value); + */ + if(verified) { + sx_err = abs((sx - sx_verify_value)/sx_verify_value); + sy_err = abs((sy - sy_verify_value)/sy_verify_value); + /* + fprintf(stdout,("sx_err = " + sx_err); + fprintf(stdout,("sy_err = " + sx_err); + fprintf(stdout,("epsilon= " + epsilon); + */ + verified = ((sx_err < epsilon) && (sy_err < epsilon)); + } + + Mops = (pow(2.0, m+1))/tm/1000; + + fprintf(stdout,"EP Benchmark Results:\n"); + fprintf(stdout,"CPU Time=%d\n",tm); + fprintf(stdout,"N = 2^%d\n",m); + fprintf(stdout,"No. Gaussain Pairs =%d\n",gc); + fprintf(stdout,"Sum = %lf %ld\n",sx,sy); + fprintf(stdout,"Count:"); + for(i = 0; i < nq; i++) { + fprintf(stdout,"%d\t %ld\n",i,q[i]); + } + + /* + print_results("EP", _class, m+1, 0, 0, nit, npm, no_nodes, tm, Mops, + "Random numbers generated", verified, npbversion, + compiletime, cs1, cs2, cs3, cs4, cs5, cs6, cs7) */ + fprintf(stdout,"\nEP Benchmark Completed\n"); fprintf(stdout,"Class = %s\n", _class); - fprintf(stdout,"Size = %s\n", size); - fprintf(stdout,"Iteration = %d\n", nit); - fprintf(stdout,"Time in seconds = %lf\n",(tm/1000)); - fprintf(stdout,"Total processes = %d\n",no_nodes); - fprintf(stdout,"Mops/s total = %lf\n",Mops); - fprintf(stdout,"Mops/s/process = %lf\n", Mops/no_nodes); - fprintf(stdout,"Operation type = Random number generated\n"); - if(verified) { - fprintf(stdout,"Verification = SUCCESSFUL\n"); - } else { - fprintf(stdout,"Verification = UNSUCCESSFUL\n"); - } - fprintf(stdout,"Total time: %lf\n",(timer_read(1,elapsed)/1000)); - fprintf(stdout,"Gaussian pairs: %lf\n",(timer_read(2,elapsed)/1000)); - fprintf(stdout,"Random numbers: %lf\n",(timer_read(3,elapsed)/1000)); - } + fprintf(stdout,"Size = %s\n", size); + fprintf(stdout,"Iteration = %d\n", nit); + fprintf(stdout,"Time in seconds = %lf\n",(tm/1000)); + fprintf(stdout,"Total processes = %d\n",no_nodes); + fprintf(stdout,"Mops/s total = %lf\n",Mops); + fprintf(stdout,"Mops/s/process = %lf\n", Mops/no_nodes); + fprintf(stdout,"Operation type = Random number generated\n"); + if(verified) { + fprintf(stdout,"Verification = SUCCESSFUL\n"); + } else { + fprintf(stdout,"Verification = UNSUCCESSFUL\n"); + } + fprintf(stdout,"Total time: %lf\n",(timer_read(1,elapsed)/1000)); + fprintf(stdout,"Gaussian pairs: %lf\n",(timer_read(2,elapsed)/1000)); + fprintf(stdout,"Random numbers: %lf\n",(timer_read(3,elapsed)/1000)); + } #ifdef USE_MPE MPE_Finish_log(argv[0]); #endif diff --git a/examples/smpi/NAS/EP-sampling/randlc.c b/examples/smpi/NAS/EP-sampling/randlc.c index 624b800df8..4de6c93b88 100644 --- a/examples/smpi/NAS/EP-sampling/randlc.c +++ b/examples/smpi/NAS/EP-sampling/randlc.c @@ -38,17 +38,17 @@ /************* portable random number generator ************/ /*****************************************************************/ -double randlc( double *X, double *A ) +double randlc( double *X, double *A ) { static int KS=0; - static double R23, R46, T23, T46; - double T1, T2, T3, T4; - double A1; - double A2; - double X1; - double X2; - double Z; - int i, j; + static double R23, R46, T23, T46; + double T1, T2, T3, T4; + double A1; + double A2; + double X1; + double X2; + double Z; + int i, j; if (KS == 0) { diff --git a/examples/smpi/NAS/EP-trace/ep-trace.c b/examples/smpi/NAS/EP-trace/ep-trace.c index a0cec1b10a..4c5f5a7027 100644 --- a/examples/smpi/NAS/EP-trace/ep-trace.c +++ b/examples/smpi/NAS/EP-trace/ep-trace.c @@ -48,7 +48,7 @@ { int i; long i246m1=0x00003FFFFFFFFFFF; - long LLx, Lx, La; + long LLx, Lx, La; double d2m46; // This doesn't work, because the compiler does the calculation in 32 @@ -72,21 +72,21 @@ La = (long)a; //fprintf(stdout,("================== Vranlc ================"); //fprintf(stdout,("Before Loop: Lx = " + Lx + ", La = " + La); - LLx = Lx; - for (i=0; i< n; i++) { - Lx = Lx*La & i246m1 ; - LLx = Lx; - y[i] = d2m46 * (double)LLx; - /* - if(i == 0) { - fprintf(stdout,("After loop 0:"); - fprintf(stdout,("Lx = " + Lx + ", La = " + La); - fprintf(stdout,("d2m46 = " + d2m46); - fprintf(stdout,("LLX(Lx) = " + LLX.doubleValue()); - fprintf(stdout,("Y[0]" + y[0]); - } - */ - } + LLx = Lx; + for (i=0; i< n; i++) { + Lx = Lx*La & i246m1 ; + LLx = Lx; + y[i] = d2m46 * (double)LLx; + /* + if(i == 0) { + fprintf(stdout,("After loop 0:"); + fprintf(stdout,("Lx = " + Lx + ", La = " + La); + fprintf(stdout,("d2m46 = " + d2m46); + fprintf(stdout,("LLX(Lx) = " + LLX.doubleValue()); + fprintf(stdout,("Y[0]" + y[0]); + } + */ + } x = (double)LLx; /* @@ -100,77 +100,77 @@ //-------------- the core (unique function) ----------- void doTest(int argc, char **argv) { - double dum[3] = {1.,1.,1.}; - double x1, x2, sx, sy, tm, an, tt, gc; - double Mops; - double epsilon=1.0E-8, a = 1220703125., s=271828183.; - double t1, t2, t3, t4; - double sx_verify_value, sy_verify_value, sx_err, sy_err; + double dum[3] = {1.,1.,1.}; + double x1, x2, sx, sy, tm, an, tt, gc; + double Mops; + double epsilon=1.0E-8, a = 1220703125., s=271828183.; + double t1, t2, t3, t4; + double sx_verify_value, sy_verify_value, sx_err, sy_err; #include "npbparams.h" - int mk=16, - // --> set by make : in npbparams.h - //m=28, // for CLASS=A - //m=30, // for CLASS=B - //npm=2, // NPROCS - mm = m-mk, - nn = (int)(pow(2,mm)), - nk = (int)(pow(2,mk)), - nq=10, - np, - node, - no_nodes, - i, - ik, - kk, - l, - k, nit, no_large_nodes, - np_add, k_offset, j; - int me, nprocs, root=0, dp_type; - int verified, - timers_enabled=true; - char size[500]; // mind the size of the string to represent a big number - - //Use in randlc.. - int KS = 0; - double R23, R46, T23, T46; - - double *qq = (double *) malloc (10000*sizeof(double)); - double *start = (double *) malloc (64*sizeof(double)); - double *elapsed = (double *) malloc (64*sizeof(double)); - - double *x = (double *) malloc (2*nk*sizeof(double)); - double *q = (double *) malloc (nq*sizeof(double)); + int mk=16, + // --> set by make : in npbparams.h + //m=28, // for CLASS=A + //m=30, // for CLASS=B + //npm=2, // NPROCS + mm = m-mk, + nn = (int)(pow(2,mm)), + nk = (int)(pow(2,mk)), + nq=10, + np, + node, + no_nodes, + i, + ik, + kk, + l, + k, nit, no_large_nodes, + np_add, k_offset, j; + int me, nprocs, root=0, dp_type; + int verified, + timers_enabled=true; + char size[500]; // mind the size of the string to represent a big number + + //Use in randlc.. + int KS = 0; + double R23, R46, T23, T46; + + double *qq = (double *) malloc (10000*sizeof(double)); + double *start = (double *) malloc (64*sizeof(double)); + double *elapsed = (double *) malloc (64*sizeof(double)); + + double *x = (double *) malloc (2*nk*sizeof(double)); + double *q = (double *) malloc (nq*sizeof(double)); TRACE_smpi_set_category ("start"); - MPI_Init( &argc, &argv ); - MPI_Comm_size( MPI_COMM_WORLD, &no_nodes); - MPI_Comm_rank( MPI_COMM_WORLD, &node); + MPI_Init( &argc, &argv ); + MPI_Comm_size( MPI_COMM_WORLD, &no_nodes); + MPI_Comm_rank( MPI_COMM_WORLD, &node); #ifdef USE_MPE MPE_Init_log(); #endif - root = 0; - if (node == root ) { - - /* Because the size of the problem is too large to store in a 32-bit - * integer for some classes, we put it into a string (for printing). - * Have to strip off the decimal point put in there by the floating - * point print statement (internal file) - */ - fprintf(stdout," NAS Parallel Benchmarks 3.2 -- EP Benchmark"); - sprintf(size,"%d",pow(2,m+1)); - //size = size.replace('.', ' '); - fprintf(stdout," Number of random numbers generated: %s\n",size); - fprintf(stdout," Number of active processes: %d\n",no_nodes); - - } - verified = false; - - /* c Compute the number of "batches" of random number pairs generated - c per processor. Adjust if the number of processors does not evenly - c divide the total number + root = 0; + if (node == root ) { + + /* Because the size of the problem is too large to store in a 32-bit + * integer for some classes, we put it into a string (for printing). + * Have to strip off the decimal point put in there by the floating + * point print statement (internal file) + */ + fprintf(stdout," NAS Parallel Benchmarks 3.2 -- EP Benchmark"); + sprintf(size,"%d",pow(2,m+1)); + //size = size.replace('.', ' '); + fprintf(stdout," Number of random numbers generated: %s\n",size); + fprintf(stdout," Number of active processes: %d\n",no_nodes); + + } + verified = false; + + /* c Compute the number of "batches" of random number pairs generated + c per processor. Adjust if the number of processors does not evenly + c divide the total number */ np = nn / no_nodes; @@ -191,22 +191,22 @@ c sure these initializations cannot be eliminated as dead code. */ - //call vranlc(0, dum[1], dum[2], dum[3]); - // Array indexes start at 1 in Fortran, 0 in Java - vranlc(0, dum[0], dum[1], &(dum[2])); - - dum[0] = randlc(&(dum[1]),&(dum[2])); - ///////////////////////////////// - for (i=0;i<2*nk;i++) { - x[i] = -1e99; - } - Mops = log(sqrt(abs(1))); - - /* - c--------------------------------------------------------------------- - c Synchronize before placing time stamp - c--------------------------------------------------------------------- - */ + //call vranlc(0, dum[1], dum[2], dum[3]); + // Array indexes start at 1 in Fortran, 0 in Java + vranlc(0, dum[0], dum[1], &(dum[2])); + + dum[0] = randlc(&(dum[1]),&(dum[2])); + ///////////////////////////////// + for (i=0;i<2*nk;i++) { + x[i] = -1e99; + } + Mops = log(sqrt(abs(1))); + + /* + c--------------------------------------------------------------------- + c Synchronize before placing time stamp + c--------------------------------------------------------------------- + */ MPI_Barrier( MPI_COMM_WORLD ); @@ -218,21 +218,21 @@ timer_start(&(start[1])); t1 = a; - //fprintf(stdout,("(ep.f:160) t1 = " + t1); + //fprintf(stdout,("(ep.f:160) t1 = " + t1); t1 = vranlc(0, t1, a, x); - //fprintf(stdout,("(ep.f:161) t1 = " + t1); - + //fprintf(stdout,("(ep.f:161) t1 = " + t1); + /* c Compute AN = A ^ (2 * NK) (mod 2^46). */ t1 = a; - //fprintf(stdout,("(ep.f:165) t1 = " + t1); + //fprintf(stdout,("(ep.f:165) t1 = " + t1); for (i=1; i <= mk+1; i++) { t2 = randlc(&t1, &t1); - //fprintf(stdout,("(ep.f:168)[loop i=" + i +"] t1 = " + t1); + //fprintf(stdout,("(ep.f:168)[loop i=" + i +"] t1 = " + t1); } an = t1; - //fprintf(stdout,("(ep.f:172) s = " + s); + //fprintf(stdout,("(ep.f:172) s = " + s); tt = s; gc = 0.; sx = 0.; @@ -264,7 +264,7 @@ for (i=1;i<=100 && !stop;i++) { ik = kk / 2; - //fprintf(stdout,("(ep.f:199) ik = " +ik+", kk = " + kk); + //fprintf(stdout,("(ep.f:199) ik = " +ik+", kk = " + kk); if (2 * ik != kk) { t3 = randlc(&t1, &t2); //fprintf(stdout,("(ep.f:200) t1= " +t1 ); @@ -279,34 +279,34 @@ // Compute uniform pseudorandom numbers. //if (timers_enabled) timer_start(3); - timer_start(&(start[3])); + timer_start(&(start[3])); //call vranlc(2 * nk, t1, a, x) --> t1 and y are modified - //fprintf(stdout,">>>>>>>>>>>Before vranlc(l.210)<<<<<<<<<<<<<"); - //fprintf(stdout,"2*nk = " + (2*nk)); - //fprintf(stdout,"t1 = " + t1); - //fprintf(stdout,"a = " + a); - //fprintf(stdout,"x[0] = " + x[0]); - //fprintf(stdout,">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<"); + //fprintf(stdout,">>>>>>>>>>>Before vranlc(l.210)<<<<<<<<<<<<<"); + //fprintf(stdout,"2*nk = " + (2*nk)); + //fprintf(stdout,"t1 = " + t1); + //fprintf(stdout,"a = " + a); + //fprintf(stdout,"x[0] = " + x[0]); + //fprintf(stdout,">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<"); - t1 = vranlc(2 * nk, t1, a, x); - - //fprintf(stdout,(">>>>>>>>>>>After Enter vranlc (l.210)<<<<<<"); - //fprintf(stdout,("2*nk = " + (2*nk)); - //fprintf(stdout,("t1 = " + t1); - //fprintf(stdout,("a = " + a); - //fprintf(stdout,("x[0] = " + x[0]); - //fprintf(stdout,(">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<"); + t1 = vranlc(2 * nk, t1, a, x); + + //fprintf(stdout,(">>>>>>>>>>>After Enter vranlc (l.210)<<<<<<"); + //fprintf(stdout,("2*nk = " + (2*nk)); + //fprintf(stdout,("t1 = " + t1); + //fprintf(stdout,("a = " + a); + //fprintf(stdout,("x[0] = " + x[0]); + //fprintf(stdout,(">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<"); //if (timers_enabled) timer_stop(3); - timer_stop(3,elapsed,start); + timer_stop(3,elapsed,start); /* Compute Gaussian deviates by acceptance-rejection method and * tally counts in concentric square annuli. This loop is not * vectorizable. */ //if (timers_enabled) timer_start(2); - timer_start(&(start[2])); + timer_start(&(start[2])); for(i=1; i<=nk;i++) { x1 = 2. * x[2*i-2] -1.0; x2 = 2. * x[2*i-1] - 1.0; @@ -320,8 +320,8 @@ sx = sx + t3; sy = sy + t4; } - /* - if(i == 1) { + /* + if(i == 1) { fprintf(stdout,"x1 = " + x1); fprintf(stdout,"x2 = " + x2); fprintf(stdout,"t1 = " + t1); @@ -332,111 +332,111 @@ fprintf(stdout,"q[l] = " + q[l]); fprintf(stdout,"sx = " + sx); fprintf(stdout,"sy = " + sy); - } - */ + } + */ } //if (timers_enabled) timer_stop(2); - timer_stop(2,elapsed,start); + timer_stop(2,elapsed,start); } TRACE_smpi_set_category ("finalize"); //int MPI_Allreduce(void *sbuf, void *rbuf, int count, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm) - MPI_Allreduce(&sx, x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - sx = x[0]; //FIXME : x[0] or x[1] => x[0] because fortran starts with 1 + MPI_Allreduce(&sx, x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + sx = x[0]; //FIXME : x[0] or x[1] => x[0] because fortran starts with 1 MPI_Allreduce(&sy, x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); sy = x[0]; MPI_Allreduce(q, x, nq, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); for(i = 0; i < nq; i++) { - q[i] = x[i]; - } - for(i = 0; i < nq; i++) { - gc += q[i]; - } + q[i] = x[i]; + } + for(i = 0; i < nq; i++) { + gc += q[i]; + } - timer_stop(1,elapsed,start); + timer_stop(1,elapsed,start); tm = timer_read(1,elapsed); - MPI_Allreduce(&tm, x, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - tm = x[0]; - - if(node == root) { - nit = 0; - verified = true; - - if(m == 24) { - sx_verify_value = -3.247834652034740E3; - sy_verify_value = -6.958407078382297E3; - } else if(m == 25) { - sx_verify_value = -2.863319731645753E3; - sy_verify_value = -6.320053679109499E3; - } else if(m == 28) { - sx_verify_value = -4.295875165629892E3; - sy_verify_value = -1.580732573678431E4; - } else if(m == 30) { - sx_verify_value = 4.033815542441498E4; - sy_verify_value = -2.660669192809235E4; - } else if(m == 32) { - sx_verify_value = 4.764367927995374E4; - sy_verify_value = -8.084072988043731E4; - } else if(m == 36) { - sx_verify_value = 1.982481200946593E5; - sy_verify_value = -1.020596636361769E5; - } else { - verified = false; - } - - /* - fprintf(stdout,("sx = " + sx); - fprintf(stdout,("sx_verify = " + sx_verify_value); - fprintf(stdout,("sy = " + sy); - fprintf(stdout,("sy_verify = " + sy_verify_value); - */ - if(verified) { - sx_err = abs((sx - sx_verify_value)/sx_verify_value); - sy_err = abs((sy - sy_verify_value)/sy_verify_value); - /* - fprintf(stdout,("sx_err = " + sx_err); - fprintf(stdout,("sy_err = " + sx_err); - fprintf(stdout,("epsilon= " + epsilon); - */ - verified = ((sx_err < epsilon) && (sy_err < epsilon)); - } - - Mops = (pow(2.0, m+1))/tm/1000; - - fprintf(stdout,"EP Benchmark Results:\n"); - fprintf(stdout,"CPU Time=%d\n",tm); - fprintf(stdout,"N = 2^%d\n",m); - fprintf(stdout,"No. Gaussain Pairs =%d\n",gc); - fprintf(stdout,"Sum = %lf %ld\n",sx,sy); - fprintf(stdout,"Count:"); - for(i = 0; i < nq; i++) { - fprintf(stdout,"%d\t %ld\n",i,q[i]); - } - - /* - print_results("EP", _class, m+1, 0, 0, nit, npm, no_nodes, tm, Mops, - "Random numbers generated", verified, npbversion, - compiletime, cs1, cs2, cs3, cs4, cs5, cs6, cs7) */ - fprintf(stdout,"\nEP Benchmark Completed\n"); + MPI_Allreduce(&tm, x, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + tm = x[0]; + + if(node == root) { + nit = 0; + verified = true; + + if(m == 24) { + sx_verify_value = -3.247834652034740E3; + sy_verify_value = -6.958407078382297E3; + } else if(m == 25) { + sx_verify_value = -2.863319731645753E3; + sy_verify_value = -6.320053679109499E3; + } else if(m == 28) { + sx_verify_value = -4.295875165629892E3; + sy_verify_value = -1.580732573678431E4; + } else if(m == 30) { + sx_verify_value = 4.033815542441498E4; + sy_verify_value = -2.660669192809235E4; + } else if(m == 32) { + sx_verify_value = 4.764367927995374E4; + sy_verify_value = -8.084072988043731E4; + } else if(m == 36) { + sx_verify_value = 1.982481200946593E5; + sy_verify_value = -1.020596636361769E5; + } else { + verified = false; + } + + /* + fprintf(stdout,("sx = " + sx); + fprintf(stdout,("sx_verify = " + sx_verify_value); + fprintf(stdout,("sy = " + sy); + fprintf(stdout,("sy_verify = " + sy_verify_value); + */ + if(verified) { + sx_err = abs((sx - sx_verify_value)/sx_verify_value); + sy_err = abs((sy - sy_verify_value)/sy_verify_value); + /* + fprintf(stdout,("sx_err = " + sx_err); + fprintf(stdout,("sy_err = " + sx_err); + fprintf(stdout,("epsilon= " + epsilon); + */ + verified = ((sx_err < epsilon) && (sy_err < epsilon)); + } + + Mops = (pow(2.0, m+1))/tm/1000; + + fprintf(stdout,"EP Benchmark Results:\n"); + fprintf(stdout,"CPU Time=%d\n",tm); + fprintf(stdout,"N = 2^%d\n",m); + fprintf(stdout,"No. Gaussain Pairs =%d\n",gc); + fprintf(stdout,"Sum = %lf %ld\n",sx,sy); + fprintf(stdout,"Count:"); + for(i = 0; i < nq; i++) { + fprintf(stdout,"%d\t %ld\n",i,q[i]); + } + + /* + print_results("EP", _class, m+1, 0, 0, nit, npm, no_nodes, tm, Mops, + "Random numbers generated", verified, npbversion, + compiletime, cs1, cs2, cs3, cs4, cs5, cs6, cs7) */ + fprintf(stdout,"\nEP Benchmark Completed\n"); fprintf(stdout,"Class = %s\n", _class); - fprintf(stdout,"Size = %s\n", size); - fprintf(stdout,"Iteration = %d\n", nit); - fprintf(stdout,"Time in seconds = %lf\n",(tm/1000)); - fprintf(stdout,"Total processes = %d\n",no_nodes); - fprintf(stdout,"Mops/s total = %lf\n",Mops); - fprintf(stdout,"Mops/s/process = %lf\n", Mops/no_nodes); - fprintf(stdout,"Operation type = Random number generated\n"); - if(verified) { - fprintf(stdout,"Verification = SUCCESSFUL\n"); - } else { - fprintf(stdout,"Verification = UNSUCCESSFUL\n"); - } - fprintf(stdout,"Total time: %lf\n",(timer_read(1,elapsed)/1000)); - fprintf(stdout,"Gaussian pairs: %lf\n",(timer_read(2,elapsed)/1000)); - fprintf(stdout,"Random numbers: %lf\n",(timer_read(3,elapsed)/1000)); - } + fprintf(stdout,"Size = %s\n", size); + fprintf(stdout,"Iteration = %d\n", nit); + fprintf(stdout,"Time in seconds = %lf\n",(tm/1000)); + fprintf(stdout,"Total processes = %d\n",no_nodes); + fprintf(stdout,"Mops/s total = %lf\n",Mops); + fprintf(stdout,"Mops/s/process = %lf\n", Mops/no_nodes); + fprintf(stdout,"Operation type = Random number generated\n"); + if(verified) { + fprintf(stdout,"Verification = SUCCESSFUL\n"); + } else { + fprintf(stdout,"Verification = UNSUCCESSFUL\n"); + } + fprintf(stdout,"Total time: %lf\n",(timer_read(1,elapsed)/1000)); + fprintf(stdout,"Gaussian pairs: %lf\n",(timer_read(2,elapsed)/1000)); + fprintf(stdout,"Random numbers: %lf\n",(timer_read(3,elapsed)/1000)); + } #ifdef USE_MPE MPE_Finish_log(argv[0]); #endif diff --git a/examples/smpi/NAS/EP-trace/randlc.c b/examples/smpi/NAS/EP-trace/randlc.c index 624b800df8..4de6c93b88 100644 --- a/examples/smpi/NAS/EP-trace/randlc.c +++ b/examples/smpi/NAS/EP-trace/randlc.c @@ -38,17 +38,17 @@ /************* portable random number generator ************/ /*****************************************************************/ -double randlc( double *X, double *A ) +double randlc( double *X, double *A ) { static int KS=0; - static double R23, R46, T23, T46; - double T1, T2, T3, T4; - double A1; - double A2; - double X1; - double X2; - double Z; - int i, j; + static double R23, R46, T23, T46; + double T1, T2, T3, T4; + double A1; + double A2; + double X1; + double X2; + double Z; + int i, j; if (KS == 0) { diff --git a/examples/smpi/NAS/EP/ep.c b/examples/smpi/NAS/EP/ep.c index 753fd431a3..9c18da4e8d 100644 --- a/examples/smpi/NAS/EP/ep.c +++ b/examples/smpi/NAS/EP/ep.c @@ -46,7 +46,7 @@ { int i; long i246m1=0x00003FFFFFFFFFFF; - long LLx, Lx, La; + long LLx, Lx, La; double d2m46; // This doesn't work, because the compiler does the calculation in 32 @@ -70,21 +70,21 @@ La = (long)a; //fprintf(stdout,("================== Vranlc ================"); //fprintf(stdout,("Before Loop: Lx = " + Lx + ", La = " + La); - LLx = Lx; - for (i=0; i< n; i++) { - Lx = Lx*La & i246m1 ; - LLx = Lx; - y[i] = d2m46 * (double)LLx; - /* - if(i == 0) { - fprintf(stdout,("After loop 0:"); - fprintf(stdout,("Lx = " + Lx + ", La = " + La); - fprintf(stdout,("d2m46 = " + d2m46); - fprintf(stdout,("LLX(Lx) = " + LLX.doubleValue()); - fprintf(stdout,("Y[0]" + y[0]); - } - */ - } + LLx = Lx; + for (i=0; i< n; i++) { + Lx = Lx*La & i246m1 ; + LLx = Lx; + y[i] = d2m46 * (double)LLx; + /* + if(i == 0) { + fprintf(stdout,("After loop 0:"); + fprintf(stdout,("Lx = " + Lx + ", La = " + La); + fprintf(stdout,("d2m46 = " + d2m46); + fprintf(stdout,("LLX(Lx) = " + LLX.doubleValue()); + fprintf(stdout,("Y[0]" + y[0]); + } + */ + } x = (double)LLx; /* @@ -98,75 +98,75 @@ //-------------- the core (unique function) ----------- void doTest(int argc, char **argv) { - double dum[3] = {1.,1.,1.}; - double x1, x2, sx, sy, tm, an, tt, gc; - double Mops; - double epsilon=1.0E-8, a = 1220703125., s=271828183.; - double t1, t2, t3, t4; - double sx_verify_value, sy_verify_value, sx_err, sy_err; + double dum[3] = {1.,1.,1.}; + double x1, x2, sx, sy, tm, an, tt, gc; + double Mops; + double epsilon=1.0E-8, a = 1220703125., s=271828183.; + double t1, t2, t3, t4; + double sx_verify_value, sy_verify_value, sx_err, sy_err; #include "npbparams.h" - int mk=16, - // --> set by make : in npbparams.h - //m=28, // for CLASS=A - //m=30, // for CLASS=B - //npm=2, // NPROCS - mm = m-mk, - nn = (int)(pow(2,mm)), - nk = (int)(pow(2,mk)), - nq=10, - np, - node, - no_nodes, - i, - ik, - kk, - l, - k, nit, no_large_nodes, - np_add, k_offset, j; - int me, nprocs, root=0, dp_type; - int verified, - timers_enabled=true; - char size[500]; // mind the size of the string to represent a big number - - //Use in randlc.. - int KS = 0; - double R23, R46, T23, T46; - - double *qq = (double *) malloc (10000*sizeof(double)); - double *start = (double *) malloc (64*sizeof(double)); - double *elapsed = (double *) malloc (64*sizeof(double)); - - double *x = (double *) malloc (2*nk*sizeof(double)); - double *q = (double *) malloc (nq*sizeof(double)); - - MPI_Init( &argc, &argv ); - MPI_Comm_size( MPI_COMM_WORLD, &no_nodes); - MPI_Comm_rank( MPI_COMM_WORLD, &node); + int mk=16, + // --> set by make : in npbparams.h + //m=28, // for CLASS=A + //m=30, // for CLASS=B + //npm=2, // NPROCS + mm = m-mk, + nn = (int)(pow(2,mm)), + nk = (int)(pow(2,mk)), + nq=10, + np, + node, + no_nodes, + i, + ik, + kk, + l, + k, nit, no_large_nodes, + np_add, k_offset, j; + int me, nprocs, root=0, dp_type; + int verified, + timers_enabled=true; + char size[500]; // mind the size of the string to represent a big number + + //Use in randlc.. + int KS = 0; + double R23, R46, T23, T46; + + double *qq = (double *) malloc (10000*sizeof(double)); + double *start = (double *) malloc (64*sizeof(double)); + double *elapsed = (double *) malloc (64*sizeof(double)); + + double *x = (double *) malloc (2*nk*sizeof(double)); + double *q = (double *) malloc (nq*sizeof(double)); + + MPI_Init( &argc, &argv ); + MPI_Comm_size( MPI_COMM_WORLD, &no_nodes); + MPI_Comm_rank( MPI_COMM_WORLD, &node); #ifdef USE_MPE MPE_Init_log(); #endif - root = 0; - if (node == root ) { - - /* Because the size of the problem is too large to store in a 32-bit - * integer for some classes, we put it into a string (for printing). - * Have to strip off the decimal point put in there by the floating - * point print statement (internal file) - */ - fprintf(stdout," NAS Parallel Benchmarks 3.2 -- EP Benchmark"); - sprintf(size,"%d",pow(2,m+1)); - //size = size.replace('.', ' '); - fprintf(stdout," Number of random numbers generated: %s\n",size); - fprintf(stdout," Number of active processes: %d\n",no_nodes); - - } - verified = false; - - /* c Compute the number of "batches" of random number pairs generated - c per processor. Adjust if the number of processors does not evenly - c divide the total number + root = 0; + if (node == root ) { + + /* Because the size of the problem is too large to store in a 32-bit + * integer for some classes, we put it into a string (for printing). + * Have to strip off the decimal point put in there by the floating + * point print statement (internal file) + */ + fprintf(stdout," NAS Parallel Benchmarks 3.2 -- EP Benchmark"); + sprintf(size,"%d",pow(2,m+1)); + //size = size.replace('.', ' '); + fprintf(stdout," Number of random numbers generated: %s\n",size); + fprintf(stdout," Number of active processes: %d\n",no_nodes); + + } + verified = false; + + /* c Compute the number of "batches" of random number pairs generated + c per processor. Adjust if the number of processors does not evenly + c divide the total number */ np = nn / no_nodes; @@ -187,22 +187,22 @@ c sure these initializations cannot be eliminated as dead code. */ - //call vranlc(0, dum[1], dum[2], dum[3]); - // Array indexes start at 1 in Fortran, 0 in Java - vranlc(0, dum[0], dum[1], &(dum[2])); - - dum[0] = randlc(&(dum[1]),&(dum[2])); - ///////////////////////////////// - for (i=0;i<2*nk;i++) { - x[i] = -1e99; - } - Mops = log(sqrt(abs(1))); - - /* - c--------------------------------------------------------------------- - c Synchronize before placing time stamp - c--------------------------------------------------------------------- - */ + //call vranlc(0, dum[1], dum[2], dum[3]); + // Array indexes start at 1 in Fortran, 0 in Java + vranlc(0, dum[0], dum[1], &(dum[2])); + + dum[0] = randlc(&(dum[1]),&(dum[2])); + ///////////////////////////////// + for (i=0;i<2*nk;i++) { + x[i] = -1e99; + } + Mops = log(sqrt(abs(1))); + + /* + c--------------------------------------------------------------------- + c Synchronize before placing time stamp + c--------------------------------------------------------------------- + */ MPI_Barrier( MPI_COMM_WORLD ); timer_clear(&(elapsed[1])); @@ -211,21 +211,21 @@ timer_start(&(start[1])); t1 = a; - //fprintf(stdout,("(ep.f:160) t1 = " + t1); + //fprintf(stdout,("(ep.f:160) t1 = " + t1); t1 = vranlc(0, t1, a, x); - //fprintf(stdout,("(ep.f:161) t1 = " + t1); - + //fprintf(stdout,("(ep.f:161) t1 = " + t1); + /* c Compute AN = A ^ (2 * NK) (mod 2^46). */ t1 = a; - //fprintf(stdout,("(ep.f:165) t1 = " + t1); + //fprintf(stdout,("(ep.f:165) t1 = " + t1); for (i=1; i <= mk+1; i++) { t2 = randlc(&t1, &t1); - //fprintf(stdout,("(ep.f:168)[loop i=" + i +"] t1 = " + t1); + //fprintf(stdout,("(ep.f:168)[loop i=" + i +"] t1 = " + t1); } an = t1; - //fprintf(stdout,("(ep.f:172) s = " + s); + //fprintf(stdout,("(ep.f:172) s = " + s); tt = s; gc = 0.; sx = 0.; @@ -257,7 +257,7 @@ for (i=1;i<=100 && !stop;i++) { ik = kk / 2; - //fprintf(stdout,("(ep.f:199) ik = " +ik+", kk = " + kk); + //fprintf(stdout,("(ep.f:199) ik = " +ik+", kk = " + kk); if (2 * ik != kk) { t3 = randlc(&t1, &t2); //fprintf(stdout,("(ep.f:200) t1= " +t1 ); @@ -272,34 +272,34 @@ // Compute uniform pseudorandom numbers. //if (timers_enabled) timer_start(3); - timer_start(&(start[3])); + timer_start(&(start[3])); //call vranlc(2 * nk, t1, a, x) --> t1 and y are modified - //fprintf(stdout,">>>>>>>>>>>Before vranlc(l.210)<<<<<<<<<<<<<"); - //fprintf(stdout,"2*nk = " + (2*nk)); - //fprintf(stdout,"t1 = " + t1); - //fprintf(stdout,"a = " + a); - //fprintf(stdout,"x[0] = " + x[0]); - //fprintf(stdout,">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<"); + //fprintf(stdout,">>>>>>>>>>>Before vranlc(l.210)<<<<<<<<<<<<<"); + //fprintf(stdout,"2*nk = " + (2*nk)); + //fprintf(stdout,"t1 = " + t1); + //fprintf(stdout,"a = " + a); + //fprintf(stdout,"x[0] = " + x[0]); + //fprintf(stdout,">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<"); - t1 = vranlc(2 * nk, t1, a, x); - - //fprintf(stdout,(">>>>>>>>>>>After Enter vranlc (l.210)<<<<<<"); - //fprintf(stdout,("2*nk = " + (2*nk)); - //fprintf(stdout,("t1 = " + t1); - //fprintf(stdout,("a = " + a); - //fprintf(stdout,("x[0] = " + x[0]); - //fprintf(stdout,(">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<"); + t1 = vranlc(2 * nk, t1, a, x); + + //fprintf(stdout,(">>>>>>>>>>>After Enter vranlc (l.210)<<<<<<"); + //fprintf(stdout,("2*nk = " + (2*nk)); + //fprintf(stdout,("t1 = " + t1); + //fprintf(stdout,("a = " + a); + //fprintf(stdout,("x[0] = " + x[0]); + //fprintf(stdout,(">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<"); //if (timers_enabled) timer_stop(3); - timer_stop(3,elapsed,start); + timer_stop(3,elapsed,start); /* Compute Gaussian deviates by acceptance-rejection method and * tally counts in concentric square annuli. This loop is not * vectorizable. */ //if (timers_enabled) timer_start(2); - timer_start(&(start[2])); + timer_start(&(start[2])); for(i=1; i<=nk;i++) { x1 = 2. * x[2*i-2] -1.0; x2 = 2. * x[2*i-1] - 1.0; @@ -313,8 +313,8 @@ sx = sx + t3; sy = sy + t4; } - /* - if(i == 1) { + /* + if(i == 1) { fprintf(stdout,"x1 = " + x1); fprintf(stdout,"x2 = " + x2); fprintf(stdout,"t1 = " + t1); @@ -325,109 +325,109 @@ fprintf(stdout,"q[l] = " + q[l]); fprintf(stdout,"sx = " + sx); fprintf(stdout,"sy = " + sy); - } - */ + } + */ } //if (timers_enabled) timer_stop(2); - timer_stop(2,elapsed,start); + timer_stop(2,elapsed,start); } //int MPI_Allreduce(void *sbuf, void *rbuf, int count, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm) - MPI_Allreduce(&sx, x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - sx = x[0]; //FIXME : x[0] or x[1] => x[0] because fortran starts with 1 + MPI_Allreduce(&sx, x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + sx = x[0]; //FIXME : x[0] or x[1] => x[0] because fortran starts with 1 MPI_Allreduce(&sy, x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); sy = x[0]; MPI_Allreduce(q, x, nq, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); for(i = 0; i < nq; i++) { - q[i] = x[i]; - } - for(i = 0; i < nq; i++) { - gc += q[i]; - } + q[i] = x[i]; + } + for(i = 0; i < nq; i++) { + gc += q[i]; + } - timer_stop(1,elapsed,start); + timer_stop(1,elapsed,start); tm = timer_read(1,elapsed); - MPI_Allreduce(&tm, x, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - tm = x[0]; - - if(node == root) { - nit = 0; - verified = true; - - if(m == 24) { - sx_verify_value = -3.247834652034740E3; - sy_verify_value = -6.958407078382297E3; - } else if(m == 25) { - sx_verify_value = -2.863319731645753E3; - sy_verify_value = -6.320053679109499E3; - } else if(m == 28) { - sx_verify_value = -4.295875165629892E3; - sy_verify_value = -1.580732573678431E4; - } else if(m == 30) { - sx_verify_value = 4.033815542441498E4; - sy_verify_value = -2.660669192809235E4; - } else if(m == 32) { - sx_verify_value = 4.764367927995374E4; - sy_verify_value = -8.084072988043731E4; - } else if(m == 36) { - sx_verify_value = 1.982481200946593E5; - sy_verify_value = -1.020596636361769E5; - } else { - verified = false; - } - - /* - fprintf(stdout,("sx = " + sx); - fprintf(stdout,("sx_verify = " + sx_verify_value); - fprintf(stdout,("sy = " + sy); - fprintf(stdout,("sy_verify = " + sy_verify_value); - */ - if(verified) { - sx_err = abs((sx - sx_verify_value)/sx_verify_value); - sy_err = abs((sy - sy_verify_value)/sy_verify_value); - /* - fprintf(stdout,("sx_err = " + sx_err); - fprintf(stdout,("sy_err = " + sx_err); - fprintf(stdout,("epsilon= " + epsilon); - */ - verified = ((sx_err < epsilon) && (sy_err < epsilon)); - } - - Mops = (pow(2.0, m+1))/tm/1000; - - fprintf(stdout,"EP Benchmark Results:\n"); - fprintf(stdout,"CPU Time=%d\n",tm); - fprintf(stdout,"N = 2^%d\n",m); - fprintf(stdout,"No. Gaussain Pairs =%d\n",gc); - fprintf(stdout,"Sum = %lf %ld\n",sx,sy); - fprintf(stdout,"Count:"); - for(i = 0; i < nq; i++) { - fprintf(stdout,"%d\t %ld\n",i,q[i]); - } - - /* - print_results("EP", _class, m+1, 0, 0, nit, npm, no_nodes, tm, Mops, - "Random numbers generated", verified, npbversion, - compiletime, cs1, cs2, cs3, cs4, cs5, cs6, cs7) */ - fprintf(stdout,"\nEP Benchmark Completed\n"); + MPI_Allreduce(&tm, x, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + tm = x[0]; + + if(node == root) { + nit = 0; + verified = true; + + if(m == 24) { + sx_verify_value = -3.247834652034740E3; + sy_verify_value = -6.958407078382297E3; + } else if(m == 25) { + sx_verify_value = -2.863319731645753E3; + sy_verify_value = -6.320053679109499E3; + } else if(m == 28) { + sx_verify_value = -4.295875165629892E3; + sy_verify_value = -1.580732573678431E4; + } else if(m == 30) { + sx_verify_value = 4.033815542441498E4; + sy_verify_value = -2.660669192809235E4; + } else if(m == 32) { + sx_verify_value = 4.764367927995374E4; + sy_verify_value = -8.084072988043731E4; + } else if(m == 36) { + sx_verify_value = 1.982481200946593E5; + sy_verify_value = -1.020596636361769E5; + } else { + verified = false; + } + + /* + fprintf(stdout,("sx = " + sx); + fprintf(stdout,("sx_verify = " + sx_verify_value); + fprintf(stdout,("sy = " + sy); + fprintf(stdout,("sy_verify = " + sy_verify_value); + */ + if(verified) { + sx_err = abs((sx - sx_verify_value)/sx_verify_value); + sy_err = abs((sy - sy_verify_value)/sy_verify_value); + /* + fprintf(stdout,("sx_err = " + sx_err); + fprintf(stdout,("sy_err = " + sx_err); + fprintf(stdout,("epsilon= " + epsilon); + */ + verified = ((sx_err < epsilon) && (sy_err < epsilon)); + } + + Mops = (pow(2.0, m+1))/tm/1000; + + fprintf(stdout,"EP Benchmark Results:\n"); + fprintf(stdout,"CPU Time=%d\n",tm); + fprintf(stdout,"N = 2^%d\n",m); + fprintf(stdout,"No. Gaussain Pairs =%d\n",gc); + fprintf(stdout,"Sum = %lf %ld\n",sx,sy); + fprintf(stdout,"Count:"); + for(i = 0; i < nq; i++) { + fprintf(stdout,"%d\t %ld\n",i,q[i]); + } + + /* + print_results("EP", _class, m+1, 0, 0, nit, npm, no_nodes, tm, Mops, + "Random numbers generated", verified, npbversion, + compiletime, cs1, cs2, cs3, cs4, cs5, cs6, cs7) */ + fprintf(stdout,"\nEP Benchmark Completed\n"); fprintf(stdout,"Class = %s\n", _class); - fprintf(stdout,"Size = %s\n", size); - fprintf(stdout,"Iteration = %d\n", nit); - fprintf(stdout,"Time in seconds = %lf\n",(tm/1000)); - fprintf(stdout,"Total processes = %d\n",no_nodes); - fprintf(stdout,"Mops/s total = %lf\n",Mops); - fprintf(stdout,"Mops/s/process = %lf\n", Mops/no_nodes); - fprintf(stdout,"Operation type = Random number generated\n"); - if(verified) { - fprintf(stdout,"Verification = SUCCESSFUL\n"); - } else { - fprintf(stdout,"Verification = UNSUCCESSFUL\n"); - } - fprintf(stdout,"Total time: %lf\n",(timer_read(1,elapsed)/1000)); - fprintf(stdout,"Gaussian pairs: %lf\n",(timer_read(2,elapsed)/1000)); - fprintf(stdout,"Random numbers: %lf\n",(timer_read(3,elapsed)/1000)); - } + fprintf(stdout,"Size = %s\n", size); + fprintf(stdout,"Iteration = %d\n", nit); + fprintf(stdout,"Time in seconds = %lf\n",(tm/1000)); + fprintf(stdout,"Total processes = %d\n",no_nodes); + fprintf(stdout,"Mops/s total = %lf\n",Mops); + fprintf(stdout,"Mops/s/process = %lf\n", Mops/no_nodes); + fprintf(stdout,"Operation type = Random number generated\n"); + if(verified) { + fprintf(stdout,"Verification = SUCCESSFUL\n"); + } else { + fprintf(stdout,"Verification = UNSUCCESSFUL\n"); + } + fprintf(stdout,"Total time: %lf\n",(timer_read(1,elapsed)/1000)); + fprintf(stdout,"Gaussian pairs: %lf\n",(timer_read(2,elapsed)/1000)); + fprintf(stdout,"Random numbers: %lf\n",(timer_read(3,elapsed)/1000)); + } #ifdef USE_MPE MPE_Finish_log(argv[0]); #endif diff --git a/examples/smpi/NAS/EP/randlc.c b/examples/smpi/NAS/EP/randlc.c index 624b800df8..4de6c93b88 100644 --- a/examples/smpi/NAS/EP/randlc.c +++ b/examples/smpi/NAS/EP/randlc.c @@ -38,17 +38,17 @@ /************* portable random number generator ************/ /*****************************************************************/ -double randlc( double *X, double *A ) +double randlc( double *X, double *A ) { static int KS=0; - static double R23, R46, T23, T46; - double T1, T2, T3, T4; - double A1; - double A2; - double X1; - double X2; - double Z; - int i, j; + static double R23, R46, T23, T46; + double T1, T2, T3, T4; + double A1; + double A2; + double X1; + double X2; + double Z; + int i, j; if (KS == 0) { diff --git a/examples/smpi/NAS/IS-trace/is-trace.c b/examples/smpi/NAS/IS-trace/is-trace.c index 30aa5f7617..645038c2b7 100644 --- a/examples/smpi/NAS/IS-trace/is-trace.c +++ b/examples/smpi/NAS/IS-trace/is-trace.c @@ -259,7 +259,7 @@ const INT_TYPE2 /***********************/ /* function prototypes */ /***********************/ -double randlc( double *X, double *A ); +double randlc( double *X, double *A ); void full_verify( global_data* gd ); @@ -273,7 +273,7 @@ void c_print_results( char *name, int nprocs_total, double t, double mops, - char *optype, + char *optype, int passed_verification, char *npbversion, char *compiletime, @@ -345,17 +345,17 @@ double timer_read(global_data* gd, int n ) { /************* portable random number generator ************/ /*****************************************************************/ -double randlc( double *X, double *A ) +double randlc( double *X, double *A ) { static int KS=0; - static double R23, R46, T23, T46; - double T1, T2, T3, T4; - double A1; - double A2; - double X1; - double X2; - double Z; - int i, j; + static double R23, R46, T23, T46; + double T1, T2, T3, T4; + double A1; + double A2; + double X1; + double X2; + double Z; + int i, j; if (KS == 0) { @@ -472,22 +472,22 @@ double find_my_seed( int kn, /* my processor rank, 0<=kn<=num procs */ /************* C R E A T E _ S E Q ************/ /*****************************************************************/ -void create_seq( global_data* gd, double seed, double a ) +void create_seq( global_data* gd, double seed, double a ) { - double x; - int i, k; + double x; + int i, k; k = MAX_KEY/4; - for (i=0; ikey_array[i] = k*x; - } + } } @@ -825,12 +825,12 @@ void rank( global_data* gd, int iteration ) break; case 'A': if( i <= 2 ) - { + { if( key_rank != gd->test_rank_array[i]+(iteration-1) ) failed = 1; else gd->passed_verification++; - } + } else { if( key_rank != gd->test_rank_array[i]-(iteration-1) ) @@ -841,12 +841,12 @@ void rank( global_data* gd, int iteration ) break; case 'B': if( i == 1 || i == 2 || i == 4 ) - { + { if( key_rank != gd->test_rank_array[i]+iteration ) failed = 1; else gd->passed_verification++; - } + } else { if( key_rank != gd->test_rank_array[i]-iteration ) @@ -857,12 +857,12 @@ void rank( global_data* gd, int iteration ) break; case 'C': if( i <= 2 ) - { + { if( key_rank != gd->test_rank_array[i]+iteration ) failed = 1; else gd->passed_verification++; - } + } else { if( key_rank != gd->test_rank_array[i]-iteration ) @@ -873,12 +873,12 @@ void rank( global_data* gd, int iteration ) break; case 'D': if( i < 2 ) - { + { if( key_rank != gd->test_rank_array[i]+iteration ) failed = 1; else gd->passed_verification++; - } + } else { if( key_rank != gd->test_rank_array[i]-iteration ) diff --git a/examples/smpi/NAS/IS/is.c b/examples/smpi/NAS/IS/is.c index a83d998704..d617726937 100644 --- a/examples/smpi/NAS/IS/is.c +++ b/examples/smpi/NAS/IS/is.c @@ -257,7 +257,7 @@ const INT_TYPE2 /***********************/ /* function prototypes */ /***********************/ -double randlc( double *X, double *A ); +double randlc( double *X, double *A ); void full_verify( global_data* gd ); @@ -271,7 +271,7 @@ void c_print_results( char *name, int nprocs_total, double t, double mops, - char *optype, + char *optype, int passed_verification, char *npbversion, char *compiletime, @@ -343,17 +343,17 @@ double timer_read(global_data* gd, int n ) { /************* portable random number generator ************/ /*****************************************************************/ -double randlc( double *X, double *A ) +double randlc( double *X, double *A ) { static int KS=0; - static double R23, R46, T23, T46; - double T1, T2, T3, T4; - double A1; - double A2; - double X1; - double X2; - double Z; - int i, j; + static double R23, R46, T23, T46; + double T1, T2, T3, T4; + double A1; + double A2; + double X1; + double X2; + double Z; + int i, j; if (KS == 0) { @@ -470,22 +470,22 @@ double find_my_seed( int kn, /* my processor rank, 0<=kn<=num procs */ /************* C R E A T E _ S E Q ************/ /*****************************************************************/ -void create_seq( global_data* gd, double seed, double a ) +void create_seq( global_data* gd, double seed, double a ) { - double x; - int i, k; + double x; + int i, k; k = MAX_KEY/4; - for (i=0; ikey_array[i] = k*x; - } + } } @@ -823,12 +823,12 @@ void rank( global_data* gd, int iteration ) break; case 'A': if( i <= 2 ) - { + { if( key_rank != gd->test_rank_array[i]+(iteration-1) ) failed = 1; else gd->passed_verification++; - } + } else { if( key_rank != gd->test_rank_array[i]-(iteration-1) ) @@ -839,12 +839,12 @@ void rank( global_data* gd, int iteration ) break; case 'B': if( i == 1 || i == 2 || i == 4 ) - { + { if( key_rank != gd->test_rank_array[i]+iteration ) failed = 1; else gd->passed_verification++; - } + } else { if( key_rank != gd->test_rank_array[i]-iteration ) @@ -855,12 +855,12 @@ void rank( global_data* gd, int iteration ) break; case 'C': if( i <= 2 ) - { + { if( key_rank != gd->test_rank_array[i]+iteration ) failed = 1; else gd->passed_verification++; - } + } else { if( key_rank != gd->test_rank_array[i]-iteration ) @@ -871,12 +871,12 @@ void rank( global_data* gd, int iteration ) break; case 'D': if( i < 2 ) - { + { if( key_rank != gd->test_rank_array[i]+iteration ) failed = 1; else gd->passed_verification++; - } + } else { if( key_rank != gd->test_rank_array[i]-iteration ) diff --git a/examples/smpi/NAS/common/c_print_results.c b/examples/smpi/NAS/common/c_print_results.c index d7417fba15..14a9d880d8 100644 --- a/examples/smpi/NAS/common/c_print_results.c +++ b/examples/smpi/NAS/common/c_print_results.c @@ -14,7 +14,7 @@ void c_print_results( char *name, int nprocs_total, double t, double mops, - char *optype, + char *optype, int passed_verification, char *npbversion, char *compiletime, diff --git a/examples/smpi/NAS/common/randdp.c b/examples/smpi/NAS/common/randdp.c index 676624795d..03901354c3 100644 --- a/examples/smpi/NAS/common/randdp.c +++ b/examples/smpi/NAS/common/randdp.c @@ -2,19 +2,19 @@ // This function is C verson of random number generator randdp.f //--------------------------------------------------------------------- -double randlc(X, A) +double randlc(X, A) double *X; double *A; { static int KS=0; - static double R23, R46, T23, T46; - double T1, T2, T3, T4; - double A1; - double A2; - double X1; - double X2; - double Z; - int i, j; + static double R23, R46, T23, T46; + double T1, T2, T3, T4; + double A1; + double A2; + double X1; + double X2; + double Z; + int i, j; if (KS == 0) { diff --git a/examples/smpi/NAS/sys/setparams.c b/examples/smpi/NAS/sys/setparams.c index 9a4fba590c..70fca1cffc 100644 --- a/examples/smpi/NAS/sys/setparams.c +++ b/examples/smpi/NAS/sys/setparams.c @@ -66,7 +66,7 @@ int fortran_rec_size = 4; #endif void get_info(int argc, char *argv[], int *typep, int *nprocsp, char *classp, - int* subtypep); + int* subtypep); void check_info(int type, int nprocs, char class); void read_info(int type, int *nprocsp, char *classp, int *subtypep); void write_info(int type, int nprocs, char class, int subtype); @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) if (class != 'U') { #ifdef VERBOSE printf("setparams: For benchmark %s: number of processors = %d class = %c\n", - argv[1], nprocs, class); + argv[1], nprocs, class); #endif check_info(type, nprocs, class); } @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) if (class_old != 'X') { #ifdef VERBOSE printf("setparams: old settings: number of processors = %d class = %c\n", - nprocs_old, class_old); + nprocs_old, class_old); #endif } } else { @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) if (class_old != 'X') { #ifdef VERBOSE printf("setparams: Previous settings were CLASS=%c NPROCS=%d\n", - class_old, nprocs_old); + class_old, nprocs_old); #endif } exit(1); /* exit on class==U */ @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) */ void get_info(int argc, char *argv[], int *typep, int *nprocsp, char *classp, - int *subtypep) + int *subtypep) { if (argc < 4) { @@ -307,29 +307,29 @@ void read_info(int type, int *nprocsp, char *classp, int *subtypep) switch(type) { case BT: { - char subtype_str[100]; + char subtype_str[100]; nread = fscanf(fp, BT_DESC_LINE, nprocsp, classp, subtype_str); if (nread != 3) { if (nread != 2) { printf("setparams: Error parsing config file %s. Ignoring previous settings\n", FILENAME); goto abort; - } - *subtypep = 0; - break; + } + *subtypep = 0; + break; } if (!strcmp(subtype_str, "full") || !strcmp(subtype_str, "FULL")) { - *subtypep = FULL; + *subtypep = FULL; } else if (!strcmp(subtype_str, "simple") || - !strcmp(subtype_str, "SIMPLE")) { - *subtypep = SIMPLE; + !strcmp(subtype_str, "SIMPLE")) { + *subtypep = SIMPLE; } else if (!strcmp(subtype_str, "epio") || !strcmp(subtype_str, "EPIO")) { - *subtypep = EPIO; + *subtypep = EPIO; } else if (!strcmp(subtype_str, "fortran") || - !strcmp(subtype_str, "FORTRAN")) { - *subtypep = FORTRAN; + !strcmp(subtype_str, "FORTRAN")) { + *subtypep = FORTRAN; } else { - *subtypep = -1; - } + *subtypep = -1; + } break; } @@ -395,11 +395,11 @@ void write_info(int type, int nprocs, char class, int subtype) switch(type) { case BT: /* Write out the header */ - if (subtype == -1 || subtype == 0) { + if (subtype == -1 || subtype == 0) { fprintf(fp, DESC_LINE, nprocs, class); - } else { + } else { fprintf(fp, BT_DESC_LINE, nprocs, class, BT_TYPES[subtype]); - } + } /* Print out a warning so bozos don't mess with the file */ fprintf(fp, "\ c \n\ @@ -410,7 +410,7 @@ c in this directory. Do not modify it by hand.\n\ c \n"); break; - + case SP: case FT: case MG: @@ -429,7 +429,7 @@ c in this directory. Do not modify it by hand.\n\ c \n"); break; - case EP: + case EP: case IS: case DT: fprintf(fp, DEF_CLASS_LINE, class); @@ -510,7 +510,7 @@ void write_sp_info(FILE *fp, int nprocs, char class) } fprintf(fp, "%sinteger maxcells, problem_size, niter_default\n", FINDENT); fprintf(fp, "%sparameter (maxcells=%d, problem_size=%d, niter_default=%d)\n", - FINDENT, maxcells, problem_size, niter); + FINDENT, maxcells, problem_size, niter); fprintf(fp, "%sdouble precision dt_default\n", FINDENT); fprintf(fp, "%sparameter (dt_default = %s)\n", FINDENT, dt); } @@ -538,7 +538,7 @@ void write_bt_info(FILE *fp, int nprocs, char class, int io) wr_interval = 5; fprintf(fp, "%sinteger maxcells, problem_size, niter_default\n", FINDENT); fprintf(fp, "%sparameter (maxcells=%d, problem_size=%d, niter_default=%d)\n", - FINDENT, maxcells, problem_size, niter); + FINDENT, maxcells, problem_size, niter); fprintf(fp, "%sdouble precision dt_default\n", FINDENT); fprintf(fp, "%sparameter (dt_default = %s)\n", FINDENT, dt); fprintf(fp, "%sinteger wr_default\n", FINDENT); @@ -548,23 +548,23 @@ void write_bt_info(FILE *fp, int nprocs, char class, int io) if (io) { fprintf(fp, "%scharacter*(*) filenm\n", FINDENT); switch (io) { - case FULL: - fprintf(fp, "%sparameter (filenm = 'btio.full.out')\n", FINDENT); - break; - case SIMPLE: - fprintf(fp, "%sparameter (filenm = 'btio.simple.out')\n", FINDENT); - break; - case EPIO: - fprintf(fp, "%sparameter (filenm = 'btio.epio.out')\n", FINDENT); - break; - case FORTRAN: - fprintf(fp, "%sparameter (filenm = 'btio.fortran.out')\n", FINDENT); - fprintf(fp, "%sinteger fortran_rec_sz\n", FINDENT); - fprintf(fp, "%sparameter (fortran_rec_sz = %d)\n", - FINDENT, fortran_rec_size); - break; - default: - break; + case FULL: + fprintf(fp, "%sparameter (filenm = 'btio.full.out')\n", FINDENT); + break; + case SIMPLE: + fprintf(fp, "%sparameter (filenm = 'btio.simple.out')\n", FINDENT); + break; + case EPIO: + fprintf(fp, "%sparameter (filenm = 'btio.epio.out')\n", FINDENT); + break; + case FORTRAN: + fprintf(fp, "%sparameter (filenm = 'btio.fortran.out')\n", FINDENT); + fprintf(fp, "%sinteger fortran_rec_sz\n", FINDENT); + fprintf(fp, "%sparameter (fortran_rec_sz = %d)\n", + FINDENT, fortran_rec_size); + break; + default: + break; } } } @@ -607,17 +607,17 @@ void write_lu_info(FILE *fp, int nprocs, char class) fprintf(fp, "\nc full problem size\n"); fprintf(fp, "%sinteger isiz01, isiz02, isiz03\n", FINDENT); fprintf(fp, "%sparameter (isiz01=%d, isiz02=%d, isiz03=%d)\n", - FINDENT, problem_size, problem_size, problem_size); + FINDENT, problem_size, problem_size, problem_size); fprintf(fp, "\nc sub-domain array size\n"); fprintf(fp, "%sinteger isiz1, isiz2, isiz3\n", FINDENT); fprintf(fp, "%sparameter (isiz1=%d, isiz2=%d, isiz3=isiz03)\n", - FINDENT, isiz1, isiz2); + FINDENT, isiz1, isiz2); fprintf(fp, "\nc number of iterations and how often to print the norm\n"); fprintf(fp, "%sinteger itmax_default, inorm_default\n", FINDENT); fprintf(fp, "%sparameter (itmax_default=%d, inorm_default=%d)\n", - FINDENT, itmax, inorm); + FINDENT, itmax, inorm); fprintf(fp, "%sdouble precision dt_default\n", FINDENT); fprintf(fp, "%sparameter (dt_default = %s)\n", FINDENT, dt_default); @@ -657,15 +657,15 @@ void write_mg_info(FILE *fp, int nprocs, char class) fprintf(fp, "%sparameter (nprocs_compiled = %d)\n", FINDENT, nprocs); fprintf(fp, "%sinteger nx_default, ny_default, nz_default\n", FINDENT); fprintf(fp, "%sparameter (nx_default=%d, ny_default=%d, nz_default=%d)\n", - FINDENT, problem_size, problem_size, problem_size); + FINDENT, problem_size, problem_size, problem_size); fprintf(fp, "%sinteger nit_default, lm, lt_default\n", FINDENT); fprintf(fp, "%sparameter (nit_default=%d, lm = %d, lt_default=%d)\n", - FINDENT, nit, lm, lt_default); + FINDENT, nit, lm, lt_default); fprintf(fp, "%sinteger debug_default\n", FINDENT); fprintf(fp, "%sparameter (debug_default=%d)\n", FINDENT, 0); fprintf(fp, "%sinteger ndim1, ndim2, ndim3\n", FINDENT); fprintf(fp, "%sparameter (ndim1 = %d, ndim2 = %d, ndim3 = %d)\n", - FINDENT, ndim1, ndim2, ndim3); + FINDENT, ndim1, ndim2, ndim3); } @@ -966,7 +966,7 @@ setparams: File %s doesn't exist. To build the NAS benchmarks\n\ put_string(fp, "cs4", fmpi_inc); put_string(fp, "cs5", fflags); put_string(fp, "cs6", flinkflags); - put_string(fp, "cs7", randfile); + put_string(fp, "cs7", randfile); break; case IS: case EP: diff --git a/examples/smpi/dsend.c b/examples/smpi/dsend.c index 674aa819fe..c304c5da31 100644 --- a/examples/smpi/dsend.c +++ b/examples/smpi/dsend.c @@ -19,14 +19,14 @@ int main(int argc, char *argv[]) { MPI_Comm_rank(MPI_COMM_WORLD, &rank); if (rank==1) { - data=22; - MPI_Send(&data,1,MPI_INT,(rank+1)%2,666,MPI_COMM_WORLD); -// smpi_sleep(1000); + data=22; + MPI_Send(&data,1,MPI_INT,(rank+1)%2,666,MPI_COMM_WORLD); +// smpi_sleep(1000); } else { - MPI_Recv(&data,1,MPI_INT,-1,666,MPI_COMM_WORLD,NULL); - if (data !=22) { - printf("rank %d: Damn, data does not match (got %d)\n",rank, data); - } + MPI_Recv(&data,1,MPI_INT,-1,666,MPI_COMM_WORLD,NULL); + if (data !=22) { + printf("rank %d: Damn, data does not match (got %d)\n",rank, data); + } } XBT_INFO("rank %d: data exchanged", rank); diff --git a/examples/xbt/sem_basic.c b/examples/xbt/sem_basic.c index c840eb66f1..7b36a83986 100644 --- a/examples/xbt/sem_basic.c +++ b/examples/xbt/sem_basic.c @@ -16,7 +16,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(sem_basic, -#define THREAD_THREADS_MAX ((unsigned int)10) +#define THREAD_THREADS_MAX ((unsigned int)10) /* * the thread funtion. diff --git a/examples/xbt/sem_sched.c b/examples/xbt/sem_sched.c index 64a6bf1bb9..337d8c5371 100644 --- a/examples/xbt/sem_sched.c +++ b/examples/xbt/sem_sched.c @@ -17,14 +17,14 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(sem_sched, "Messages specific for this sem example"); #ifndef ENOBUFS -#define ENOBUFS 1024 +#define ENOBUFS 1024 #endif -#define CTX_MAX ((unsigned int)1000) +#define CTX_MAX ((unsigned int)1000) -#define MAX_ARG 30 -#define MAX_ARGS 10 +#define MAX_ARG 30 +#define MAX_ARGS 10 typedef int (*pfn_func_t) (int, char **); diff --git a/include/instr/jedule/jedule_events.h b/include/instr/jedule/jedule_events.h index 9ea2893209..1a665a8a28 100644 --- a/include/instr/jedule/jedule_events.h +++ b/include/instr/jedule/jedule_events.h @@ -19,14 +19,14 @@ #ifdef HAVE_JEDULE struct jed_event { - int event_id; - char *name; - double start_time; - double end_time; - char *type; - xbt_dynar_t resource_subsets; - xbt_dynar_t characteristics_list; /* just a list of names (strings) */ - xbt_dict_t info_hash; /* key/value pairs */ + int event_id; + char *name; + double start_time; + double end_time; + char *type; + xbt_dynar_t resource_subsets; + xbt_dynar_t characteristics_list; /* just a list of names (strings) */ + xbt_dict_t info_hash; /* key/value pairs */ }; typedef struct jed_event s_jed_event_t, *jed_event_t; diff --git a/include/instr/jedule/jedule_output.h b/include/instr/jedule/jedule_output.h index a735ff7e2f..1e3287a65e 100644 --- a/include/instr/jedule/jedule_output.h +++ b/include/instr/jedule/jedule_output.h @@ -26,7 +26,7 @@ void jedule_cleanup_output(void); void jedule_store_event(jed_event_t event); void write_jedule_output(FILE *file, jedule_t jedule, - xbt_dynar_t event_list, xbt_dict_t meta_info_dict); + xbt_dynar_t event_list, xbt_dict_t meta_info_dict); #endif diff --git a/include/instr/jedule/jedule_platform.h b/include/instr/jedule/jedule_platform.h index 8999e03d7b..282821eb02 100644 --- a/include/instr/jedule/jedule_platform.h +++ b/include/instr/jedule/jedule_platform.h @@ -16,17 +16,17 @@ #ifdef HAVE_JEDULE typedef struct jed_simgrid_container s_jed_simgrid_container_t, - *jed_simgrid_container_t; + *jed_simgrid_container_t; struct jed_simgrid_container { - char *name; - xbt_dynar_t container_children; - jed_simgrid_container_t parent; - xbt_dynar_t resource_list; - xbt_dict_t name2id; - int last_id; - int is_lowest; + char *name; + xbt_dynar_t container_children; + jed_simgrid_container_t parent; + xbt_dynar_t resource_list; + xbt_dict_t name2id; + int last_id; + int is_lowest; }; @@ -35,16 +35,16 @@ struct jed_simgrid_container { * */ struct jed_res_subset { - jed_simgrid_container_t parent; - int start_idx; // start idx in resource_list of container - int nres; // number of resources spanning starting at start_idx + jed_simgrid_container_t parent; + int start_idx; // start idx in resource_list of container + int nres; // number of resources spanning starting at start_idx }; typedef struct jed_res_subset s_jed_res_subset_t, *jed_res_subset_t; struct jedule_struct { - jed_simgrid_container_t root_container; - xbt_dict_t jedule_meta_info; + jed_simgrid_container_t root_container; + xbt_dict_t jedule_meta_info; }; typedef struct jedule_struct s_jedule_t, *jedule_t; @@ -61,10 +61,10 @@ void jedule_add_meta_info(jedule_t jedule, char *key, char *value); void jed_simgrid_create_container(jed_simgrid_container_t *container, char *name); void jed_simgrid_add_container(jed_simgrid_container_t parent, - jed_simgrid_container_t child); + jed_simgrid_container_t child); void jed_simgrid_add_resources(jed_simgrid_container_t parent, - xbt_dynar_t host_names); + xbt_dynar_t host_names); /** * @@ -75,18 +75,18 @@ void jed_simgrid_add_resources(jed_simgrid_container_t parent, * host_names is the list of host_names associated with an event */ void jed_simgrid_get_resource_selection_by_hosts(xbt_dynar_t subset_list, - xbt_dynar_t host_names); + xbt_dynar_t host_names); /* global: - hash host_id -> container + hash host_id -> container container: - hash host_id -> jed_host_id + hash host_id -> jed_host_id - list <- [ jed_host_ids ] - list <- sort( list ) - list_chunks <- chunk( list ) -> [ 1, 3-5, 7-9 ] + list <- [ jed_host_ids ] + list <- sort( list ) + list_chunks <- chunk( list ) -> [ 1, 3-5, 7-9 ] */ diff --git a/include/simdag/datatypes.h b/include/simdag/datatypes.h index 414c173873..fad284dbb9 100644 --- a/include/simdag/datatypes.h +++ b/include/simdag/datatypes.h @@ -67,7 +67,7 @@ typedef enum { SD_NOT_SCHEDULED = 0, /**< @brief Initial state (not valid for SD_watch and SD_unwatch). */ SD_SCHEDULABLE = 0x0001, /**< @brief A task becomes SD_READY as soon as its dependencies are satisfied */ SD_SCHEDULED = 0x0002, /**< @brief A task becomes SD_SCHEDULED when you call function - SD_task_schedule. SD_simulate will execute it when it becomes SD_RUNNABLE. */ + SD_task_schedule. SD_simulate will execute it when it becomes SD_RUNNABLE. */ SD_RUNNABLE = 0x0004, /**< @brief A scheduled task becomes runnable is SD_simulate as soon as its dependencies are satisfied. */ SD_IN_FIFO = 0x0008, /**< @brief A runnable task can have to wait in a workstation fifo if the workstation is sequential */ SD_RUNNING = 0x0010, /**< @brief An SD_RUNNABLE or SD_IN_FIFO becomes SD_RUNNING when it is launched. */ diff --git a/include/simdag/simdag.h b/include/simdag/simdag.h index 6efd7525eb..b2844d9fc2 100644 --- a/include/simdag/simdag.h +++ b/include/simdag/simdag.h @@ -160,9 +160,9 @@ XBT_PUBLIC(void) SD_task_dotty(SD_task_t task, void *out_FILE); XBT_PUBLIC(SD_task_t) SD_task_create_comp_seq(const char *name, void *data, double amount); XBT_PUBLIC(SD_task_t) SD_task_create_comp_par_amdahl(const char *name, - void *data, - double amount, - double alpha); + void *data, + double amount, + double alpha); XBT_PUBLIC(SD_task_t) SD_task_create_comm_e2e(const char *name, void *data, double amount); diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index dfd7ac010a..8ec4bf4f50 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -320,7 +320,7 @@ XBT_PUBLIC(void) simcall_process_killall(void); /* Process handling */ XBT_PUBLIC(void) simcall_process_cleanup(smx_process_t process); XBT_PUBLIC(void) simcall_process_change_host(smx_process_t process, - smx_host_t dest); + smx_host_t dest); XBT_PUBLIC(void) simcall_process_suspend(smx_process_t process); XBT_PUBLIC(void) simcall_process_resume(smx_process_t process); diff --git a/include/surf/surf_routing.h b/include/surf/surf_routing.h index 1e355c6f97..d7459ac3e9 100644 --- a/include/surf/surf_routing.h +++ b/include/surf/surf_routing.h @@ -11,23 +11,23 @@ extern xbt_lib_t host_lib; extern int ROUTING_HOST_LEVEL; //Routing level -extern int SURF_CPU_LEVEL; //Surf cpu level -extern int SURF_WKS_LEVEL; //Surf workstation level -extern int SIMIX_HOST_LEVEL; //Simix level -extern int MSG_HOST_LEVEL; //Msg level -extern int SD_HOST_LEVEL; //Simdag level -extern int COORD_HOST_LEVEL; //Coordinates level -extern int NS3_HOST_LEVEL; //host node for ns3 +extern int SURF_CPU_LEVEL; //Surf cpu level +extern int SURF_WKS_LEVEL; //Surf workstation level +extern int SIMIX_HOST_LEVEL; //Simix level +extern int MSG_HOST_LEVEL; //Msg level +extern int SD_HOST_LEVEL; //Simdag level +extern int COORD_HOST_LEVEL; //Coordinates level +extern int NS3_HOST_LEVEL; //host node for ns3 extern xbt_lib_t link_lib; -extern int SD_LINK_LEVEL; //Simdag level -extern int SURF_LINK_LEVEL; //Surf level -extern int NS3_LINK_LEVEL; //link for ns3 +extern int SD_LINK_LEVEL; //Simdag level +extern int SURF_LINK_LEVEL; //Surf level +extern int NS3_LINK_LEVEL; //link for ns3 extern xbt_lib_t as_router_lib; -extern int ROUTING_ASR_LEVEL; //Routing level -extern int COORD_ASR_LEVEL; //Coordinates level -extern int NS3_ASR_LEVEL; //host node for ns3 +extern int ROUTING_ASR_LEVEL; //Routing level +extern int COORD_ASR_LEVEL; //Coordinates level +extern int NS3_ASR_LEVEL; //host node for ns3 extern xbt_lib_t storage_lib; extern int ROUTING_STORAGE_LEVEL; //Routing storage level diff --git a/include/xbt/asserts.h b/include/xbt/asserts.h index e02965353c..dcb0e0522b 100644 --- a/include/xbt/asserts.h +++ b/include/xbt/asserts.h @@ -32,7 +32,7 @@ SG_BEGIN_DECL() #define xbt_assert(...) ((void)0) #else /** @brief The condition which failed will be displayed. - @hideinitializer */ + @hideinitializer */ #define xbt_assert(...) \ _XBT_IF_ONE_ARG(_xbt_assert_ARG1, _xbt_assert_ARGN, __VA_ARGS__)(__VA_ARGS__) #define _xbt_assert_ARG1(cond) \ diff --git a/include/xbt/automatonparse_promela.h b/include/xbt/automatonparse_promela.h index c80c34db2b..d461474458 100644 --- a/include/xbt/automatonparse_promela.h +++ b/include/xbt/automatonparse_promela.h @@ -18,7 +18,7 @@ XBT_PUBLIC(void) new_transition(char* id, xbt_exp_label_t label); XBT_PUBLIC(xbt_exp_label_t) new_label(int type, ...); XBT_PUBLIC(xbt_automaton_t) get_automaton(void); - + XBT_PUBLIC(void) display_automaton(void); SG_END_DECL() diff --git a/include/xbt/datadesc.h b/include/xbt/datadesc.h index fdc1c79ec2..32d20cb56f 100644 --- a/include/xbt/datadesc.h +++ b/include/xbt/datadesc.h @@ -258,7 +258,7 @@ int server(int argc, char *argv[]) { (xbt_datadesc_by_name_or_null(#name) ? \ xbt_datadesc_by_name_or_null(#name) : \ xbt_datadesc_parse(#name, \ - _xbt_this_type_symbol_does_not_exist__##name) \ + _xbt_this_type_symbol_does_not_exist__##name) \ ) /** @def XBT_ANNOTE diff --git a/include/xbt/dynar.h b/include/xbt/dynar.h index 87b501c655..d2117851ab 100644 --- a/include/xbt/dynar.h +++ b/include/xbt/dynar.h @@ -279,7 +279,7 @@ xbt_dynar_foreach (dyn,cpt,str) { */ #define xbt_dynar_foreach(_dynar,_cursor,_data) \ for (_xbt_dynar_cursor_first(_dynar,&(_cursor)) ; \ - _xbt_dynar_cursor_get(_dynar,_cursor,&_data) ; \ + _xbt_dynar_cursor_get(_dynar,_cursor,&_data) ; \ (_cursor)++ ) /** @} */ diff --git a/include/xbt/ex.h b/include/xbt/ex.h index b7903c152a..a6db6fc792 100644 --- a/include/xbt/ex.h +++ b/include/xbt/ex.h @@ -65,7 +65,7 @@ SG_BEGIN_DECL() # define MAYDAY_CATCH(e) printf("%d %s:%d Catched '%s'\n", \ xbt_getpid(), __FILE__, __LINE__, \ (e).msg \ - ), + ), #else # define MAYDAY_SAVE(m) # define MAYDAY_RESTORE(m) diff --git a/include/xbt/log.h b/include/xbt/log.h index 1dcdfde590..fe199ac475 100644 --- a/include/xbt/log.h +++ b/include/xbt/log.h @@ -185,7 +185,7 @@ typedef enum { # define XBT_LOG_DEFAULT_CATEGORY(cname) #else # define XBT_LOG_DEFAULT_CATEGORY(cname) \ - static xbt_log_category_t _XBT_LOGV(default) _XBT_GNUC_UNUSED = &_XBT_LOGV(cname) + static xbt_log_category_t _XBT_LOGV(default) _XBT_GNUC_UNUSED = &_XBT_LOGV(cname) #endif /** diff --git a/include/xbt/misc.h b/include/xbt/misc.h index 485598becf..5260bce95e 100644 --- a/include/xbt/misc.h +++ b/include/xbt/misc.h @@ -12,9 +12,9 @@ /* Attributes are only in recent versions of GCC */ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)) # define _XBT_GNUC_PRINTF( format_idx, arg_idx ) \ - __attribute__((__format__ (__printf__, format_idx, arg_idx))) + __attribute__((__format__ (__printf__, format_idx, arg_idx))) # define _XBT_GNUC_SCANF( format_idx, arg_idx ) \ - __attribute__((__format__ (__scanf__, format_idx, arg_idx))) + __attribute__((__format__ (__scanf__, format_idx, arg_idx))) # define _XBT_GNUC_NORETURN __attribute__((__noreturn__)) # define _XBT_GNUC_UNUSED __attribute__((__unused__)) /* Constructor priorities exist since gcc 4.3. Apparently, they are however not @@ -63,11 +63,11 @@ # define XBT_INLINE # endif # else -# if defined (__VISUALC__) -# define XBT_INLINE __inline -# else -# define XBT_INLINE inline -# endif +# if defined (__VISUALC__) +# define XBT_INLINE __inline +# else +# define XBT_INLINE inline +# endif # endif /* __cplusplus */ #endif @@ -166,7 +166,7 @@ # define XBT_PUBLIC(type) __declspec(dllexport) type # define XBT_EXPORT_NO_IMPORT(type) __declspec(dllexport) type # define XBT_IMPORT_NO_EXPORT(type) type -# define XBT_PUBLIC_DATA(type) __declspec(dllexport) type +# define XBT_PUBLIC_DATA(type) __declspec(dllexport) type /* Pack everything up statically */ #elif defined(DLL_STATIC) @@ -177,10 +177,10 @@ /* Link against the DLL */ #elif (defined(_XBT_WIN32) && !defined(DLL_EXPORT) && !defined(DLL_STATIC)) -# define XBT_PUBLIC(type) __declspec(dllimport) type -# define XBT_EXPORT_NO_IMPORT(type) type -# define XBT_IMPORT_NO_EXPORT(type) __declspec(dllimport) type -# define XBT_PUBLIC_DATA(type) __declspec(dllimport) type +# define XBT_PUBLIC(type) __declspec(dllimport) type +# define XBT_EXPORT_NO_IMPORT(type) type +# define XBT_IMPORT_NO_EXPORT(type) __declspec(dllimport) type +# define XBT_PUBLIC_DATA(type) __declspec(dllimport) type /* UNIX build */ #else @@ -191,10 +191,10 @@ #endif #if !defined (max) && !defined(__cplusplus) -# define max(a,b) (((a) > (b)) ? (a) : (b)) +# define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #if !defined (min) && !defined(__cplusplus) -# define min(a,b) (((a) < (b)) ? (a) : (b)) +# define min(a,b) (((a) < (b)) ? (a) : (b)) #endif #define TRUE 1 diff --git a/include/xbt/parmap.h b/include/xbt/parmap.h index bb45845b67..3b9f9ed8fa 100644 --- a/include/xbt/parmap.h +++ b/include/xbt/parmap.h @@ -16,7 +16,7 @@ SG_BEGIN_DECL() /** \addtogroup XBT_parmap - * \ingroup XBT_misc + * \ingroup XBT_misc * \brief Parallel map. * * A function is applied to all elements of a dynar in parallel with n worker diff --git a/include/xbt/swag.h b/include/xbt/swag.h index fa29a5a016..69004c3ebc 100644 --- a/include/xbt/swag.h +++ b/include/xbt/swag.h @@ -168,7 +168,7 @@ static XBT_INLINE void *xbt_swag_getFirst(xbt_swag_t swag) #define xbt_swag_foreach_safe(obj,obj_next,swag) \ for((obj)=xbt_swag_getFirst((swag)), \ ((obj)?(obj_next=xbt_swag_getNext((obj),(swag)->offset)): \ - (obj_next=NULL)); \ + (obj_next=NULL)); \ (obj)!=NULL; \ (obj)=obj_next, \ ((obj)?(obj_next=xbt_swag_getNext((obj),(swag)->offset)): \ diff --git a/include/xbt/time.h b/include/xbt/time.h index 2a7ebad897..6795b051dd 100644 --- a/include/xbt/time.h +++ b/include/xbt/time.h @@ -1,4 +1,4 @@ -/* xbt/time.h -- Time tools */ +/* xbt/time.h -- Time tools */ /* Usable in simulator, (or in real life when mixing with GRAS) */ /* Copyright (c) 2007, 2009, 2010. The SimGrid Team. diff --git a/src/gras/Msg/gras_msg_listener.c b/src/gras/Msg/gras_msg_listener.c index ca62d02f4a..0dcc36fb46 100644 --- a/src/gras/Msg/gras_msg_listener.c +++ b/src/gras/Msg/gras_msg_listener.c @@ -62,8 +62,8 @@ static void listener_function(void *p) while (1) { msg = gras_msg_recv_any(); if (msg->type != msg_wakeup_listener_t) { - /* Cannot display who sent this since in SG, xbt_socket_peer_* wont work: - I'm not the user process but I'm just the listener. Too bad */ + /* Cannot display who sent this since in SG, xbt_socket_peer_* wont work: + I'm not the user process but I'm just the listener. Too bad */ XBT_VERB("Got a '%s' message (%s) from sock %p. Queue it for handling by main thread", gras_msgtype_get_name(msg->type),e_gras_msg_kind_names[msg->kind],msg->expe); xbt_queue_push(me->incoming_messages, msg); diff --git a/src/gras/Msg/sg_msg.c b/src/gras/Msg/sg_msg.c index 3816885af6..78d510d990 100644 --- a/src/gras/Msg/sg_msg.c +++ b/src/gras/Msg/sg_msg.c @@ -72,7 +72,7 @@ int gras_socket_im_the_server(xbt_socket_t sock) listener_thread = ((fake_gras_msg_listener_t)l)->listener; client_listener_process = ((fake_xbt_thread_t)listener_thread)->s_process; if (client_listener_process == SIMIX_process_self()) { - XBT_VERB("I am the listener of the client"); + XBT_VERB("I am the listener of the client"); return 0; } } diff --git a/src/gras/Transport/sg_transport.c b/src/gras/Transport/sg_transport.c index 8e52a7569a..d8bf5b02f7 100644 --- a/src/gras/Transport/sg_transport.c +++ b/src/gras/Transport/sg_transport.c @@ -17,7 +17,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_trp); xbt_socket_t _gras_lastly_selected_socket = NULL; #ifdef KILLME -/** +/** * gras_trp_select: * * Returns the next socket to service having a message awaiting. diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 310ecd0159..df8f9c949c 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -79,16 +79,16 @@ typedef struct surf_action { double cost; /**< cost */ double priority; /**< priority (1.0 by default) */ double max_duration; /**< max_duration (may fluctuate until - the task is completed) */ + the task is completed) */ double remains; /**< How much of that cost remains to - * be done in the currently running task */ + * be done in the currently running task */ #ifdef HAVE_LATENCY_BOUND_TRACKING int latency_limited; /**< Set to 1 if is limited by latency, 0 otherwise */ #endif double start; /**< start time */ double finish; /**< finish time : this is modified during the run - * and fluctuates until the task is completed */ + * and fluctuates until the task is completed */ void *data; /**< for your convenience */ int refcount; surf_model_t model_type; @@ -233,7 +233,7 @@ typedef struct surf_storage_model_extension_public { */ typedef struct surf_workstation_model_extension_public { surf_action_t(*execute) (void *workstation, double size); /**< Execute a computation amount on a workstation - and create the corresponding action */ + and create the corresponding action */ surf_action_t(*sleep) (void *workstation, double duration); /**< Make a workstation sleep during a given duration */ e_surf_resource_state_t(*get_state) (void *workstation); /**< Return the CPU state of a workstation */ double (*get_speed) (void *workstation, double load); /**< Return the speed of a workstation */ @@ -332,10 +332,10 @@ surf_model_t surf_model_init(void); void surf_model_exit(surf_model_t model); static inline void *surf_cpu_resource_by_name(const char *name) { - return xbt_lib_get_or_null(host_lib, name, SURF_CPU_LEVEL); + return xbt_lib_get_or_null(host_lib, name, SURF_CPU_LEVEL); } static inline void *surf_workstation_resource_by_name(const char *name){ - return xbt_lib_get_or_null(host_lib, name, SURF_WKS_LEVEL); + return xbt_lib_get_or_null(host_lib, name, SURF_WKS_LEVEL); } static inline void *surf_storage_resource_by_name(const char *name){ return xbt_lib_get_or_null(storage_lib, name, SURF_STORAGE_LEVEL); diff --git a/src/include/surf/surfxml_parse_values.h b/src/include/surf/surfxml_parse_values.h index d030d07a19..0092095617 100644 --- a/src/include/surf/surfxml_parse_values.h +++ b/src/include/surf/surfxml_parse_values.h @@ -10,8 +10,8 @@ typedef struct s_surf_parsing_link_up_down *surf_parsing_link_up_down_t; typedef struct s_surf_parsing_link_up_down { - void* link_up; - void* link_down; + void* link_up; + void* link_down; } s_surf_parsing_link_up_down_t; #endif /* SURFXML_PARSE_VALUES_H_ */ diff --git a/src/include/surf/trace_mgr.h b/src/include/surf/trace_mgr.h index bfa4b22528..c9961a601b 100644 --- a/src/include/surf/trace_mgr.h +++ b/src/include/surf/trace_mgr.h @@ -23,7 +23,7 @@ XBT_PUBLIC(void) tmgr_trace_free(tmgr_trace_t trace); * \brief Free a trace event structure * * This function frees a trace_event if it can be freed, ie, if it has the free_me flag set to 1. This flag indicates whether the structure is still used somewhere or not. - * \param trace_event Trace event structure + * \param trace_event Trace event structure * \return 1 if the structure was freed, 0 otherwise */ XBT_PUBLIC(int) tmgr_trace_event_free(tmgr_trace_event_t trace_event); diff --git a/src/instr/instr_paje_trace.c b/src/instr/instr_paje_trace.c index df1b98f411..a9540ca361 100644 --- a/src/instr/instr_paje_trace.c +++ b/src/instr/instr_paje_trace.c @@ -354,7 +354,7 @@ static void insert_into_buffer (paje_event_t tbi) return; } XBT_DEBUG("%s: insert event_type=%d, timestamp=%f, buffersize=%lu)", - __FUNCTION__, (int)tbi->event_type, tbi->timestamp, xbt_dynar_length(buffer)); + __FUNCTION__, (int)tbi->event_type, tbi->timestamp, xbt_dynar_length(buffer)); unsigned int i; for (i = xbt_dynar_length(buffer); i > 0; i--) { diff --git a/src/instr/jedule/jedule_events.c b/src/instr/jedule/jedule_events.c index 8d235a0209..e5175e9c0d 100644 --- a/src/instr/jedule/jedule_events.c +++ b/src/instr/jedule/jedule_events.c @@ -19,66 +19,66 @@ #ifdef HAVE_JEDULE void jed_event_add_resources(jed_event_t event, xbt_dynar_t host_selection) { - xbt_dynar_t resource_subset_list; - jed_res_subset_t res_set; - unsigned int i; + xbt_dynar_t resource_subset_list; + jed_res_subset_t res_set; + unsigned int i; - resource_subset_list = xbt_dynar_new(sizeof(jed_res_subset_t), NULL); + resource_subset_list = xbt_dynar_new(sizeof(jed_res_subset_t), NULL); - jed_simgrid_get_resource_selection_by_hosts(resource_subset_list, host_selection); - xbt_dynar_foreach(resource_subset_list, i, res_set) { - xbt_dynar_push(event->resource_subsets, &res_set); - } + jed_simgrid_get_resource_selection_by_hosts(resource_subset_list, host_selection); + xbt_dynar_foreach(resource_subset_list, i, res_set) { + xbt_dynar_push(event->resource_subsets, &res_set); + } - xbt_dynar_free(&resource_subset_list); + xbt_dynar_free(&resource_subset_list); } void jed_event_add_characteristic(jed_event_t event, char *characteristic) { - xbt_assert( characteristic != NULL ); - xbt_dynar_push(event->characteristics_list, &characteristic); + xbt_assert( characteristic != NULL ); + xbt_dynar_push(event->characteristics_list, &characteristic); } void jed_event_add_info(jed_event_t event, char *key, char *value) { - char *val_cp; + char *val_cp; - xbt_assert(key != NULL); - xbt_assert(value != NULL); + xbt_assert(key != NULL); + xbt_assert(value != NULL); - val_cp = strdup(value); - xbt_dict_set(event->info_hash, key, val_cp, NULL); + val_cp = strdup(value); + xbt_dict_set(event->info_hash, key, val_cp, NULL); } void create_jed_event(jed_event_t *event, char *name, double start_time, - double end_time, const char *type) { + double end_time, const char *type) { - *event = (jed_event_t) calloc(1, sizeof(s_jed_event_t)); - (*event)->name = xbt_strdup(name); + *event = (jed_event_t) calloc(1, sizeof(s_jed_event_t)); + (*event)->name = xbt_strdup(name); - (*event)->start_time = start_time; - (*event)->end_time = end_time; + (*event)->start_time = start_time; + (*event)->end_time = end_time; - (*event)->type = xbt_strdup(type); + (*event)->type = xbt_strdup(type); - (*event)->resource_subsets = xbt_dynar_new(sizeof(jed_res_subset_t), NULL); - (*event)->characteristics_list = xbt_dynar_new(sizeof(char*), NULL); - (*event)->info_hash = xbt_dict_new_homogeneous(NULL); + (*event)->resource_subsets = xbt_dynar_new(sizeof(jed_res_subset_t), NULL); + (*event)->characteristics_list = xbt_dynar_new(sizeof(char*), NULL); + (*event)->info_hash = xbt_dict_new_homogeneous(NULL); } void jed_event_free(jed_event_t event) { - free(event->name); - free(event->type); + free(event->name); + free(event->type); - xbt_dynar_free(&event->resource_subsets); + xbt_dynar_free(&event->resource_subsets); - xbt_dynar_free(&event->characteristics_list); - xbt_dict_free(&event->info_hash); + xbt_dynar_free(&event->characteristics_list); + xbt_dict_free(&event->info_hash); - free(event); + free(event); } #endif diff --git a/src/instr/jedule/jedule_output.c b/src/instr/jedule/jedule_output.c index 7cb7af073b..25682b25ec 100644 --- a/src/instr/jedule/jedule_output.c +++ b/src/instr/jedule/jedule_output.c @@ -38,36 +38,36 @@ static void get_hierarchy_list(xbt_dynar_t hier_list, jed_simgrid_container_t co static void get_hierarchy_list(xbt_dynar_t hier_list, jed_simgrid_container_t container) { - xbt_assert( container != NULL ); + xbt_assert( container != NULL ); - if( container->parent != NULL ) { + if( container->parent != NULL ) { - if( container->parent->container_children == NULL ) { - // we are in the last level - get_hierarchy_list(hier_list, container->parent); + if( container->parent->container_children == NULL ) { + // we are in the last level + get_hierarchy_list(hier_list, container->parent); - } else { - unsigned int i; - int child_nb = -1; - jed_simgrid_container_t child_container; + } else { + unsigned int i; + int child_nb = -1; + jed_simgrid_container_t child_container; - xbt_dynar_foreach(container->parent->container_children, i, child_container) { - if( child_container == container ) { - child_nb = i; - break; - } - } + xbt_dynar_foreach(container->parent->container_children, i, child_container) { + if( child_container == container ) { + child_nb = i; + break; + } + } - xbt_assert( child_nb > - 1); + xbt_assert( child_nb > - 1); - xbt_dynar_insert_at(hier_list, 0, &child_nb); + xbt_dynar_insert_at(hier_list, 0, &child_nb); - get_hierarchy_list(hier_list, container->parent); - } - } else { - int top_level = 0; - xbt_dynar_insert_at(hier_list, 0, &top_level); - } + get_hierarchy_list(hier_list, container->parent); + } + } else { + int top_level = 0; + xbt_dynar_insert_at(hier_list, 0, &top_level); + } } @@ -97,158 +97,158 @@ static void get_hierarchy_string(jed_simgrid_container_t container, char *outbuf } static void print_key_value_dict(xbt_dict_t key_value_dict) { - xbt_dict_cursor_t cursor=NULL; - char *key,*data; - - if( key_value_dict != NULL ) { - xbt_dict_foreach(key_value_dict,cursor,key,data) { - fprintf(jed_file, "\n",key,data); - } - } + xbt_dict_cursor_t cursor=NULL; + char *key,*data; + + if( key_value_dict != NULL ) { + xbt_dict_foreach(key_value_dict,cursor,key,data) { + fprintf(jed_file, "\n",key,data); + } + } } static void print_container(jed_simgrid_container_t container) { - unsigned int i; - jed_simgrid_container_t child_container; - - xbt_assert( container != NULL ); - - fprintf(jed_file, "\n", container->name); - if( container->container_children != NULL ) { - xbt_dynar_foreach(container->container_children, i, child_container) { - print_container(child_container); - } - } else { - print_resources(container); - } - fprintf(jed_file, "\n"); + unsigned int i; + jed_simgrid_container_t child_container; + + xbt_assert( container != NULL ); + + fprintf(jed_file, "\n", container->name); + if( container->container_children != NULL ) { + xbt_dynar_foreach(container->container_children, i, child_container) { + print_container(child_container); + } + } else { + print_resources(container); + } + fprintf(jed_file, "\n"); } static void print_resources(jed_simgrid_container_t resource_parent) { - int res_nb; - unsigned int i; - char *res_name; + int res_nb; + unsigned int i; + char *res_name; char resid[1024]; - xbt_assert( resource_parent->resource_list != NULL ); + xbt_assert( resource_parent->resource_list != NULL ); - res_nb = xbt_dynar_length(resource_parent->resource_list); + res_nb = xbt_dynar_length(resource_parent->resource_list); get_hierarchy_string(resource_parent, resid); - fprintf(jed_file, "resource_list, i, res_name) { - fprintf(jed_file, "%s", res_name); - if( i != res_nb-1 ) { - fprintf(jed_file, "|"); - } - } - fprintf(jed_file, "\" />\n"); + fprintf(jed_file, "resource_list, i, res_name) { + fprintf(jed_file, "%s", res_name); + if( i != res_nb-1 ) { + fprintf(jed_file, "|"); + } + } + fprintf(jed_file, "\" />\n"); } static void print_platform(jed_simgrid_container_t root_container) { - fprintf(jed_file, "\n"); - print_container(root_container); - fprintf(jed_file, "\n"); + fprintf(jed_file, "\n"); + print_container(root_container); + fprintf(jed_file, "\n"); } static void print_event(jed_event_t event) { - unsigned int i; - jed_res_subset_t subset; + unsigned int i; + jed_res_subset_t subset; - xbt_assert( event != NULL ); - xbt_assert( event->resource_subsets != NULL ); + xbt_assert( event != NULL ); + xbt_assert( event->resource_subsets != NULL ); - fprintf(jed_file, "\n"); + fprintf(jed_file, "\n"); - fprintf(jed_file, "\n", event->name); - fprintf(jed_file, "\n", event->start_time); - fprintf(jed_file, "\n", event->end_time); - fprintf(jed_file, "\n", event->type); + fprintf(jed_file, "\n", event->name); + fprintf(jed_file, "\n", event->start_time); + fprintf(jed_file, "\n", event->end_time); + fprintf(jed_file, "\n", event->type); - fprintf(jed_file, "\n"); + fprintf(jed_file, "\n"); - xbt_dynar_foreach(event->resource_subsets, i, subset) { + xbt_dynar_foreach(event->resource_subsets, i, subset) { - int start = subset->start_idx; - int end = subset->start_idx + subset->nres - 1; + int start = subset->start_idx; + int end = subset->start_idx + subset->nres - 1; char resid[1024]; get_hierarchy_string(subset->parent, resid); - fprintf(jed_file, "