Compiling CUDA files with mexcuda - why wont Matlab accept my compiler?!

Im trying to compile CUDA files into mex.
Matlab ships with an example CUDA file located in matlabfolder\toolbox\distcomp\gpu\extern\src\mex, but when I try to compile it by typing:
mexcuda mexGPUExample.cu
I get:
"Error using mex
No supported compiler or SDK was found"
Im using the Microsoft Visual C++ 2015 Professional (C) compiler for both C and C++ but Ive also tried the MinGW64 Compiler and the Windows SDK 7.1 which all gives me the same error.
Im using the CUDA toolkit 8, and in Visual studio I can compile .cu files so I obviously have a supported compiler. How do I make Matlab realize that and allow me to compile .cu files?
Thanks.

 Respuesta aceptada

Joss Knight
Joss Knight el 3 de Oct. de 2016
Hello Petter,
CUDA 8.0 was only released last week! mexcuda doesn't yet support it, and consequently does not yet support Visual Studio 2015, which is supported by CUDA 8.0 but not CUDA 7.5.

7 comentarios

Oh, I see.. I guess I will try to uninstall CUDA and reinstall an older legacy version and see if that helps then.
Thanks.
I’ve now uninstalled CUDA 8.0 and installed CUDA 7.5.18, but still I get the “ No supported compiler or SDK was found ” error.. I’ve tried setting the C/C++ compiler to both Microsoft Visual C++ 2015 Professional and MinGW64 but the result is the same.
Any ideas on what I need to do in order to get it to compile? Try another compiler?
If you want to know more about using mexcuda, and its limitations, check out the doc here: https://www.mathworks.com/help/distcomp/run-mex-functions-containing-cuda-code.html
Thank you but I don’t think the main problem I’m facing is that I lack sufficient reading material on how to use mexcuda, the problem is that it fundamentally does not work at the moment since it refuses to accept all compilers I’ve tried and both CUDA toolbox 8 and 7.5 which as far as I can see the documentations does not give any advice on.
I have also tried explicitly telling Matlab the location of nvcc as suggested in the text you linked to:
setenv('MW_NVCC_PATH','C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin')
but sadly that changed nothing.
Joss Knight
Joss Knight el 5 de Oct. de 2016
Editada: Joss Knight el 5 de Oct. de 2016
Like I said, mexcuda does not support Visual Studio 2015 because CUDA 7.5 doesn't support it. You need to use VS 2012 or 2013. mexcuda can only support the host compilers that the CUDA compiler supports.
I am using VS2010 and having the same problem. I don't think an earlier version of VS is the correct fix.
CUDA 7.5 supported VS 2013, VS 2013 Community, VS 2012, and VS 2010

Iniciar sesión para comentar.

Más respuestas (1)

Mendi Barel
Mendi Barel el 28 de Feb. de 2017
Editada: Mendi Barel el 28 de Feb. de 2017
This is how to compile (mexcuda) with Visual Studio 2015 and Cuda 8.0 :
  1. Go to: "\toolbox\distcomp\gpu\extern\src\mex\win64"
  2. Copy files and rename 2013 to 2015: { "nvcc_msvcpp2013.xml" , "nvcc_msvcpp2013_dynamic.xml"}
  3. Replace inside those files "7.5" to "8.0" and "12" to "14".
  4. Done.

2 comentarios

Dang Manh Truong
Dang Manh Truong el 21 de Mzo. de 2017
Editada: Dang Manh Truong el 24 de Mzo. de 2017
Actually when I tried your solution, an error came up: It says that the file ucrt.lib was missing. I searched the internet but could not find a solution, so I had no choice but to search for the file (in Program Files), then copy it to the Matlab's working directory. Only then did it work. But thanks anyway
Dang, is the name of file exactly ucrt.lib? I cannot find it in the program files.Thanks!

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with GPU Coder en Centro de ayuda y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by