mirror of
https://github.com/MartinOpat/cuda-based-raytrace.git
synced 2025-06-07 02:13:10 +02:00
Added a few clearing-up code tweaks
This commit is contained in:
@@ -1,25 +1,14 @@
|
||||
#include <iostream>
|
||||
#include <cuda_runtime.h>
|
||||
|
||||
#define cudaCheckError() { \
|
||||
cudaError_t e = cudaGetLastError(); \
|
||||
if (e != cudaSuccess) { \
|
||||
printf("CUDA error %s:%d: %s\n", __FILE__, __LINE__, \
|
||||
cudaGetErrorString(e)); \
|
||||
exit(EXIT_FAILURE); \
|
||||
} \
|
||||
}
|
||||
|
||||
__global__ void hello_from_gpu() {
|
||||
printf("Hello from GPU!\n");
|
||||
}
|
||||
|
||||
int main() {
|
||||
hello_from_gpu<<<1, 1>>>();
|
||||
cudaCheckError();
|
||||
|
||||
cudaDeviceSynchronize();
|
||||
cudaCheckError();
|
||||
|
||||
// Reset device
|
||||
cudaDeviceReset();
|
||||
|
||||
Reference in New Issue
Block a user