Commit b3375cb0 authored by Erik Strand's avatar Erik Strand
Browse files

Add proper includes and namespaces

parent 82f8f06b
// This code performs a single precision a*X plus Y operation on the GPU.
// Adapated from https://developer.nvidia.com/blog/easy-introduction-cuda-c-and-c/
#include <algorithm>
#include <cmath>
#include <iostream>
#include <chrono>
......@@ -73,7 +75,7 @@ int main() {
cudaMemcpy(h_y, d_y, N * sizeof(float), cudaMemcpyDeviceToHost);
float max_error = 0.0f;
for (int i = 0; i < N; i++) {
max_error = max(max_error, abs(h_y[i] - h_z[i]));
max_error = std::max(max_error, std::abs(h_y[i] - h_z[i]));
}
std::cout << "Max error: " << max_error << '\n';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment