Ver código fonte

src/core/workers.c: function _starpu_can_use_nth_implementation: check function and number of devices

Nathalie Furmento 12 anos atrás
pai
commit
0fd8214db4
1 arquivos alterados com 8 adições e 6 exclusões
  1. 8 6
      src/core/workers.c

+ 8 - 6
src/core/workers.c

@@ -167,20 +167,22 @@ static int _starpu_can_use_nth_implementation(enum starpu_archtype arch, struct
 		starpu_cuda_func_t cuda_func = _starpu_task_get_cuda_nth_implementation(cl, nimpl);
 		starpu_opencl_func_t opencl_func = _starpu_task_get_opencl_nth_implementation(cl, nimpl);
 		starpu_gordon_func_t gordon_func = _starpu_task_get_gordon_nth_implementation(cl, nimpl);
-		return (
+		int cpu_func_enabled=1, cuda_func_enabled=1, opencl_func_enabled=1, gordon_func_enabled=1;
+
 #ifdef STARPU_USE_CPU
-			cpu_func != NULL &&
+		cpu_func_enabled = cpu_func != NULL && starpu_cpu_worker_get_count();
 #endif
 #ifdef STARPU_USE_CUDA
-			cuda_func != NULL &&
+		cuda_func_enabled = cuda_func != NULL && starpu_cuda_worker_get_count();
 #endif
 #ifdef STARPU_USE_OPENCL
-			opencl_func != NULL &&
+		opencl_func_enabled = opencl_func != NULL && starpu_opencl_worker_get_count();
 #endif
 #ifdef STARPU_USE_GORDON
-			gordon_func != NULL &&
+		gordon_func_enabled = gordon_func != 0 && starpu_spu_worker_get_count();
 #endif
-			1);
+
+		return (cpu_func_enabled && cuda_func_enabled && opencl_func_enabled && gordon_func_enabled);
 	}
 	case STARPU_CPU_WORKER:
 	{