aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/gpu_common.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2018-07-13 16:05:07 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2018-07-13 16:05:07 +0200
commit195c9c054b6beab9d8bf0c71e0556b69c5e61548 (patch)
treeeea2cc7692fdc16eef436f8790cfc99f2b5993d0 /test/gpu_common.h
parent06eb24cf4d7d54e56abfb37ea062a7cb0c887550 (diff)
Print more debug info in gpu_basic
Diffstat (limited to 'test/gpu_common.h')
-rw-r--r--test/gpu_common.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/gpu_common.h b/test/gpu_common.h
index 60a78ccd7..3aac49e96 100644
--- a/test/gpu_common.h
+++ b/test/gpu_common.h
@@ -100,12 +100,47 @@ void run_and_compare_to_gpu(const Kernel& ker, int n, const Input& in, Output& o
#endif
}
+struct compile_time_device_info {
+ EIGEN_DEVICE_FUNC
+ void operator()(int /*i*/, const int* /*in*/, int* info) const
+ {
+ #if defined(__CUDA_ARCH__)
+ info[0] = int(__CUDA_ARCH__ +0);
+ #endif
+ #if defined(EIGEN_HIP_DEVICE_COMPILE)
+ info[1] = int(EIGEN_HIP_DEVICE_COMPILE +0);
+ #endif
+ }
+};
void ei_test_init_gpu()
{
int device = 0;
gpuDeviceProp_t deviceProp;
gpuGetDeviceProperties(&deviceProp, device);
+
+ ArrayXi dummy(1), info(10);
+ info = -1;
+ run_on_gpu(compile_time_device_info(),10,dummy,info);
+
+
+ std::cout << "GPU compile-time info:\n";
+
+ #ifdef EIGEN_CUDACC
+ std::cout << " EIGEN_CUDACC: " << int(EIGEN_CUDACC) << "\n";
+ #endif
+
+ #ifdef EIGEN_CUDACC_VER
+ std::cout << " EIGEN_CUDACC_VER: " << int(EIGEN_CUDACC_VER) << "\n";
+ #endif
+
+ #ifdef EIGEN_HIPCC
+ std::cout << " EIGEN_HIPCC: " << int(EIGEN_HIPCC) << "\n";
+ #endif
+
+ std::cout << " EIGEN_CUDA_ARCH: " << info[0] << "\n";
+ std::cout << " EIGEN_HIP_DEVICE_COMPILE: " << info[1] << "\n";
+
std::cout << "GPU device info:\n";
std::cout << " name: " << deviceProp.name << "\n";
std::cout << " capability: " << deviceProp.major << "." << deviceProp.minor << "\n";