Fix CUDA being quiet and mark all CUDA_* as advanced
authorRoland Schulz <roland@utk.edu>
Mon, 31 Dec 2012 05:08:40 +0000 (00:08 -0500)
committerRoland Schulz <roland@utk.edu>
Mon, 7 Jan 2013 21:39:54 +0000 (16:39 -0500)
The if statement was wrong (didn't agree with comment) and caused
FindCUDA not to be quite on the first run. Also one of the
FindCUDA varaibles CUDA_TOOLKIT_ROOT_DIR wasn't marked as advanced.
While that one is the most important variable, similar variables
(e.g. ${FFTW}_LIBRARIES) is also advanced. It is only marked as
advanced if NOT GMX_GPU.

Fixes #1088

Change-Id: Id6d2c16e64688f1dd4bb3193017deb8b36c5c06e

cmake/gmxManageGPU.cmake

index 2d0121555a1a26cba4dc94538b8398d4120dde87..2ad6661fedab67eac1f46c24152c1df237f97bea 100644 (file)
@@ -52,14 +52,14 @@ if(GMX_GPU_AUTO AND GMX_DOUBLE)
 endif()
 
 # detect GPUs in the build host machine
-if (GMX_GPU OR GMX_GPU_AUTO AND NOT GMX_GPU_DETECTION_DONE)
+if ((GMX_GPU OR GMX_GPU_AUTO) AND NOT GMX_GPU_DETECTION_DONE)
     include(gmxDetectGpu)
     gmx_detect_gpu()
 endif()
 
 # We need to call find_package even when we've already done the detection/setup
 if(GMX_GPU OR GMX_GPU_AUTO)
-    if(NOT GMX_GPU AND GMX_GPU_AUTO AND GMX_GPU_DETECTION_DONE)
+    if(NOT GMX_GPU AND NOT GMX_DETECT_GPU_AVAILABLE)
         # Stay quiet when detection has occured and found no GPU.
         # Noise is acceptable when there is a GPU or the user required one.
         set(FIND_CUDA_QUIETLY QUIET)
@@ -80,7 +80,7 @@ endif()
 # - ON , FALSE: The user requested GPU builds, will require CUDA and will fail
 #               if it is not available.
 # - ON , TRUE : Can't happen (GMX_GPU=ON can only be user-set at this point)
-if(GMX_GPU OR GMX_GPU_AUTO AND NOT GMX_GPU_DETECTION_DONE)
+if((GMX_GPU OR GMX_GPU_AUTO) AND NOT GMX_GPU_DETECTION_DONE)
     if (EXISTS ${CUDA_TOOLKIT_ROOT_DIR})
         set(CUDA_FOUND TRUE CACHE INTERNAL "Whether the CUDA toolkit was found" FORCE)
     else()
@@ -142,6 +142,9 @@ endif()
 # user turns GMX_GPU=OFF after a failed cmake pass, these variables will be
 # left behind in the cache.
 mark_as_advanced(CUDA_BUILD_CUBIN CUDA_BUILD_EMULATION CUDA_SDK_ROOT_DIR CUDA_VERBOSE_BUILD)
+if(NOT GMX_GPU)
+    mark_as_advanced(CUDA_TOOLKIT_ROOT_DIR)
+endif()
 
 macro(gmx_gpu_setup)
     # set up nvcc options