Tests: Added double precision check
This commit is contained in:
@@ -144,6 +144,39 @@ std::string Device::extensions() const
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<unsigned int, unsigned int> Device::nv_compute_capability() const
|
||||
{
|
||||
switch(backend_)
|
||||
{
|
||||
case OPENCL:
|
||||
return std::pair<unsigned int, unsigned int>(ocl::info<CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV>(h_.cl()), ocl::info<CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV>(h_.cl()));
|
||||
#ifdef ISAAC_WITH_CUDA
|
||||
case CUDA:
|
||||
return std::pair<unsigned int, unsigned int>(cuGetInfo<CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR>(), cuGetInfo<CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR>());
|
||||
#endif
|
||||
default:
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
bool Device::fp64_support() const
|
||||
{
|
||||
switch(backend_)
|
||||
{
|
||||
case OPENCL:
|
||||
return ocl::info<CL_DEVICE_DOUBLE_FP_CONFIG>(h_.cl());
|
||||
|
||||
#ifdef ISAAC_WITH_CUDA
|
||||
case CUDA:
|
||||
return true;
|
||||
#endif
|
||||
|
||||
default:
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef ISAAC_WITH_CUDA
|
||||
#define CUDACASE(CUNAME) case CUDA: return cuGetInfo<CUNAME>();
|
||||
#else
|
||||
@@ -168,24 +201,6 @@ WRAP_ATTRIBUTE(size_t, warp_wavefront_size, CU_DEVICE_ATTRIBUTE_WARP_SIZE, CL_DE
|
||||
WRAP_ATTRIBUTE(size_t, clock_rate, CU_DEVICE_ATTRIBUTE_CLOCK_RATE, CL_DEVICE_MAX_CLOCK_FREQUENCY)
|
||||
|
||||
|
||||
std::pair<unsigned int, unsigned int> Device::nv_compute_capability() const
|
||||
{
|
||||
switch(backend_)
|
||||
{
|
||||
case OPENCL:
|
||||
return std::pair<unsigned int, unsigned int>(ocl::info<CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV>(h_.cl()), ocl::info<CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV>(h_.cl()));
|
||||
#ifdef ISAAC_WITH_CUDA
|
||||
case CUDA:
|
||||
return std::pair<unsigned int, unsigned int>(cuGetInfo<CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR>(), cuGetInfo<CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR>());
|
||||
#endif
|
||||
default:
|
||||
throw;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@@ -106,7 +106,7 @@ Program::Program(Context const & context, std::string const & source) : backend_
|
||||
std::string fname(cache_path + sha1);
|
||||
|
||||
//Load cached program
|
||||
const char * build_opt = "";
|
||||
std::string build_opt;
|
||||
if(cache_path.size())
|
||||
{
|
||||
std::ifstream cached(fname, std::ios::binary);
|
||||
@@ -120,7 +120,7 @@ Program::Program(Context const & context, std::string const & source) : backend_
|
||||
char* cbuffer = buffer.data();
|
||||
h_.cl() = clCreateProgramWithBinary(context_.h_.cl(), devices.size(), devices.data(), &len, (const unsigned char **)&cbuffer, NULL, &err);
|
||||
ocl::check(err);
|
||||
ocl::check(clBuildProgram(h_.cl(), devices.size(), devices.data(), build_opt, NULL, NULL));
|
||||
ocl::check(clBuildProgram(h_.cl(), devices.size(), devices.data(), build_opt.c_str(), NULL, NULL));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ Program::Program(Context const & context, std::string const & source) : backend_
|
||||
const char * csrc = source.c_str();
|
||||
h_.cl() = clCreateProgramWithSource(context_.h_.cl(), 1, &csrc, &srclen, &err);
|
||||
try{
|
||||
ocl::check(clBuildProgram(h_.cl(), devices.size(), devices.data(), build_opt, NULL, NULL));
|
||||
ocl::check(clBuildProgram(h_.cl(), devices.size(), devices.data(), build_opt.c_str(), NULL, NULL));
|
||||
}catch(ocl::exception::build_program_failure const & e){
|
||||
for(std::vector<cl_device_id>::const_iterator it = devices.begin(); it != devices.end(); ++it)
|
||||
{
|
||||
|
Reference in New Issue
Block a user