Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV Error: Gpu API call (out of memory) in mallocPitch (GPU: 9400m, Snow Leopard, opencv 2.4.9) )

Hi, 
I compiled opencv 2.4.9 with cmake and WITH_CUDA=ON and I get the following error on my 
Late 2009 Mac Book Pro (GPU 9400M) with Snow Leopard. gpu-z does not find my cuda gpu... but open cv finds it and does not run my test code...
I have been trying to solve this problem for days now. Any help would be much appreciated!
piranha

#### error ###############
OpenCV Error: Gpu API call (out of memory) in mallocPitch, file /Users/michael/Documents/OpenCV-2.4.2/modules/core/src/gpumat.cpp, line 1276
terminate called after throwing an instance of 'cv::Exception'
  what():  /Users/michael/Documents/OpenCV-2.4.2/modules/core/src/gpumat.cpp:1276: error: (-217) out of memory in function mallocPitch

Abort trap
#### Code #########################
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <opencv2/core/core.hpp>
#include <opencv2/gpu/gpu.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/contrib/contrib.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace std;
using namespace cv;

int main(int, char**)
{
    gpu::printCudaDeviceInfo(cv::gpu::getDevice());
    Mat src2, dst;
    Mat src = imread("file.png", CV_LOAD_IMAGE_GRAYSCALE);  
    gpu::GpuMat edges;
    namedWindow("Window", WINDOW_AUTOSIZE);
    for(;;)
    {
    src.copyTo(src2);
    gpu::GpuMat frame_gpu(src2);
    gpu::GaussianBlur(frame_gpu, edges, Size(7,7), 1.5, 1.5);
    edges.download(dst);
        imshow("Window", dst);

        if(waitKey(30) >= 0) break;
    }
    return 0;
}

#### CUDA Device Query (Runtime API) #######################
Device count: 1
Device 0: "GeForce 9400M"
  CUDA Driver Version / Runtime Version          4.10 / 4.10
  CUDA Capability Major/Minor version number:    1.1
  Total amount of global memory:                 254 MBytes (265945088 bytes)
  ( 2) Multiprocessors x ( 8) CUDA Cores/MP:     16 CUDA Cores
  GPU Clock Speed:                               1.10 GHz
  Memory Clock rate:                             1062.50 Mhz
  Memory Bus Width:                              128-bit
  Max Texture Dimension Size (x,y,z)             1D=(8192), 2D=(65536,32768), 3D=(2048,2048,2048)
  Max Layered Texture Size (dim) x layers        1D=(8192) x 512, 2D=(8192,8192) x 512
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       16384 bytes
  Total number of registers available per block: 8192
  Warp size:                                     32
  Maximum number of threads per block:           512
  Maximum sizes of each dimension of a block:    512 x 512 x 64
  Maximum sizes of each dimension of a grid:     65535 x 65535 x 1
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             256 bytes
  Concurrent copy and execution:                 No with 0 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            Yes
  Support host page-locked memory mapping:       Yes
  Concurrent kernel execution:                   No
  Alignment requirement for Surfaces:            Yes
  Device has ECC support enabled:                No
  Device is using TCC driver mode:               No
  Device supports Unified Addressing (UVA):      No
  Device PCI Bus ID / PCI location ID:           2 / 0
  Compute Mode:
      Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) 
#### copencv config ###########

