为什么我在我的新电脑上出现这个 cuda out of memory 错误,而在旧电脑上却没有?

Why am I getting this cuda out of memory error on my new computer and not on the old one?

我目前正在尝试使用以下包提取 SIFT 特征: https://github.com/Celebrandil/CudaSift

自带一个CMakeLists.txt,我修改了,这里是:

cmake_minimum_required(VERSION 2.6)

project(cudaSift)
set(cudaSift_VERSION_MAJOR 2)
set(cudaSift_VERSION_MINOR 0)
set(cudaSift_VERSION_PATCH 0)

set(CPACK_PACKAGE_VERSION_MAJOR "${cudaSift_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${cudaSift_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${cudaSift_VERSION_PATCH}")
set(CPACK_GENERATOR "ZIP")
include(CPack)

find_package(OpenCV REQUIRED)
find_package(CUDA)
if (NOT CUDA_FOUND)
  message(STATUS "CUDA not found. Project will not be built.")
endif(NOT CUDA_FOUND)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -msse2 ")
list(APPEND CUDA_NVCC_FLAGS "-lineinfo;-ccbin;/usr/bin/gcc-7;--compiler-options;-O2;-D_FORCE_INLINES;-DVERBOSE_NOT; -arch=sm_75") 

cuda_add_library(cudaSift SHARED
  src/cudaImage.cu  
  src/cudaSiftH.cu  
  src/matching.cu
  src/geomFuncs.cpp  
  src/mainSift.cpp
)

target_link_libraries(cudaSift ${CUDA_cudadevrt_LIBRARY} ${OpenCV_LIBS})

set(PUBLIC_HEADERS include/cudaImage.h include/cudaSift.h)

set_target_properties(cudaSift PROPERTIES PUBLIC_HEADER 
"${PUBLIC_HEADERS}"
)

include(GNUInstallDirs)
install(TARGETS cudaSift
  LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
  PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

configure_file(cudaSift.pc.in cudaSift.pc @ONLY)

install(FILES ${CMAKE_BINARY_DIR}/cudaSift.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)


我的 GPU 是 GeForce RTX 2060,驱动版本 430.5,在 运行ning 之后:

mkdir build && cd build
cmake ..
sudo make -j
sudo make install
sudo ldconfig

-为了构建包,我尝试 运行 我的代码并得到以下错误:

safeCall() Runtime API error in file </path/to/CudaSift/src/cudaImage.cu>, line 24 : out of memory.

精度:

更新: 我发现了问题,这个包实际上是正确编译的。 其实代码中加载了一个tensorflow模型,但是删掉之后,就没有再出现这个错误。 我不知道为什么,也许它保留了很多 GPU 内存?