瀏覽代碼

Do not set ncudagpus each time _starpu_init_cuda is called, it is useless

Samuel Thibault 8 年之前
父節點
當前提交
03c9afe025
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/drivers/cuda/driver_cuda.c

+ 5 - 2
src/drivers/cuda/driver_cuda.c

@@ -446,8 +446,11 @@ unsigned _starpu_get_cuda_device_count(void)
 
 void _starpu_init_cuda(void)
 {
-	ncudagpus = _starpu_get_cuda_device_count();
-	STARPU_ASSERT(ncudagpus <= STARPU_MAXCUDADEVS);
+	if (ncudagpus < 0)
+	{
+		ncudagpus = _starpu_get_cuda_device_count();
+		STARPU_ASSERT(ncudagpus <= STARPU_MAXCUDADEVS);
+	}
 }
 
 static int start_job_on_cuda(struct _starpu_job *j, struct _starpu_worker *worker, unsigned char pipeline_idx STARPU_ATTRIBUTE_UNUSED)