-- General configuration for OpenCV 2.4.9 =====================================
--   Version control:               commit:b7b32e7
-- 
--   Platform:
--     Host:                        Darwin 10.8.0 i386
--     CMake:                       2.8.9
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 4.2.1)
--     C++ flags (Release):         -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     C Compiler:                  /usr/bin/gcc
--     C flags (Release):           -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     Linker flags (Release):      
--     Linker flags (Debug):        
--     Precompiled headers:         YES
-- 
--   OpenCV modules:
--     To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree legacy gpu photo python stitching ts videostab
--     Disabled:                    java world
--     Disabled by dependency:      -
--     Unavailable:                 androidcamera ocl
-- 
--   GUI: 
--     QT 4.x:                      NO
--     Cocoa:                       YES
--     OpenGL support:              NO
-- 
--   Media I/O: 
--     ZLib:                        build (ver 1.2.7)
--     JPEG:                        build (ver 80)
--     PNG:                         build (ver 1.5.12)
--     TIFF:                        build (ver 42 - 4.0.2)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  NO
--     FFMPEG:                      YES
--       codec:                     YES (ver Unknown)
--       format:                    YES (ver Unknown)
--       util:                      YES (ver Unknown)
--       swscale:                   YES (ver Unknown)
--       gentoo-style:              YES
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     PvAPI:                       NO
--     QuickTime:                   NO
--     QTKit:                       YES
-- 
--   Other third-party libraries:
--     Use IPP:                     NO
--     Use TBB:                     YES (ver 4.0 interface 6005)
--     Use Cuda:                    YES (ver 4.1)
--     Use OpenCL:                  NO
--     Use Eigen:                   YES (ver 3.1.1)
--     Use Clp:                     NO
-- 
--   NVIDIA CUDA
--     Use CUFFT:                   YES
--     Use CUBLAS:                  NO
--     NVIDIA GPU arch:             11 12 13 20 21
--     NVIDIA PTX archs:            20
-- 
--   Python:
--     Interpreter:                 /usr/bin/python (ver 2.6.1)
--     Libraries:                   /usr/lib/libpython2.6.dylib (ver 2.6.1)
--     numpy:                       /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/core/include (ver 1.2.1)
--     packages path:               lib/python2.6/site-packages
-- 
--   Documentation:
--     Build Documentation:         NO
--     Sphinx:                      NO
--     PdfLaTeX compiler:           NO
-- 
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     Examples:                    NO
-- 
--   Install path:                  /usr/local
-- 
--   cvconfig.h is in:              /Users/michael/Documents/opencv/build
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/michael/Documents/opencv/build

OpenCV Error: Gpu API call (out of memory) in mallocPitch (GPU: 9400m, Snow Leopard, opencv 2.4.9) )

Hi, 
I compiled opencv 2.4.9 with cmake and WITH_CUDA=ON and I get the following error on my 
Late 2009 Mac Book Pro (GPU 9400M) with Snow Leopard. gpu-z does not find my cuda gpu...  but open cv does! It finds it and does not run my test code...
code... but I fould posts with people that made this work! What am I doing wrong?
I have been trying to solve this problem for days now. Any help would be much appreciated!
piranha

#### error ###############
OpenCV Error: Gpu API call (out of memory) in mallocPitch, file /Users/michael/Documents/OpenCV-2.4.2/modules/core/src/gpumat.cpp, line 1276
terminate called after throwing an instance of 'cv::Exception'
  what():  /Users/michael/Documents/OpenCV-2.4.2/modules/core/src/gpumat.cpp:1276: error: (-217) out of memory in function mallocPitch

Abort trap
#### Code #########################
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <opencv2/core/core.hpp>
#include <opencv2/gpu/gpu.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/contrib/contrib.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace std;
using namespace cv;

int main(int, char**)
{
    gpu::printCudaDeviceInfo(cv::gpu::getDevice());
    Mat src2, dst;
    Mat src = imread("file.png", CV_LOAD_IMAGE_GRAYSCALE);  
    gpu::GpuMat edges;
    namedWindow("Window", WINDOW_AUTOSIZE);
    for(;;)
    {
    src.copyTo(src2);
    gpu::GpuMat frame_gpu(src2);
    gpu::GaussianBlur(frame_gpu, edges, Size(7,7), 1.5, 1.5);
    edges.download(dst);
        imshow("Window", dst);

        if(waitKey(30) >= 0) break;
    }
    return 0;
}

#### CUDA Device Query (Runtime API) #######################
Device count: 1
Device 0: "GeForce 9400M"
  CUDA Driver Version / Runtime Version          4.10 / 4.10
  CUDA Capability Major/Minor version number:    1.1
  Total amount of global memory:                 254 MBytes (265945088 bytes)
  ( 2) Multiprocessors x ( 8) CUDA Cores/MP:     16 CUDA Cores
  GPU Clock Speed:                               1.10 GHz
  Memory Clock rate:                             1062.50 Mhz
  Memory Bus Width:                              128-bit
  Max Texture Dimension Size (x,y,z)             1D=(8192), 2D=(65536,32768), 3D=(2048,2048,2048)
  Max Layered Texture Size (dim) x layers        1D=(8192) x 512, 2D=(8192,8192) x 512
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       16384 bytes
  Total number of registers available per block: 8192
  Warp size:                                     32
  Maximum number of threads per block:           512
  Maximum sizes of each dimension of a block:    512 x 512 x 64
  Maximum sizes of each dimension of a grid:     65535 x 65535 x 1
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             256 bytes
  Concurrent copy and execution:                 No with 0 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            Yes
  Support host page-locked memory mapping:       Yes
  Concurrent kernel execution:                   No
  Alignment requirement for Surfaces:            Yes
  Device has ECC support enabled:                No
  Device is using TCC driver mode:               No
  Device supports Unified Addressing (UVA):      No
  Device PCI Bus ID / PCI location ID:           2 / 0
  Compute Mode:
      Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) 
#### copencv config ###########

-- General configuration for OpenCV 2.4.9 =====================================
--   Version control:               commit:b7b32e7
-- 
--   Platform:
--     Host:                        Darwin 10.8.0 i386
--     CMake:                       2.8.9
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 4.2.1)
--     C++ flags (Release):         -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     C Compiler:                  /usr/bin/gcc
--     C flags (Release):           -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     Linker flags (Release):      
--     Linker flags (Debug):        
--     Precompiled headers:         YES
-- 
--   OpenCV modules:
--     To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree legacy gpu photo python stitching ts videostab
--     Disabled:                    java world
--     Disabled by dependency:      -
--     Unavailable:                 androidcamera ocl
-- 
--   GUI: 
--     QT 4.x:                      NO
--     Cocoa:                       YES
--     OpenGL support:              NO
-- 
--   Media I/O: 
--     ZLib:                        build (ver 1.2.7)
--     JPEG:                        build (ver 80)
--     PNG:                         build (ver 1.5.12)
--     TIFF:                        build (ver 42 - 4.0.2)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  NO
--     FFMPEG:                      YES
--       codec:                     YES (ver Unknown)
--       format:                    YES (ver Unknown)
--       util:                      YES (ver Unknown)
--       swscale:                   YES (ver Unknown)
--       gentoo-style:              YES
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     PvAPI:                       NO
--     QuickTime:                   NO
--     QTKit:                       YES
-- 
--   Other third-party libraries:
--     Use IPP:                     NO
--     Use TBB:                     YES (ver 4.0 interface 6005)
--     Use Cuda:                    YES (ver 4.1)
--     Use OpenCL:                  NO
--     Use Eigen:                   YES (ver 3.1.1)
--     Use Clp:                     NO
-- 
--   NVIDIA CUDA
--     Use CUFFT:                   YES
--     Use CUBLAS:                  NO
--     NVIDIA GPU arch:             11 12 13 20 21
--     NVIDIA PTX archs:            20
-- 
--   Python:
--     Interpreter:                 /usr/bin/python (ver 2.6.1)
--     Libraries:                   /usr/lib/libpython2.6.dylib (ver 2.6.1)
--     numpy:                       /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/core/include (ver 1.2.1)
--     packages path:               lib/python2.6/site-packages
-- 
--   Documentation:
--     Build Documentation:         NO
--     Sphinx:                      NO
--     PdfLaTeX compiler:           NO
-- 
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     Examples:                    NO
-- 
--   Install path:                  /usr/local
-- 
--   cvconfig.h is in:              /Users/michael/Documents/opencv/build
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/michael/Documents/opencv/build

OpenCV Error: Gpu API call (out of memory) in mallocPitch (GPU: 9400m, Snow Leopard, opencv 2.4.9) )

Hi, 
I compiled opencv 2.4.9 with cmake and WITH_CUDA=ON and I get the following error on my 
Late 2009 Mac Book Pro (GPU 9400M) with Snow Leopard. gpu-z does not find my cuda gpu...  but open cv does! It Opencv finds it and the GPU 9400m but does not run my test code... but I fould posts with people that made this work! What am I doing wrong?
I have been trying to solve this problem for days now. Any help would be much appreciated!
piranha

#### error ###############
OpenCV Error: Gpu API call (out of memory) in mallocPitch, file /Users/michael/Documents/OpenCV-2.4.2/modules/core/src/gpumat.cpp, line 1276
terminate called after throwing an instance of 'cv::Exception'
  what():  /Users/michael/Documents/OpenCV-2.4.2/modules/core/src/gpumat.cpp:1276: error: (-217) out of memory in function mallocPitch

