From: mquinson Date: Mon, 5 Oct 2009 12:26:26 +0000 (+0000) Subject: First prototype of the networking API for SIMIX. It compiles but it is X-Git-Tag: SVN~1016 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7a4e264744a18d8953c3bd5e4a1df05f5d6088b9?hp=5f6e41166f6e37688a8a735582042979ee245a36 First prototype of the networking API for SIMIX. It compiles but it is not used by anyone. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6697 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/include/surf/simgrid_dtd.h b/include/surf/simgrid_dtd.h index 63dc0b2c57..441a053f6f 100644 --- a/include/surf/simgrid_dtd.h +++ b/include/surf/simgrid_dtd.h @@ -1,5 +1,5 @@ /* XML processor/application API for surf/simgrid.dtd. - * Generated 2009/08/14 11:23:44. + * Generated 2009/09/09 17:39:05. * * This program was generated with the FleXML XML processor generator. * FleXML is Copyright (C) 1999-2005 Kristoffer Rose. All rights reserved. @@ -48,372 +48,323 @@ #ifndef _FLEXML_simgrid_H #define _FLEXML_simgrid_H -SG_BEGIN_DECL() - /* XML application entry points. */ -XBT_PUBLIC(void) STag_surfxml_platform(void); -XBT_PUBLIC(void) ETag_surfxml_platform(void); -XBT_PUBLIC(void) STag_surfxml_include(void); -XBT_PUBLIC(void) ETag_surfxml_include(void); -XBT_PUBLIC(void) STag_surfxml_trace(void); -XBT_PUBLIC(void) ETag_surfxml_trace(void); -XBT_PUBLIC(void) STag_surfxml_random(void); -XBT_PUBLIC(void) ETag_surfxml_random(void); -XBT_PUBLIC(void) STag_surfxml_trace_c_connect(void); -XBT_PUBLIC(void) ETag_surfxml_trace_c_connect(void); -XBT_PUBLIC(void) STag_surfxml_set(void); -XBT_PUBLIC(void) ETag_surfxml_set(void); -XBT_PUBLIC(void) STag_surfxml_foreach(void); -XBT_PUBLIC(void) ETag_surfxml_foreach(void); -XBT_PUBLIC(void) STag_surfxml_host(void); -XBT_PUBLIC(void) ETag_surfxml_host(void); -XBT_PUBLIC(void) STag_surfxml_prop(void); -XBT_PUBLIC(void) ETag_surfxml_prop(void); -XBT_PUBLIC(void) STag_surfxml_cluster(void); -XBT_PUBLIC(void) ETag_surfxml_cluster(void); -XBT_PUBLIC(void) STag_surfxml_router(void); -XBT_PUBLIC(void) ETag_surfxml_router(void); -XBT_PUBLIC(void) STag_surfxml_link(void); -XBT_PUBLIC(void) ETag_surfxml_link(void); -XBT_PUBLIC(void) STag_surfxml_route_c_multi(void); -XBT_PUBLIC(void) ETag_surfxml_route_c_multi(void); -XBT_PUBLIC(void) STag_surfxml_route(void); -XBT_PUBLIC(void) ETag_surfxml_route(void); -XBT_PUBLIC(void) STag_surfxml_link_c_ctn(void); -XBT_PUBLIC(void) ETag_surfxml_link_c_ctn(void); -XBT_PUBLIC(void) STag_surfxml_process(void); -XBT_PUBLIC(void) ETag_surfxml_process(void); -XBT_PUBLIC(void) STag_surfxml_argument(void); -XBT_PUBLIC(void) ETag_surfxml_argument(void); +XBT_PUBLIC(void ) STag_surfxml_platform(void); +XBT_PUBLIC(void ) ETag_surfxml_platform(void); +XBT_PUBLIC(void ) STag_surfxml_include(void); +XBT_PUBLIC(void ) ETag_surfxml_include(void); +XBT_PUBLIC(void ) STag_surfxml_trace(void); +XBT_PUBLIC(void ) ETag_surfxml_trace(void); +XBT_PUBLIC(void ) STag_surfxml_random(void); +XBT_PUBLIC(void ) ETag_surfxml_random(void); +XBT_PUBLIC(void ) STag_surfxml_trace_c_connect(void); +XBT_PUBLIC(void ) ETag_surfxml_trace_c_connect(void); +XBT_PUBLIC(void ) STag_surfxml_set(void); +XBT_PUBLIC(void ) ETag_surfxml_set(void); +XBT_PUBLIC(void ) STag_surfxml_foreach(void); +XBT_PUBLIC(void ) ETag_surfxml_foreach(void); +XBT_PUBLIC(void ) STag_surfxml_host(void); +XBT_PUBLIC(void ) ETag_surfxml_host(void); +XBT_PUBLIC(void ) STag_surfxml_prop(void); +XBT_PUBLIC(void ) ETag_surfxml_prop(void); +XBT_PUBLIC(void ) STag_surfxml_cluster(void); +XBT_PUBLIC(void ) ETag_surfxml_cluster(void); +XBT_PUBLIC(void ) STag_surfxml_router(void); +XBT_PUBLIC(void ) ETag_surfxml_router(void); +XBT_PUBLIC(void ) STag_surfxml_link(void); +XBT_PUBLIC(void ) ETag_surfxml_link(void); +XBT_PUBLIC(void ) STag_surfxml_route_c_multi(void); +XBT_PUBLIC(void ) ETag_surfxml_route_c_multi(void); +XBT_PUBLIC(void ) STag_surfxml_route(void); +XBT_PUBLIC(void ) ETag_surfxml_route(void); +XBT_PUBLIC(void ) STag_surfxml_link_c_ctn(void); +XBT_PUBLIC(void ) ETag_surfxml_link_c_ctn(void); +XBT_PUBLIC(void ) STag_surfxml_process(void); +XBT_PUBLIC(void ) ETag_surfxml_process(void); +XBT_PUBLIC(void ) STag_surfxml_argument(void); +XBT_PUBLIC(void ) ETag_surfxml_argument(void); /* XML application data. */ - typedef enum { AU_surfxml_random_generator, - A_surfxml_random_generator_DRAND48, - A_surfxml_random_generator_RAND - } AT_surfxml_random_generator; - typedef int AT_surfxml_prop_id; +typedef enum { AU_surfxml_random_generator, A_surfxml_random_generator_DRAND48,A_surfxml_random_generator_RAND } AT_surfxml_random_generator; +typedef int AT_surfxml_prop_id; #define AU_surfxml_prop_id NULL - typedef int AT_surfxml_host_interference_recv; +typedef int AT_surfxml_host_interference_recv; #define AU_surfxml_host_interference_recv NULL - typedef int AT_surfxml_host_id; +typedef int AT_surfxml_host_id; #define AU_surfxml_host_id NULL - typedef int AT_surfxml_set_id; +typedef int AT_surfxml_set_id; #define AU_surfxml_set_id NULL - typedef int AT_surfxml_link_latency_file; +typedef int AT_surfxml_link_latency_file; #define AU_surfxml_link_latency_file NULL - typedef enum { AU_surfxml_host_state, A_surfxml_host_state_ON, - A_surfxml_host_state_OFF - } AT_surfxml_host_state; - typedef int AT_surfxml_host_interference_send_recv; +typedef enum { AU_surfxml_host_state, A_surfxml_host_state_ON,A_surfxml_host_state_OFF } AT_surfxml_host_state; +typedef int AT_surfxml_host_interference_send_recv; #define AU_surfxml_host_interference_send_recv NULL - typedef int AT_surfxml_host_interference_send; +typedef int AT_surfxml_host_interference_send; #define AU_surfxml_host_interference_send NULL - typedef int AT_surfxml_set_suffix; +typedef int AT_surfxml_set_suffix; #define AU_surfxml_set_suffix NULL - typedef int AT_surfxml_route_impact_on_dst; +typedef int AT_surfxml_route_impact_on_dst; #define AU_surfxml_route_impact_on_dst NULL - typedef int AT_surfxml_host_power; +typedef int AT_surfxml_host_power; #define AU_surfxml_host_power NULL - typedef int AT_surfxml_router_id; +typedef int AT_surfxml_router_id; #define AU_surfxml_router_id NULL - typedef int AT_surfxml_process_start_time; +typedef int AT_surfxml_process_start_time; #define AU_surfxml_process_start_time NULL - typedef int AT_surfxml_cluster_suffix; +typedef int AT_surfxml_cluster_suffix; #define AU_surfxml_cluster_suffix NULL - typedef int AT_surfxml_platform_xmlns_c_route; +typedef int AT_surfxml_platform_xmlns_c_route; #define AU_surfxml_platform_xmlns_c_route NULL - typedef int AT_surfxml_cluster_prefix; +typedef int AT_surfxml_cluster_prefix; #define AU_surfxml_cluster_prefix NULL - typedef int AT_surfxml_trace_file; +typedef int AT_surfxml_trace_file; #define AU_surfxml_trace_file NULL - typedef enum { AU_surfxml_route_action, A_surfxml_route_action_POSTPEND, - A_surfxml_route_action_PREPEND, - A_surfxml_route_action_OVERRIDE - } AT_surfxml_route_action; - typedef enum { AU_surfxml_link_sharing_policy, - A_surfxml_link_sharing_policy_SHARED, - A_surfxml_link_sharing_policy_FATPIPE - } AT_surfxml_link_sharing_policy; - typedef int AT_surfxml_random_min; +typedef enum { AU_surfxml_route_action, A_surfxml_route_action_POSTPEND,A_surfxml_route_action_PREPEND,A_surfxml_route_action_OVERRIDE } AT_surfxml_route_action; +typedef enum { AU_surfxml_link_sharing_policy, A_surfxml_link_sharing_policy_SHARED,A_surfxml_link_sharing_policy_FATPIPE } AT_surfxml_link_sharing_policy; +typedef int AT_surfxml_random_min; #define AU_surfxml_random_min NULL - typedef int AT_surfxml_process_kill_time; +typedef int AT_surfxml_process_kill_time; #define AU_surfxml_process_kill_time NULL - typedef int AT_surfxml_cluster_bb_bw; +typedef int AT_surfxml_cluster_bb_bw; #define AU_surfxml_cluster_bb_bw NULL - typedef int AT_surfxml_trace_c_connect_element; +typedef int AT_surfxml_trace_c_connect_element; #define AU_surfxml_trace_c_connect_element NULL - typedef int AT_surfxml_argument_value; +typedef int AT_surfxml_argument_value; #define AU_surfxml_argument_value NULL - typedef enum { AU_surfxml_link_state, A_surfxml_link_state_ON, - A_surfxml_link_state_OFF - } AT_surfxml_link_state; - typedef int AT_surfxml_route_impact_on_src; +typedef enum { AU_surfxml_link_state, A_surfxml_link_state_ON,A_surfxml_link_state_OFF } AT_surfxml_link_state; +typedef int AT_surfxml_route_impact_on_src; #define AU_surfxml_route_impact_on_src NULL - typedef int AT_surfxml_link_bandwidth; +typedef int AT_surfxml_link_bandwidth; #define AU_surfxml_link_bandwidth NULL - typedef int AT_surfxml_cluster_id; +typedef int AT_surfxml_cluster_id; #define AU_surfxml_cluster_id NULL - typedef int AT_surfxml_random_mean; +typedef int AT_surfxml_random_mean; #define AU_surfxml_random_mean NULL - typedef int AT_surfxml_cluster_bb_lat; +typedef int AT_surfxml_cluster_bb_lat; #define AU_surfxml_cluster_bb_lat NULL - typedef int AT_surfxml_link_latency; +typedef int AT_surfxml_link_latency; #define AU_surfxml_link_latency NULL - typedef int AT_surfxml_platform_xmlns_c_link; +typedef int AT_surfxml_platform_xmlns_c_link; #define AU_surfxml_platform_xmlns_c_link NULL - typedef int AT_surfxml_link_bandwidth_file; +typedef int AT_surfxml_link_bandwidth_file; #define AU_surfxml_link_bandwidth_file NULL - typedef int AT_surfxml_random_id; +typedef int AT_surfxml_random_id; #define AU_surfxml_random_id NULL - typedef int AT_surfxml_set_radical; +typedef int AT_surfxml_set_radical; #define AU_surfxml_set_radical NULL - typedef int AT_surfxml_random_max; +typedef int AT_surfxml_random_max; #define AU_surfxml_random_max NULL - typedef int AT_surfxml_link_id; +typedef int AT_surfxml_link_id; #define AU_surfxml_link_id NULL - typedef int AT_surfxml_process_host; +typedef int AT_surfxml_process_host; #define AU_surfxml_process_host NULL - typedef int AT_surfxml_host_availability_file; +typedef int AT_surfxml_host_availability_file; #define AU_surfxml_host_availability_file NULL - typedef int AT_surfxml_cluster_lat; +typedef int AT_surfxml_cluster_lat; #define AU_surfxml_cluster_lat NULL - typedef int AT_surfxml_trace_periodicity; +typedef int AT_surfxml_trace_periodicity; #define AU_surfxml_trace_periodicity NULL - typedef int AT_surfxml_foreach_set_id; +typedef int AT_surfxml_foreach_set_id; #define AU_surfxml_foreach_set_id NULL - typedef int AT_surfxml_route_impact_on_dst_with_other_send; +typedef int AT_surfxml_route_impact_on_dst_with_other_send; #define AU_surfxml_route_impact_on_dst_with_other_send NULL - typedef int AT_surfxml_prop_value; +typedef int AT_surfxml_prop_value; #define AU_surfxml_prop_value NULL - typedef int AT_surfxml_route_impact_on_src_with_other_recv; +typedef int AT_surfxml_route_impact_on_src_with_other_recv; #define AU_surfxml_route_impact_on_src_with_other_recv NULL - typedef int AT_surfxml_trace_timestep; +typedef int AT_surfxml_trace_timestep; #define AU_surfxml_trace_timestep NULL - typedef int AT_surfxml_link_state_file; +typedef int AT_surfxml_link_state_file; #define AU_surfxml_link_state_file NULL - typedef int AT_surfxml_set_prefix; +typedef int AT_surfxml_set_prefix; #define AU_surfxml_set_prefix NULL - typedef int AT_surfxml_cluster_power; +typedef int AT_surfxml_cluster_power; #define AU_surfxml_cluster_power NULL - typedef int AT_surfxml_process_function; +typedef int AT_surfxml_process_function; #define AU_surfxml_process_function NULL - typedef int AT_surfxml_host_max_outgoing_rate; +typedef int AT_surfxml_host_max_outgoing_rate; #define AU_surfxml_host_max_outgoing_rate NULL - typedef int AT_surfxml_link_c_ctn_id; +typedef int AT_surfxml_link_c_ctn_id; #define AU_surfxml_link_c_ctn_id NULL - typedef int AT_surfxml_host_availability; +typedef int AT_surfxml_host_availability; #define AU_surfxml_host_availability NULL - typedef int AT_surfxml_route_src; +typedef int AT_surfxml_route_src; #define AU_surfxml_route_src NULL - typedef int AT_surfxml_route_c_multi_src; +typedef int AT_surfxml_route_c_multi_src; #define AU_surfxml_route_c_multi_src NULL - typedef enum { AU_surfxml_route_c_multi_action, - A_surfxml_route_c_multi_action_POSTPEND, - A_surfxml_route_c_multi_action_PREPEND, - A_surfxml_route_c_multi_action_OVERRIDE - } AT_surfxml_route_c_multi_action; - typedef int AT_surfxml_trace_c_connect_trace; +typedef enum { AU_surfxml_route_c_multi_action, A_surfxml_route_c_multi_action_POSTPEND,A_surfxml_route_c_multi_action_PREPEND,A_surfxml_route_c_multi_action_OVERRIDE } AT_surfxml_route_c_multi_action; +typedef int AT_surfxml_trace_c_connect_trace; #define AU_surfxml_trace_c_connect_trace NULL - typedef int AT_surfxml_trace_id; +typedef int AT_surfxml_trace_id; #define AU_surfxml_trace_id NULL - typedef int AT_surfxml_cluster_radical; +typedef int AT_surfxml_cluster_radical; #define AU_surfxml_cluster_radical NULL - typedef int AT_surfxml_include_file; +typedef int AT_surfxml_include_file; #define AU_surfxml_include_file NULL - typedef int AT_surfxml_random_std_deviation; +typedef int AT_surfxml_random_std_deviation; #define AU_surfxml_random_std_deviation NULL - typedef enum { AU_surfxml_trace_c_connect_kind, - A_surfxml_trace_c_connect_kind_HOST_AVAIL, - A_surfxml_trace_c_connect_kind_POWER, - A_surfxml_trace_c_connect_kind_LINK_AVAIL, - A_surfxml_trace_c_connect_kind_BANDWIDTH, - A_surfxml_trace_c_connect_kind_LATENCY - } AT_surfxml_trace_c_connect_kind; - typedef int AT_surfxml_route_c_multi_dst; +typedef enum { AU_surfxml_trace_c_connect_kind, A_surfxml_trace_c_connect_kind_HOST_AVAIL,A_surfxml_trace_c_connect_kind_POWER,A_surfxml_trace_c_connect_kind_LINK_AVAIL,A_surfxml_trace_c_connect_kind_BANDWIDTH,A_surfxml_trace_c_connect_kind_LATENCY } AT_surfxml_trace_c_connect_kind; +typedef int AT_surfxml_route_c_multi_dst; #define AU_surfxml_route_c_multi_dst NULL - typedef int AT_surfxml_host_state_file; +typedef int AT_surfxml_host_state_file; #define AU_surfxml_host_state_file NULL - typedef enum { AU_surfxml_route_c_multi_symmetric, - A_surfxml_route_c_multi_symmetric_YES, - A_surfxml_route_c_multi_symmetric_NO - } AT_surfxml_route_c_multi_symmetric; - typedef int AT_surfxml_route_dst; +typedef enum { AU_surfxml_route_c_multi_symmetric, A_surfxml_route_c_multi_symmetric_YES,A_surfxml_route_c_multi_symmetric_NO } AT_surfxml_route_c_multi_symmetric; +typedef int AT_surfxml_route_dst; #define AU_surfxml_route_dst NULL - typedef int AT_surfxml_cluster_bw; +typedef int AT_surfxml_cluster_bw; #define AU_surfxml_cluster_bw NULL - typedef int AT_surfxml_platform_version; +typedef int AT_surfxml_platform_version; #define AU_surfxml_platform_version NULL /* FleXML-provided data. */ -XBT_PUBLIC_DATA(int) surfxml_pcdata_ix; +XBT_PUBLIC_DATA(int ) surfxml_pcdata_ix; XBT_PUBLIC_DATA(char *) surfxml_bufferstack; #define surfxml_pcdata (surfxml_bufferstack + surfxml_pcdata_ix) -XBT_PUBLIC_DATA(AT_surfxml_random_generator) AX_surfxml_random_generator; +XBT_PUBLIC_DATA(AT_surfxml_random_generator ) AX_surfxml_random_generator; #define A_surfxml_random_generator AX_surfxml_random_generator -XBT_PUBLIC_DATA(AT_surfxml_prop_id) AX_surfxml_prop_id; +XBT_PUBLIC_DATA(AT_surfxml_prop_id ) AX_surfxml_prop_id; #define A_surfxml_prop_id (surfxml_bufferstack + AX_surfxml_prop_id) -XBT_PUBLIC_DATA(AT_surfxml_host_interference_recv) - AX_surfxml_host_interference_recv; +XBT_PUBLIC_DATA(AT_surfxml_host_interference_recv ) AX_surfxml_host_interference_recv; #define A_surfxml_host_interference_recv (surfxml_bufferstack + AX_surfxml_host_interference_recv) -XBT_PUBLIC_DATA(AT_surfxml_host_id) AX_surfxml_host_id; +XBT_PUBLIC_DATA(AT_surfxml_host_id ) AX_surfxml_host_id; #define A_surfxml_host_id (surfxml_bufferstack + AX_surfxml_host_id) -XBT_PUBLIC_DATA(AT_surfxml_set_id) AX_surfxml_set_id; +XBT_PUBLIC_DATA(AT_surfxml_set_id ) AX_surfxml_set_id; #define A_surfxml_set_id (surfxml_bufferstack + AX_surfxml_set_id) -XBT_PUBLIC_DATA(AT_surfxml_link_latency_file) AX_surfxml_link_latency_file; +XBT_PUBLIC_DATA(AT_surfxml_link_latency_file ) AX_surfxml_link_latency_file; #define A_surfxml_link_latency_file (surfxml_bufferstack + AX_surfxml_link_latency_file) -XBT_PUBLIC_DATA(AT_surfxml_host_state) AX_surfxml_host_state; +XBT_PUBLIC_DATA(AT_surfxml_host_state ) AX_surfxml_host_state; #define A_surfxml_host_state AX_surfxml_host_state -XBT_PUBLIC_DATA(AT_surfxml_host_interference_send_recv) - AX_surfxml_host_interference_send_recv; +XBT_PUBLIC_DATA(AT_surfxml_host_interference_send_recv ) AX_surfxml_host_interference_send_recv; #define A_surfxml_host_interference_send_recv (surfxml_bufferstack + AX_surfxml_host_interference_send_recv) -XBT_PUBLIC_DATA(AT_surfxml_host_interference_send) - AX_surfxml_host_interference_send; +XBT_PUBLIC_DATA(AT_surfxml_host_interference_send ) AX_surfxml_host_interference_send; #define A_surfxml_host_interference_send (surfxml_bufferstack + AX_surfxml_host_interference_send) -XBT_PUBLIC_DATA(AT_surfxml_set_suffix) AX_surfxml_set_suffix; +XBT_PUBLIC_DATA(AT_surfxml_set_suffix ) AX_surfxml_set_suffix; #define A_surfxml_set_suffix (surfxml_bufferstack + AX_surfxml_set_suffix) -XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_dst) - AX_surfxml_route_impact_on_dst; +XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_dst ) AX_surfxml_route_impact_on_dst; #define A_surfxml_route_impact_on_dst (surfxml_bufferstack + AX_surfxml_route_impact_on_dst) -XBT_PUBLIC_DATA(AT_surfxml_host_power) AX_surfxml_host_power; +XBT_PUBLIC_DATA(AT_surfxml_host_power ) AX_surfxml_host_power; #define A_surfxml_host_power (surfxml_bufferstack + AX_surfxml_host_power) -XBT_PUBLIC_DATA(AT_surfxml_router_id) AX_surfxml_router_id; +XBT_PUBLIC_DATA(AT_surfxml_router_id ) AX_surfxml_router_id; #define A_surfxml_router_id (surfxml_bufferstack + AX_surfxml_router_id) -XBT_PUBLIC_DATA(AT_surfxml_process_start_time) AX_surfxml_process_start_time; +XBT_PUBLIC_DATA(AT_surfxml_process_start_time ) AX_surfxml_process_start_time; #define A_surfxml_process_start_time (surfxml_bufferstack + AX_surfxml_process_start_time) -XBT_PUBLIC_DATA(AT_surfxml_cluster_suffix) AX_surfxml_cluster_suffix; +XBT_PUBLIC_DATA(AT_surfxml_cluster_suffix ) AX_surfxml_cluster_suffix; #define A_surfxml_cluster_suffix (surfxml_bufferstack + AX_surfxml_cluster_suffix) -XBT_PUBLIC_DATA(AT_surfxml_platform_xmlns_c_route) - AX_surfxml_platform_xmlns_c_route; +XBT_PUBLIC_DATA(AT_surfxml_platform_xmlns_c_route ) AX_surfxml_platform_xmlns_c_route; #define A_surfxml_platform_xmlns_c_route (surfxml_bufferstack + AX_surfxml_platform_xmlns_c_route) -XBT_PUBLIC_DATA(AT_surfxml_cluster_prefix) AX_surfxml_cluster_prefix; +XBT_PUBLIC_DATA(AT_surfxml_cluster_prefix ) AX_surfxml_cluster_prefix; #define A_surfxml_cluster_prefix (surfxml_bufferstack + AX_surfxml_cluster_prefix) -XBT_PUBLIC_DATA(AT_surfxml_trace_file) AX_surfxml_trace_file; +XBT_PUBLIC_DATA(AT_surfxml_trace_file ) AX_surfxml_trace_file; #define A_surfxml_trace_file (surfxml_bufferstack + AX_surfxml_trace_file) -XBT_PUBLIC_DATA(AT_surfxml_route_action) AX_surfxml_route_action; +XBT_PUBLIC_DATA(AT_surfxml_route_action ) AX_surfxml_route_action; #define A_surfxml_route_action AX_surfxml_route_action -XBT_PUBLIC_DATA(AT_surfxml_link_sharing_policy) - AX_surfxml_link_sharing_policy; +XBT_PUBLIC_DATA(AT_surfxml_link_sharing_policy ) AX_surfxml_link_sharing_policy; #define A_surfxml_link_sharing_policy AX_surfxml_link_sharing_policy -XBT_PUBLIC_DATA(AT_surfxml_random_min) AX_surfxml_random_min; +XBT_PUBLIC_DATA(AT_surfxml_random_min ) AX_surfxml_random_min; #define A_surfxml_random_min (surfxml_bufferstack + AX_surfxml_random_min) -XBT_PUBLIC_DATA(AT_surfxml_process_kill_time) AX_surfxml_process_kill_time; +XBT_PUBLIC_DATA(AT_surfxml_process_kill_time ) AX_surfxml_process_kill_time; #define A_surfxml_process_kill_time (surfxml_bufferstack + AX_surfxml_process_kill_time) -XBT_PUBLIC_DATA(AT_surfxml_cluster_bb_bw) AX_surfxml_cluster_bb_bw; +XBT_PUBLIC_DATA(AT_surfxml_cluster_bb_bw ) AX_surfxml_cluster_bb_bw; #define A_surfxml_cluster_bb_bw (surfxml_bufferstack + AX_surfxml_cluster_bb_bw) -XBT_PUBLIC_DATA(AT_surfxml_trace_c_connect_element) - AX_surfxml_trace_c_connect_element; +XBT_PUBLIC_DATA(AT_surfxml_trace_c_connect_element ) AX_surfxml_trace_c_connect_element; #define A_surfxml_trace_c_connect_element (surfxml_bufferstack + AX_surfxml_trace_c_connect_element) -XBT_PUBLIC_DATA(AT_surfxml_argument_value) AX_surfxml_argument_value; +XBT_PUBLIC_DATA(AT_surfxml_argument_value ) AX_surfxml_argument_value; #define A_surfxml_argument_value (surfxml_bufferstack + AX_surfxml_argument_value) -XBT_PUBLIC_DATA(AT_surfxml_link_state) AX_surfxml_link_state; +XBT_PUBLIC_DATA(AT_surfxml_link_state ) AX_surfxml_link_state; #define A_surfxml_link_state AX_surfxml_link_state -XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_src) - AX_surfxml_route_impact_on_src; +XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_src ) AX_surfxml_route_impact_on_src; #define A_surfxml_route_impact_on_src (surfxml_bufferstack + AX_surfxml_route_impact_on_src) -XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth) AX_surfxml_link_bandwidth; +XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth ) AX_surfxml_link_bandwidth; #define A_surfxml_link_bandwidth (surfxml_bufferstack + AX_surfxml_link_bandwidth) -XBT_PUBLIC_DATA(AT_surfxml_cluster_id) AX_surfxml_cluster_id; +XBT_PUBLIC_DATA(AT_surfxml_cluster_id ) AX_surfxml_cluster_id; #define A_surfxml_cluster_id (surfxml_bufferstack + AX_surfxml_cluster_id) -XBT_PUBLIC_DATA(AT_surfxml_random_mean) AX_surfxml_random_mean; +XBT_PUBLIC_DATA(AT_surfxml_random_mean ) AX_surfxml_random_mean; #define A_surfxml_random_mean (surfxml_bufferstack + AX_surfxml_random_mean) -XBT_PUBLIC_DATA(AT_surfxml_cluster_bb_lat) AX_surfxml_cluster_bb_lat; +XBT_PUBLIC_DATA(AT_surfxml_cluster_bb_lat ) AX_surfxml_cluster_bb_lat; #define A_surfxml_cluster_bb_lat (surfxml_bufferstack + AX_surfxml_cluster_bb_lat) -XBT_PUBLIC_DATA(AT_surfxml_link_latency) AX_surfxml_link_latency; +XBT_PUBLIC_DATA(AT_surfxml_link_latency ) AX_surfxml_link_latency; #define A_surfxml_link_latency (surfxml_bufferstack + AX_surfxml_link_latency) -XBT_PUBLIC_DATA(AT_surfxml_platform_xmlns_c_link) - AX_surfxml_platform_xmlns_c_link; +XBT_PUBLIC_DATA(AT_surfxml_platform_xmlns_c_link ) AX_surfxml_platform_xmlns_c_link; #define A_surfxml_platform_xmlns_c_link (surfxml_bufferstack + AX_surfxml_platform_xmlns_c_link) -XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth_file) - AX_surfxml_link_bandwidth_file; +XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth_file ) AX_surfxml_link_bandwidth_file; #define A_surfxml_link_bandwidth_file (surfxml_bufferstack + AX_surfxml_link_bandwidth_file) -XBT_PUBLIC_DATA(AT_surfxml_random_id) AX_surfxml_random_id; +XBT_PUBLIC_DATA(AT_surfxml_random_id ) AX_surfxml_random_id; #define A_surfxml_random_id (surfxml_bufferstack + AX_surfxml_random_id) -XBT_PUBLIC_DATA(AT_surfxml_set_radical) AX_surfxml_set_radical; +XBT_PUBLIC_DATA(AT_surfxml_set_radical ) AX_surfxml_set_radical; #define A_surfxml_set_radical (surfxml_bufferstack + AX_surfxml_set_radical) -XBT_PUBLIC_DATA(AT_surfxml_random_max) AX_surfxml_random_max; +XBT_PUBLIC_DATA(AT_surfxml_random_max ) AX_surfxml_random_max; #define A_surfxml_random_max (surfxml_bufferstack + AX_surfxml_random_max) -XBT_PUBLIC_DATA(AT_surfxml_link_id) AX_surfxml_link_id; +XBT_PUBLIC_DATA(AT_surfxml_link_id ) AX_surfxml_link_id; #define A_surfxml_link_id (surfxml_bufferstack + AX_surfxml_link_id) -XBT_PUBLIC_DATA(AT_surfxml_process_host) AX_surfxml_process_host; +XBT_PUBLIC_DATA(AT_surfxml_process_host ) AX_surfxml_process_host; #define A_surfxml_process_host (surfxml_bufferstack + AX_surfxml_process_host) -XBT_PUBLIC_DATA(AT_surfxml_host_availability_file) - AX_surfxml_host_availability_file; +XBT_PUBLIC_DATA(AT_surfxml_host_availability_file ) AX_surfxml_host_availability_file; #define A_surfxml_host_availability_file (surfxml_bufferstack + AX_surfxml_host_availability_file) -XBT_PUBLIC_DATA(AT_surfxml_cluster_lat) AX_surfxml_cluster_lat; +XBT_PUBLIC_DATA(AT_surfxml_cluster_lat ) AX_surfxml_cluster_lat; #define A_surfxml_cluster_lat (surfxml_bufferstack + AX_surfxml_cluster_lat) -XBT_PUBLIC_DATA(AT_surfxml_trace_periodicity) AX_surfxml_trace_periodicity; +XBT_PUBLIC_DATA(AT_surfxml_trace_periodicity ) AX_surfxml_trace_periodicity; #define A_surfxml_trace_periodicity (surfxml_bufferstack + AX_surfxml_trace_periodicity) -XBT_PUBLIC_DATA(AT_surfxml_foreach_set_id) AX_surfxml_foreach_set_id; +XBT_PUBLIC_DATA(AT_surfxml_foreach_set_id ) AX_surfxml_foreach_set_id; #define A_surfxml_foreach_set_id (surfxml_bufferstack + AX_surfxml_foreach_set_id) -XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_dst_with_other_send) - AX_surfxml_route_impact_on_dst_with_other_send; +XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_dst_with_other_send ) AX_surfxml_route_impact_on_dst_with_other_send; #define A_surfxml_route_impact_on_dst_with_other_send (surfxml_bufferstack + AX_surfxml_route_impact_on_dst_with_other_send) -XBT_PUBLIC_DATA(AT_surfxml_prop_value) AX_surfxml_prop_value; +XBT_PUBLIC_DATA(AT_surfxml_prop_value ) AX_surfxml_prop_value; #define A_surfxml_prop_value (surfxml_bufferstack + AX_surfxml_prop_value) -XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_src_with_other_recv) - AX_surfxml_route_impact_on_src_with_other_recv; +XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_src_with_other_recv ) AX_surfxml_route_impact_on_src_with_other_recv; #define A_surfxml_route_impact_on_src_with_other_recv (surfxml_bufferstack + AX_surfxml_route_impact_on_src_with_other_recv) -XBT_PUBLIC_DATA(AT_surfxml_trace_timestep) AX_surfxml_trace_timestep; +XBT_PUBLIC_DATA(AT_surfxml_trace_timestep ) AX_surfxml_trace_timestep; #define A_surfxml_trace_timestep (surfxml_bufferstack + AX_surfxml_trace_timestep) -XBT_PUBLIC_DATA(AT_surfxml_link_state_file) AX_surfxml_link_state_file; +XBT_PUBLIC_DATA(AT_surfxml_link_state_file ) AX_surfxml_link_state_file; #define A_surfxml_link_state_file (surfxml_bufferstack + AX_surfxml_link_state_file) -XBT_PUBLIC_DATA(AT_surfxml_set_prefix) AX_surfxml_set_prefix; +XBT_PUBLIC_DATA(AT_surfxml_set_prefix ) AX_surfxml_set_prefix; #define A_surfxml_set_prefix (surfxml_bufferstack + AX_surfxml_set_prefix) -XBT_PUBLIC_DATA(AT_surfxml_cluster_power) AX_surfxml_cluster_power; +XBT_PUBLIC_DATA(AT_surfxml_cluster_power ) AX_surfxml_cluster_power; #define A_surfxml_cluster_power (surfxml_bufferstack + AX_surfxml_cluster_power) -XBT_PUBLIC_DATA(AT_surfxml_process_function) AX_surfxml_process_function; +XBT_PUBLIC_DATA(AT_surfxml_process_function ) AX_surfxml_process_function; #define A_surfxml_process_function (surfxml_bufferstack + AX_surfxml_process_function) -XBT_PUBLIC_DATA(AT_surfxml_host_max_outgoing_rate) - AX_surfxml_host_max_outgoing_rate; +XBT_PUBLIC_DATA(AT_surfxml_host_max_outgoing_rate ) AX_surfxml_host_max_outgoing_rate; #define A_surfxml_host_max_outgoing_rate (surfxml_bufferstack + AX_surfxml_host_max_outgoing_rate) -XBT_PUBLIC_DATA(AT_surfxml_link_c_ctn_id) AX_surfxml_link_c_ctn_id; +XBT_PUBLIC_DATA(AT_surfxml_link_c_ctn_id ) AX_surfxml_link_c_ctn_id; #define A_surfxml_link_c_ctn_id (surfxml_bufferstack + AX_surfxml_link_c_ctn_id) -XBT_PUBLIC_DATA(AT_surfxml_host_availability) AX_surfxml_host_availability; +XBT_PUBLIC_DATA(AT_surfxml_host_availability ) AX_surfxml_host_availability; #define A_surfxml_host_availability (surfxml_bufferstack + AX_surfxml_host_availability) -XBT_PUBLIC_DATA(AT_surfxml_route_src) AX_surfxml_route_src; +XBT_PUBLIC_DATA(AT_surfxml_route_src ) AX_surfxml_route_src; #define A_surfxml_route_src (surfxml_bufferstack + AX_surfxml_route_src) -XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_src) AX_surfxml_route_c_multi_src; +XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_src ) AX_surfxml_route_c_multi_src; #define A_surfxml_route_c_multi_src (surfxml_bufferstack + AX_surfxml_route_c_multi_src) -XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_action) - AX_surfxml_route_c_multi_action; +XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_action ) AX_surfxml_route_c_multi_action; #define A_surfxml_route_c_multi_action AX_surfxml_route_c_multi_action -XBT_PUBLIC_DATA(AT_surfxml_trace_c_connect_trace) - AX_surfxml_trace_c_connect_trace; +XBT_PUBLIC_DATA(AT_surfxml_trace_c_connect_trace ) AX_surfxml_trace_c_connect_trace; #define A_surfxml_trace_c_connect_trace (surfxml_bufferstack + AX_surfxml_trace_c_connect_trace) -XBT_PUBLIC_DATA(AT_surfxml_trace_id) AX_surfxml_trace_id; +XBT_PUBLIC_DATA(AT_surfxml_trace_id ) AX_surfxml_trace_id; #define A_surfxml_trace_id (surfxml_bufferstack + AX_surfxml_trace_id) -XBT_PUBLIC_DATA(AT_surfxml_cluster_radical) AX_surfxml_cluster_radical; +XBT_PUBLIC_DATA(AT_surfxml_cluster_radical ) AX_surfxml_cluster_radical; #define A_surfxml_cluster_radical (surfxml_bufferstack + AX_surfxml_cluster_radical) -XBT_PUBLIC_DATA(AT_surfxml_include_file) AX_surfxml_include_file; +XBT_PUBLIC_DATA(AT_surfxml_include_file ) AX_surfxml_include_file; #define A_surfxml_include_file (surfxml_bufferstack + AX_surfxml_include_file) -XBT_PUBLIC_DATA(AT_surfxml_random_std_deviation) - AX_surfxml_random_std_deviation; +XBT_PUBLIC_DATA(AT_surfxml_random_std_deviation ) AX_surfxml_random_std_deviation; #define A_surfxml_random_std_deviation (surfxml_bufferstack + AX_surfxml_random_std_deviation) -XBT_PUBLIC_DATA(AT_surfxml_trace_c_connect_kind) - AX_surfxml_trace_c_connect_kind; +XBT_PUBLIC_DATA(AT_surfxml_trace_c_connect_kind ) AX_surfxml_trace_c_connect_kind; #define A_surfxml_trace_c_connect_kind AX_surfxml_trace_c_connect_kind -XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_dst) AX_surfxml_route_c_multi_dst; +XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_dst ) AX_surfxml_route_c_multi_dst; #define A_surfxml_route_c_multi_dst (surfxml_bufferstack + AX_surfxml_route_c_multi_dst) -XBT_PUBLIC_DATA(AT_surfxml_host_state_file) AX_surfxml_host_state_file; +XBT_PUBLIC_DATA(AT_surfxml_host_state_file ) AX_surfxml_host_state_file; #define A_surfxml_host_state_file (surfxml_bufferstack + AX_surfxml_host_state_file) -XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_symmetric) - AX_surfxml_route_c_multi_symmetric; +XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_symmetric ) AX_surfxml_route_c_multi_symmetric; #define A_surfxml_route_c_multi_symmetric AX_surfxml_route_c_multi_symmetric -XBT_PUBLIC_DATA(AT_surfxml_route_dst) AX_surfxml_route_dst; +XBT_PUBLIC_DATA(AT_surfxml_route_dst ) AX_surfxml_route_dst; #define A_surfxml_route_dst (surfxml_bufferstack + AX_surfxml_route_dst) -XBT_PUBLIC_DATA(AT_surfxml_cluster_bw) AX_surfxml_cluster_bw; +XBT_PUBLIC_DATA(AT_surfxml_cluster_bw ) AX_surfxml_cluster_bw; #define A_surfxml_cluster_bw (surfxml_bufferstack + AX_surfxml_cluster_bw) -XBT_PUBLIC_DATA(AT_surfxml_platform_version) AX_surfxml_platform_version; +XBT_PUBLIC_DATA(AT_surfxml_platform_version ) AX_surfxml_platform_version; #define A_surfxml_platform_version (surfxml_bufferstack + AX_surfxml_platform_version) /* XML application utilities. */ -XBT_PUBLIC(int) surfxml_element_context(int); +XBT_PUBLIC(int ) surfxml_element_context(int); /* XML processor entry point. */ -XBT_PUBLIC(int) yylex(void); +XBT_PUBLIC(int ) yylex(void); /* Flexml error handling function (useful only when -q flag passed to flexml) */ - const char *surfxml_parse_err_msg(void); - -SG_END_DECL() +const char * surfxml_parse_err_msg(void); #endif diff --git a/src/Makefile.am b/src/Makefile.am index 3a8081a712..32c5006278 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -198,18 +198,16 @@ GTNETS_SRC= \ surf/gtnets/gtnets_interface.cc \ surf/network_gtnets.c -# Separated because src/gras/rl_stubs also define the function xbt_context_mod_init() and xbt_context_mod_exit() -# so there is an implementation of these functions in the simgrid library and an implementatin in the gras library -CTX_SRC= simix/smx_context.c - SIMIX_SRC= \ simix/smx_global.c \ simix/smx_deployment.c \ simix/smx_environment.c \ simix/smx_host.c \ simix/smx_process.c \ + simix/smx_context.c \ simix/smx_action.c \ - simix/smx_synchro.c + simix/smx_synchro.c \ + simix/smx_network.c if CONTEXT_THREADS SURF_SRC += simix/smx_context_thread.c @@ -330,8 +328,7 @@ libgras_la_SOURCES= $(XBT_SRC) $(GRAS_COMMON_SRC) $(GRAS_RL_SRC) $(AMOK_SRC) libgras_la_LDFLAGS = -no-undefined $(VERSION_INFO) @GRAS_DEP@ @LD_DYNAMIC_FLAGS@ -lm libsimgrid_la_SOURCES = $(XBT_SRC) $(SURF_SRC) $(GTNETS_USED) \ - $(SIMIX_SRC) $(CTX_SRC) \ - $(MSG_SRC) $(SIMDAG_SRC) \ + $(SIMIX_SRC) $(MSG_SRC) $(SIMDAG_SRC) \ $(GRAS_COMMON_SRC) $(GRAS_SG_SRC) $(AMOK_SRC) libsimgrid_la_LDFLAGS = -no-undefined $(VERSION_INFO) @SIMGRID_DEP@ @LD_DYNAMIC_FLAGS@ -lm # -Wl,--entry -Wl,simgrid_version diff --git a/src/include/simix/datatypes.h b/src/include/simix/datatypes.h index 0ac220284c..98b21a9f41 100644 --- a/src/include/simix/datatypes.h +++ b/src/include/simix/datatypes.h @@ -51,5 +51,12 @@ SG_BEGIN_DECL() /** @} */ typedef struct s_smx_context *smx_context_t; + +/******************************* Networking ***********************************/ + typedef struct s_smx_rvpoint *smx_rvpoint_t; + typedef struct s_smx_comm *smx_comm_t; + + + SG_END_DECL() #endif diff --git a/src/include/simix/simix.h b/src/include/simix/simix.h index c26324f122..6d62fd28a6 100644 --- a/src/include/simix/simix.h +++ b/src/include/simix/simix.h @@ -171,9 +171,26 @@ XBT_PUBLIC(smx_action_t) SIMIX_action_parallel_execute(char *name, XBT_PUBLIC(char *) SIMIX_action_get_name(smx_action_t action); XBT_PUBLIC(void) SIMIX_action_signal_all(smx_action_t action); - -void SIMIX_display_process_status(void); - +XBT_PUBLIC(void) SIMIX_display_process_status(void); +/************************** Comunication Handling *****************************/ + +/* Public */ +XBT_PUBLIC(smx_rvpoint_t) SIMIX_rvpoint_create(char *name); +XBT_PUBLIC(void) SIMIX_rvpoint_destroy(smx_rvpoint_t rvp); +XBT_PUBLIC(void) SIMIX_network_send(smx_rvpoint_t rdv, void *data, size_t size, double rate, double timeout); +XBT_PUBLIC(void) SIMIX_network_recv(smx_rvpoint_t rvp, void **data, size_t *size, double timeout); +XBT_PUBLIC(void) SIMIX_network_wait(smx_action_t comm); +XBT_PUBLIC(int) SIMIX_network_test(smx_action_t comm); + +/* These should be private to SIMIX */ +smx_comm_t SIMIX_communication_new(smx_host_t src_host, smx_host_t dst_host, + smx_rvpoint_t rdv); +void SIMIX_communication_destroy(smx_comm_t comm); +smx_comm_t SIMIX_rvpoint_get_receiver(smx_rvpoint_t rvp); +smx_comm_t SIMIX_rvpoint_get_sender(smx_rvpoint_t rvp); +static inline void SIMIX_rvpoint_push(smx_rvpoint_t rvp, smx_comm_t comm); +static inline smx_cond_t SIMIX_rvpoint_get_cond(smx_rvpoint_t rvp); +static inline smx_mutex_t SIMIX_rvpoint_get_comm_mutex(smx_rvpoint_t rvp); SG_END_DECL() #endif /* _SIMIX_SIMIX_H */ diff --git a/src/simix/private.h b/src/simix/private.h index 2b344a057a..8a41816b6b 100644 --- a/src/simix/private.h +++ b/src/simix/private.h @@ -97,7 +97,6 @@ void SIMIX_process_yield(void); ex_ctx_t *SIMIX_process_get_exception(void); void SIMIX_process_exception_terminate(xbt_ex_t * e); - /*************************** Mutex and Conditional ****************************/ typedef struct s_smx_mutex { @@ -119,8 +118,35 @@ typedef struct s_smx_cond { } s_smx_cond_t; +/******************************* Networking ***********************************/ + +/** @brief Rendez-vous point datatype */ +typedef struct s_smx_rvpoint { + char *name; + smx_mutex_t read; + smx_mutex_t write; + smx_mutex_t comm_mutex; + xbt_fifo_t comm_fifo; +} s_smx_rvpoint_t; + +typedef struct s_smx_comm { + smx_host_t src_host; + smx_host_t dst_host; + smx_rvpoint_t rdv; + smx_cond_t cond; + smx_action_t act; + void *data; + size_t data_size; + void **dest_buff; + size_t dest_buff_size; + double rate; + int refcount; +} s_smx_comm_t; + /********************************* Action *************************************/ +typedef enum {ready, ongoing, done, failed} smx_action_state_t; + /** @brief Action datatype @ingroup m_datatypes_management_details */ typedef struct s_smx_action { diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c new file mode 100644 index 0000000000..8890f81c67 --- /dev/null +++ b/src/simix/smx_network.c @@ -0,0 +1,313 @@ +/* $Id$ */ + +/* Copyright (c) 2009 Cristian Rosa. + All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "private.h" +#include "xbt/log.h" + +/******************************************************************************/ +/* Rendez-Vous Points */ +/******************************************************************************/ + +/** + * \brief Creates a new rendez-vous point + * \param name The name of the rendez-vous point + * \return The created rendez-vous point + */ +smx_rvpoint_t SIMIX_rvpoint_create(char *name) +{ + smx_rvpoint_t rvp = xbt_new0(s_smx_rvpoint_t, 1); + rvp->name = xbt_strdup(name); + rvp->read = SIMIX_mutex_init(); + rvp->write = SIMIX_mutex_init(); + rvp->comm_mutex = SIMIX_mutex_init(); + rvp->comm_fifo = xbt_fifo_new(); + + return rvp; +} + +/** + * \brief Destroy a rendez-vous point + * \param name The rendez-vous point to destroy + */ +void SIMIX_rvpoint_destroy(smx_rvpoint_t rvp) +{ + xbt_free(rvp->name); + SIMIX_mutex_destroy(rvp->read); + SIMIX_mutex_destroy(rvp->write); + SIMIX_mutex_destroy(rvp->comm_mutex); + xbt_fifo_free(rvp->comm_fifo); + xbt_free(rvp); +} + +/** + * \brief Push a communication request into a rendez-vous point + * The communications request are dequeued by the two functions below + * \param rvp The rendez-vous point + * \param comm The communication request + */ +static inline void SIMIX_rvpoint_push(smx_rvpoint_t rvp, smx_comm_t comm) +{ + xbt_fifo_push(rvp->comm_fifo, comm); +} + +/** + * \brief Checks if there is a receive communication request queued in a rendez-vous + * \param rvp The rendez-vous with the queue + * \return The communication request if found, NULL otherwise. + */ +smx_comm_t SIMIX_rvpoint_get_receiver(smx_rvpoint_t rvp) +{ + /* Get a communication request from the rendez-vous queue. If it is a receive + request then return it, otherwise put it again in the queue and return NULL + */ + smx_comm_t comm_head = xbt_fifo_shift(rvp->comm_fifo); + + if(comm_head != NULL && comm_head->dst_host != NULL) + return comm_head; + + xbt_fifo_unshift(rvp->comm_fifo, comm_head); + return NULL; +} + +/** + * \brief Checks if there is a send communication request queued in a rendez-vous + * \param rvp The rendez-vous with the queue + * \return The communication request if found, NULL otherwise. + */ +smx_comm_t SIMIX_rvpoint_get_sender(smx_rvpoint_t rvp) +{ + /* Get a communication request from the rendez-vous queue. If it is a send + request then return it, otherwise put it again in the queue and return NULL + */ + smx_comm_t comm_head = xbt_fifo_shift(rvp->comm_fifo); + + if(comm_head != NULL && comm_head->src_host != NULL) + return comm_head; + + xbt_fifo_unshift(rvp->comm_fifo, comm_head); + return NULL; +} + +/** + * \brief Get the communication mutex of the rendez-vous point + * \param rvp The rendez-vous point + */ +static inline smx_mutex_t SIMIX_rvpoint_get_comm_mutex(smx_rvpoint_t rvp) +{ + return rvp->comm_mutex; +} + +/******************************************************************************/ +/* Communication Requests */ +/******************************************************************************/ + +/** + * \brief Creates a new communication request + * \param sender The process starting the communication (by send) + * \param receiver The process receiving the communication (by recv) + * \return the communication request + */ +smx_comm_t SIMIX_communication_new(smx_host_t src_host, smx_host_t dst_host, + smx_rvpoint_t rdv) +{ + /* alloc structures */ + smx_comm_t comm = xbt_new0(s_smx_comm_t, 1); + comm->cond = SIMIX_cond_init(); + + /* initialize them */ + comm->src_host = src_host; + comm->dst_host = dst_host; + comm->rdv = rdv; + + return comm; +} + +/** + * \brief Destroy a communication request + * \param comm The request to be destroyed + */ +void SIMIX_communication_destroy(smx_comm_t comm) +{ + comm->refcount--; + if(comm->refcount == 0){ + if(comm->act != NULL) + SIMIX_action_destroy(comm->act); + + if(comm->data != NULL) + xbt_free(comm->data); + + xbt_free(comm->cond); + xbt_free(comm); + } +} + +/** + * \brief Increase the number of users of the communication. + * \param comm The communication request + * Each communication request can be used by more than one process, so it is + * necessary to know number of them at destroy time, to avoid freeing stuff that + * maybe is in use by others. + * \ + */ +static inline void SIMIX_communication_use(smx_comm_t comm) +{ + comm->refcount++; +} + +/** + * \brief Start the simulation of a communication request + * \param comm The communicatino request + */ +static inline void SIMIX_communication_start(smx_comm_t comm) +{ + comm->act = SIMIX_action_communicate(comm->src_host, comm->dst_host, NULL, + comm->data_size, comm->rate); + + SIMIX_register_action_to_condition(comm->act, comm->cond); + __SIMIX_cond_wait(comm->cond); + SIMIX_unregister_action_to_condition(comm->act, comm->cond); +} + +/******************************************************************************/ +/* Synchronous Communication */ +/******************************************************************************/ + +void SIMIX_network_send(smx_rvpoint_t rdv, void *data, size_t size, double timeout, double rate) +{ + /*double start_time = SIMIX_get_clock();*/ + void *smx_net_data; + smx_host_t my_host = SIMIX_host_self(); + smx_comm_t comm; + smx_mutex_t rvp_comm_mutex = SIMIX_rvpoint_get_comm_mutex(rdv); + + /* Lock the rendez-vous point */ + SIMIX_mutex_lock(rvp_comm_mutex); + /* Copy the message to the network */ + /*FIXME here the MC should allocate the space from the network storage area */ + smx_net_data = xbt_malloc(size); + memcpy(smx_net_data, data, size); + + /* Check if there is already a receive waiting in the rendez-vous point */ + if((comm = SIMIX_rvpoint_get_receiver(rdv)) != NULL){ + comm->src_host = my_host; + comm->data = smx_net_data; + comm->data_size = size; + comm->rate = rate; + SIMIX_communication_use(comm); + + /* Unlock the rendez-vous point and start the communication action.*/ + /* FIXME: if the semantic is non blocking, it shouldn't wait on the condition here */ + SIMIX_mutex_unlock(rvp_comm_mutex); + SIMIX_communication_start(comm); + + /* Nobody is at the rendez-vous point, so push the comm action into it */ + }else{ + comm = SIMIX_communication_new(my_host, NULL, rdv); + comm->data = smx_net_data; + comm->data_size = size; + comm->rate = rate; + SIMIX_communication_use(comm); + SIMIX_rvpoint_push(rdv, comm); + + /* Wait for communication completion */ + /* FIXME: if the semantic is non blocking, it shouldn't wait on the condition here */ + /* FIXME: add timeout checking stuff */ + SIMIX_mutex_unlock (rvp_comm_mutex); + __SIMIX_cond_wait(comm->cond); + } + + /* Check for errors */ + if (SIMIX_host_get_state(comm->dst_host) == 0){ + THROW1(host_error, 0, "Destination host %s failed", comm->dst_host->name); + }else if(SIMIX_action_get_state(comm->act) == SURF_ACTION_FAILED){ + THROW0(network_error, 0, "Link failure"); + } + + SIMIX_communication_destroy(comm); + return; +} + +void SIMIX_network_recv(smx_rvpoint_t rdv, void **data, size_t *size, double timeout) +{ + /*double start_time = SIMIX_get_clock();*/ + smx_comm_t comm; + smx_host_t my_host = SIMIX_host_self(); + smx_mutex_t rvp_comm_mutex = SIMIX_rvpoint_get_comm_mutex(rdv); + + /* Lock the rendez-vous point */ + SIMIX_mutex_lock(rvp_comm_mutex); + + /* Check if there is already a send waiting in the rendez-vous point */ + if((comm = SIMIX_rvpoint_get_sender(rdv)) != NULL){ + comm->dst_host = my_host; + comm->dest_buff = data; + SIMIX_communication_use(comm); + + /* Unlock the rendez-vous point and start the communication action.*/ + /* FIXME: if the semantic is non blocking, it shouldn't wait on the condition here */ + SIMIX_mutex_unlock(rvp_comm_mutex); + SIMIX_communication_start(comm); + + /* Nobody is at the rendez-vous point, so push the comm action into it */ + }else{ + comm = SIMIX_communication_new(NULL, my_host, rdv); + comm->dest_buff = data; + SIMIX_communication_use(comm); + SIMIX_rvpoint_push(rdv, comm); + + /* Wait for communication completion */ + /* FIXME: if the semantic is non blocking, it shouldn't wait on the condition here */ + /* FIXME: add timeout checking stuff*/ + SIMIX_mutex_unlock (rvp_comm_mutex); + __SIMIX_cond_wait(comm->cond); + } + + /* Check for errors */ + if (SIMIX_host_get_state(comm->src_host) == 0){ + THROW1(host_error, 0, "Source host %s failed", comm->src_host->name); + }else if(SIMIX_action_get_state(comm->act) == SURF_ACTION_FAILED){ + THROW0(network_error, 0, "Link failure"); + } + + /* We are OK, let's copy the message to receiver's buffer */ + *size = *size < comm->data_size ? *size : comm->data_size; + memcpy(*data, comm->data, *size); + + SIMIX_communication_destroy(comm); + return; +} + +/******************************************************************************/ +/* Asynchronous Communication */ +/******************************************************************************/ + +/* +void SIMIX_network_wait(smx_action_t comm, double timeout) +{ + if (timeout > 0) + SIMIX_cond_wait_timeout(rvp_cond, rvp_comm_mutex, timeout - start_time); + else + SIMIX_cond_wait(rvp_cond, rvp_comm_mutex); + +} + + +XBT_PUBLIC(int) SIMIX_network_test(smx_action_t comm) +{ + if(SIMIX_action_get_state (comm) == SURF_ACTION_DONE){ + memcpy(comm->data + + return SIMIX_action_get_state (comm) == SURF_ACTION_DONE ? TRUE : FALSE; +}*/ + + + + + + +