Invalid MEX-file The specified procedure could not be found : Calling a CUDA MEX function

I want to use some mex function in MATLAB ( that is written with CUDA language for executing on Nvidia GPUs.

I start with building .mexw64 version of it using the Visual Studio, But I got the invalid mex file error when I tried to call it in MATLAB:

??? Invalid MEX-file 'I:\cusvm_vs2005.mexw64': The specified procedure could not

be found.

I already used the dependency walker. Initially the “IESHIMS.DLL” and “MSVCR80.DLL” are missing. I put the first in system32 and the second in current matlab folder.

The Dependency Walker still get error:

Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.

Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

The DLL-tree has a red "nvcuda.dll" block and a red "ieframe.dll" block in its sub-tree.

I currently use VS2005, Matlab 2010b, Window 7 (64 bit), cuda toolkit 3.2.

The original cuSVM code is implemented on window xp (32 bit) and VS2005, So It has .mexw32 version in its package.



I uploaded two files of the project:

-mex function and its MATLAB test code

-visual studio project that builds the .mexw64 file.

The shared links are:

(2)Some details of the steps I followed, can be found in my question in the following websites:

I appreciate your help and comments.

Hi Superbot

I have successfully been using these two small guides on how to get CUDA functioning well on Matlab. I use a different setup from you (MSVC++ 8.0, Matlab R2011b x64) but otherwise it should work identically.

The first is:

which allows you to create a basic Matlab dll. Just remember to link to the 64-bit matlab library, name the output mexw64 instead of mexw32, and you should be fine. Remember to set the Visual C++ target machine to x64 and download the correct compiler libraries if you have not already done that. For help here, google is you friend.

After this, you can use:

to include cuda functionality.

For basic functionality testing along with cuda include library and linking library check, you can use

#include <mex.h>

#include <cuda.h>

#include <driver_types.h>

#include <cuda_runtime_api.h>

void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray *prhs[])


	cudaDeviceProp cudaDvcProp;

	cudaError_t cudaError;

	cudaError = cudaGetDeviceProperties( &cudaDvcProp, 0 );


	mexPrintf( "Name: %s\n", );

	mexPrintf( "Total memory: %d MB\n", cudaDvcProp.totalGlobalMem >> 20);

	mexPrintf( "Shared memory per block: %d B\n", cudaDvcProp.sharedMemPerBlock );

	mexPrintf( "Total constant memory: %d B\n", cudaDvcProp.totalConstMem );

	mexPrintf( "Memory pitch: %d B\n", cudaDvcProp.memPitch );

	mexPrintf( "Registers per block: %d\n", cudaDvcProp.regsPerBlock );

	mexPrintf( "Warp size: %d\n", cudaDvcProp.warpSize );

	mexPrintf( "Maximum # of threads per block: %d\n", cudaDvcProp.maxThreadsPerBlock );

	mexPrintf( "Maximum thread dimension: (%d,%d,%d)\n", cudaDvcProp.maxThreadsDim[0], cudaDvcProp.maxThreadsDim[1], cudaDvcProp.maxThreadsDim[2] );

	mexPrintf( "Maximum grid dimension: (%d,%d,%d)\n", cudaDvcProp.maxGridSize[0], cudaDvcProp.maxGridSize[1], cudaDvcProp.maxGridSize[2] );

	mexPrintf( "Compute capability: %d.%d\n", cudaDvcProp.major, cudaDvcProp.minor );

	mexPrintf( "Clock rate: %d MHz\n", cudaDvcProp.clockRate/1000 );

	mexPrintf( "Multiprocessor count: %d\n", cudaDvcProp.multiProcessorCount );



It does not do anything fancy, but you access the CUDA interface and checks that you are using the correct GPU.

Also, I know this is not an answer to your specific question, but sometimes it is easier to do something new from scratch that fix the old code. For me at least.

Hope this helps