mirror of
https://github.com/reactos/CMake.git
synced 2025-02-11 14:36:01 +00:00
CUDA: Tests now state why they are failing when no CUDA card is found.
This commit is contained in:
parent
59461c2696
commit
c59811a233
@ -1,6 +1,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <cuda.h>
|
||||
#include <iostream>
|
||||
|
||||
int dynamic_base_func(int);
|
||||
|
||||
@ -15,15 +16,12 @@ void DetermineIfValidCudaDevice()
|
||||
{
|
||||
}
|
||||
|
||||
void cuda_dynamic_lib_func(std::string& contents )
|
||||
void cuda_dynamic_lib_func()
|
||||
{
|
||||
DetermineIfValidCudaDevice <<<1,1>>> ();
|
||||
if(cudaSuccess == cudaGetLastError())
|
||||
cudaError_t err = cudaGetLastError();
|
||||
if(err == cudaSuccess)
|
||||
{
|
||||
contents = "ran a cuda kernel";
|
||||
}
|
||||
else
|
||||
{
|
||||
contents = "cant run a cuda kernel";
|
||||
std::cerr << cudaGetErrorString(err) << std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,6 @@ static
|
||||
__global__
|
||||
void file3_kernel(result_type& r, int x)
|
||||
{
|
||||
//call static_func which is a method that is defined in the
|
||||
//static library that is always out of date
|
||||
r = file1_func(x);
|
||||
result_type_dynamic rd = file2_func(x);
|
||||
}
|
||||
@ -21,5 +19,11 @@ int file3_launch_kernel(int x)
|
||||
{
|
||||
result_type r;
|
||||
file3_kernel <<<1,1>>> (r,x);
|
||||
cudaError_t err = cudaGetLastError();
|
||||
if(err == cudaSuccess)
|
||||
{
|
||||
std::cerr << cudaGetErrorString(err) << std::endl;
|
||||
return x;
|
||||
}
|
||||
return r.sum;
|
||||
}
|
||||
|
@ -7,18 +7,20 @@
|
||||
result_type __device__ file1_func(int x);
|
||||
result_type_dynamic __device__ file2_func(int x);
|
||||
|
||||
void __host__ cuda_dynamic_lib_func();
|
||||
|
||||
static
|
||||
__global__
|
||||
void mixed_kernel(result_type& r, int x)
|
||||
{
|
||||
//call static_func which is a method that is defined in the
|
||||
//static library that is always out of date
|
||||
r = file1_func(x);
|
||||
result_type_dynamic rd = file2_func(x);
|
||||
}
|
||||
|
||||
int mixed_launch_kernel(int x)
|
||||
{
|
||||
cuda_dynamic_lib_func();
|
||||
|
||||
result_type r;
|
||||
mixed_kernel <<<1,1>>> (r,x);
|
||||
return r.sum;
|
||||
|
@ -40,6 +40,7 @@ int main(int argc, char **argv)
|
||||
err = cudaGetDeviceCount(&nDevices);
|
||||
if(err != cudaSuccess)
|
||||
{
|
||||
std::cerr << cudaGetErrorString(err) << std::endl;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user