Browse Source

measure_bandwidth_between_host_and_dev_on_cpu_with_opencl: when running OpenCL on a CPU, make sure not to use too much RAM, s that the operating system does not have to start swapping.

Otherwise, the calibration could last a very long time and use almost all of the RAM.
Cyril Roelandt 13 years ago
parent
commit
dad99fc4bc
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/core/perfmodel/perfmodel_bus.c

+ 7 - 0
src/core/perfmodel/perfmodel_bus.c

@@ -254,6 +254,13 @@ static void measure_bandwidth_between_host_and_dev_on_cpu_with_opencl(int dev, i
         if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err);
         if (size > (size_t)maxMemAllocSize/4) size = maxMemAllocSize/4;
 
+	if (_starpu_opencl_get_device_type(dev) == CL_DEVICE_TYPE_CPU)
+	{
+		/* Let's not use too much RAM when running OpenCL on a CPU: it
+		 * would make the OS swap like crazy. */
+		size /= 2;
+	}
+
 	/* hack to avoid third party libs to rebind threads */
 	_starpu_bind_thread_on_cpu(config, cpu);