Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would suggest using the procedure in <a href="http://www.orangeowlsolutions.com/archives/498" rel="nofollow">Compiling CUDA mex files with Visual Studio</a>:</p> <blockquote> <p>Configuration: Matlab 2010a, Visual Studio 2010, Intel 64bit machine.</p> <ol> <li><p>File &rarr; New Project</p></li> <li><p>Choose MFC DLL as well as the Name of the project and the Location<br> Choose OK</p></li> <li><p>Choose Next</p></li> <li><p>Choose Finish (do not change any selection)</p></li> <li><p>Solution Explorer &rarr; Right click on the project's name &rarr; Build Customizations &rarr; CUDA 5.0 &rarr; OK</p></li> <li><p>Project &rarr; Add New Item; Choose C++ File (.cpp); Choose a Name for the file</p></li> <li><p>Add the line #include "stdafx.h"; of course, include "mex.h" and &lt;cuda.h>, &lt;cuda_runtime.h> etc. as appropriate</p></li> <li><p>Write your code containing the mexFunction under the above include lines; this .cpp file should contain only CPU-side code, namely, the mex function and other C++ functions. Note that the mex function as well as the C++ functions should not contain kernel function invocations (no &lt;&lt;&lt; >>> syntax permitted); kernel invocations should be contained in "wrapper functions" declared in this .cpp file as extern "C" and then defined in a .cu file (see next point)</p></li> <li><p>Project &rarr; Add New Item; Choose C++ File (.cpp); Choose a Name for the file, but use the .cu extension; this .cu file should contain the needed <strong>global</strong> as well as <strong>device</strong> functions</p></li> <li><p>Add the following lines to the .def file</p></li> </ol> <p>LIBRARY "TestMex" EXPORTS mexFunction</p> <p>Replace TestMex with the name of your .cpp file</p> <ol start="11"> <li><p>Project &rarr; Properties &rarr; Configuration Properties &rarr; C/C++ &amp;rarr General &rarr; Additional Include Directories &rarr; Add C:\Program Files\MATLAB\R2010a\extern\include</p></li> <li><p>Project &rarr; Properties &rarr; Configuration Properties &rarr; Linker &amp;rarr General &rarr; OutPut File &rarr; $(OutDir)$(ProjectName).mexw64</p></li> <li><p>Project &rarr; Properties &rarr; Configuration Properties &rarr; Linker &amp;rarr Input &rarr; Additional Dependencies &rarr; C:\Program Files\MATLAB\R2010a\extern\lib\win64\microsoft\libmex.lib; C:\Program Files\MATLAB\R2010a\extern\lib\win64\microsoft\libmx.lib</p></li> <li><p>Project &rarr; Properties &rarr; Configuration Properties &rarr; CUDA C/C++ &amp;rarr Device &rarr; Choose your compute capability</p></li> <li><p>Project &rarr; Properties &rarr; Configuration Properties &rarr; Configuration Manager &rarr; Active Solution Platform &rarr; New &rarr; x64 &rarr; Copy Settings From Win32</p></li> <li><p>Project &rarr; Properties &rarr; Configuration Properties &rarr; Linker &amp;rarr Input &rarr; Additional Dependencies &rarr; Add cudart.lib</p></li> <li><p>The directory containing the compiled mex library is ..\x64\Debug</p></li> </ol> <p>You can find a worked out example in the <a href="http://orangeowlsolutions.com/file_download/Compiling_CUDA_Mex_VS.zip" rel="nofollow">attached Visual Studio 2010 project</a>.</p> </blockquote> <p>The procedure has been tested for CUDA 5.0, Visual Studio 2010 and Matlab 2010a/2012b, but perhaps it could be of interest also to people using other versions of the above products.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload