From d8a2492c0ca99d82c19553664a8f6e63b1acda2b Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Sat, 23 Jan 2021 13:35:16 +0000
Subject: [PATCH] RF: Support for cuda toolkits 10.2, 11.1 and 11.2. Fix
 nvccflags construction

---
 config/supportedGencodes.sh | 48 +++++++++++++++++++++++++++++++++++++
 config/vars.mk              | 16 ++++++++-----
 2 files changed, 58 insertions(+), 6 deletions(-)

diff --git a/config/supportedGencodes.sh b/config/supportedGencodes.sh
index 7465274..f2ed504 100755
--- a/config/supportedGencodes.sh
+++ b/config/supportedGencodes.sh
@@ -150,6 +150,22 @@ then
           -gencode arch=compute_75,code=sm_75"
     exit 0
 elif [ "$vn" = 10.1 ]
+then
+    echo "-gencode arch=compute_30,code=sm_30 \
+          -gencode arch=compute_32,code=sm_32 \
+          -gencode arch=compute_35,code=sm_35 \
+          -gencode arch=compute_37,code=sm_37 \
+          -gencode arch=compute_50,code=sm_50 \
+          -gencode arch=compute_52,code=sm_52 \
+          -gencode arch=compute_53,code=sm_53 \
+          -gencode arch=compute_60,code=sm_60 \
+          -gencode arch=compute_61,code=sm_61 \
+          -gencode arch=compute_62,code=sm_62 \
+          -gencode arch=compute_70,code=sm_70 \
+          -gencode arch=compute_72,code=sm_72 \
+          -gencode arch=compute_75,code=sm_75"
+    exit 0
+elif [ "$vn" = 10.2 ]
 then
     echo "-gencode arch=compute_30,code=sm_30 \
           -gencode arch=compute_32,code=sm_32 \
@@ -180,6 +196,38 @@ then
           -gencode arch=compute_75,code=sm_75 \
           -gencode arch=compute_80,code=sm_80"
     exit 0
+elif [ "$vn" = 11.1 ]
+then
+    echo "-gencode arch=compute_35,code=sm_35 \
+          -gencode arch=compute_37,code=sm_37 \
+          -gencode arch=compute_50,code=sm_50 \
+          -gencode arch=compute_52,code=sm_52 \
+          -gencode arch=compute_53,code=sm_53 \
+          -gencode arch=compute_60,code=sm_60 \
+          -gencode arch=compute_61,code=sm_61 \
+          -gencode arch=compute_62,code=sm_62 \
+          -gencode arch=compute_70,code=sm_70 \
+          -gencode arch=compute_72,code=sm_72 \
+          -gencode arch=compute_75,code=sm_75 \
+          -gencode arch=compute_80,code=sm_80 \
+          -gencode arch=compute_86,code=sm_86"
+    exit 0
+elif [ "$vn" = 11.2 ]
+then
+    echo "-gencode arch=compute_35,code=sm_35 \
+          -gencode arch=compute_37,code=sm_37 \
+          -gencode arch=compute_50,code=sm_50 \
+          -gencode arch=compute_52,code=sm_52 \
+          -gencode arch=compute_53,code=sm_53 \
+          -gencode arch=compute_60,code=sm_60 \
+          -gencode arch=compute_61,code=sm_61 \
+          -gencode arch=compute_62,code=sm_62 \
+          -gencode arch=compute_70,code=sm_70 \
+          -gencode arch=compute_72,code=sm_72 \
+          -gencode arch=compute_75,code=sm_75 \
+          -gencode arch=compute_80,code=sm_80 \
+          -gencode arch=compute_86,code=sm_86"
+    exit 0
 else
     echo $default_arch
     exit 0
diff --git a/config/vars.mk b/config/vars.mk
index 1fc7019..b8d2286 100644
--- a/config/vars.mk
+++ b/config/vars.mk
@@ -110,11 +110,15 @@ CXXFLAGS    += ${CPPFLAGS} ${ARCHCXXFLAGS} ${USRCXXFLAGS} ${INCFLAGS}
 LDFLAGS     += ${ARCHLDFLAGS} ${USRLDFLAGS}   \
                -L. -L${DEVLIBDIR} -L${LIBDIR} \
                 ${LIBS} ${ARCHLIBS}
-NVCCFLAGS   += ${CPPFLAGS}                      \
-               ${ARCHNVCCFLAGS} ${ARCHCXXFLAGS} \
-               ${USRNVCCFLAGS}  ${USRCXXFLASG}  \
+NVCCFLAGS   += --compiler-options "${CPPFLAGS}"     \
+               ${ARCHNVCCFLAGS}                     \
+               --compiler-options "${ARCHCXXFLAGS}" \
+               ${USRNVCCFLAGS}                      \
+               --compiler-options "${USRCXXFLASG}"  \
                ${INCFLAGS}
-NVCCLDFLAGS += ${ARCHNVCCLDFLAGS} ${ARCHLDFLAGS} \
-               ${USRNVCCLDFLAGS}  ${USRLDFLAGS}  \
-               -L. -L${DEVLIBDIR} -L${LIBDIR}    \
+NVCCLDFLAGS += ${ARCHNVCCLDFLAGS}                  \
+               --compiler-options "${ARCHLDFLAGS}" \
+               ${USRNVCCLDFLAGS}                   \
+               --compiler-options "${USRLDFLAGS}"  \
+               -L. -L${DEVLIBDIR} -L${LIBDIR}      \
                 ${LIBS} ${CUDALIBS} ${ARCHLIBS}
-- 
GitLab