Building Blender in VS2013 - not successful with CUDA.

Hello,
I tried to build the Blender according
https://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Windows/msvc/CMake
and used Visual Studio community 2013
all is OK except CUDA,

after build I have

2.78.4 date 2016-12-29
Blender User Preferences
System
Cycles Compute Device: None

Cycles Render
Render
Device: CPU + GPU Compute … UI element is grayed but can be switched between these two values

GPU Compute not functioning.


If I install Blender from blender-2.78a-windows64.msi

2.78a date 2016-10-24
Blender User Preferences
System
Compute Device: None + CUDA (GeForce GTX …)

Cycles Render
Render
Device: CPU + GPU Compute … UI element is NOT grayed

GPU Compute is OK.


If I try to build some CUDA 8.0 sample project in Visual Studio for example bandwidthTest
everything is OK. Even New Project - Installed - Templates - NVIDIA - CUDA 8.0 exists in VS2013.


Please how can I repair CUDA in Blender solution for Visual Studio community 2013 ?

No answer yet, so I provide more info

Build Cycles CUDA binaries according to

https://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Windows/msvc/CMake
https://wiki.blender.org/index.php/Dev:Source/Render/Cycles/Building

what am I doing wrong ?

Hi, I am building on Linux so cant help here but you can step by to #blendercoders at freenode.net to get help from the Blender developer.
I know you need at least VS 2013 update 4.

Cheers, mib

a couple of varibles,
Have you installed Cuda Toolkit 8?
Configure cmake manually?
in lib folder after the build does it show your kernels?
…\bin\Release\2.78\scripts\addons\cycles\lib

Have cuda toolkit in your path environment?
just off the top of my head but start there :slight_smile:

Also here’s my build script…

:@Echo off

call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64


set "PATH=%PATH%;C:\Program Files\TortoiseSVN\bin"
set "PATH=%PATH%;C:\Program Files (x86)\Git\bin"
set "PATH=%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
vvm\bin"
set "PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin"
set "PATH=%PATH%;C:\Program Files\SlikSvn\bin"
set "PATH=%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
vcc.exe"
set "PATH=%PATH%;C:\Python34/Lib/site-packages
umpy"


D:
cd D:\MyBuilds	runk_msvc-2013\make_msvc2013
MSBuild INSTALL.vcxproj /p:Configuration=Release /t:Build /m



Others may have more efficient scripts that they can share.

Thank you tungerz,
I had proceeded strictly according to these two manuals

https://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Windows/msvc/CMake
and
https://wiki.blender.org/index.php/Dev:Source/Render/Cycles/Building


Have you installed Cuda Toolkit 8? … YES
Configure cmake manually? … NO expect these two lines in CMakeLists.txt

option(WITH_CYCLES_CUDA_BINARIES “Build Cycles CUDA binaries” ON)
set(CYCLES_CUDA_BINARIES_ARCH sm_50 sm_61 CACHE STRING “CUDA architectures to build binaries for”)

in lib folder after the build does it show your kernels?
…\bin\Release\2.78\scripts\addons\cycles\lib … I HAVE NO lib directory there

Have cuda toolkit in your path environment? … I hope YES

PATH=
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;

C:\Program Files\TortoiseSVN\bin;
C:\Program Files\TortoiseGit\bin;
C:\Program Files\CMake\bin;

if I compare with your PATH commands in your build script this one is missing

set “PATH=%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
vvm\bin”

anyway why should I do build script - no wiki blender document mention this ?

Are you building from a msvc2013 x64 terminal or msvc gui?

Im seeing double

Hi I am building from VS2013 UI and I have little progress

I need just two CUDA architectures so according

https://wiki.blender.org/index.php/Dev:Source/Render/Cycles/Building

option(WITH_CYCLES_CUDA_BINARIES “Build Cycles CUDA binaries” ON)
set(CYCLES_CUDA_BINARIES_ARCH sm_50 sm_61 CACHE STRING “CUDA architectures to build binaries for”)

I have chosen sm_50 sm_61

I again read this

https://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Windows/msvc/CMake

and tried this option to build VS project

D:\blender-git\blender>make release nobuild
.
.
.
– Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0 (found version “8.0”)
– CUDA nvcc = C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/bin/nvcc.exe
.
.
.
– Configuring done
– Generating done
– Build files have been written to: D:/blender-git/build_windows_Release_x64_vc12_Release


Now I build from VS2013 UI project

1>------ Build started: Project: ZERO_CHECK, Configuration: Release x64 ------
.
.
.
146>------ Build started: Project: blenderplayer, Configuration: Release x64 ------
144> Internal error
144>CUSTOMBUILD : nvcc warning : The ‘compute_20’, ‘sm_20’, and ‘sm_21’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
144> kernel.cu
144>CUSTOMBUILD : nvcc error : ‘ptxas’ died with status 0xC0000005 (ACCESS_VIOLATION)
146> Building Custom Rule D:/blender-git/blender/source/blenderplayer/CMakeLists.txt
.
.
.
149> CMake Error at source/creator/cmake_install.cmake:352 (file):
149> file INSTALL cannot find
149> “D:/blender-git/build_windows_Release_x64_vc12_Release/intern/cycles/kernel/kernel_sm_20.cubin”.
149> Call Stack (most recent call first):
149> cmake_install.cmake:35 (include)
149>
149>
149>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: The command “setlocal
149>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: “C:\Program Files\CMake\bin\cmake.exe” -DBUILD_TYPE=Release -P cmake_install.cmake
149>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
149>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: :cmEnd
149>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
149>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: :cmErrorLevel
149>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: exit /b %1
149>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: :cmDone
149>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
149>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: :VCEnd” exited with code 1.
========== Build: 147 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

So CUDA is recognized but … nvcc error : ‘ptxas’ died with status 0xC0000005 (ACCESS_VIOLATION)

nvcc error : ‘ptxas’ died with status 0xC0000005 (ACCESS_VIOLATION)
do you know what this could mean ?

Looks like its kicking the 2.0 and 2.1 kernels
I usually build sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61 I dropped sm_20 and sm_21 because it usually kicks the build.
Drop those and you should be fine.
You only need the kernels for your cards, will save build time without the others.

Reboot the computer solved problem. Now I have my build of Blender with CUDA.
But another surprise - output file format H.264 is missing … I will create new thread.