Initial commit of new design with classes
This commit is contained in:
parent
bbee439985
commit
2234841b16
29
src/CUDAStream.cu
Normal file
29
src/CUDAStream.cu
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
#include "CUDAStream.h"
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CUDAStream<T>::copy()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CUDAStream<T>::mul()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CUDAStream<T>::add()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CUDAStream<T>::triad()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
template class CUDAStream<float>;
|
||||||
|
template class CUDAStream<double>;
|
||||||
13
src/CUDAStream.h
Normal file
13
src/CUDAStream.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include "Stream.h"
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class CUDAStream : public Stream<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void copy();
|
||||||
|
void add();
|
||||||
|
void mul();
|
||||||
|
void triad();
|
||||||
|
};
|
||||||
23
src/Stream.h
Normal file
23
src/Stream.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class Stream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Kernels
|
||||||
|
// These must be blocking calls
|
||||||
|
virtual void copy() = 0;
|
||||||
|
virtual void mul() = 0;
|
||||||
|
virtual void add() = 0;
|
||||||
|
virtual void triad() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Implementation specific device functions
|
||||||
|
static std::vector<int> getDeviceList();
|
||||||
|
static std::vector<int> getDeviceName();
|
||||||
|
static std::vector<int> getDeviceDriver();
|
||||||
|
|
||||||
|
};
|
||||||
2
src/common.h
Normal file
2
src/common.h
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
#define VERSION_STRING "2.0"
|
||||||
22
src/main.cpp
Normal file
22
src/main.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "Stream.h"
|
||||||
|
#include "CUDAStream.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
std::cout
|
||||||
|
<< "GPU-STREAM" << std::endl
|
||||||
|
<< "Version:" << VERSION_STRING << std::endl
|
||||||
|
<< "Implementation: " << std::endl;
|
||||||
|
|
||||||
|
Stream<double> *stream;
|
||||||
|
stream = new CUDAStream<double>();
|
||||||
|
|
||||||
|
delete[] stream;
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user