Move device functions outside class
This commit is contained in:
parent
1a96b71935
commit
3c394b9db0
@ -135,8 +135,7 @@ void CUDAStream<T>::triad()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
void listDevices(void)
|
||||||
void CUDAStream<T>::listDevices(void)
|
|
||||||
{
|
{
|
||||||
// Get number of devices
|
// Get number of devices
|
||||||
int count;
|
int count;
|
||||||
@ -160,8 +159,8 @@ void CUDAStream<T>::listDevices(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
|
||||||
std::string CUDAStream<T>::getDeviceName(const int device)
|
std::string getDeviceName(const int device)
|
||||||
{
|
{
|
||||||
cudaDeviceProp props;
|
cudaDeviceProp props;
|
||||||
cudaGetDeviceProperties(&props, device);
|
cudaGetDeviceProperties(&props, device);
|
||||||
@ -169,8 +168,8 @@ std::string CUDAStream<T>::getDeviceName(const int device)
|
|||||||
return std::string(props.name);
|
return std::string(props.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
|
||||||
std::string CUDAStream<T>::getDeviceDriver(const int device)
|
std::string getDeviceDriver(const int device)
|
||||||
{
|
{
|
||||||
cudaSetDevice(device);
|
cudaSetDevice(device);
|
||||||
check_error();
|
check_error();
|
||||||
|
|||||||
@ -31,9 +31,5 @@ class CUDAStream : public Stream<T>
|
|||||||
virtual void write_arrays(const std::vector<T>& a, const std::vector<T>& b, const std::vector<T>& c) override;
|
virtual void write_arrays(const std::vector<T>& a, const std::vector<T>& b, const std::vector<T>& c) override;
|
||||||
virtual void read_arrays(std::vector<T>& a, std::vector<T>& b, std::vector<T>& c) override;
|
virtual void read_arrays(std::vector<T>& a, std::vector<T>& b, std::vector<T>& c) override;
|
||||||
|
|
||||||
static void listDevices(void);
|
|
||||||
static std::string getDeviceName(const int device);
|
|
||||||
static std::string getDeviceDriver(const int device);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -19,10 +19,10 @@ class Stream
|
|||||||
virtual void write_arrays(const std::vector<T>& a, const std::vector<T>& b, const std::vector<T>& c) = 0;
|
virtual void write_arrays(const std::vector<T>& a, const std::vector<T>& b, const std::vector<T>& c) = 0;
|
||||||
virtual void read_arrays(std::vector<T>& a, std::vector<T>& b, std::vector<T>& c) = 0;
|
virtual void read_arrays(std::vector<T>& a, std::vector<T>& b, std::vector<T>& c) = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Implementation specific device functions
|
// Implementation specific device functions
|
||||||
static void listDevices(void);
|
static void listDevices(void);
|
||||||
static std::string getDeviceName(const int);
|
static std::string getDeviceName(const int);
|
||||||
static std::string getDeviceDriver(const int);
|
static std::string getDeviceDriver(const int);
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|||||||
@ -205,11 +205,7 @@ void parseArguments(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (!std::string("--list").compare(argv[i]))
|
if (!std::string("--list").compare(argv[i]))
|
||||||
{
|
{
|
||||||
#if defined(CUDA)
|
listDevices();
|
||||||
CUDAStream<double>::listDevices();
|
|
||||||
#elif defined(OCL)
|
|
||||||
OCLStream<double>::listDevices();
|
|
||||||
#endif
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
else if (!std::string("--device").compare(argv[i]))
|
else if (!std::string("--device").compare(argv[i]))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user