Abort trap
#### Code #########################
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <opencv2/core/core.hpp>
#include <opencv2/gpu/gpu.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/contrib/contrib.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace std;
using namespace cv;

int main(int, char**)
{
    gpu::printCudaDeviceInfo(cv::gpu::getDevice());
    Mat src2, dst;
    Mat src = imread("file.png", CV_LOAD_IMAGE_GRAYSCALE);  
    gpu::GpuMat edges;
    namedWindow("Window", WINDOW_AUTOSIZE);
    for(;;)
    {
    src.copyTo(src2);
    gpu::GpuMat frame_gpu(src2);
    gpu::GaussianBlur(frame_gpu, edges, Size(7,7), 1.5, 1.5);
    edges.download(dst);
        imshow("Window", dst);

        if(waitKey(30) >= 0) break;
    }
    return 0;
}

#### CUDA Device Query (Runtime API) #######################
Device count: 1
Device 0: "GeForce 9400M"
  CUDA Driver Version / Runtime Version          4.10 / 4.10
  CUDA Capability Major/Minor version number:    1.1
  Total amount of global memory:                 254 MBytes (265945088 bytes)
  ( 2) Multiprocessors x ( 8) CUDA Cores/MP:     16 CUDA Cores
  GPU Clock Speed:                               1.10 GHz
  Memory Clock rate:                             1062.50 Mhz
  Memory Bus Width:                              128-bit
  Max Texture Dimension Size (x,y,z)             1D=(8192), 2D=(65536,32768), 3D=(2048,2048,2048)
  Max Layered Texture Size (dim) x layers        1D=(8192) x 512, 2D=(8192,8192) x 512
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       16384 bytes
  Total number of registers available per block: 8192
  Warp size:                                     32
  Maximum number of threads per block:           512
  Maximum sizes of each dimension of a block:    512 x 512 x 64
  Maximum sizes of each dimension of a grid:     65535 x 65535 x 1
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             256 bytes
  Concurrent copy and execution:                 No with 0 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            Yes
  Support host page-locked memory mapping:       Yes
  Concurrent kernel execution:                   No
  Alignment requirement for Surfaces:            Yes
  Device has ECC support enabled:                No
  Device is using TCC driver mode:               No
  Device supports Unified Addressing (UVA):      No
  Device PCI Bus ID / PCI location ID:           2 / 0
  Compute Mode:
      Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) 
#### copencv config ###########

-- General configuration for OpenCV 2.4.9 =====================================
--   Version control:               commit:b7b32e7
-- 
--   Platform:
--     Host:                        Darwin 10.8.0 i386
--     CMake:                       2.8.9
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 4.2.1)
--     C++ flags (Release):         -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     C Compiler:                  /usr/bin/gcc
--     C flags (Release):           -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     Linker flags (Release):      
--     Linker flags (Debug):        
--     Precompiled headers:         YES
-- 
--   OpenCV modules:
--     To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree legacy gpu photo python stitching ts videostab
--     Disabled:                    java world
--     Disabled by dependency:      -
--     Unavailable:                 androidcamera ocl
-- 
--   GUI: 
--     QT 4.x:                      NO
--     Cocoa:                       YES
--     OpenGL support:              NO
-- 
--   Media I/O: 
--     ZLib:                        build (ver 1.2.7)
--     JPEG:                        build (ver 80)
--     PNG:                         build (ver 1.5.12)
--     TIFF:                        build (ver 42 - 4.0.2)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  NO
--     FFMPEG:                      YES
--       codec:                     YES (ver Unknown)
--       format:                    YES (ver Unknown)
--       util:                      YES (ver Unknown)
--       swscale:                   YES (ver Unknown)
--       gentoo-style:              YES
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     PvAPI:                       NO
--     QuickTime:                   NO
--     QTKit:                       YES
-- 
--   Other third-party libraries:
--     Use IPP:                     NO
--     Use TBB:                     YES (ver 4.0 interface 6005)
--     Use Cuda:                    YES (ver 4.1)
--     Use OpenCL:                  NO
--     Use Eigen:                   YES (ver 3.1.1)
--     Use Clp:                     NO
-- 
--   NVIDIA CUDA
--     Use CUFFT:                   YES
--     Use CUBLAS:                  NO
--     NVIDIA GPU arch:             11 12 13 20 21
--     NVIDIA PTX archs:            20
-- 
--   Python:
--     Interpreter:                 /usr/bin/python (ver 2.6.1)
--     Libraries:                   /usr/lib/libpython2.6.dylib (ver 2.6.1)
--     numpy:                       /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/core/include (ver 1.2.1)
--     packages path:               lib/python2.6/site-packages
-- 
--   Documentation:
--     Build Documentation:         NO
--     Sphinx:                      NO
--     PdfLaTeX compiler:           NO
-- 
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     Examples:                    NO
-- 
--   Install path:                  /usr/local
-- 
--   cvconfig.h is in:              /Users/michael/Documents/opencv/build
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/michael/Documents/opencv/build

