vl_compilenn ('enableGpu', true) on matlabr2016b, visualstudio2015 MatConvNet compile GPU - matlab

I have the follow configuration:
Windows 10 64bit
Matlab r2016b, NVidia GeForce 920MX, compute capability 5.0, toolkit version 7.5
Visual Studio 2015 for community
MatConvNet beta 23
Cuda 8.0 (ga1 02/2017)
cuDNN 6.0 (04/2017)
When I compile with vl_compilenn (only cpu) the compile is correct.
But when I compile with:
vl_compilenn ('enableGpu', true)
or more specific with:
vl_compilenn('enableGpu', true, 'cudaMethod', 'nvcc', 'cudaRoot', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0', 'enableCudnn', true, 'cudnnRoot', 'C:\..\..\..\..\..\MatConvNet\cuda')
I have the follow issue:
vl_compilenn: CUDA: MEX config file: 'C:\Program
Files\MATLAB\R2016b\toolbox\distcomp\gpu\extern\src\mex\win64\mex_CUDA_win64.xml'
C:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/../VC/bin/../../VC/INCLUDE\crtdefs.h(10): fatal error C1083: Non Þ possibile aprire il file inclusione: 'corecrt.h': No such file
or directory data.cu Error using vl_compilenn>nvcc_compile (line 540)
Command "C:\Program Files\NVIDIA GPU Computing
Toolkit\CUDA\v8.0\bin\nvcc" -c
"C:.........\MatConvNet\matconvnet-1.0-beta23\matlab\src\bits\data.cu"
-DNDEBUG -DENABLE_GPU -DENABLE_CUDNN -I"C:..........\MatConvNet\cuda\include" -DENABLE_DOUBLE -D__SSSE3__ -gencode=arch=compute_50,code=\"sm_50,compute_50\" -I"C:\Program Files\MATLAB\R2016b\extern\include" -I"C:\Program Files\MATLAB\R2016b\toolbox\distcomp\gpu\extern\include"
-gencode=arch=compute_50,code=\"sm_50,compute_50\" -O3
-Xcompiler /MD --compiler-bindir "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC..\VC\bin" -o
"C:..........\MatConvNet\matconvnet-1.0-beta23\matlab\mex.build\bits\data.obj"
failed.
Error in vl_compilenn (line 485) nvcc_compile(opts, srcs{i}, objfile,
flags.nvcc) ;
Also, i have copied the cudnn64_6.dll into the specific directory matlab/mex
If you have an idea, i would be gratefull, since I have made several attempt with another version of matconvnet (example b24), but the issue is similar.
Thank you very much.

I have solved used the follows libraries and software:
Matlab r2017a
Visual studio 2015
MatConvNet beta 24
Cuda 8.0.66
Regards

Probably there is no bin folder so Create 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC..\VC\bin' folder. It will stay empty but compiling will finished.

Related

Building Darknet but getting this errors

-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - NOTFOUND
-- CUDA_PATH: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6
-- CUDACXX: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6/bin/nvcc
CMake Error at CMakeLists.txt:153 (message):
CUDA not found, please build explicitly with -DENABLE_CUDA=OFF if you do
not want CUDA.
I have Cuda 11.6 and cudnn 8.3
Use CUDA version 11.1. Worked for me.

vscode cmake move from visual studio 17 to 19

I have been using vscode with the cmake integration for visual studio community edition 2017. I'm only using visual studio integration to vscode, not the IDE. I just moved to Vstudio 19. Now cmake is failing because I cannot get it to recognize that it should use the new visual studio. See error output below.
What is really interesting is that it's using the correct cmake.exe from the VS19 folder, but the parameter it uses is "-G "Visual Studio 15 2017" that is causing the problem. I removed the c_cpp_properties.json file (then CMake: Clean/Rebuild) in my .vscode folder which had a reference to VS17 and that didn't help.
I've tried to remove all the extensions (C/C++ Extension Pack), checked every folder/file in my projects for references to that VS 17. Removed the build folder and CMake: Clean/Rebuild after reinstalling the extensions..
[variant] Loaded new set of variants
[kit] Successfully loaded 4 kits from C:\Users\wood\AppData\Local\CMakeTools\cmake-tools-kits.json
[main] Configuring folder: mycode
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -Hc:/Users/wood/mycode/build -G "Visual Studio 15 2017" -T host=x64 -A win32
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Hc:/Users/wood/mycode -Bc:/Users/wood/OneDrive/mycode/build -G "Visual Studio 15 2017" -T host=x64 -A win32
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at CMakeLists.txt:13 (project):
[cmake] Generator
[cmake]
[cmake] Visual Studio 15 2017
[cmake]
[cmake] could not find any instance of Visual Studio.
[cmake]
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Users/wood/OneDrive/mycode/build/CMakeFiles/CMakeOutput.log".
Any ideas where else that -G setting might be coming from?
Looked for 24 hours, posted a question, then solved in in the first five minutes.
I removed the file.
C:\Users\wood\AppData\Local\CMakeTools\cmake-tools-kits.json
Well, just renamed it.
Uninstalled the C/C++ extension pack, then re-installed the extension pack. It looked like there was a command to rescan for visual studio, but I missed that as it went by. When rebuilding the cmake I was asked to pick the architecture and everything is working again.
That rescan of visual studio, re-created the cmake-tools-kits.json file with the correct references.

Matlab r2013a doesn't recognize any compiler in order to protect a model

I have a problem with my r2013a Matlab.
I want to protect a model using Simulink.ModelReference.protect('test') command. For this
I have to configure my compiler. I'm using the mex -setup command, and the xpcsetCC -setup command.
At first, Matlab says that is all ok with the compiler, but when i try to execute the Simulink.ModelReference.protect('model') command it shows an erro saying that there is no compiler avaiable.
Here are the sequences of commands:
PART 1 - 'mex -setup'
INPUT
mex -setup
OUTPUT
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2013a/win64.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n?
INPUT
y
OUTPUT
Select a compiler:
[1] Intel C++ 12.0 (with Microsoft Software Development Kit (SDK) linker) in C:\Program Files (x86)\Intel\ComposerXE-2011\
[2] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker) in C:\Program Files (x86)\Intel\ComposerXE-2011
[3] Microsoft Software Development Kit (SDK) 7.1 in C:\Program Files (x86)\Microsoft Visual Studio 10.0
[4] Microsoft Visual C++ 2010 in C:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
Compiler:
INPUT
4
OUTPUT
Please verify your choices:
Compiler: Microsoft Visual C++ 2010
Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0
Are these correct [y]/n?
INPUT
y
OUTPUT
***************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2010 require
that Microsoft Visual Studio 2010 run-time libraries be
available on the computer they are run on.
If you plan to redistribute your MEX-files to other MATLAB
users, be sure that they have the run-time libraries.
***************************************************************************
Trying to update options file: C:\Users\Guilherme\AppData\Roaming\MathWorks\MATLAB\R2013a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2013a\bin\win64\mexopts\msvc100opts.bat
Done . . .
**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html
Building with the -largeArrayDims option enables the new API.
**************************************************************************
PART 2 - 'xpcsetCC -setup'
INPUT
xpcsetCC -setup
OUTPUT
Select your compiler for xPC Target.
[1] Microsoft Visual C++ Compilers 2010 Professional in C:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
Compiler:
INPUT
1
OUTPUT
Verify your selection:
Compiler: Microsoft Visual C++ Compilers 2010 Professional
Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0
Are these correct [y]/n?Y
Done...
Until now everthing is ok, but next there is an error:
Part 3 - Simulink.ModelReference.protect('test')
INPUT
Simulink.ModelReference.protect('test')
OUTPUT
### Model reference SIM target (test_msp.mexw64) for model test is out of date because test_msp.mexw64 does not exist.
### Updating model reference SIM target for model: test
Warning: The model 'test' does not have continuous states, hence Simulink is using the solver 'VariableStepDiscrete' instead of solver 'ode45'.
You can disable this diagnostic by explicitly specifying a discrete solver in the solver tab of the Configuration Parameters dialog, or by
setting the 'Automatic solver parameter selection' diagnostic to 'none' in the Diagnostics tab of the Configuration Parameters dialog
Warning: Using a default value of 0.2 for maximum step size. The simulation step size will be equal to or less than this value. You can disable
this diagnostic by setting 'Automatic solver parameter selection' diagnostic to 'none' in the Diagnostics page of the configuration parameters
dialog
### Build procedure for model: 'test' aborted due to an error.
Error using Creator.protect (line 287)
An installed compiler was not detected. Certain simulation modes, as well as host-based coder builds require that a compiler be installed. Please
install one of the supported compilers for this release as listed at:
http://www.mathworks.com/support/compilers/R2013a/win64.html
MATLAB must be restarted after the compiler is installed.
Error in C:\Program Files\MATLAB\R2013a\toolbox\simulink\simulink\+Simulink\+ModelReference\protect.p>protect (line 74)
[harnessHandle, neededVars] = protectedModelCreator.protect(varargin{:});
I've already tried all different choices of available compilers. I also tried to choose no for the fist question of mex -setup ("Would you like mex to locate installed compilers [y]/n?") and choose the compiler manually. None of this worked.

