|
@@ -1671,9 +1671,12 @@ static void generate_bus_config_file(void)
|
|
|
}
|
|
|
#endif /* !SIMGRID */
|
|
|
|
|
|
-void _starpu_simgrid_get_platform_path(char *path, size_t maxlen)
|
|
|
+void _starpu_simgrid_get_platform_path(int version, char *path, size_t maxlen)
|
|
|
{
|
|
|
- get_bus_path("platform.xml", path, maxlen);
|
|
|
+ if (version == 3)
|
|
|
+ get_bus_path("platform.xml", path, maxlen);
|
|
|
+ else
|
|
|
+ get_bus_path("platform.v4.xml", path, maxlen);
|
|
|
}
|
|
|
|
|
|
#ifndef STARPU_SIMGRID
|
|
@@ -1890,7 +1893,7 @@ static void emit_pci_dev(FILE *f, struct hwloc_pcidev_attr_s *pcidev)
|
|
|
}
|
|
|
|
|
|
/* Emit the links of the object */
|
|
|
-static void emit_topology_bandwidths(FILE *f, hwloc_obj_t obj)
|
|
|
+static void emit_topology_bandwidths(FILE *f, hwloc_obj_t obj, const char *Bps, const char *s)
|
|
|
{
|
|
|
unsigned i;
|
|
|
if (obj->userdata)
|
|
@@ -1902,10 +1905,10 @@ static void emit_topology_bandwidths(FILE *f, hwloc_obj_t obj)
|
|
|
/* Uplink */
|
|
|
fprintf(f, " <link id=\"");
|
|
|
emit_pci_hub(f, obj);
|
|
|
- fprintf(f, " up\" bandwidth=\"%f\" latency=\"0.000000\"/>\n", data->bw_up);
|
|
|
+ fprintf(f, " up\" bandwidth=\"%f%s\" latency=\"0.000000%s\"/>\n", data->bw_up, Bps, s);
|
|
|
fprintf(f, " <link id=\"");
|
|
|
emit_pci_hub(f, obj);
|
|
|
- fprintf(f, " down\" bandwidth=\"%f\" latency=\"0.000000\"/>\n", data->bw_down);
|
|
|
+ fprintf(f, " down\" bandwidth=\"%f%s\" latency=\"0.000000%s\"/>\n", data->bw_down, Bps, s);
|
|
|
|
|
|
/* PCI Switches are assumed to have infinite internal bandwidth */
|
|
|
if (!obj->name || !strstr(obj->name, "Switch"))
|
|
@@ -1914,22 +1917,22 @@ static void emit_topology_bandwidths(FILE *f, hwloc_obj_t obj)
|
|
|
* order to support full duplex but not more */
|
|
|
fprintf(f, " <link id=\"");
|
|
|
emit_pci_hub(f, obj);
|
|
|
- fprintf(f, " through\" bandwidth=\"%f\" latency=\"0.000000\"/>\n", data->bw * 2);
|
|
|
+ fprintf(f, " through\" bandwidth=\"%f%s\" latency=\"0.000000%s\"/>\n", data->bw * 2, Bps, s);
|
|
|
}
|
|
|
}
|
|
|
else if (obj->type == HWLOC_OBJ_PCI_DEVICE)
|
|
|
{
|
|
|
fprintf(f, " <link id=\"");
|
|
|
emit_pci_dev(f, &obj->attr->pcidev);
|
|
|
- fprintf(f, " up\" bandwidth=\"%f\" latency=\"0.000000\"/>\n", data->bw_up);
|
|
|
+ fprintf(f, " up\" bandwidth=\"%f%s\" latency=\"0.000000%s\"/>\n", data->bw_up, Bps, s);
|
|
|
fprintf(f, " <link id=\"");
|
|
|
emit_pci_dev(f, &obj->attr->pcidev);
|
|
|
- fprintf(f, " down\" bandwidth=\"%f\" latency=\"0.000000\"/>\n", data->bw_down);
|
|
|
+ fprintf(f, " down\" bandwidth=\"%f%s\" latency=\"0.000000%s\"/>\n", data->bw_down, Bps, s);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (i = 0; i < obj->arity; i++)
|
|
|
- emit_topology_bandwidths(f, obj->children[i]);
|
|
|
+ emit_topology_bandwidths(f, obj->children[i], Bps, s);
|
|
|
}
|
|
|
|
|
|
/* emit_pci_link_* functions perform the third step: emitting the routes */
|
|
@@ -2098,15 +2101,34 @@ static void clean_topology(hwloc_obj_t obj)
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-static void write_bus_platform_file_content(void)
|
|
|
+static void write_bus_platform_file_content(int version)
|
|
|
{
|
|
|
FILE *f;
|
|
|
char path[256];
|
|
|
unsigned i;
|
|
|
+ const char *speed, *flops, *Bps, *s;
|
|
|
+ char dash;
|
|
|
+
|
|
|
+ if (version == 3)
|
|
|
+ {
|
|
|
+ speed = "power";
|
|
|
+ flops = "";
|
|
|
+ Bps = "";
|
|
|
+ s = "";
|
|
|
+ dash = '_';
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ speed = "speed";
|
|
|
+ flops = "f";
|
|
|
+ Bps = "Bps";
|
|
|
+ s = "s";
|
|
|
+ dash = '-';
|
|
|
+ }
|
|
|
|
|
|
STARPU_ASSERT(was_benchmarked);
|
|
|
|
|
|
- _starpu_simgrid_get_platform_path(path, sizeof(path));
|
|
|
+ _starpu_simgrid_get_platform_path(version, path, sizeof(path));
|
|
|
|
|
|
_STARPU_DEBUG("writing platform to %s\n", path);
|
|
|
|
|
@@ -2123,24 +2145,27 @@ static void write_bus_platform_file_content(void)
|
|
|
|
|
|
fprintf(f,
|
|
|
"<?xml version='1.0'?>\n"
|
|
|
-" <!DOCTYPE platform SYSTEM 'http://simgrid.gforge.inria.fr/simgrid.dtd'>\n"
|
|
|
-" <platform version=\"3\">\n"
|
|
|
+"<!DOCTYPE platform SYSTEM '%s'>\n"
|
|
|
+" <platform version=\"%u\">\n"
|
|
|
" <config id=\"General\">\n"
|
|
|
-" <prop id=\"network/TCP_gamma\" value=\"-1\"></prop>\n"
|
|
|
-" <prop id=\"network/latency_factor\" value=\"1\"></prop>\n"
|
|
|
-" <prop id=\"network/bandwidth_factor\" value=\"1\"></prop>\n"
|
|
|
+" <prop id=\"network/TCP%cgamma\" value=\"-1\"></prop>\n"
|
|
|
+" <prop id=\"network/latency%cfactor\" value=\"1\"></prop>\n"
|
|
|
+" <prop id=\"network/bandwidth%cfactor\" value=\"1\"></prop>\n"
|
|
|
" </config>\n"
|
|
|
" <AS id=\"AS0\" routing=\"Full\">\n"
|
|
|
-" <host id=\"MAIN\" power=\"1\"/>\n"
|
|
|
- );
|
|
|
+" <host id=\"MAIN\" %s=\"1%s\"/>\n",
|
|
|
+ version == 3
|
|
|
+ ? "http://simgrid.gforge.inria.fr/simgrid.dtd"
|
|
|
+ : "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd",
|
|
|
+ version, dash, dash, dash, speed, flops);
|
|
|
|
|
|
for (i = 0; i < ncpus; i++)
|
|
|
/* TODO: host memory for out-of-core simulation */
|
|
|
- fprintf(f, " <host id=\"CPU%d\" power=\"2000000000\"/>\n", i);
|
|
|
+ fprintf(f, " <host id=\"CPU%d\" %s=\"2000000000%s\"/>\n", i, speed, flops);
|
|
|
|
|
|
for (i = 0; i < ncuda; i++)
|
|
|
{
|
|
|
- fprintf(f, " <host id=\"CUDA%d\" power=\"2000000000\">\n", i);
|
|
|
+ fprintf(f, " <host id=\"CUDA%d\" %s=\"2000000000%s\">\n", i, speed, flops);
|
|
|
fprintf(f, " <prop id=\"memsize\" value=\"%llu\"/>\n", (unsigned long long) cuda_size[i]);
|
|
|
#ifdef HAVE_CUDA_MEMCPY_PEER
|
|
|
fprintf(f, " <prop id=\"memcpy_peer\" value=\"1\"/>\n");
|
|
@@ -2150,12 +2175,12 @@ static void write_bus_platform_file_content(void)
|
|
|
|
|
|
for (i = 0; i < nopencl; i++)
|
|
|
{
|
|
|
- fprintf(f, " <host id=\"OpenCL%d\" power=\"2000000000\">\n", i);
|
|
|
+ fprintf(f, " <host id=\"OpenCL%d\" %s=\"2000000000%s\">\n", i, speed, flops);
|
|
|
fprintf(f, " <prop id=\"memsize\" value=\"%llu\"/>\n", (unsigned long long) opencl_size[i]);
|
|
|
fprintf(f, " </host>\n");
|
|
|
}
|
|
|
|
|
|
- fprintf(f, "\n <host id=\"RAM\" power=\"1\"/>\n");
|
|
|
+ fprintf(f, "\n <host id=\"RAM\" %s=\"1%s\"/>\n", speed, flops);
|
|
|
|
|
|
/*
|
|
|
* Compute maximum bandwidth, taken as host bandwidth
|
|
@@ -2183,7 +2208,7 @@ static void write_bus_platform_file_content(void)
|
|
|
max_bandwidth = up_bw;
|
|
|
}
|
|
|
#endif
|
|
|
- fprintf(f, "\n <link id=\"Host\" bandwidth=\"%f\" latency=\"0.000000\"/>\n\n", max_bandwidth*1000000);
|
|
|
+ fprintf(f, "\n <link id=\"Host\" bandwidth=\"%f%s\" latency=\"0.000000%s\"/>\n\n", max_bandwidth*1000000, Bps, s);
|
|
|
|
|
|
/*
|
|
|
* OpenCL links
|
|
@@ -2194,14 +2219,14 @@ static void write_bus_platform_file_content(void)
|
|
|
{
|
|
|
char i_name[16];
|
|
|
snprintf(i_name, sizeof(i_name), "OpenCL%d", i);
|
|
|
- fprintf(f, " <link id=\"RAM-%s\" bandwidth=\"%f\" latency=\"%f\"/>\n",
|
|
|
+ fprintf(f, " <link id=\"RAM-%s\" bandwidth=\"%f%s\" latency=\"%f%s\"/>\n",
|
|
|
i_name,
|
|
|
- 1000000 / opencldev_timing_htod[1+i],
|
|
|
- opencldev_latency_htod[1+i]/1000000.);
|
|
|
- fprintf(f, " <link id=\"%s-RAM\" bandwidth=\"%f\" latency=\"%f\"/>\n",
|
|
|
+ 1000000 / opencldev_timing_htod[1+i], Bps,
|
|
|
+ opencldev_latency_htod[1+i]/1000000., s);
|
|
|
+ fprintf(f, " <link id=\"%s-RAM\" bandwidth=\"%f%s\" latency=\"%f%s\"/>\n",
|
|
|
i_name,
|
|
|
- 1000000 / opencldev_timing_dtoh[1+i],
|
|
|
- opencldev_latency_dtoh[1+i]/1000000.);
|
|
|
+ 1000000 / opencldev_timing_dtoh[1+i], Bps,
|
|
|
+ opencldev_latency_dtoh[1+i]/1000000., s);
|
|
|
}
|
|
|
fprintf(f, "\n");
|
|
|
#endif
|
|
@@ -2216,14 +2241,14 @@ static void write_bus_platform_file_content(void)
|
|
|
{
|
|
|
char i_name[16];
|
|
|
snprintf(i_name, sizeof(i_name), "CUDA%d", i);
|
|
|
- fprintf(f, " <link id=\"RAM-%s\" bandwidth=\"%f\" latency=\"%f\"/>\n",
|
|
|
+ fprintf(f, " <link id=\"RAM-%s\" bandwidth=\"%f%s\" latency=\"%f%s\"/>\n",
|
|
|
i_name,
|
|
|
- 1000000. / cudadev_timing_htod[1+i],
|
|
|
- cudadev_latency_htod[1+i]/1000000.);
|
|
|
- fprintf(f, " <link id=\"%s-RAM\" bandwidth=\"%f\" latency=\"%f\"/>\n",
|
|
|
+ 1000000. / cudadev_timing_htod[1+i], Bps,
|
|
|
+ cudadev_latency_htod[1+i]/1000000., s);
|
|
|
+ fprintf(f, " <link id=\"%s-RAM\" bandwidth=\"%f%s\" latency=\"%f%s\"/>\n",
|
|
|
i_name,
|
|
|
- 1000000. / cudadev_timing_dtoh[1+i],
|
|
|
- cudadev_latency_dtoh[1+i]/1000000.);
|
|
|
+ 1000000. / cudadev_timing_dtoh[1+i], Bps,
|
|
|
+ cudadev_latency_dtoh[1+i]/1000000., s);
|
|
|
}
|
|
|
fprintf(f, "\n");
|
|
|
#ifdef HAVE_CUDA_MEMCPY_PEER
|
|
@@ -2239,10 +2264,10 @@ static void write_bus_platform_file_content(void)
|
|
|
if (j == i)
|
|
|
continue;
|
|
|
snprintf(j_name, sizeof(j_name), "CUDA%d", j);
|
|
|
- fprintf(f, " <link id=\"%s-%s\" bandwidth=\"%f\" latency=\"%f\"/>\n",
|
|
|
+ fprintf(f, " <link id=\"%s-%s\" bandwidth=\"%f%s\" latency=\"%f%s\"/>\n",
|
|
|
i_name, j_name,
|
|
|
- 1000000. / cudadev_timing_dtod[1+i][1+j],
|
|
|
- cudadev_latency_dtod[1+i][1+j]/1000000.);
|
|
|
+ 1000000. / cudadev_timing_dtod[1+i][1+j], Bps,
|
|
|
+ cudadev_latency_dtod[1+i][1+j]/1000000., s);
|
|
|
}
|
|
|
}
|
|
|
#endif
|
|
@@ -2275,7 +2300,7 @@ static void write_bus_platform_file_content(void)
|
|
|
|
|
|
/* Ok, found path in all cases, can emit advanced platform routes */
|
|
|
fprintf(f, "\n");
|
|
|
- emit_topology_bandwidths(f, hwloc_get_root_obj(topology));
|
|
|
+ emit_topology_bandwidths(f, hwloc_get_root_obj(topology), Bps, s);
|
|
|
fprintf(f, "\n");
|
|
|
for (i = 0; i < ncuda; i++)
|
|
|
{
|
|
@@ -2367,7 +2392,8 @@ static void generate_bus_platform_file(void)
|
|
|
if (!was_benchmarked)
|
|
|
benchmark_all_gpu_devices();
|
|
|
|
|
|
- write_bus_platform_file_content();
|
|
|
+ write_bus_platform_file_content(3);
|
|
|
+ write_bus_platform_file_content(4);
|
|
|
}
|
|
|
|
|
|
static void check_bus_platform_file(void)
|
|
@@ -2375,9 +2401,16 @@ static void check_bus_platform_file(void)
|
|
|
int res;
|
|
|
|
|
|
char path[256];
|
|
|
- _starpu_simgrid_get_platform_path(path, sizeof(path));
|
|
|
+ _starpu_simgrid_get_platform_path(4, path, sizeof(path));
|
|
|
|
|
|
res = access(path, F_OK);
|
|
|
+
|
|
|
+ if (res)
|
|
|
+ {
|
|
|
+ _starpu_simgrid_get_platform_path(3, path, sizeof(path));
|
|
|
+ res = access(path, F_OK);
|
|
|
+ }
|
|
|
+
|
|
|
if (res)
|
|
|
{
|
|
|
/* File does not exist yet */
|