OpenCV Error: Gpu API call (out of memory) in mallocPitch (GPU: 9400m, Snow Leopard, opencv 2.4.9) )

Hi, 
I compiled opencv 2.4.9 with cmake and WITH_CUDA=ON and I get the following error on my 
Late 2009 Mac Book Pro (GPU 9400M) with Snow Leopard. gpu-z does not find my cuda gpu...  but open cv does! Opencv finds the GPU 9400m but does not run my test code... but I fould posts with people that made this work! What am I doing wrong?
I have been trying to solve this problem for days now. Any help would be much appreciated!
piranha

#### error ###############
OpenCV Error: Gpu API call (out of memory) in mallocPitch, file /Users/michael/Documents/OpenCV-2.4.2/modules/core/src/gpumat.cpp, line 1276
terminate called after throwing an instance of 'cv::Exception'
  what():  /Users/michael/Documents/OpenCV-2.4.2/modules/core/src/gpumat.cpp:1276: error: (-217) out of memory in function mallocPitch

Abort trap
#### Code #########################
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <opencv2/core/core.hpp>
#include <opencv2/gpu/gpu.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/contrib/contrib.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace std;
using namespace cv;

int main(int, char**)
{
    gpu::printCudaDeviceInfo(cv::gpu::getDevice());
    Mat src2, dst;
    Mat src = imread("file.png", CV_LOAD_IMAGE_GRAYSCALE);  
    gpu::GpuMat edges;
    namedWindow("Window", WINDOW_AUTOSIZE);
    for(;;)
    {
    src.copyTo(src2);
    gpu::GpuMat frame_gpu(src2);
    gpu::GaussianBlur(frame_gpu, edges, Size(7,7), 1.5, 1.5);
    edges.download(dst);
        imshow("Window", dst);

        if(waitKey(30) >= 0) break;
    }
    return 0;
}

#### CUDA Device Query (Runtime API) #######################
Device count: 1
Device 0: "GeForce 9400M"
  CUDA Driver Version / Runtime Version          4.10 / 4.10
  CUDA Capability Major/Minor version number:    1.1
  Total amount of global memory:                 254 MBytes (265945088 bytes)
  ( 2) Multiprocessors x ( 8) CUDA Cores/MP:     16 CUDA Cores
  GPU Clock Speed:                               1.10 GHz
  Memory Clock rate:                             1062.50 Mhz
  Memory Bus Width:                              128-bit
  Max Texture Dimension Size (x,y,z)             1D=(8192), 2D=(65536,32768), 3D=(2048,2048,2048)
  Max Layered Texture Size (dim) x layers        1D=(8192) x 512, 2D=(8192,8192) x 512
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       16384 bytes
  Total number of registers available per block: 8192
  Warp size:                                     32
  Maximum number of threads per block:           512
  Maximum sizes of each dimension of a block:    512 x 512 x 64
  Maximum sizes of each dimension of a grid:     65535 x 65535 x 1
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             256 bytes
  Concurrent copy and execution:                 No with 0 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            Yes
  Support host page-locked memory mapping:       Yes
  Concurrent kernel execution:                   No
  Alignment requirement for Surfaces:            Yes
  Device has ECC support enabled:                No
  Device is using TCC driver mode:               No
  Device supports Unified Addressing (UVA):      No
  Device PCI Bus ID / PCI location ID:           2 / 0
  Compute Mode:
      Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) 
#### copencv config ###########

