Browse Source

Add `STARPU_DONT_INCLUDE_CUDA_HEADERS' to stay away from the Evil Empire.

* include/starpu_cuda.h: Don't do anything when
  STARPU_DONT_INCLUDE_CUDA_HEADERS is defined.

* include/starpu_data_interfaces.h: Don't include <cuda_runtime.h> when
  STARPU_DONT_INCLUDE_CUDA_HEADERS is defined; define `cudaStream_t' in
  that case.

* include/starpu_task.h: Don't include <cuda.h> when
  STARPU_DONT_INCLUDE_CUDA_HEADERS is defined.

* gcc-plugin/src/starpu.c (STARPU_DONT_INCLUDE_CUDA_HEADERS): Define.
Ludovic Courtès 14 years ago
parent
commit
412ca0bf83
4 changed files with 14 additions and 5 deletions
  1. 5 0
      gcc-plugin/src/starpu.c
  2. 2 2
      include/starpu_cuda.h
  3. 5 1
      include/starpu_data_interfaces.h
  4. 2 2
      include/starpu_task.h

+ 5 - 0
gcc-plugin/src/starpu.c

@@ -42,6 +42,11 @@ int plugin_is_GPL_compatible;
 
 #include <stdio.h>
 
+/* Don't include the dreaded proprietary headers that we don't need anyway.
+   In particular, this waives the obligation to reproduce their silly
+   disclaimer.  */
+#define STARPU_DONT_INCLUDE_CUDA_HEADERS
+
 #include <starpu.h>  /* for `STARPU_CPU' & co.  */
 
 

+ 2 - 2
include/starpu_cuda.h

@@ -18,7 +18,7 @@
 #ifndef __STARPU_CUDA_H__
 #define __STARPU_CUDA_H__
 
-#ifdef STARPU_USE_CUDA
+#if defined STARPU_USE_CUDA && !defined STARPU_DONT_INCLUDE_CUDA_HEADERS
 #include <cuda.h>
 #include <cuda_runtime.h>
 #include <cuda_runtime_api.h>
@@ -43,6 +43,6 @@ cudaStream_t starpu_cuda_get_local_stream(void);
 }
 #endif
 
-#endif /* STARPU_USE_CUDA */
+#endif /* STARPU_USE_CUDA && !STARPU_DONT_INCLUDE_CUDA_HEADERS */
 #endif /* __STARPU_CUDA_H__ */
 

+ 5 - 1
include/starpu_data_interfaces.h

@@ -30,7 +30,11 @@
 
 #ifdef STARPU_USE_CUDA
 /* to use CUDA streams */
-#include <cuda_runtime.h>
+# ifdef STARPU_DONT_INCLUDE_CUDA_HEADERS
+typedef void *cudaStream_t;
+# else
+#  include <cuda_runtime.h>
+# endif
 #endif
 
 #ifdef __cplusplus

+ 2 - 2
include/starpu_task.h

@@ -22,8 +22,8 @@
 #include <starpu.h>
 #include <starpu_config.h>
 
-#ifdef STARPU_USE_CUDA
-#include <cuda.h>
+#if defined STARPU_USE_CUDA && !defined STARPU_DONT_INCLUDE_CUDA_HEADERS
+# include <cuda.h>
 #endif
 
 #include <starpu_data.h>