problems with creating an exe file in matlab

this is the session of building exe file in matlab 7.1.
I think I have a problem with the compiler.
mbuild -setup
Please choose your compiler for building standalone MATLAB
applications: Would you like mbuild to locate installed compilers
[y]/n? y
Select a compiler:
[1] Microsoft Visual C++ 2008 Express in C:\Program Files (x86)\Microsoft Visual Studio 9.0
[0] None
Compiler: 1
Please verify your choices:
Compiler: Microsoft Visual C++ 2008 Express
Location: C:\Program Files (x86)\Microsoft Visual Studio 9.0
Are these correct [y]/n? y
*****************************************************************************
Error: Could not find the 64-bit compiler. This may indicate that the
"X64 Compilers and Tools" or the Microsoft Windows Software
Development Kit (SDK) is not installed. To build 64-bit binaries,
Microsoft Visual C++ 2008 Express Edition requires that these two
packages be properly installed.
*****************************************************************************
Trying to update options file: C:\Users\****\AppData\Roaming\MathWorks\MATLAB\R2010a\compopts.bat
From template: C:\PROGRA~1\MATLAB\R2010a\bin\win64\mbuildopts\msvc90freecompp.bat
Done . . .
>> mcc -m mainmain.m -o mainmain
Could not find the compiler "cl" on the DOS path.
Use mbuild -setup to configure your environment properly.
C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Unable to locate compiler.
Error: An error occurred while shelling out to mbuild (error code = 2).
Unable to build executable (specify the -v option for more information).
??? Error using ==> mcc
Error executing mcc, return status = 1 (0x1).
if the problem is with the compiler, how can I install another compiler?
I have windows 7 (64 bits) and I want that the exe file will work on windows operating system.
This is probably the result of one of two issues.
1) You don't have the Windows SDK installed (as indicated in the error message). According to this MathWorks page regarding supported compilers
Both Microsoft Visual Studio 2008 and Windows Software Development Kit (SDK) 6.1 must be installed. When installing Microsoft Visual Studio, you must choose "X64 Compilers and Tools" when installing Microsoft Visual Studio; this is not selected by default.
Now, keep in mind, this reference is for the most recent release of MATLAB, but I'm betting that this information is still relevant to your issue.
You can download the SDK here.
2) It's also possible that the compiler that you're using simply isn't supported for your release of MATLAB. See here for info on supported compilers for MATLAB 7.1.

