1

For a while I have been compiling some mex files with own CUDA functions. I have the nvcc set up and everything compiles, and runs without problems.

However, when compiling

 mex -largeArrayDims ./Source/Atb.cpp ./Source/voxel_backprojection.cu ./Source/voxel_backprojection2.cu -outdir ./Mex_files

I always get the following messages after the successful compilation

Building with 'NVIDIA CUDA Compiler'.
Could Not Find C:\CUDA_MATLABtests\MyToolbox\Mex_files\Atb.exp

Could Not Find C:\CUDA_MATLABtests\MyToolbox\Mex_files\Atb.exp

Why do I get this messages, If the code seems to work properly?

Should I have them? If so, should I manually create them? How?

Ander Biguri
  • 35,140
  • 11
  • 74
  • 120
  • Can you insert -v and try it again? I assume you will see another message that a file could not be written. – Daniel Mar 11 '16 at 14:54
  • @Daniel no its not there. there is no error/warning of the type. The comment seems to appear when the compiler runs `del PATH/Atb.pbj PATH/Atb.exp PATH/atb.manufest` and some others. After that the .`exp` not found line is written. However, everything works, the code runs smoothly. – Ander Biguri Mar 11 '16 at 15:30
  • Atb - All the best. I cannot even find a file format in .exp on Google; I suppose you could create a blank .exp file and see what happens when you run (if it throws a different exception). – GameOfThrows Mar 11 '16 at 15:33
  • 2
    Looks like this explains it decently http://www.mathworks.com/matlabcentral/answers/262537-mex-problem-can-t-find-the-exp-file. So I'd say it's harmless. – Suever Mar 11 '16 at 15:34
  • @Suever consider answering this with some explanation! – Ander Biguri Mar 11 '16 at 15:44

1 Answers1

4

In Visual Studio, an export (.exp) file is created so that others can link against your library.

For your typical mex file, no one will be linking against it, therefore the .exp files are not necessary. This is why your mex file runs just fine despite the fact that MATLAB issues this warning. Their uselessness in the context of mex files is further verified by the fact MATLAB tries to delete them itself during the cleanup process.

del PATH/Atb.pbj PATH/Atb.exp PATH/atb.manufest

Since Visual Studio generates these files by default (and there doesn't seem to be a good way to disable this behavior), I believe that they should exist somewhere on your machine after your code is compiled. It may actually be that MATLAB's mex configuration doesn't properly handle where to place these files and they end up somewhere other than your output directory.

I don't have Visual Studio currently, but you could probably search your local machine for that .exp file just to verify that it is indeed created and it's just placed somewhere that MATLAB isn't expecting. If this is the case, you can likely tweak your mexopts to handle this.

That being said, this warning is harmless for your typical mex file and can safely be ignored.

MATLAB Answers post on the topic

Community
  • 1
  • 1
Suever
  • 64,497
  • 14
  • 82
  • 101