Added a few clearing-up code tweaks

This commit is contained in:
Martin committed 2024-11-14 12:17:09 +01:00
1 parent c8e17dfe4f
commit 0bdb7195de
3 files changed
+3 -13

No files matched your search

-11
View File
@@ -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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.