Browse Source

tools/starpu_perfmodel_plot.c: add OpenCL architecture

Nathalie Furmento 12 years ago
parent
commit
d3b2291830
1 changed files with 24 additions and 1 deletions
  1. 24 1
      tools/starpu_perfmodel_plot.c

+ 24 - 1
tools/starpu_perfmodel_plot.c

@@ -68,7 +68,7 @@ given perfmodel\n");
         fprintf(stderr, "   -l                  display all available models\n");
         fprintf(stderr, "   -s <symbol>         specify the symbol\n");
 	fprintf(stderr, "   -i <Fxt files>      input FxT files generated by StarPU\n");
-        fprintf(stderr, "   -a <arch>           specify the architecture (e.g. cpu, cpu:x, cuda, cuda_d)\n");
+        fprintf(stderr, "   -a <arch>           specify the architecture (e.g. cpu, cpu:x, cuda, cuda_d, opencl, opencl_d)\n");
 	fprintf(stderr, "   -h, --help          display this help and exit\n");
 	fprintf(stderr, "   -v, --version       output version information and exit\n\n");
         fprintf(stderr, "Report bugs to <%s>.", PACKAGE_BUGREPORT);
@@ -419,6 +419,29 @@ static void display_selected_models(FILE *gnuplot_file, struct starpu_perfmodel
 			}
 		}
 
+		if (strcmp(archname, "opencl") == 0)
+		{
+			display_perf_models(gnuplot_file, model, STARPU_OPENCL_DEFAULT, (enum starpu_perf_archtype) (STARPU_OPENCL_DEFAULT + STARPU_MAXOPENCLDEVS), &first);
+			return;
+		}
+
+		/* There must be a cleaner way ! */
+		nmatched = sscanf(archname, "opencl_%d", &gpuid);
+		if (nmatched == 1)
+		{
+			int archid = STARPU_OPENCL_DEFAULT+ gpuid;
+			if (archid < STARPU_NARCH_VARIATIONS)
+			{
+				display_perf_models(gnuplot_file, model, (enum starpu_perf_archtype) archid, (enum starpu_perf_archtype) (archid + 1), &first);
+				return;
+			}
+			else
+			{
+				fprintf(stderr, "Invalid OpenCL device %d (last valid one is %d)\n", gpuid, STARPU_MAXOPENCLDEVS-1);
+				exit(-1);
+			}
+		}
+
 		fprintf(stderr, "Unknown architecture requested, aborting.\n");
 		exit(-1);
 	}