Make a copy kernel using the private variables
This commit is contained in:
parent
1a259d4fc8
commit
0bf68f9909
@ -11,7 +11,7 @@ __global__ void copy_kernel(const T * a, T * c)
|
|||||||
template <class T>
|
template <class T>
|
||||||
void CUDAStream<T>::copy()
|
void CUDAStream<T>::copy()
|
||||||
{
|
{
|
||||||
copy<<<1024, 1024>>>(a, c);
|
copy_kernel<<<1024, 1024>>>(d_a, d_c);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|||||||
@ -5,16 +5,17 @@
|
|||||||
template <class T>
|
template <class T>
|
||||||
class CUDAStream : public Stream<T>
|
class CUDAStream : public Stream<T>
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
void copy();
|
|
||||||
void add();
|
|
||||||
void mul();
|
|
||||||
void triad();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Device side pointers to arrays
|
// Device side pointers to arrays
|
||||||
T *d_a;
|
T *d_a;
|
||||||
T *d_b;
|
T *d_b;
|
||||||
T *d_c;
|
T *d_c;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
void copy();
|
||||||
|
void add();
|
||||||
|
void mul();
|
||||||
|
void triad();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -16,6 +16,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Stream<double> *stream;
|
Stream<double> *stream;
|
||||||
stream = new CUDAStream<double>();
|
stream = new CUDAStream<double>();
|
||||||
|
stream->copy();
|
||||||
|
|
||||||
delete[] stream;
|
delete[] stream;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user