HIGH GPU Memory Usage by OpenCV Python Module [closed]
I found the OpenCV Python module occupies a lot of GPU memory (111MB) even if I only call simple functions like cv2.resize() and cv2.cvtColor.(). This become a huge problem because I need to run 16 subprocesses in parallel and they take several GB of GPU memory. I don't think I enabled the GPU options and please find below my cmake variables. Could anyone suggest how I could solve it? Thanks!
bash-4.2$ cmake -LAH
-- Cache values
// Path to a program.
ANT_EXECUTABLE:FILEPATH=/bin/ant
// Build CUDA modules stubs when no CUDA SDK
BUILD_CUDA_STUBS:BOOL=OFF
// Create build rules for OpenCV Documentation
BUILD_DOCS:BOOL=ON
// Build all examples
BUILD_EXAMPLES:BOOL=OFF
// Build libjasper from source
BUILD_JASPER:BOOL=OFF
// Build libjpeg from source
BUILD_JPEG:BOOL=OFF
// Build openexr from source
BUILD_OPENEXR:BOOL=OFF
// Enables 'make package_source' command
BUILD_PACKAGE:BOOL=ON
// Build performance tests
BUILD_PERF_TESTS:BOOL=ON
// Build libpng from source
BUILD_PNG:BOOL=OFF
// Build shared libraries (.dll/.so) instead of static ones (.lib/.a)
BUILD_SHARED_LIBS:BOOL=ON
// Download and build TBB from source
BUILD_TBB:BOOL=OFF
// Build accuracy & regression tests
BUILD_TESTS:BOOL=ON
// Build libtiff from source
BUILD_TIFF:BOOL=OFF
// Include debug info into debug libs (not MSCV only)
BUILD_WITH_DEBUG_INFO:BOOL=ON
// Enables dynamic linking of IPP (only for standalone IPP)
BUILD_WITH_DYNAMIC_IPP:BOOL=OFF
// Build zlib from source
BUILD_ZLIB:BOOL=OFF
// Build utility applications (used for example to train classifiers)
BUILD_opencv_apps:BOOL=ON
// Include opencv_calib3d module into the OpenCV build
BUILD_opencv_calib3d:BOOL=ON
// Include opencv_core module into the OpenCV build
BUILD_opencv_core:BOOL=ON
// Include opencv_features2d module into the OpenCV build
BUILD_opencv_features2d:BOOL=ON
// Include opencv_flann module into the OpenCV build
BUILD_opencv_flann:BOOL=ON
// Include opencv_hal module into the OpenCV build
BUILD_opencv_hal:BOOL=ON
// Include opencv_highgui module into the OpenCV build
BUILD_opencv_highgui:BOOL=ON
// Include opencv_imgcodecs module into the OpenCV build
BUILD_opencv_imgcodecs:BOOL=ON
// Include opencv_imgproc module into the OpenCV build
BUILD_opencv_imgproc:BOOL=ON
// Include opencv_java module into the OpenCV build
BUILD_opencv_java:BOOL=ON
// Include opencv_ml module into the OpenCV build
BUILD_opencv_ml:BOOL=ON
// Include opencv_objdetect module into the OpenCV build
BUILD_opencv_objdetect:BOOL=ON
// Include opencv_photo module into the OpenCV build
BUILD_opencv_photo:BOOL=ON
// Include opencv_python2 module into the OpenCV build
BUILD_opencv_python2:BOOL=OFF
// Include opencv_python3 module into the OpenCV build
BUILD_opencv_python3:BOOL=ON
// Include opencv_shape module into the OpenCV build
BUILD_opencv_shape:BOOL=ON
// Include opencv_stitching module into the OpenCV build
BUILD_opencv_stitching:BOOL=ON
// Include opencv_superres module into the OpenCV build
BUILD_opencv_superres:BOOL=ON
// Include opencv_ts module into the OpenCV build
BUILD_opencv_ts:BOOL=ON
// Include opencv_video module into the OpenCV build
BUILD_opencv_video:BOOL=ON
// Include opencv_videoio module into the OpenCV build
BUILD_opencv_videoio:BOOL=ON
// Include opencv_videostab module into the OpenCV build
BUILD_opencv_videostab:BOOL=ON
// Include opencv_world module into the OpenCV build
BUILD_opencv_world:BOOL=OFF
// clAmdFft include directory
CLAMDBLAS_INCLUDE_DIR:PATH=CLAMDBLAS_INCLUDE_DIR-NOTFOUND
// AMD FFT root directory
CLAMDBLAS_ROOT_DIR:PATH=CLAMDBLAS_ROOT_DIR-NOTFOUND
// clAmdFft include directory
CLAMDFFT_INCLUDE_DIR:PATH=CLAMDFFT_INCLUDE_DIR-NOTFOUND
// AMD FFT root directory
CLAMDFFT_ROOT_DIR:PATH=CLAMDFFT_ROOT_DIR-NOTFOUND
// Path to a program.
CMAKE_AR:FILEPATH=/usr/bin/ar
// Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS ...
I don't know PYTHOn but you have WITH_OPENCL:BOOL=ON
Solved by disabling OPENCL. Thanks!