From ed19fa078f07a84effeba25c5ac4de226be7ebd0 Mon Sep 17 00:00:00 2001
From: Jakub Homola <jakub.homola@vsb.cz>
Date: Tue, 8 Oct 2024 10:06:51 +0200
Subject: [PATCH] better error message

---
 solution/reduction/reduction.cu | 4 ++++
 tasks/reduction/reduction.cu    | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/solution/reduction/reduction.cu b/solution/reduction/reduction.cu
index 7c3a128..657f99a 100644
--- a/solution/reduction/reduction.cu
+++ b/solution/reduction/reduction.cu
@@ -1,6 +1,10 @@
 #include <cstdio>
 #include <algorithm>
 
+#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ < 600
+    #error "This code must be compiled with the -arch=native flag (or -arch=sm_80 for A100)!"
+#endif
+
 constexpr int TPB = 1024;
 
 
diff --git a/tasks/reduction/reduction.cu b/tasks/reduction/reduction.cu
index 59cc75f..e3deeae 100644
--- a/tasks/reduction/reduction.cu
+++ b/tasks/reduction/reduction.cu
@@ -1,6 +1,10 @@
 #include <cstdio>
 #include <algorithm>
 
+#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ < 600
+    #error "This code must be compiled with the -arch=native flag (or -arch=sm_80 for A100)!"
+#endif
+
 constexpr int TPB = 1024;
 
 
-- 
GitLab