Преглед на файлове

avoid crash in non-profiling case

Samuel Thibault преди 6 години
родител
ревизия
a0d9146eff
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      src/drivers/cuda/driver_cuda.c

+ 2 - 2
src/drivers/cuda/driver_cuda.c

@@ -530,7 +530,7 @@ static int start_job_on_cuda(struct _starpu_job *j, struct _starpu_worker *worke
 #ifdef HAVE_LIBNVIDIA_ML
 		unsigned long long energy_start = 0;
 		nvmlReturn_t nvmlRet = -1;
-		if (profiling)
+		if (profiling && task->profiling_info)
 		{
 			nvmlRet = nvmlDeviceGetTotalEnergyConsumption(nvmlDev[worker->devid], &energy_start);
 			if (nvmlRet == NVML_SUCCESS)
@@ -552,7 +552,7 @@ static void finish_job_on_cuda(struct _starpu_job *j, struct _starpu_worker *wor
 
 
 #ifdef HAVE_LIBNVIDIA_ML
-	if (profiling && j->task->profiling_info->energy_consumed)
+	if (profiling && j->task->profiling_info && j->task->profiling_info->energy_consumed)
 	{
 		unsigned long long energy_end;
 		nvmlReturn_t nvmlRet = -1;