Modification of the file gromacs-5.1.2/cmake/gmxManageNvccConfig.cmake can solve your problem (lines 184 to 227):
# First add flags that trigger SASS (binary) code generation for physical arch
if(CUDA_VERSION VERSION_LESS "9.00") # < 9.0
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_20,code=sm_20")
endif()
if(NOT CUDA_VERSION VERSION_LESS "4.2") # >= 4.2
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_30,code=sm_30")
endif()
if(NOT CUDA_VERSION VERSION_LESS "5.0") # >= 5.0
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_35,code=sm_35")
endif()
if(NOT CUDA_VERSION VERSION_LESS "6.5") # >= 6.5
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_37,code=sm_37")
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_50,code=sm_50")
endif()
if(NOT CUDA_VERSION VERSION_LESS "7.0") # >= 7.0
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_52,code=sm_52")
endif()
if(NOT CUDA_VERSION VERSION_LESS "8.0") # >= 8.0
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_60,code=sm_60")
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_61,code=sm_61")
endif()
if(NOT CUDA_VERSION VERSION_LESS "9.0") # >= 9.0
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_70,code=sm_70")
endif()
# Next add flags that trigger PTX code generation for the newest supported virtual arch
# that's useful to JIT to future architectures
if(CUDA_VERSION VERSION_LESS "4.2")
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_20,code=compute_20")
elseif(CUDA_VERSION VERSION_LESS "5.0")
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_30,code=compute_30")
elseif(CUDA_VERSION VERSION_LESS "6.5")
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_35,code=compute_35")
elseif(CUDA_VERSION VERSION_LESS "7.0")
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_50,code=compute_50")
elseif(CUDA_VERSION VERSION_LESS "8.0")
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_52,code=compute_52")
elseif(CUDA_VERSION VERSION_LESS "9.0")
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_60,code=compute_60")
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_61,code=compute_61")
else() # version >= 9.0
list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_70,code=compute_70")
endif()
endif()