-
-
Save mantaionut/e4c588e2f5273f75e8eb286a54f20c69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "cuda_runtime.h" | |
#include "device_launch_parameters.h" | |
#include <stdio.h> | |
#include <stdio.h> | |
#include <chrono> | |
#include <iostream> | |
__global__ void vectorized_elementwise_kernel(int N) { | |
} | |
inline void benchmarkTest(int iterations) | |
{ | |
double elapsed_time = 0; | |
for (int i = 0; i < iterations; i++) | |
{ | |
auto start = std::chrono::steady_clock::now(); | |
vectorized_elementwise_kernel | |
<< <8, 128, 0, nullptr >> > (4000); | |
auto end = std::chrono::steady_clock::now(); | |
elapsed_time += std::chrono::duration<double>(end - start).count(); | |
} | |
std::cout << "benchmark iterations " << iterations << " took " << elapsed_time << "\n"; | |
} | |
int main() | |
{ | |
cudaError_t cudaStatus; | |
cudaStatus = cudaSetDevice(0); | |
benchmarkTest(750); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment