diff --git a/common.h b/common.h index 8cd2156..864bcb6 100644 --- a/common.h +++ b/common.h @@ -14,6 +14,23 @@ extern bool useFloat; 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 > void check_solution(void* a_in, void* b_in, void* c_in) { diff --git a/cuda-stream.cu b/cuda-stream.cu index 87981ec..9b06efd 100644 --- a/cuda-stream.cu +++ b/cuda-stream.cu @@ -11,22 +11,6 @@ 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 void check_cuda_error(void) { diff --git a/ocl-stream.cpp b/ocl-stream.cpp index 5a0b6bc..54c7a5c 100644 --- a/ocl-stream.cpp +++ b/ocl-stream.cpp @@ -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 void die(std::string msg, cl::Error& e)