+static double constant_bandwidth_constraint(double rate, double bound,
+ double size)
+{
+ return rate;
+}
+
+/**********************/
+/* SMPI callbacks */
+/**********************/
+static double smpi_latency_factor(double size)
+{
+ /* 1 B <= size <= 1 KiB */
+ if (size <= 1024.0) {
+ return 1.0056;
+ }
+
+ /* 2 KiB <= size <= 32 KiB */
+ if (size <= 32768.0) {
+ return 1.8805;
+ }
+
+ /* 64 KiB <= size <= 4 MiB */
+ return 22.7111;
+}
+
+static double smpi_bandwidth_factor(double size)
+{
+ /* 1 B <= size <= 1 KiB */
+ if (size <= 1024.0) {
+ return 0.2758;
+ }
+
+ /* 2 KiB <= size <= 32 KiB */
+ if (size <= 32768.0) {
+ return 0.5477;
+ }
+
+ /* 64 KiB <= size <= 4 MiB */
+ return 0.9359;
+}
+
+static double smpi_bandwidth_constraint(double rate, double bound,
+ double size)
+{
+ return rate < 0 ? bound : min(bound, rate * smpi_bandwidth_factor(size));
+}
+
+
+static double (*latency_factor_callback) (double) =
+ &constant_latency_factor;
+static double (*bandwidth_factor_callback) (double) =
+ &constant_bandwidth_factor;
+static double (*bandwidth_constraint_callback) (double, double, double) =
+ &constant_bandwidth_constraint;
+
+
+static link_CM02_t net_link_new(char *name,
+ double bw_initial,
+ tmgr_trace_t bw_trace,
+ double lat_initial,
+ tmgr_trace_t lat_trace,
+ e_surf_resource_state_t
+ state_initial,
+ tmgr_trace_t state_trace,
+ e_surf_link_sharing_policy_t
+ policy, xbt_dict_t properties)
+{
+ link_CM02_t nw_link = (link_CM02_t)
+ surf_resource_lmm_new(sizeof(s_link_CM02_t),
+ surf_network_model, name, properties,
+ network_maxmin_system,
+ sg_bandwidth_factor * bw_initial,
+ history,
+ state_initial, state_trace,
+ bw_initial, bw_trace);
+
+ xbt_assert1(!xbt_dict_get_or_null
+ (surf_network_model->resource_set, name),
+ "Link '%s' declared several times in the platform file.",
+ name);