Просмотр исходного кода

src/drivers/opencl/driver_opencl_utils.c: Do not try to load and compile the opencl kernel file if there is no devices

Nathalie Furmento лет назад: 15
Родитель
Сommit
535638a071
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      src/drivers/opencl/driver_opencl_utils.c

+ 6 - 1
src/drivers/opencl/driver_opencl_utils.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  * Copyright (C) 2010, 2011  Université de Bordeaux 1
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -170,8 +170,13 @@ int starpu_opencl_load_opencl_from_string(const char *opencl_program_source, str
 
 int starpu_opencl_load_opencl_from_file(const char *source_file_name, struct starpu_opencl_program *opencl_programs)
 {
+	int nb_devices;
         char located_file_name[1024];
 
+	// Do not try to load and compile the file if there is no devices
+	nb_devices = _starpu_opencl_get_device_count();
+	if (nb_devices == 0) return EXIT_SUCCESS;
+
         // Locate source file
         _starpu_opencl_locate_file(source_file_name, located_file_name);
         _STARPU_DEBUG("Source file name : <%s>\n", located_file_name);