ソースを参照

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 年 前
コミット
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.
 /* 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
  * Copyright (C) 2010, 2011  Université de Bordeaux 1
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * 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 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];
         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
         // Locate source file
         _starpu_opencl_locate_file(source_file_name, located_file_name);
         _starpu_opencl_locate_file(source_file_name, located_file_name);
         _STARPU_DEBUG("Source file name : <%s>\n", located_file_name);
         _STARPU_DEBUG("Source file name : <%s>\n", located_file_name);