ECE 408 sem project

This commit is contained in:
Aryan Singh committed 2026-06-07 13:43:20 -05:00
1 parent 1d79ccd2e3
commit fa3efcaf07
139 files changed
+11634 -1

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
#ifndef RESIDUAL_KERNEL_CUH_
#define RESIDUAL_KERNEL_CUH_
#include <cuda_runtime.h>
#include "../utils/cuda_utils.cuh"
__global__ void residual_forward_kernel(float* out, float* inp1, float* inp2, int N) {
// Implement this
int x = blockDim.x * blockIdx.x + threadIdx.x;
if(x < N){
out[x] = inp1[x] + inp2[x];
}
}
// Launch kernel here
void residual_forward(float* out, float* inp1, float* inp2, int N) {
// Implement this
dim3 block(32,1,1);
dim3 grid((N + block.x - 1)/ block.x);
residual_forward_kernel<<<grid, block>>>(out, inp1, inp2, N);
}
#endif // RESIDUAL_KERNEL_CUH_