Add a copy kernel
This commit is contained in:
parent
2234841b16
commit
1a259d4fc8
@ -1,10 +1,17 @@
|
|||||||
|
|
||||||
#include "CUDAStream.h"
|
#include "CUDAStream.h"
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
__global__ void copy_kernel(const T * a, T * c)
|
||||||
|
{
|
||||||
|
const int i = blockDim.x * blockIdx.x + threadIdx.x;
|
||||||
|
c[i] = a[i];
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void CUDAStream<T>::copy()
|
void CUDAStream<T>::copy()
|
||||||
{
|
{
|
||||||
return;
|
copy<<<1024, 1024>>>(a, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|||||||
@ -10,4 +10,11 @@ class CUDAStream : public Stream<T>
|
|||||||
void add();
|
void add();
|
||||||
void mul();
|
void mul();
|
||||||
void triad();
|
void triad();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Device side pointers to arrays
|
||||||
|
T *d_a;
|
||||||
|
T *d_b;
|
||||||
|
T *d_c;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user