-- General configuration for OpenCV 2.4.9 =====================================
--   Version control:               commit:b7b32e7
-- 
--   Platform:
--     Host:                        Darwin 10.8.0 i386
--     CMake:                       2.8.9
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 4.2.1)
--     C++ flags (Release):         -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     C Compiler:                  /usr/bin/gcc
--     C flags (Release):           -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     Linker flags (Release):      
--     Linker flags (Debug):        
--     Precompiled headers:         YES
-- 
--   OpenCV modules:
--     To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree legacy gpu photo python stitching ts videostab
--     Disabled:                    java world
--     Disabled by dependency:      -
--     Unavailable:                 androidcamera ocl
-- 
--   GUI: 
--     QT 4.x:                      NO
--     Cocoa:                       YES
--     OpenGL support:              NO
-- 
--   Media I/O: 
--     ZLib:                        build (ver 1.2.7)
--     JPEG:                        build (ver 80)
--     PNG:                         build (ver 1.5.12)
--     TIFF:                        build (ver 42 - 4.0.2)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  NO
--     FFMPEG:                      YES
--       codec:                     YES (ver Unknown)
--       format:                    YES (ver Unknown)
--       util:                      YES (ver Unknown)
--       swscale:                   YES (ver Unknown)
--       gentoo-style:              YES
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     PvAPI:                       NO
--     QuickTime:                   NO
--     QTKit:                       YES
-- 
--   Other third-party libraries:
--     Use IPP:                     NO
--     Use TBB:                     YES (ver 4.0 interface 6005)
--     Use Cuda:                    YES (ver 4.1)
--     Use OpenCL:                  NO
--     Use Eigen:                   YES (ver 3.1.1)
--     Use Clp:                     NO
-- 
--   NVIDIA CUDA
--     Use CUFFT:                   YES
--     Use CUBLAS:                  NO
--     NVIDIA GPU arch:             11 12 13 20 21
--     NVIDIA PTX archs:            20
-- 
--   Python:
--     Interpreter:                 /usr/bin/python (ver 2.6.1)
--     Libraries:                   /usr/lib/libpython2.6.dylib (ver 2.6.1)
--     numpy:                       /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/core/include (ver 1.2.1)
--     packages path:               lib/python2.6/site-packages
-- 
--   Documentation:
--     Build Documentation:         NO
--     Sphinx:                      NO
--     PdfLaTeX compiler:           NO
-- 
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     Examples:                    NO
-- 
--   Install path:                  /usr/local
-- 
--   cvconfig.h is in:              /Users/michael/Documents/opencv/build
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/michael/Documents/opencv/build
click to hide/show revision 5
No.5 Revision

OpenCV Error: Gpu API call error (out of memory) in mallocPitch (GPU: 9400m, Snow Leopard, opencv 2.4.9) )mallocPitch

Hi, I compiled opencv OpenCV 2.4.9 with cmake and WITH_CUDA=ON and I get the following error on my Late 2009 Mac Book Pro (GPU 9400M) with Snow Leopard. gpu-z does not find my cuda gpu... but open cv OpenCV does! Opencv OpenCV finds the GPU 9400m but does not run my test code... but I fould found posts with people that made this work! What am I doing wrong? I have been trying to solve this problem for days now. Any help would be much appreciated! piranha appreciated!

#### error ###############
OpenCV Error: Gpu API call (out of memory) in mallocPitch, file /Users/michael/Documents/OpenCV-2.4.2/modules/core/src/gpumat.cpp, line 1276
terminate called after throwing an instance of 'cv::Exception'
  what():  /Users/michael/Documents/OpenCV-2.4.2/modules/core/src/gpumat.cpp:1276: error: (-217) out of memory in function mallocPitch

Abort trap
#### Code #########################
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <opencv2/core/core.hpp>
#include <opencv2/gpu/gpu.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/contrib/contrib.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace std;
using namespace cv;

int main(int, char**)
{
    gpu::printCudaDeviceInfo(cv::gpu::getDevice());
    Mat src2, dst;
    Mat src = imread("file.png", CV_LOAD_IMAGE_GRAYSCALE);  
    gpu::GpuMat edges;
    namedWindow("Window", WINDOW_AUTOSIZE);
    for(;;)
    {
    src.copyTo(src2);
    gpu::GpuMat frame_gpu(src2);
    gpu::GaussianBlur(frame_gpu, edges, Size(7,7), 1.5, 1.5);
    edges.download(dst);
        imshow("Window", dst);

        if(waitKey(30) >= 0) break;
    }
    return 0;
}

