Bläddra i källkod

examples/interface: codelet to display takes a optional string parameter

Nathalie Furmento 12 år sedan
förälder
incheckning
a872a04d26
2 ändrade filer med 12 tillägg och 8 borttagningar
  1. 5 5
      examples/interface/complex.c
  2. 7 3
      examples/interface/complex_codelet.h

+ 5 - 5
examples/interface/complex.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -95,11 +95,11 @@ int main(int argc, char **argv)
 	starpu_complex_data_register(&handle1, 0, &real, &imaginary, 1);
 	starpu_complex_data_register(&handle2, 0, &copy_real, &copy_imaginary, 1);
 
-	ret = starpu_insert_task(&cl_display, STARPU_R, handle1, 0);
+	ret = starpu_insert_task(&cl_display, STARPU_VALUE, "handle1", strlen("handle1"), STARPU_R, handle1, 0);
 	if (ret == -ENODEV) goto end;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_insert_task");
 
-	ret = starpu_insert_task(&cl_display, STARPU_R, handle2, 0);
+	ret = starpu_insert_task(&cl_display, STARPU_VALUE, "handle2", strlen("handle2"), STARPU_R, handle2, 0);
 	if (ret == -ENODEV) goto end;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_insert_task");
 
@@ -124,11 +124,11 @@ int main(int argc, char **argv)
 	if (ret == -ENODEV) goto end;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_insert_task");
 
-	ret = starpu_insert_task(&cl_display, STARPU_R, handle1, 0);
+	ret = starpu_insert_task(&cl_display, STARPU_VALUE, "handle1", strlen("handle1"), STARPU_R, handle1, 0);
 	if (ret == -ENODEV) goto end;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_insert_task");
 
-	ret = starpu_insert_task(&cl_display, STARPU_R, handle2, 0);
+	ret = starpu_insert_task(&cl_display, STARPU_VALUE, "handle2", strlen("handle2"), STARPU_R, handle2, 0);
 	if (ret == -ENODEV) goto end;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_insert_task");
 

+ 7 - 3
examples/interface/complex_codelet.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -56,16 +56,20 @@ struct starpu_codelet cl_compare =
 	.name = "cl_compare"
 };
 
-void display_complex_codelet(void *descr[], __attribute__ ((unused)) void *_args)
+void display_complex_codelet(void *descr[], void *_args)
 {
 	int nx = STARPU_COMPLEX_GET_NX(descr[0]);
 	double *real = STARPU_COMPLEX_GET_REAL(descr[0]);
 	double *imaginary = STARPU_COMPLEX_GET_IMAGINARY(descr[0]);
 	int i;
+	char msg[100];
+
+	if (_args)
+		starpu_codelet_unpack_args(_args, &msg);
 
 	for(i=0 ; i<nx ; i++)
 	{
-		fprintf(stderr, "Complex[%d] = %3.2f + %3.2f i\n", i, real[i], imaginary[i]);
+		fprintf(stderr, "[%s] Complex[%d] = %3.2f + %3.2f i\n", _args?msg:NULL, i, real[i], imaginary[i]);
 	}
 }