0

I have compiled matcaffe with caffe in Windows.

My current matcaffe folder structure is as below:

.
C:\PYTHON\caffe
            |-- matlab
                  |
                  |-- +caffe
                         |
                         |--private
                                |
                                |-- caffe_.mexw64
                                |...
                                |-- all hard linked dlls

I have checked caffe_.mexw64 using dependency walker that the following files are missing:

LIBMEX.DLL
LIBMX.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
DCOMP.DLL
IESHIMS.DLL

which is quite obvious from dependency walker. All caffe-related dlls are found.

In matlab, I have added the following path:

addpath('C:\PYTHON\caffe\matlab');

but on running this command:

caffe.run_tests()

I get the following error:

Invalid MEX-file 'C:\PYTHON\caffe\matlab\+caffe\private\caffe_.mexw64': The
specified procedure could not be found.
Error in caffe.set_mode_cpu (line 5)
caffe_('set_mode_cpu');
Error in caffe.run_tests (line 6)
caffe.set_mode_cpu(); 

Interesting thing is the following. If I go to the caffe\matlab\+caffe\private folder and run the same caffe.run_tests(), then it runs successfully.

And thereafter only, I can run the matcaffe commands without MEX errors from any other folder (as the dlls are then already loaded in the memory).

My questions are:

  • What is happening here that I cannot directly run from any other folder?
  • How to solve this to get the normal behaviour?

Update:

Now I see that the same problem has been posted here, but no proper solution.

user62039
  • 371
  • 2
  • 15

1 Answers1

0

You need to add the directory with the DLLs to the PATH environment variable. You can do this from within MATLAB on Windows (this does not work to modify the equivalent LD_LIBRARY_PATH on Linux and Unix):

setenv('PATH',['C:\PYTHON\caffe\matlab\+caffe\private\;',getenv('PATH')]);
Cris Luengo
  • 55,762
  • 10
  • 62
  • 120