浏览代码

add trivial CUDA testcase

Samuel Thibault 8 年之前
父节点
当前提交
5694a4f4a5
共有 1 个文件被更改,包括 50 次插入2 次删除
  1. 50 2
      doc/doxygen/chapters/390_faq.doxy

+ 50 - 2
doc/doxygen/chapters/390_faq.doxy

@@ -226,10 +226,58 @@ starpu_resume();
 starpu_shutdown();
 \endcode
 
+\section CUDADrivers StarPU does not see my CUDA device
+
+First make sure that CUDA is properly running outside StarPU: build and
+run the following program with -lcudart:
+
+\code{.c}
+#include <stdio.h>
+#include <cuda.h>
+#include <cuda_runtime.h>
+
+int main(void) {
+	int n, i, version;
+	cudaError_t err;
+
+	err = cudaGetDeviceCount(&n);
+	if (err)
+	{
+		fprintf(stderr,"cuda error %d\n", err);
+		exit(1);
+	}
+	cudaDriverGetVersion(&version);
+	printf("driver version %d\n", version);
+	cudaRuntimeGetVersion(&version);
+	printf("runtime version %d\n", version);
+	printf("\n");
+
+	for (i = 0; i < n; i++) {
+		struct cudaDeviceProp props;
+		printf("CUDA%d\n", i);
+		err = cudaGetDeviceProperties(&props, i);
+		if (err)
+		{
+			fprintf(stderr,"cuda error %d\n", err);
+			continue;
+		}
+		printf("%s\n", props.name);
+		printf("%0.3f GB\n", (float) props.totalGlobalMem / (1<<30));
+		printf("%u MP\n", props.multiProcessorCount);
+		printf("\n");
+	}
+	return 0;
+}
+\endcode
+
+If that program does not find your device, the problem is not at the StarPU
+level, but the CUDA drivers, check the documentation of your CUDA
+setup.
+
 \section OpenCLDrivers StarPU does not see my OpenCL device
 
-First make sure that your OpenCL is properly running outside StarPU: build and
-run the following program:
+First make sure that OpenCL is properly running outside StarPU: build and
+run the following program with -lOpenCL:
 
 \code{.c}
 #include <CL/cl.h>