Browse Source

workers: new function starpu_worker_get_type_as_string()

Nathalie Furmento 10 years ago
parent
commit
53a11e7402
4 changed files with 19 additions and 1 deletions
  1. 1 0
      ChangeLog
  2. 5 1
      doc/doxygen/chapters/api/workers.doxy
  3. 3 0
      include/starpu_worker.h
  4. 10 0
      src/core/workers.c

+ 1 - 0
ChangeLog

@@ -73,6 +73,7 @@ Small features:
     manage the tag.
     manage the tag.
   * On Linux x86, spinlocks now block after a hundred tries. This avoids
   * On Linux x86, spinlocks now block after a hundred tries. This avoids
     typical 10ms pauses when the application thread tries to submit tasks.
     typical 10ms pauses when the application thread tries to submit tasks.
+  * New function char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type)
 
 
 Changes:
 Changes:
   * Data interfaces (variable, vector, matrix and block) now define
   * Data interfaces (variable, vector, matrix and block) now define

+ 5 - 1
doc/doxygen/chapters/api/workers.doxy

@@ -1,7 +1,7 @@
 /*
 /*
  * This file is part of the StarPU Handbook.
  * This file is part of the StarPU Handbook.
  * Copyright (C) 2009--2011  Universit@'e de Bordeaux 1
  * Copyright (C) 2009--2011  Universit@'e de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014  Centre National de la Recherche Scientifique
  * Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique
  * Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique
  * See the file version.doxy for copying conditions.
  * See the file version.doxy for copying conditions.
  */
  */
@@ -222,4 +222,8 @@ Returns the type of the given node as defined by
 this function should be used in the allocation function to determine
 this function should be used in the allocation function to determine
 on which device the memory needs to be allocated.
 on which device the memory needs to be allocated.
 
 
+\fn char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type)
+\ingroup API_Workers_Properties
+Returns the given worker type as a string.
+
 */
 */

+ 3 - 0
include/starpu_worker.h

@@ -116,6 +116,9 @@ struct starpu_tree* starpu_workers_get_tree(void);
 unsigned starpu_worker_get_sched_ctx_list(int worker, unsigned **sched_ctx);
 unsigned starpu_worker_get_sched_ctx_list(int worker, unsigned **sched_ctx);
 
 
 unsigned starpu_worker_is_slave(int workerid);
 unsigned starpu_worker_is_slave(int workerid);
+
+char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type);
+
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif
 #endif

+ 10 - 0
src/core/workers.c

@@ -1987,3 +1987,13 @@ unsigned starpu_worker_get_sched_ctx_list(int workerid, unsigned **sched_ctxs)
 	return nsched_ctxs;
 	return nsched_ctxs;
 }
 }
 
 
+char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type)
+{
+	if (type == STARPU_CPU_WORKER) return "STARPU_CPU_WORKER";
+	if (type == STARPU_CUDA_WORKER) return "STARPU_CUDA_WORKER";
+	if (type == STARPU_OPENCL_WORKER) return "STARPU_OPENCL_WORKER";
+	if (type == STARPU_MIC_WORKER) return "STARPU_MIC_WORKER";
+	if (type == STARPU_SCC_WORKER) return "STARPU_SCC_WORKER";
+	if (type == STARPU_ANY_WORKER) return "STARPU_ANY_WORKER";
+	return "STARPU_unknown_WORKER";
+}