return 0;
}
+# Return 1 if cuda.h and -lcuda are available.
+
+proc check_effective_target_openacc_cuda { } {
+ return [check_no_compiler_messages openacc_cuda executable {
+#include <cuda.h>
+int main() {
+ CUdevice dev;
+ CUresult r = cuDeviceGet (&dev, 0);
+ if (r != CUDA_SUCCESS)
+ return 1;
+ return 0;
+} } "-lcuda" ]
+}
+
+# Return 1 if cublas_v2.h and -lcublas are available.
+
+proc check_effective_target_openacc_cublas { } {
+ return [check_no_compiler_messages openacc_cublas executable {
+#include <cuda.h>
+#include <cublas_v2.h>
+int main() {
+ cublasStatus_t s;
+ cublasHandle_t h;
+ CUdevice dev;
+ CUresult r = cuDeviceGet (&dev, 0);
+ if (r != CUDA_SUCCESS)
+ return 1;
+ s = cublasCreate (&h);
+ if (s != CUBLAS_STATUS_SUCCESS)
+ return 1;
+ return 0;
+} } "-lcuda -lcublas" ]
+}
+
+# Return 1 if cuda_runtime_api.h and -lcudart are available.
+
+proc check_effective_target_openacc_cudart { } {
+ return [check_no_compiler_messages openacc_cudart executable {
+#include <cuda.h>
+#include <cuda_runtime_api.h>
+int main() {
+ cudaError_t e;
+ int devn;
+ CUdevice dev;
+ CUresult r = cuDeviceGet (&dev, 0);
+ if (r != CUDA_SUCCESS)
+ return 1;
+ e = cudaGetDevice (&devn);
+ if (e != cudaSuccess)
+ return 1;
+ return 0;
+} } "-lcuda -lcudart" ]
+}
/* { dg-additional-sources acc_get_property-aux.c } */
/* { dg-additional-options "-lcuda -lcudart" } */
/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* { dg-require-effective-target openacc_cudart } */
#include <openacc.h>
#include <cuda.h>
/* { dg-do run } */
-/* { dg-additional-options "-lcuda" { target openacc_nvidia_accel_selected } } */
+/* { dg-additional-options "-DUSE_CUDA_H" { target openacc_cuda } } */
+/* { dg-additional-options "-lcuda" { target { openacc_nvidia_accel_selected && openacc_cuda } } } */
#include <openacc.h>
#include <stdlib.h>
-#if defined ACC_DEVICE_TYPE_nvidia
+#if defined ACC_DEVICE_TYPE_nvidia && defined USE_CUDA_H
#include "cuda.h"
#endif
int
main (int argc, char **argv)
{
-#if defined ACC_DEVICE_TYPE_nvidia
+#if defined ACC_DEVICE_TYPE_nvidia && defined USE_CUDA_H
CUresult r;
CUstream stream1;
#endif
int i;
int nbytes;
-#if defined ACC_DEVICE_TYPE_nvidia
+#if defined ACC_DEVICE_TYPE_nvidia && defined USE_CUDA_H
acc_init (acc_device_nvidia);
#endif
}
-#if defined ACC_DEVICE_TYPE_nvidia
+#if defined ACC_DEVICE_TYPE_nvidia && defined USE_CUDA_H
r = cuStreamCreate (&stream1, CU_STREAM_NON_BLOCKING);
if (r != CUDA_SUCCESS)
{
}
-#if defined ACC_DEVICE_TYPE_nvidia
+#if defined ACC_DEVICE_TYPE_nvidia && defined USE_CUDA_H
r = cuStreamCreate (&stream1, CU_STREAM_NON_BLOCKING);
if (r != CUDA_SUCCESS)
{
abort ();
}
-#if defined ACC_DEVICE_TYPE_nvidia
+#if defined ACC_DEVICE_TYPE_nvidia && defined USE_CUDA_H
acc_shutdown (acc_device_nvidia);
#endif
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda -lcublas -lcudart" } */
+/* { dg-require-effective-target openacc_cublas } */
+/* { dg-require-effective-target openacc_cudart } */
#include <stdio.h>
#include <stdlib.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda -lcublas -lcudart" } */
+/* { dg-require-effective-target openacc_cublas } */
+/* { dg-require-effective-target openacc_cudart } */
#include <stdio.h>
#include <stdlib.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda -lcublas -lcudart" } */
+/* { dg-require-effective-target openacc_cublas } */
+/* { dg-require-effective-target openacc_cudart } */
#include <stdio.h>
#include <stdlib.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda -lcublas -lcudart" } */
+/* { dg-require-effective-target openacc_cublas } */
+/* { dg-require-effective-target openacc_cudart } */
#include <stdio.h>
#include <stdlib.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lm -lcuda -lcublas -lcudart -Wall -Wextra" } */
+/* { dg-require-effective-target openacc_cublas } */
+/* { dg-require-effective-target openacc_cudart } */
#include <stdlib.h>
#include <math.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdio.h>
#include <unistd.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdio.h>
#include <stdlib.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdio.h>
#include <unistd.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdio.h>
#include <unistd.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdio.h>
#include <stdlib.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdio.h>
#include <unistd.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdio.h>
#include <stdlib.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdio.h>
#include <stdlib.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdio.h>
#include <stdlib.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdio.h>
#include <stdlib.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdio.h>
#include <stdlib.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdio.h>
#include <stdlib.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdlib.h>
#include <unistd.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdlib.h>
#include <unistd.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <pthread.h>
#include <stdio.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <stdlib.h>
#include <unistd.h>
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda" } */
+/* { dg-require-effective-target openacc_cuda } */
#include <openacc.h>
#include <stdlib.h>
! { dg-do run { target openacc_nvidia_accel_selected } }
! { dg-additional-options "-lcublas -Wall -Wextra" }
+! { dg-require-effective-target openacc_cublas }
program test
implicit none
! { dg-do run { target openacc_nvidia_accel_selected } }
! { dg-additional-options "-lcublas -Wall -Wextra" }
+! { dg-require-effective-target openacc_cublas }
include "cublas-fixed.h"
! { dg-do run { target openacc_nvidia_accel_selected } }
! { dg-additional-options "-lcublas -Wall -Wextra" }
+! { dg-require-effective-target openacc_cublas }
module cublas
interface