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 CUDAStream<T>::listDevices(void)
|
||||
void listDevices(void)
|
||||
{
|
||||
// Get number of devices
|
||||
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;
|
||||
cudaGetDeviceProperties(&props, device);
|
||||
@ -169,8 +168,8 @@ std::string CUDAStream<T>::getDeviceName(const int device)
|
||||
return std::string(props.name);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::string CUDAStream<T>::getDeviceDriver(const int device)
|
||||
|
||||
std::string getDeviceDriver(const int device)
|
||||
{
|
||||
cudaSetDevice(device);
|
||||
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 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);
|
||||
|
||||
};
|
||||
|
||||
|
||||
10
src/Stream.h
10
src/Stream.h
@ -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 read_arrays(std::vector<T>& a, std::vector<T>& b, std::vector<T>& c) = 0;
|
||||
|
||||
// Implementation specific device functions
|
||||
static void listDevices(void);
|
||||
static std::string getDeviceName(const int);
|
||||
static std::string getDeviceDriver(const int);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Implementation specific device functions
|
||||
static void listDevices(void);
|
||||
static std::string getDeviceName(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 defined(CUDA)
|
||||
CUDAStream<double>::listDevices();
|
||||
#elif defined(OCL)
|
||||
OCLStream<double>::listDevices();
|
||||
#endif
|
||||
listDevices();
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else if (!std::string("--device").compare(argv[i]))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user