Selaa lähdekoodia

src/datawizard/interfaces/data_interface.c: test values before setting them to NULL

Nathalie Furmento 13 vuotta sitten
vanhempi
commit
31be5f7d91
1 muutettua tiedostoa jossa 12 lisäystä ja 6 poistoa
  1. 12 6
      src/datawizard/interfaces/data_interface.c

+ 12 - 6
src/datawizard/interfaces/data_interface.c

@@ -292,14 +292,20 @@ void starpu_data_register(starpu_data_handle_t *handleptr, uint32_t home_node,
 	if (STARPU_UNLIKELY(disable_asynchronous_copy))
 	{
 #ifdef STARPU_USE_CUDA
-	     ((struct starpu_data_copy_methods *)ops->copy_methods)->ram_to_cuda_async = NULL;
-	     ((struct starpu_data_copy_methods *)ops->copy_methods)->cuda_to_ram_async = NULL;
-	     ((struct starpu_data_copy_methods *)ops->copy_methods)->cuda_to_cuda_async = NULL;
+	     if (ops->copy_methods->ram_to_cuda_async)
+		  ((struct starpu_data_copy_methods *)ops->copy_methods)->ram_to_cuda_async = NULL;
+	     if (ops->copy_methods->cuda_to_ram_async)
+		  ((struct starpu_data_copy_methods *)ops->copy_methods)->cuda_to_ram_async = NULL;
+	     if (ops->copy_methods->cuda_to_cuda_async)
+		  ((struct starpu_data_copy_methods *)ops->copy_methods)->cuda_to_cuda_async = NULL;
 #endif
 #ifdef STARPU_USE_OPENCL
-	     ((struct starpu_data_copy_methods *)ops->copy_methods)->ram_to_opencl_async = NULL;
-	     ((struct starpu_data_copy_methods *)ops->copy_methods)->opencl_to_ram_async = NULL;
-	     ((struct starpu_data_copy_methods *)ops->copy_methods)->opencl_to_opencl_async = NULL;
+	     if (ops->copy_methods->ram_to_opencl_async)
+		  ((struct starpu_data_copy_methods *)ops->copy_methods)->ram_to_opencl_async = NULL;
+	     if (ops->copy_methods->opencl_to_ram_async)
+		  ((struct starpu_data_copy_methods *)ops->copy_methods)->opencl_to_ram_async = NULL;
+	     if (ops->copy_methods->opencl_to_opencl_async)
+		  ((struct starpu_data_copy_methods *)ops->copy_methods)->opencl_to_opencl_async = NULL;
 #endif
 	}