Browse Source

load_bus_affinity_file_content: do not try to open the affinity file if neither CUDA or OpenCL are defined.

In this case, the file will not have been created by wrtie_bus_affinity_file_content.
This fixes a bug introduced in r. 5451.
Cyril Roelandt 13 years ago
parent
commit
43fc35e2a5
1 changed files with 5 additions and 4 deletions
  1. 5 4
      src/core/perfmodel/perfmodel_bus.c

+ 5 - 4
src/core/perfmodel/perfmodel_bus.c

@@ -592,6 +592,7 @@ static void get_affinity_path(char *path, size_t maxlen)
 
 
 static void load_bus_affinity_file_content(void)
 static void load_bus_affinity_file_content(void)
 {
 {
+#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL)
 	FILE *f;
 	FILE *f;
 
 
 	char path[256];
 	char path[256];
@@ -600,7 +601,6 @@ static void load_bus_affinity_file_content(void)
 	f = fopen(path, "r");
 	f = fopen(path, "r");
 	STARPU_ASSERT(f);
 	STARPU_ASSERT(f);
 
 
-#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL)
 	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	ncpus = _starpu_topology_get_nhwcpu(config);
 	ncpus = _starpu_topology_get_nhwcpu(config);
         int gpu;
         int gpu;
@@ -629,7 +629,7 @@ static void load_bus_affinity_file_content(void)
 		ret = fscanf(f, "\n");
 		ret = fscanf(f, "\n");
 		STARPU_ASSERT(ret == 0);
 		STARPU_ASSERT(ret == 0);
 	}
 	}
-#endif
+#endif /* !STARPU_USE_CUDA */
 #ifdef STARPU_USE_OPENCL
 #ifdef STARPU_USE_OPENCL
         nopencl = _starpu_opencl_get_device_count();
         nopencl = _starpu_opencl_get_device_count();
 	for (gpu = 0; gpu < nopencl; gpu++)
 	for (gpu = 0; gpu < nopencl; gpu++)
@@ -654,10 +654,11 @@ static void load_bus_affinity_file_content(void)
 		ret = fscanf(f, "\n");
 		ret = fscanf(f, "\n");
 		STARPU_ASSERT(ret == 0);
 		STARPU_ASSERT(ret == 0);
 	}
 	}
-#endif
-#endif
+#endif /* !STARPU_USE_OPENCL */
 
 
 	fclose(f);
 	fclose(f);
+#endif /* !(STARPU_USE_CUDA_ || STARPU_USE_OPENCL */
+
 }
 }
 
 
 static void write_bus_affinity_file_content(void)
 static void write_bus_affinity_file_content(void)