Visual studio 2010 integration Sort of not complete (or is it just me)

Hi,
I’ve ran into problem that “Versbose PTXAR Output” option in cuda configuration property pages, when set to Yes, doesn’t actually print anything in visual studio output. Also, if you for instance pass incorrect flags to nvcc, it would print “nvcc fatal:…” on the command line, but visual studio output window doesn’t contain that message, which makes it hard to figure out what you have done wrong.

Thanks,
Sergey.

Hi there!

I tried this with pi_cuda example shipped with ArrayFire. On enabling “Verbose PTXAR output”, I got the following log. (This is using VS 2008), seems to me it is working fine!

1>------ Build started: Project: pi_cuda, Configuration: Release x64 ------
1>Compiling with CUDA Build Rule…
1>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe” -ccbin “d:\MSVS2008\VC\bin” -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" -I"./" -I"…/…/common/inc" -I"…/…/…/shared/inc" -I"…\include" -Xcompiler "/EHsc /W3 /nologo /Od /Zi /MT " -maxrregcount=32 --ptxas-options=-v -gencode=arch=compute_10,code=“sm_10,compute_10” -gencode=arch=compute_20,code=“sm_20,compute_20” --compile -o “x64\Release\pi_cuda.cu.obj” “d:\Downloads\arrayfire\examples\pi\pi_cuda.cu”
1>pi_cuda.cu
1>tmpxft_000017dc_00000000-6_pi_cuda.compute_10.cudafe1.gpu
1>tmpxft_000017dc_00000000-10_pi_cuda.compute_10.cudafe2.gpu
1>pi_cuda.cu
1>tmpxft_000017dc_00000000-3_pi_cuda.compute_20.cudafe1.gpu
1>tmpxft_000017dc_00000000-14_pi_cuda.compute_20.cudafe2.gpu
1>pi_cuda.cu
1>pi_cuda.cu
1>ptxas info : Compiling entry function ‘Z11test_insideiPfS_S’ for ‘sm_10’
1>ptxas info : Used 3 registers, 32+16 bytes smem, 4 bytes cmem[1]
1>ptxas info : Compiling entry function ‘Z11test_insideiPfS_S’ for ‘sm_20’
1>ptxas info : Function properties for Z11test_insideiPfS_S
1> 0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
1>ptxas info : Used 8 registers, 64 bytes cmem[0], 8 bytes cmem[16]
1>tmpxft_000017dc_00000000-6_pi_cuda.compute_10.cudafe1.cpp
1>tmpxft_000017dc_00000000-23_pi_cuda.compute_10.ii
1>Linking…
1>LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
1>Embedding manifest…
1>Build log was saved at “file://d:\Downloads\arrayfire\examples\pi\x64\Release\BuildLog.htm”
1>pi_cuda - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

With VS 2010, prints nothing, so your observation seems correct.

I just found that when the build process completes, it generates a text file in arrayfire/examples/pi/x64/ directory. This is building ArrayFire pi_cuda_vs2010 example with VS2010. This contains PTXAS info. Here is the build log from pi_cuda_vs2010.txt

