Update activation test

This commit is contained in:
2024-04-21 14:00:43 +02:00
parent 942ee6a32b
commit 9a6152469a
4 changed files with 52 additions and 18 deletions

View File

@@ -28,7 +28,16 @@ void Utils::max(float* d_vec, float* d_max, const unsigned int length) {
const int grid_size = (length + BLOCK_SIZE - 1) / BLOCK_SIZE;
std::cout << "grid_size: " << grid_size << ", length: " << length << std::endl;
CUDA_CHECK(cudaGetLastError());
Kernels::max_reduce<<<grid_size, BLOCK_SIZE>>>(d_vec, d_max, length);
std::cout << "input: " << std::endl;
print_vec(d_vec, length);
std::cout << "max: " << std::endl;
print_vec(d_max, length);
CUDA_CHECK(cudaGetLastError());
int remaining = grid_size;
@@ -46,7 +55,6 @@ void Utils::sum(float* d_vec, float* d_sum, const unsigned int length) {
const int gridSize = (length + BLOCK_SIZE - 1) / BLOCK_SIZE;
CUDANet::Kernels::sum_reduce<<<gridSize, BLOCK_SIZE>>>(
d_vec, d_sum, length
);
@@ -57,7 +65,7 @@ void Utils::sum(float* d_vec, float* d_sum, const unsigned int length) {
int blocks_needed = (remaining + BLOCK_SIZE - 1) / BLOCK_SIZE;
CUDANet::Kernels::sum_reduce<<<blocks_needed, BLOCK_SIZE>>>(d_sum, d_sum, remaining);
CUDA_CHECK(cudaGetLastError());
remaining = blocks_needed;
}
}