Move common exceptions to common.h

This commit is contained in:
Tom Deakin 2015-07-28 12:06:21 +01:00
parent 201bc4638f
commit dea95fe68e
3 changed files with 17 additions and 32 deletions

View File

@ -14,6 +14,23 @@ extern bool useFloat;
extern int deviceIndex; extern int deviceIndex;
// Exceptions
struct invaliddevice : public std::exception
{
virtual const char * what () const throw ()
{
return "Chosen device index is invalid";
}
};
struct badntimes : public std::exception
{
virtual const char * what () const throw ()
{
return "Chosen number of times is invalid, must be >= 2";
}
};
template < typename T > template < typename T >
void check_solution(void* a_in, void* b_in, void* c_in) void check_solution(void* a_in, void* b_in, void* c_in)
{ {

View File

@ -11,22 +11,6 @@
std::string getDeviceName(int device); std::string getDeviceName(int device);
struct invaliddevice : public std::exception
{
virtual const char * what () const throw ()
{
return "Chosen device index is invalid";
}
};
struct badntimes : public std::exception
{
virtual const char * what () const throw ()
{
return "Chosen number of times is invalid, must be >= 2";
}
};
// Code to check CUDA errors // Code to check CUDA errors
void check_cuda_error(void) void check_cuda_error(void)
{ {

View File

@ -21,22 +21,6 @@ struct badfile : public std::exception
} }
}; };
struct invaliddevice : public std::exception
{
virtual const char * what () const throw ()
{
return "Chosen device index is invalid";
}
};
struct badntimes : public std::exception
{
virtual const char * what () const throw ()
{
return "Chosen number of times is invalid, must be >= 2";
}
};
// Print error and exit // Print error and exit
void die(std::string msg, cl::Error& e) void die(std::string msg, cl::Error& e)