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 used) Debug Release RelWithDebInfo MinSizeRel.
CMAKE_BUILD_TYPE:STRING=RELEASE
// Enable/Disable color output during build.
CMAKE_COLOR_MAKEFILE:BOOL=ON
// Configs
CMAKE_CONFIGURATION_TYPES:STRING=Debug;Release
// CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/usr/local/bin/g++4
// Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING=
// Flags used by the compiler during debug builds.
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
// Flags used by the compiler during release builds for minimum size.
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
// Flags used by the compiler during release builds.
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
// Flags used by the compiler during release builds with debug info.
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
// C compiler.
CMAKE_C_COMPILER:FILEPATH=/usr/local/bin/gcc4
// Flags used by the compiler during all build types.
CMAKE_C_FLAGS:STRING=
// Flags used by the compiler during debug builds.
CMAKE_C_FLAGS_DEBUG:STRING=-g
// Flags used by the compiler during release builds for minimum size.
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
// Flags used by the compiler during release builds.
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
// Flags used by the compiler during release builds with debug info.
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
// Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING=
// Flags used by the linker during debug builds.
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
// Flags used by the linker during release minsize builds.
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
// Flags used by the linker during release builds.
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
// Flags used by the linker during Release with Debug Info builds.
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
// Enable/Disable output of compile commands during generation.
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF
// Installation Directory
CMAKE_INSTALL_PREFIX:PATH=/home/data/czeng/env/opencv-3
// Path to a program.
CMAKE_LINKER:FILEPATH=/usr/bin/ld
// Path to a program.
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake
// Flags used by the linker during the creation of modules.
CMAKE_MODULE_LINKER_FLAGS:STRING=
// Flags used by the linker during debug builds.
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
// Flags used by the linker during release minsize builds.
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
// Flags used by the linker during release builds.
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
// Flags used by the linker during Release with Debug Info builds.
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
// Path to a program.
CMAKE_NM:FILEPATH=/usr/bin/nm
// Path to a program.
CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
// Path to a program.
CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
// Path to a program.
CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
// Flags used by the linker during the creation of dll's.
CMAKE_SHARED_LINKER_FLAGS:STRING=
// Flags used by the linker during debug builds.
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
// Flags used by the linker during release minsize builds.
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
// Flags used by the linker during release builds.
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
// Flags used by the linker during Release with Debug Info builds.
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
// If set, runtime paths are not added when installing shared libraries, but are added when building.
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
// If set, runtime paths are not added when using shared libraries.
CMAKE_SKIP_RPATH:BOOL=NO
// Flags used by the linker during the creation of static libraries.
CMAKE_STATIC_LINKER_FLAGS:STRING=
// Flags used by the linker during debug builds.
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
// Flags used by the linker during release minsize builds.
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
// Flags used by the linker during release builds.
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
// Flags used by the linker during Release with Debug Info builds.
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
// Path to a program.
CMAKE_STRIP:FILEPATH=/usr/bin/strip
// If true, cmake will use relative paths in makefiles and projects.
CMAKE_USE_RELATIVE_PATHS:BOOL=OFF
// If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
// Enable to build Debian packages
CPACK_BINARY_DEB:BOOL=OFF
// Enable to build NSIS packages
CPACK_BINARY_NSIS:BOOL=OFF
// Enable to build RPM packages
CPACK_BINARY_RPM:BOOL=OFF
// Enable to build STGZ packages
CPACK_BINARY_STGZ:BOOL=ON
// Enable to build TBZ2 packages
CPACK_BINARY_TBZ2:BOOL=OFF
// Enable to build TGZ packages
CPACK_BINARY_TGZ:BOOL=ON
// Enable to build TZ packages
CPACK_BINARY_TZ:BOOL=ON
// Enable to build TBZ2 source packages
CPACK_SOURCE_TBZ2:BOOL=ON
// Enable to build TGZ source packages
CPACK_SOURCE_TGZ:BOOL=ON
// Enable to build TZ source packages
CPACK_SOURCE_TZ:BOOL=ON
// Enable to build ZIP source packages
CPACK_SOURCE_ZIP:BOOL=OFF
// Graphviz Dot tool for using Doxygen
DOXYGEN_DOT_EXECUTABLE:FILEPATH=DOXYGEN_DOT_EXECUTABLE-NOTFOUND
// Doxygen documentation generation tool (http://www.doxygen.org)
DOXYGEN_EXECUTABLE:FILEPATH=/usr/local/bin/doxygen
// The path to Eigen3/Eigen2 headers
EIGEN_INCLUDE_PATH:PATH=EIGEN_INCLUDE_PATH-NOTFOUND
// Enable AVX instructions
ENABLE_AVX:BOOL=OFF
// Enable AVX2 instructions
ENABLE_AVX2:BOOL=OFF
// Enable coverage collection with GCov
ENABLE_COVERAGE:BOOL=OFF
// Enable -ffast-math (not recommended for GCC 4.6.x)
ENABLE_FAST_MATH:BOOL=OFF
// Enable FMA3 instructions
ENABLE_FMA3:BOOL=OFF
// Collect implementation data on function call
ENABLE_IMPL_COLLECTION:BOOL=OFF
// Show all warnings even if they are too noisy
ENABLE_NOISY_WARNINGS:BOOL=OFF
// Enable -fomit-frame-pointer for GCC
ENABLE_OMIT_FRAME_POINTER:BOOL=ON
// Enable POPCNT instructions
ENABLE_POPCNT:BOOL=OFF
// Use precompiled headers
ENABLE_PRECOMPILED_HEADERS:BOOL=ON
// Enable profiling in the GCC compiler (Add flags: -g -pg)
ENABLE_PROFILING:BOOL=OFF
// Solution folder in Visual Studio or in other IDEs
ENABLE_SOLUTION_FOLDERS:BOOL=OFF
// Enable SSE instructions
ENABLE_SSE:BOOL=ON
// Enable SSE2 instructions
ENABLE_SSE2:BOOL=ON
// Enable SSE3 instructions
ENABLE_SSE3:BOOL=ON
// Enable SSE4.1 instructions
ENABLE_SSE41:BOOL=OFF
// Enable SSE4.2 instructions
ENABLE_SSE42:BOOL=OFF
// Enable SSSE3 instructions
ENABLE_SSSE3:BOOL=OFF
// Output directory for applications
EXECUTABLE_OUTPUT_PATH:PATH=/home/data/czeng/downloads/opencv-3.0.0/build/bin
// The path to FFMPEG headers
FFMPEG_INCLUDE_DIR:PATH=FFMPEG_INCLUDE_DIR-NOTFOUND
// Generate XML file for abi_compliance_checker tool
GENERATE_ABI_DESCRIPTOR:BOOL=OFF
// The path to Smartek GigEVisionSDK header
GIGEAPI_INCLUDE_PATH:PATH=GIGEAPI_INCLUDE_PATH-NOTFOUND
// Path to a library.
GIGEAPI_LIBRARIES:FILEPATH=GIGEAPI_LIBRARIES-NOTFOUND
// git command line client
GIT_EXECUTABLE:FILEPATH=/usr/local/bin/git
// Change install rules to build the distribution package
INSTALL_CREATE_DISTRIB:BOOL=OFF
// Install C examples
INSTALL_C_EXAMPLES:BOOL=OFF
// Install Python examples
INSTALL_PYTHON_EXAMPLES:BOOL=OFF
// Install accuracy and performance test binaries and test data
INSTALL_TESTS:BOOL=OFF
// Enables mangled install paths, that help with side by side installs.
INSTALL_TO_MANGLED_PATHS:BOOL=OFF
// Path to a library.
JASPER_LIBRARY_DEBUG:FILEPATH=JASPER_LIBRARY_DEBUG-NOTFOUND
// Path to a library.
JASPER_LIBRARY_RELEASE:FILEPATH=JASPER_LIBRARY_RELEASE-NOTFOUND
// Path to a file.
JAVA_AWT_INCLUDE_PATH:PATH=/usr/lib/jvm/java/include
// Path to a library.
JAVA_AWT_LIBRARY:FILEPATH=/usr/lib/jvm/jre/lib/amd64/libjawt.so
// Path to a file.
JAVA_INCLUDE_PATH:PATH=/usr/lib/jvm/java/include
// Path to a file.
JAVA_INCLUDE_PATH2:PATH=/usr/lib/jvm/java/include/linux
// Path to a library.
JAVA_JVM_LIBRARY:FILEPATH=/usr/lib/jvm/jre/lib/amd64/server/libjvm.so
// Path to a file.
JPEG_INCLUDE_DIR:PATH=/usr/local/include
// Path to a library.
JPEG_LIBRARY:FILEPATH=/lib64/libjpeg.so
// Where to create the platform-dependant cvconfig.h
OPENCV_CONFIG_FILE_INCLUDE_DIR:PATH=/home/data/czeng/downloads/opencv-3.0.0/build
// Where to look for additional OpenCV modules
OPENCV_EXTRA_MODULES_PATH:PATH=
// Treat warnings as errors
OPENCV_WARNINGS_ARE_ERRORS:BOOL=OFF
// Path to a library.
OPENEXR_HALF_LIBRARY:FILEPATH=OPENEXR_HALF_LIBRARY-NOTFOUND
// Path to a library.
OPENEXR_IEX_LIBRARY:FILEPATH=OPENEXR_IEX_LIBRARY-NOTFOUND
// Path to a library.
OPENEXR_ILMTHREAD_LIBRARY:FILEPATH=OPENEXR_ILMTHREAD_LIBRARY-NOTFOUND
// Path to a library.
OPENEXR_IMATH_LIBRARY:FILEPATH=OPENEXR_IMATH_LIBRARY-NOTFOUND
// Path to a file.
OPENEXR_INCLUDE_PATH:PATH=OPENEXR_INCLUDE_PATH-NOTFOUND
// pkg-config executable
PKG_CONFIG_EXECUTABLE:FILEPATH=/usr/bin/pkg-config
// Path to a library.
PNG_LIBRARY_DEBUG:FILEPATH=PNG_LIBRARY_DEBUG-NOTFOUND
// Path to a library.
PNG_LIBRARY_RELEASE:FILEPATH=/lib64/libpng.so
// Path to a file.
PNG_PNG_INCLUDE_DIR:PATH=/usr/local/include
// The path to PvAPI header
PVAPI_INCLUDE_PATH:PATH=PVAPI_INCLUDE_PATH-NOTFOUND
// Path to Python interpretor
PYTHON2_EXECUTABLE:FILEPATH=/usr/local/bin/python2.7
// Python include dir
PYTHON2_INCLUDE_DIR:PATH=/usr/local/include/python2.7
// Python include dir 2
PYTHON2_INCLUDE_DIR2:PATH=
// Path to Python library
PYTHON2_LIBRARY:FILEPATH=/lib64/libpython2.7.so
// Path to Python debug
PYTHON2_LIBRARY_DEBUG:FILEPATH=
// Path to numpy headers
PYTHON2_NUMPY_INCLUDE_DIRS:PATH=/usr/local/lib/site_python2/numpy/core/include
// Where to install the python packages.
PYTHON2_PACKAGES_PATH:PATH=lib/python2.7/site-packages
// Path to Python interpretor
PYTHON3_EXECUTABLE:FILEPATH=/home/data/czeng/env/bin/python3
// Python include dir
PYTHON3_INCLUDE_DIR:PATH=/usr/local/software/python-3.5.2/include/python3.5m
// Python include dir 2
PYTHON3_INCLUDE_DIR2:PATH=
// Path to Python library
PYTHON3_LIBRARY:FILEPATH=/usr/local/lib/libpython3.5m.so
// Path to Python debug
PYTHON3_LIBRARY_DEBUG:FILEPATH=
// Path to numpy headers
PYTHON3_NUMPY_INCLUDE_DIRS:PATH=/usr/local/lib/site_python3/numpy/core/include
// Where to install the python packages.
PYTHON3_PACKAGES_PATH:PATH=/home/data/czeng/env/lib/python3.5/site-packages
// The directory containing a CMake configuration file for VTK.
VTK_DIR:PATH=VTK_DIR-NOTFOUND
// Path to a file.
WEBP_INCLUDE_DIR:PATH=WEBP_INCLUDE_DIR-NOTFOUND
// Include IEEE1394 support
WITH_1394:BOOL=ON
// Include Clp support (EPL)
WITH_CLP:BOOL=OFF
// Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support
WITH_CUBLAS:BOOL=OFF
// Include NVidia Cuda Runtime support
WITH_CUDA:BOOL=OFF
// Include NVidia Cuda Fast Fourier Transform (FFT) library support
WITH_CUFFT:BOOL=ON
// Include Eigen2/Eigen3 support
WITH_EIGEN:BOOL=ON
// Include FFMPEG support
WITH_FFMPEG:BOOL=ON
// Include GDAL Support
WITH_GDAL:BOOL=OFF
// Include Smartek GigE support
WITH_GIGEAPI:BOOL=ON
// Include gPhoto2 library support
WITH_GPHOTO2:BOOL=ON
// Include Gstreamer support
WITH_GSTREAMER:BOOL=ON
// Enable Gstreamer 0.10 support (instead of 1.x)
WITH_GSTREAMER_0_10:BOOL=OFF
// Include GTK support
WITH_GTK:BOOL=ON
// Use GTK version 2
WITH_GTK_2_X:BOOL=OFF
// Include Intel IPP support
WITH_IPP:BOOL=OFF
// Include Intel IPP_A support
WITH_IPP_A:BOOL=OFF
// Include JPEG2K support
WITH_JASPER:BOOL=ON
// Include JPEG support
WITH_JPEG:BOOL=ON
// Use libv4l for Video 4 Linux support
WITH_LIBV4L:BOOL=ON
// Include NVidia Video Decoding library support
WITH_NVCUVID:BOOL=OFF
// Include OpenCL Runtime support
WITH_OPENCL:BOOL=ON
// Include AMD OpenCL BLAS library support
WITH_OPENCLAMDBLAS:BOOL=ON
// Include AMD OpenCL FFT library support
WITH_OPENCLAMDFFT:BOOL=ON
// Include OpenCL Shared Virtual Memory support
WITH_OPENCL_SVM:BOOL=OFF
// Include ILM support via OpenEXR
WITH_OPENEXR:BOOL=ON
// Include OpenGL support
WITH_OPENGL:BOOL=OFF
// Include OpenMP support
WITH_OPENMP:BOOL=OFF
// Include OpenNI support
WITH_OPENNI:BOOL=OFF
// Include OpenNI2 support
WITH_OPENNI2:BOOL=OFF
// Include PNG support
WITH_PNG:BOOL=ON
// Use pthreads-based parallel_for
WITH_PTHREADS_PF:BOOL=OFF
// Include Prosilica GigE support
WITH_PVAPI:BOOL=ON
// Build with Qt Backend support
WITH_QT:BOOL=OFF
// Include Intel TBB support
WITH_TBB:BOOL=OFF
// Include TIFF support
WITH_TIFF:BOOL=OFF
// Include Unicap support (GPL)
WITH_UNICAP:BOOL=OFF
// Include Video 4 Linux support
WITH_V4L:BOOL=ON
// Include VTK library support (and build opencv_viz module eiher)
WITH_VTK:BOOL=ON
// Include WebP support
WITH_WEBP:BOOL=ON
// Include XIMEA cameras support
WITH_XIMEA:BOOL=OFF
// Include Xine support (GPL)
WITH_XINE:BOOL=OFF
// Path to a file.
ZLIB_INCLUDE_DIR:PATH=/usr/include
// Path to a library.
ZLIB_LIBRARY:FILEPATH=/lib64/libz.so