Load Library error Matlab

I intend to work with OpenCV 1.1 version and Matlab2011 together. The program uses call to load library. However, it returns an error
> In loadlibrary at 347
In Untitled at 4
Error using loadlibrary (line 421)
There was an error loading the library "C:\Program Files
(x86)\OpenCV1.1\bin\cxcore110.dll"
C:\Program Files (x86)\OpenCV1.1\bin\cxcore110.dll is not a valid
Win32 application.
I have tested the program in Matlab 2008 and 2010 where it gives error of a different kind I have installed x64 Compilers and Tools and my system has Visual Studio2008 and 2010 with SDK7 and 6.1. Also, on doing MEX setup I get the following options
Select a compiler:
[1] Microsoft Software Development Kit (SDK) 7.1 in c:\Program Files (x86)\Microsoft Visual Studio 10.0
[2] Microsoft Visual C++ 2010 Express in c:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
Compiler: 2
This also returns the error
Error in ==> untitled at 5
loadlibrary(...
I am perplexed at what to do as this problem is persistently appearing. I even followed the thread in link where tit mentions that 2011 supports load library. So,why does it not work?Please help.
Applications compiled for 32bits don't mix with applications compiled for 64bits. If your OpenCV was compiled for 32bits, make sure Matlab is 32bits as well as your compilers.
BTW, seriously consider moving to a more recent version. OpenCV 1.1 is jurassic!