support cuda10 in config script 08/5008/3
authorPeng Wang <penwang@nvidia.com>
Thu, 7 Mar 2019 23:55:31 +0000 (15:55 -0800)
committerJim Phillips <jim@ks.uiuc.edu>
Mon, 15 Apr 2019 17:22:54 +0000 (12:22 -0500)
Change-Id: Id2782eb8dd023dc0f4467ebaeb68d1ea7bec1cb9

config

diff --git a/config b/config
index 8ba1447..13fae53 100755 (executable)
--- a/config
+++ b/config
@@ -717,16 +717,18 @@ function error_exists {
       cuda_ver=$(${CUDA_PREFIX}/bin/nvcc --version | grep release | cut -d " " -f5 | cut -d "," -f1)
       NAMD_ARCH=$(awk '/^NAMD_ARCH =/ {print $3}' .rootdir/arch/$ARCH.arch)
       if [ -z "$cuda_ver" ]; then
-        echo "Warning: Did not find CUDA installation in $CUDA_PREFIX"
-      elif [[ "$cuda_ver" == 9.* && -f ".rootdir/arch/$NAMD_ARCH.cuda9" ]]; then
-        echo "CUDA 9 is detected: version $cuda_ver"
-        echo 'include .rootdir/arch/$(NAMD_ARCH).cuda9' >> Make.config
-      elif [[ "$cuda_ver" == 8.* && -f ".rootdir/arch/$NAMD_ARCH.cuda8" ]]; then
-        echo "CUDA 8 is detected: version $cuda_ver"
-        echo 'include .rootdir/arch/$(NAMD_ARCH).cuda8' >> Make.config
-      elif [[ "$cuda_ver" == 7.5* && -f ".rootdir/arch/$NAMD_ARCH.cuda75" ]]; then
-        echo "CUDA 7 is detected: version $cuda_ver"
-        echo 'include .rootdir/arch/$(NAMD_ARCH).cuda75' >> Make.config
+          echo "Warning: Did not find CUDA installation in $CUDA_PREFIX"
+      else 
+          echo "CUDA detected: version $cuda_ver"
+          cuda_major_ver=$(echo ${cuda_ver} | cut -d "." -f1)
+          while [ ${cuda_major_ver} -ge 7 ]; do
+              if [ -f ".rootdir/arch/${NAMD_ARCH}.cuda${cuda_major_ver}" ]; then
+                  echo "using ${NAMD_ARCH}.cuda${cuda_major_ver}"
+                  echo 'include .rootdir/arch/$(NAMD_ARCH).cuda'${cuda_major_ver} >> Make.config
+                  break
+              fi 
+              cuda_major_ver=$((cuda_major_ver-1))
+          done 
       fi
       echo "CUDADIR = $CUDA_PREFIX" >> Make.config
     fi