Bläddra i källkod

Driver CUDA: fails when number of CUDA devices required is higher than what is available

Nathalie Furmento 14 år sedan
förälder
incheckning
9347d5f45d
2 ändrade filer med 7 tillägg och 2 borttagningar
  1. 2 2
      src/core/workers.h
  2. 5 0
      src/drivers/cuda/driver_cuda.c

+ 2 - 2
src/core/workers.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -76,7 +76,7 @@ struct starpu_worker_s {
 	unsigned worker_is_running;
 	unsigned worker_is_initialized;
 	starpu_worker_status status; /* what is the worker doing now ? (eg. CALLBACK) */
-	char name[32];
+	char name[64];
 
 #ifdef __GLIBC__
 	cpu_set_t initial_cpu_set;

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

@@ -152,6 +152,11 @@ void _starpu_init_cuda(void)
 	{
 		fprintf(stderr, "# Warning: %d CUDA device(s) found. Only %d enabled.\n", ncudagpus, STARPU_MAXCUDADEVS);
 	}
+	if (STARPU_MAXCUDADEVS > ncudagpus)
+	{
+		fprintf(stderr, "# Error: %d CUDA devices asked. Only %d are available.\n", STARPU_MAXCUDADEVS, ncudagpus);
+		assert(STARPU_MAXCUDADEVS <= ncudagpus);
+	}
 }
 
 static int execute_job_on_cuda(starpu_job_t j, struct starpu_worker_s *args)