mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-05 17:34:21 +00:00
Add clearing kernel
This commit is contained in:
@@ -62,6 +62,11 @@ __global__ void vec_scalar_sub(
|
||||
const unsigned int w
|
||||
);
|
||||
|
||||
__global__ void clear(
|
||||
float* __restrict__ d_vector,
|
||||
const unsigned int w
|
||||
);
|
||||
|
||||
} // namespace CUDANet::Kernels
|
||||
|
||||
#endif // CUDANET_MATMUL_H
|
||||
@@ -83,4 +83,15 @@ __global__ void Kernels::vec_scalar_sub(
|
||||
return;
|
||||
}
|
||||
d_output[tid] = d_vector[tid] - d_scalar[0];
|
||||
}
|
||||
|
||||
__global__ void Kernels::clear(
|
||||
float* __restrict__ d_vector,
|
||||
const unsigned int w
|
||||
) {
|
||||
int tid = blockDim.x * blockIdx.x + threadIdx.x;
|
||||
if (tid >= w) {
|
||||
return;
|
||||
}
|
||||
d_vector[tid] = 0.0f;
|
||||
}
|
||||
Reference in New Issue
Block a user