X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b03c4669c65ee144f7e3c86c9b6748d0c831931c..41bd4481fbf3458d724615848762e08acb8f69f8:/src/include/surf/surf.h diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 45499ebc5d..1a59662de2 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -11,6 +11,12 @@ #include "xbt/swag.h" #include "xbt/dynar.h" #include "xbt/dict.h" +#include "xbt/misc.h" +#include "gras_config.h" + +SG_BEGIN_DECL() + + /* Actions and resources are higly connected structures... */ @@ -32,6 +38,23 @@ typedef struct surf_action *surf_action_t; */ typedef struct surf_resource *surf_resource_t; +/** \brief Resource model description + */ +typedef struct surf_resource_description { + const char *name; + surf_resource_t resource; + void (* resource_init) (const char *filename); +} s_surf_resource_description_t, *surf_resource_description_t; + +XBT_PUBLIC(void) update_resource_description(s_surf_resource_description_t *table, + int table_size, + const char* name, + surf_resource_t resource + ); +XBT_PUBLIC(int) find_resource_description(s_surf_resource_description_t *table, + int table_size, + const char* name); + /** \brief Action structure * \ingroup SURF_actions * @@ -163,7 +186,7 @@ typedef struct surf_timer_resource { /** \brief The timer resource * \ingroup SURF_resources */ -extern surf_timer_resource_t XBT_DECLARE_DATA surf_timer_resource; +XBT_PUBLIC_DATA(surf_timer_resource_t) surf_timer_resource; /** \brief Initializes the timer resource * \ingroup SURF_resources @@ -206,7 +229,7 @@ typedef struct surf_cpu_resource { /** \brief The CPU resource * \ingroup SURF_resources */ -extern surf_cpu_resource_t XBT_DECLARE_DATA surf_cpu_resource; +XBT_PUBLIC_DATA(surf_cpu_resource_t) surf_cpu_resource; /** \brief Initializes the CPU resource with the model Cas01 * \ingroup SURF_resources @@ -218,6 +241,12 @@ extern surf_cpu_resource_t XBT_DECLARE_DATA surf_cpu_resource; */ XBT_PUBLIC(void) surf_cpu_resource_init_Cas01(const char *filename); +extern XBT_PUBLIC_DATA(int) surf_cpu_resource_description_size; +/** \brief The list of all available cpu resource models + * \ingroup SURF_resources + */ +extern XBT_PUBLIC_DATA(s_surf_resource_description_t) surf_cpu_resource_description[]; + /* Network resource */ /** \brief Network resource extension public @@ -253,19 +282,90 @@ typedef struct surf_network_resource { * resource should be accessed because depending on the platform model, * the network resource can be NULL. */ -extern surf_network_resource_t XBT_DECLARE_DATA surf_network_resource; +XBT_PUBLIC_DATA(surf_network_resource_t) surf_network_resource; /** \brief Initializes the platform with the network model CM02 * \ingroup SURF_resources * \param filename XML platform file name * * This function is called by surf_workstation_resource_init_CLM03 - * so you shouldn't call it by yourself. + * or by yourself only if you plan using surf_workstation_resource_init_compound * * \see surf_workstation_resource_init_CLM03() */ XBT_PUBLIC(void) surf_network_resource_init_CM02(const char *filename); +#ifdef HAVE_GTNETS +/** \brief Initializes the platform with the network model GTNETS + * \ingroup SURF_resources + * \param filename XML platform file name + * + * This function is called by surf_workstation_resource_init_GTNETS + * or by yourself only if you plan using surf_workstation_resource_init_compound + * + * \see surf_workstation_resource_init_GTNETS() + */ +XBT_PUBLIC(void) surf_network_resource_init_GTNETS(const char *filename); +#endif + +/** \brief Initializes the platform with the network model Reno + * \ingroup SURF_resources + * \param filename XML platform file name + * + * The problem is related to max( sum( arctan(C * Df * xi) ) ). + * + * Reference: + * [LOW03] S. H. Low. A duality model of TCP and queue management algorithms. + * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003. + * + * Call this function only if you plan using surf_workstation_resource_init_compound. + * + */ +XBT_PUBLIC(void) surf_network_resource_init_Reno(const char *filename); + +/** \brief Initializes the platform with the network model Vegas + * \ingroup SURF_resources + * \param filename XML platform file name + * + * This problem is related to max( sum( a * Df * ln(xi) ) ) which is equivalent + * to the proportional fairness. + * + * Reference: + * [LOW03] S. H. Low. A duality model of TCP and queue management algorithms. + * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003. + * + * Call this function only if you plan using surf_workstation_resource_init_compound. + * + */ +XBT_PUBLIC(void) surf_network_resource_init_Vegas(const char *filename); + +#ifdef HAVE_SDP +/** \brief Initializes the platform with the network model based on SDP + * \ingroup SURF_resources + * \param filename XML platform file name + * + * This function implements the proportional fairness known as the maximization + * of x1*x2*...*xn . + * + * Reference: + * + * [TAG03]. Corinne Touati, Eitan Altman, and Jérôme Galtier. + * Semi-definite programming approach for bandwidth allocation and routing in networks. + * Game Theory and Applications, 9:169-179, December 2003. Nova publisher. + * + * Call this function only if you plan using surf_workstation_resource_init_compound. + */ +XBT_PUBLIC(void) surf_network_resource_init_SDP(const char *filename); +#endif + + + +extern XBT_PUBLIC_DATA(int) surf_network_resource_description_size; +/** \brief The list of all available network resource models + * \ingroup SURF_resources + */ +extern XBT_PUBLIC_DATA(s_surf_resource_description_t) surf_network_resource_description[]; + /** \brief Workstation resource extension public * \ingroup SURF_resources * @@ -313,7 +413,17 @@ typedef struct surf_workstation_resource { * because depending on the platform model, the network resource and the CPU resource * may not exist. */ -extern surf_workstation_resource_t XBT_DECLARE_DATA surf_workstation_resource; +XBT_PUBLIC_DATA(surf_workstation_resource_t) surf_workstation_resource; + +/** \brief Initializes the platform with a compound workstation model + * \ingroup SURF_resources + * \param filename XML platform file name + * + * This function should be called after a cpu_resource and a + * network_resource have been set up. + * + */ +XBT_PUBLIC(void) surf_workstation_resource_init_compound(const char *filename); /** \brief Initializes the platform with the workstation model CLM03 * \ingroup SURF_resources @@ -333,18 +443,31 @@ XBT_PUBLIC(void) surf_workstation_resource_init_CLM03(const char *filename); * \ingroup SURF_resources * \param filename XML platform file name * - * With this model, the workstations and the network are handled together. - * There is no network resource. This platform model is the default one for - * MSG and SimDag. + * With this model, the workstations and the network are handled + * together. The network model is roughly the same as in CM02 but + * interference between computations and communications can be taken + * into account. This platform model is the default one for MSG and + * SimDag. * - * \see surf_workstation_resource_init_CLM03() */ - XBT_PUBLIC(void) surf_workstation_resource_init_KCCFLN05(const char *filename); +/** \brief Initializes the platform with the model KCCFLN05 + * \ingroup SURF_resources + * \param filename XML platform file name + * + * With this model, only parallel tasks can be used. Resource sharing + * is done by identifying bottlenecks and giving an equal share of + * the resource to each action. + * + */ +XBT_PUBLIC(void) surf_workstation_resource_init_ptask_L07(const char *filename); -XBT_PUBLIC(void) surf_workstation_resource_init_KCCFLN05_proportionnal(const char *filename); - +extern XBT_PUBLIC_DATA(int) surf_workstation_resource_description_size; +/** \brief The list of all available workstation resource models + * \ingroup SURF_resources + */ +extern XBT_PUBLIC_DATA(s_surf_resource_description_t) surf_workstation_resource_description[]; /** \brief The network links * \ingroup SURF_resources @@ -353,7 +476,7 @@ XBT_PUBLIC(void) surf_workstation_resource_init_KCCFLN05_proportionnal(const cha * * \see workstation_set */ -extern xbt_dict_t XBT_DECLARE_DATA network_link_set; +XBT_PUBLIC_DATA(xbt_dict_t) network_link_set; /** \brief The workstations * \ingroup SURF_resources @@ -362,12 +485,12 @@ extern xbt_dict_t XBT_DECLARE_DATA network_link_set; * * \see network_link_set */ -extern xbt_dict_t XBT_DECLARE_DATA workstation_set; +XBT_PUBLIC_DATA(xbt_dict_t) workstation_set; /** \brief List of initialized resources * \ingroup SURF_resources */ -extern xbt_dynar_t XBT_DECLARE_DATA resource_list; +XBT_PUBLIC_DATA(xbt_dynar_t) resource_list; /*******************************************/ /*** SURF Globals **************************/ @@ -378,12 +501,14 @@ extern xbt_dynar_t XBT_DECLARE_DATA resource_list; * \param argc argument number * \param argv arguments * - * This function has to be called to initialize the common structures. - * Then you will have to create the environment by calling surf_timer_resource_init() - * and surf_workstation_resource_init_CLM03() or surf_workstation_resource_init_KCCFLN05(). + * This function has to be called to initialize the common + * structures. Then you will have to create the environment by + * calling surf_timer_resource_init() and + * e.g. surf_workstation_resource_init_CLM03() or + * surf_workstation_resource_init_KCCFLN05(). * * \see surf_timer_resource_init(), surf_workstation_resource_init_CLM03(), - * surf_workstation_resource_init_KCCFLN05(), surf_exit() + * surf_workstation_resource_init_KCCFLN05(), surf_workstation_resource_init_compound(), surf_exit() */ XBT_PUBLIC(void) surf_init(int *argc, char **argv); /* initialize common structures */ @@ -404,7 +529,7 @@ XBT_PUBLIC(double) surf_solve(void); * * Return the current time in millisecond. */ -XBT_PUBLIC(double) surf_get_clock(void); +XBT_PUBLIC(double)surf_get_clock(void); /** \brief Exit SURF * \ingroup SURF_simulation @@ -415,4 +540,7 @@ XBT_PUBLIC(double) surf_get_clock(void); */ XBT_PUBLIC(void) surf_exit(void); + +SG_END_DECL() + #endif /* _SURF_SURF_H */