#### CUDA Device Query (Runtime API) #######################
Device count: 1
Device 0: "GeForce 9400M"
  CUDA Driver Version / Runtime Version          4.10 / 4.10
  CUDA Capability Major/Minor version number:    1.1
  Total amount of global memory:                 254 MBytes (265945088 bytes)
  ( 2) Multiprocessors x ( 8) CUDA Cores/MP:     16 CUDA Cores
  GPU Clock Speed:                               1.10 GHz
  Memory Clock rate:                             1062.50 Mhz
  Memory Bus Width:                              128-bit
  Max Texture Dimension Size (x,y,z)             1D=(8192), 2D=(65536,32768), 3D=(2048,2048,2048)
  Max Layered Texture Size (dim) x layers        1D=(8192) x 512, 2D=(8192,8192) x 512
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       16384 bytes
  Total number of registers available per block: 8192
  Warp size:                                     32
  Maximum number of threads per block:           512
  Maximum sizes of each dimension of a block:    512 x 512 x 64
  Maximum sizes of each dimension of a grid:     65535 x 65535 x 1
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             256 bytes
  Concurrent copy and execution:                 No with 0 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            Yes
  Support host page-locked memory mapping:       Yes
  Concurrent kernel execution:                   No
  Alignment requirement for Surfaces:            Yes
  Device has ECC support enabled:                No
  Device is using TCC driver mode:               No
  Device supports Unified Addressing (UVA):      No
  Device PCI Bus ID / PCI location ID:           2 / 0
  Compute Mode:
      Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) 
#### copencv config ###########

-- General configuration for OpenCV 2.4.9 =====================================
--   Version control:               commit:b7b32e7
-- 
--   Platform:
--     Host:                        Darwin 10.8.0 i386
--     CMake:                       2.8.9
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 4.2.1)
--     C++ flags (Release):         -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     C Compiler:                  /usr/bin/gcc
--     C flags (Release):           -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     Linker flags (Release):      
--     Linker flags (Debug):        
--     Precompiled headers:         YES
-- 
--   OpenCV modules:
--     To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree legacy gpu photo python stitching ts videostab
--     Disabled:                    java world
--     Disabled by dependency:      -
--     Unavailable:                 androidcamera ocl
-- 
--   GUI: 
--     QT 4.x:                      NO
--     Cocoa:                       YES
--     OpenGL support:              NO
-- 
--   Media I/O: 
--     ZLib:                        build (ver 1.2.7)
--     JPEG:                        build (ver 80)
--     PNG:                         build (ver 1.5.12)
--     TIFF:                        build (ver 42 - 4.0.2)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  NO
--     FFMPEG:                      YES
--       codec:                     YES (ver Unknown)
--       format:                    YES (ver Unknown)
--       util:                      YES (ver Unknown)
--       swscale:                   YES (ver Unknown)
--       gentoo-style:              YES
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     PvAPI:                       NO
--     QuickTime:                   NO
--     QTKit:                       YES
-- 
--   Other third-party libraries:
--     Use IPP:                     NO
--     Use TBB:                     YES (ver 4.0 interface 6005)
--     Use Cuda:                    YES (ver 4.1)
--     Use OpenCL:                  NO
--     Use Eigen:                   YES (ver 3.1.1)
--     Use Clp:                     NO
-- 
--   NVIDIA CUDA
--     Use CUFFT:                   YES
--     Use CUBLAS:                  NO
--     NVIDIA GPU arch:             11 12 13 20 21
--     NVIDIA PTX archs:            20
-- 
--   Python:
--     Interpreter:                 /usr/bin/python (ver 2.6.1)
--     Libraries:                   /usr/lib/libpython2.6.dylib (ver 2.6.1)
--     numpy:                       /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/core/include (ver 1.2.1)
--     packages path:               lib/python2.6/site-packages
-- 
--   Documentation:
--     Build Documentation:         NO
--     Sphinx:                      NO
--     PdfLaTeX compiler:           NO
-- 
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     Examples:                    NO
-- 
--   Install path:                  /usr/local
-- 
--   cvconfig.h is in:              /Users/michael/Documents/opencv/build
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/michael/Documents/opencv/build