Build started 2/4/2012 7:42:23 PM.
1>Project “D:\Downloads\arrayfire\examples\pi\pi_cuda_vs2010.vcxproj” on node 2 (build target(s)).
1>InitializeBuildStatus:
Creating “x64\pi_cuda.unsuccessfulbuild” because “AlwaysCreate” was specified.
AddCudaCompileDeps:
d:\MSVS2010\VC\bin\x86_amd64\cl.exe /E /nologo /showIncludes /TP /I…/…/include /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" /I. /FIcuda_runtime.h /c D:\Downloads\arrayfire\examples\pi\pi_cuda.cu
AddCudaCompilePropsDeps:
Found “CudaToolkitCustomDir”.
Found “AdditionalDeps”.
Found “CompileOut”.
Found “Include”.
Found “Keep”.
Found “KeepDir”.
Found “NvccCompilation”.
Found “NvccPath”.
Found “RequiredIncludes”.
Found “TargetMachinePlatform”.
Found “CInterleavedPTX”.
Found “CodeGeneration”.
Found “GPUDebugInfo”.
Found “MaxRegCount”.
Found “PtxAsOptionV”.
Found “Defines”.
Found “Emulation”.
Found “HostDebugInfo”.
Found “FastMath”.
Found “Optimization”.
Found “Runtime”.
Found “RuntimeChecks”.
Found “TypeInfo”.
Found “Warning”.
Found “AdditionalOptions”.
Found “CommandLineTemplate”.
CudaBuild:
Compiling CUDA source file pi_cuda.cu…
cmd.exe /C “C:\Users\temp\AppData\Local\Temp\cd5f3487fcdc4ccaae1d6df8af225833.cmd”
“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe” -gencode=arch=compute_10,code=“sm_10,compute_10” -gencode=arch=compute_20,code=“sm_20,compute_20” --use-local-env --cl-version 2010 -ccbin “d:\MSVS2010\VC\bin\x86_amd64” -I"…/…/include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" --keep-dir “x64\Release” -maxrregcount=0 --ptxas-options=-v --machine 64 --compile -Xcompiler "/EHsc /nologo /Od /Zi /MT " -o “x64\pi_cuda.cu.obj” “D:\Downloads\arrayfire\examples\pi\pi_cuda.cu”

     D:\Downloads\arrayfire\examples\pi>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --use-local-env --cl-version 2010 -ccbin "d:\MSVS2010\VC\bin\x86_amd64" -I"../../include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include"    --keep-dir "x64\Release" -maxrregcount=0 --ptxas-options=-v --machine 64 --compile      -Xcompiler "/EHsc /nologo /Od /Zi  /MT " -o "x64\pi_cuda.cu.obj" "D:\Downloads\arrayfire\examples\pi\pi_cuda.cu" 
     pi_cuda.cu
     tmpxft_00000d88_00000000-3_pi_cuda.compute_10.cudafe1.gpu
     tmpxft_00000d88_00000000-7_pi_cuda.compute_10.cudafe2.gpu
     pi_cuda.cu
     tmpxft_00000d88_00000000-0_pi_cuda.compute_20.cudafe1.gpu
     tmpxft_00000d88_00000000-11_pi_cuda.compute_20.cudafe2.gpu
     pi_cuda.cu
     ptxas info    : Compiling entry function '_Z11test_insideiPfS_S_' for 'sm_10'
     ptxas info    : Used 3 registers, 32+16 bytes smem, 4 bytes cmem[1]
     pi_cuda.cu
     ptxas info    : Compiling entry function '_Z11test_insideiPfS_S_' for 'sm_20'
     ptxas info    : Function properties for _Z11test_insideiPfS_S_
         0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
     ptxas info    : Used 8 registers, 64 bytes cmem[0], 8 bytes cmem[16]
     tmpxft_00000d88_00000000-3_pi_cuda.compute_10.cudafe1.cpp
     tmpxft_00000d88_00000000-20_pi_cuda.compute_10.ii
   Link:
     d:\MSVS2010\VC\bin\x86_amd64\link.exe /ERRORREPORT:PROMPT /OUT:"..\bin_x64\/pi_cuda.exe" /NOLOGO /LIBPATH:"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\lib\x64" /LIBPATH:../../lib64 libaf.lib cudart.lib cublas.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"x64\pi_cuda.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /PDB:"D:\Downloads\arrayfire\examples\bin_x64\pi_cuda.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"..\bin_x64\pi_cuda.lib" /MACHINE:X64 x64\pi_cuda.cu.obj
     pi_cuda_vs2010.vcxproj -> D:\Downloads\arrayfire\examples\pi\..\bin_x64\pi_cuda.exe
   Manifest:
     C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\mt.exe /nologo /verbose /outputresource:"..\bin_x64\/pi_cuda.exe;#1" /manifest x64\pi_cuda.exe.intermediate.manifest
   FinalizeBuildStatus:
     Deleting file "x64\pi_cuda.unsuccessfulbuild".
     Touching "x64\pi_cuda.lastbuildstate".
 1>Done Building Project "D:\Downloads\arrayfire\examples\pi\pi_cuda_vs2010.vcxproj" (build target(s)).

Build succeeded.

Time Elapsed 00:00:15.90

Ok, for those who really needs that working with vs 2010 I’ve found a workaround:

Edit the file C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.1.targets (you’ll need administrator rights to do so)

and append

2>&1

after every

CommandLineTemplate=""$(CudaToolkitNvccPath)"

you find (I have 2 of those).

A full modified line should look like this:

CommandLineTemplate=""$(CudaToolkitNvccPath)" 2>&1 %(CudaCompile.BuildDynamicCommandLineTemplate) %(CudaCompile.BuildCommandLineTemplate) %(CudaCompile.ApiCommandLineTemplate)" />

I’m not an MSBuild expert, so I hope nvidia experts will fix this blunder the proper way.

Thanks,

Sergey.