I am learning some program which is compiled sucessfully for CUDA (v6.5). But when I switch to OpenMP I get the following errors:
Error 9 error C2668: 'thrust::raw_reference_cast' : ambiguous call to overloaded function C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include\thrust\detail\function.h 55 1
Error 10 error C2780: 'enable_if_non_const_reference_or_tuple_of_iterator_references::type>::type thrust::detail::host_unary_transform_functor::operator ()(Tuple)' : expects 1 arguments - 0 provided C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include\thrust\detail\function.h 55 1
Error 11 error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --use-local-env --cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64" -IC:\Boost -I"C:\Program Files (x86)\Microsoft SDKs\MPI\Include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include" --keep-dir x64\Debug-OMP(home) -maxrregcount=0 --machine 64 --compile -cudart static -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_OMP -DENABLE_LOGGING -DENABLE_DEBUG_LOGGING -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_OMP -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd /openmp" -o build\gopt-mpi\x64\Debug-OMP(home)\kernels_factory.cu.obj "C:\ALI\APOP\gopt-mpi\APOP_projects\src\cuda\kernels_factory.cu"" exited with code 2. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA 6.5.targets 593 9
I work under Windows, Visual Studio 13 Community and switch to OpenMP according to https://github.com/thrust/thrust/wiki/Device-Backends. I made two changes in project properties, both for CUDA C/C++, Host: 1. "Additional compiler options" set as "/openmp" 2. "Preprocessor definitions" set as THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_OMP What should I do to correct the situation?
Related
I’ve been trying to install OPENCV 2.4.13.6 into a GPU-equipped Windows10 machine (CUDA9.0, VS2015, cmake3.10.0 have already been installed).
Though trying to install the opencv 2.4 by referring to https://jamesbowley.co.uk/build-compile-opencv-3-4-in-windows-with-cuda-9-0-and-intel-mkl-tbb/, I got following error.
Error message:
The CXX compiler identification is MSVC 19.0.24215.1
The C compiler identification is MSVC 19.0.24215.1
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- broken
CMake Error at share/cmake-3.10/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeTmp
Run Build Command:"C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe" "cmTC_678c6.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 2018/10/28 21:46:10.
Project "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "cmTC_678c6.dir\Debug\".
Creating directory "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\Debug\".
Creating directory "cmTC_678c6.dir\Debug\cmTC_678c6.tlog\".
InitializeBuildStatus:
Creating "cmTC_678c6.dir\Debug\cmTC_678c6.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_678c6.dir\Debug\\" /Fd"cmTC_678c6.dir\Debug\vc140.pdb" /Gd /TP /errorReport:queue "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\testCXXCompiler.cxx"
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_678c6.dir\Debug\\" /Fd"cmTC_678c6.dir\Debug\vc140.pdb" /Gd /TP /errorReport:queue "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\testCXXCompiler.cxx"
testCXXCompiler.cxx
Link:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\Debug\cmTC_678c6.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeTmp/Debug/cmTC_678c6.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeTmp/Debug/cmTC_678c6.lib" /MACHINE:X64 /machine:x64 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib cmTC_678c6.dir\Debug\testCXXCompiler.obj
LINK : fatal error LNK1104: cannot open file 'C:\Program.obj' [C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj]
Done Building Project "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj" (default target) (1) ->
(Link target) ->
LINK : fatal error LNK1104: cannot open file 'C:\Program.obj' [C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.42
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:64 (project)
Configuring incomplete, errors occurred!
See also "C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeOutput.log".
See also "C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeError.log".
Though I've been trying to fix this error referring to below URLs for a week, those solution on the URLs did not work with me.
CMake configuring fails. "cl.exe is not able to compile a simple test program"
Why does fatal error "LNK1104: cannot open file 'C:\Program.obj'" occur when I compile a C++ project in Visual Studio?
I would sincerely appreciate for your kind instruction to solve this issue.
I recently upgraded from Winpython version 3.5 to the respective version with python 3.6. Therefore, I have to recompile my C extensions using the new interpreter. My setup script looks as follows:
from distutils.core import setup, Extension
import numpy.distutils.misc_util
c_ext = Extension("heapoperations", ["heapoperations.c"])
setup(
ext_modules=[c_ext],
include_dirs=numpy.distutils.misc_util.get_numpy_include_dirs(),
)
The console output when using python 3.5 was
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
building 'heapoperations' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I"C:\Program Files\WinPython-64bit-3.5.1.2\python-3.5.1.amd64\lib\site-packages\numpy\core\include" -I"C:\Program Files\WinPython-64bit-3.5.1.2\python-3.5.1.amd64\include" -I"C:\Program Files\WinPython-64bit-3.5.1.2\python-3.5.1.amd64\include" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" /Tcheapoperations.c /Fobuild\temp.win-amd64-3.5\Release\heapoperations.obj
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:"C:\Program Files\WinPython-64bit-3.5.1.2\python-3.5.1.amd64\libs" /LIBPATH:"C:\Program Files\WinPython-64bit-3.5.1.2\python-3.5.1.amd64\PCbuild\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64" /EXPORT:PyInit_heapoperations build\temp.win-amd64-3.5\Release\heapoperations.obj /OUT:D:\MyProject\heapoperations.cp35-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\heapoperations.cp35-win_amd64.lib
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.exe
However, when I run the same script with python 3.6 I get
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
building 'heapoperations' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I"C:\Program Files\WinPython-64bit-3.6.0.1Qt5\python-3.6.0.amd64\lib\site-packages\numpy\core\include" -I"C:\Program Files\WinPython-64bit-3.6.0.1Qt5\python-3.6.0.amd64\include" -I"C:\Program Files\WinPython-64bit-3.6.0.1Qt5\python-3.6.0.amd64\include" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" /Tcheapoperations.c /Fobuild\temp.win-amd64-3.6\Release\heapoperations.obj
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
That is, link.exe is not called. The result is that I do not get a .pyd file that allows me to use the code.
What could explain the behaviour? How could I make everything work under WinPython 3.6?
I am using 64bit WinPython under Windows 10 64bit.
I did a try from http://dan.iel.fm/posts/python-c-extensions/
(and _chi2.c from https://gist.github.com/douglas-larocca/099bf7460d853abb7c17)
result:
C:\WinPython\basedir36\buildQt5\winpython-64bit-3.6.x.2\notebooks>python setup.py build_ext --inplace
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
building '_chi2' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\WinPython\basedir36\buildQt5\winpython-64bit-3.6.x.2\python-3.6.0.amd64\lib\site-packages\numpy\core\include -IC:\WinPython\basedir36\buildQt5\winpython-64bit-3.6.x.2\python-3.6.0.amd64\include -IC:\WinPython\basedir36\buildQt5\winpython-64bit-3.6.x.2\python-3.6.0.amd64\include -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tc_chi2.c /Fobuild\temp.win-amd64-3.6\Release\_chi2.obj
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\WinPython\basedir36\buildQt5\winpython-64bit-3.6.x.2\python-3.6.0.amd64\lib\site-packages\numpy\core\include -IC:\WinPython\basedir36\buildQt5\winpython-64bit-3.6.x.2\python-3.6.0.amd64\include -IC:\WinPython\basedir36\buildQt5\winpython-64bit-3.6.x.2\python-3.6.0.amd64\include -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcchi2.c /Fobuild\temp.win-amd64-3.6\Release\chi2.obj
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\WinPython\basedir36\buildQt5\winpython-64bit-3.6.x.2\python-3.6.0.amd64\libs /LIBPATH:C:\WinPython\basedir36\buildQt5\winpython-64bit-3.6.x.2\python-3.6.0.amd64\PCbuild\amd64 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" /EXPORT:PyInit__chi2 build\temp.win-amd64-3.6\Release\_chi2.obj build\temp.win-amd64-3.6\Release\chi2.obj /OUT:C:\WinPython\basedir36\buildQt5\winpython-64bit-3.6.x.2\notebooks\_chi2.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\_chi2.cp36-win_amd64.lib
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe
C:\WinPython\basedir36\buildQt5\winpython-64bit-3.6.x.2\notebooks>
test of result:
PS C:\WinPython\basedir36\buildQt5\winpython-64bit-3.6.x.2\notebooks> python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import _chi2; print (_chi2.chi2(2.0, 1.0, [-1.0, 4.2, 30.6], [-1.5, 8.0, 63.0], [1.0, 1.5, 0.6]))
2.8988888888888766
I've installed CUDA 7.5 on Windows 7-SP1 and I'm uisng Visual Studio 2013.
Unfortunately, I can't run any CUDA code. I can't even build the sample bandwidthTest. I get the following error:
C:\ProgramData\NVIDIA Corporation\CUDA
Samples\v7.5\1_Utilities\bandwidthTest>"C:\Program Files\NVIDIA GPU
Computing Toolkit\CUDA\v7.5\bin\nvcc.exe"
-gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_30,code=\"sm_30,compute_30\" -gencode=arch=compute_35,code=\"sm_35,compute_35\" -gencode=arch=compute_37,code=\"sm_37,compute_37\" -gencode=arch=compute_50,code=\"sm_50,compute_50\" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env --cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64" -I./ -I../../common/inc -I./
-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5/include" -I../../common/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" --keep-dir x64\Release -maxrregcount=0
--machine 64 --compile -cudart static -Xcompiler "/wd 4819" -DWIN32 -DWIN32 -D_MBCS -D_MBCS -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -o x64/Release/bandwidthTest.cu.obj "C:\ProgramData\NVIDIA
Corporation\CUDA
Samples\v7.5\1_Utilities\bandwidthTest\bandwidthTest.cu" 1> nvcc
fatal : Compiler 'cl.exe' in PATH different than the one specified
with -ccbin 1>C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA
7.5.targets(604,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin\nvcc.exe"
-gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_30,code=\"sm_30,compute_30\" -gencode=arch=compute_35,code=\"sm_35,compute_35\" -gencode=arch=compute_37,code=\"sm_37,compute_37\" -gencode=arch=compute_50,code=\"sm_50,compute_50\" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env --cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64" -I./ -I../../common/inc -I./
-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5/include" -I../../common/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" --keep-dir x64\Release -maxrregcount=0
--machine 64 --compile -cudart static -Xcompiler "/wd 4819" -DWIN32 -DWIN32 -D_MBCS -D_MBCS -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -o x64/Release/bandwidthTest.cu.obj "C:\ProgramData\NVIDIA
Corporation\CUDA
Samples\v7.5\1_Utilities\bandwidthTest\bandwidthTest.cu"" exited with
code 1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
My environment variables are:
Path:
C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\bin\x86_amd64;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin;C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE;C:\TDM-GCC-64\bin;C:\TDM-GCC-64\x86_64-w64-mingw32;C:\ProgramData\Oracle\Java\javapath;C:\Program
Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin;C:\Program
Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\libnvvp;c:\Program Files
(x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS
Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program
Files (x86)\Hewlett-Packard\HP Performance Advisor;C:\Program
Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program
Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files
(x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft
SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL
Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files
(x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program
Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files
(x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files (x86)\Microsoft
SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL
Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL
Server\110\Tools\Binn\ManagementStudio\;C:\Program Files
(x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program
Files\R\R-3.1.3\bin\i386\;C:\Program Files (x86)\NVIDIA
Corporation\PhysX\Common
CUDA_PATH:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5
CUDA_PATH_V7_5:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5
I also changed
INCLUDES += "-I$(TOP)/include" $(SPACE)
to
INCLUDES += "-I$(TOP)/include" "-I$(TOP)/include/cudart" "-IC:/Program
Files (x86)/Microsoft Visual Studio 12.0/VC/include" $(SPACE)
in nvcc.profile.
But no luck so far!! :(
Could you please help me?!
Thanks
Problem
There are thee versions of Visual Studio compiler: for x86, for x86_64 and ARM platforms (and I heard fourth is coming soon).
The problem is most likely comes from the fact that you are compiling for a platform that is different from the compiler's platform you have in PATH.
Solution
You should never have Visual Studio's bin folders in your global PATH variable.
Remove everything related to Visual Studio from your PATH. Visual Studio IDE and CUDA tools are smart enough to find the compiler without your help (via registry entries).
If you want to run developer tools from the command line (without IDE) at the same time, use:
Visual Studio Command prompt in Start menu (which uses vcvarsall.bat script)
or use vcvarsall.bat directly (which temporarily sets up the environment for building against a platform given as a parameter)
or roll out your own script
If the above answer doesn't work for you, here's what I did with Visual Studio 2013 and CUDA 6.5 for an x64 compile.
I edited
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA 6.5.props
So that
<VCBinDir Condition="'$(Platform)' == 'Win32'">$(VC_ExecutablePath_x86_x86)</VCBinDir>
<VCBinDir Condition="'$(Platform)' == 'x64'">$(VC_ExecutablePath_x64)</VCBinDir>
I have the same problem, the key cause of this problem is the name of cl.exe is duplicated. I have the BullseyeCoverage(a software which can analyze the fraction of coverage of code) installed. It have the same named cl.exe program. Then i uninstall it, the problem is gone!
I am working on CUDA with Visual Studio 2010. I installed the CUDA toolkit and SDK but one of the SDK examples is not building successfully.
The output console shows:
1>_CUDA_Build_Rule:
1> Compiling with CUDA Build Rule...
1> The system cannot find the path specified.
1>E:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\Cuda.targets(45,5): error MSB3721: The command "echo "$(CUDA_BIN_PATH)\nvcc.exe" -arch sm_10 -ccbin "E:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /Od /Zi /MTd " -I"E:\CUDA\include;../../common/inc" -maxrregcount=32 --compile -o "$(IntDir)\$(InputName).cu.obj" "E:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\bandwidthTest\bandwidthTest.cu"
1>E:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\Cuda.targets(45,5): error MSB3721: "$(CUDA_BIN_PATH)\nvcc.exe" -arch sm_10 -ccbin "E:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /Od /Zi /MTd " -I"E:\CUDA\include;../../common/inc" -maxrregcount=32 --compile -o "$(IntDir)\$(InputName).cu.obj" "E:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\bandwidthTest\bandwidthTest.cu"" exited with code 1.
1>
1>Build FAILED.
there is some problem with the nvcc.exe
When i execute nvcc.exe in command prompt, it shows :
nvcc fatal: No input file specified
I'm afraid yours is a non-programming question.
Anyway, if you run nvcc from the command line, you obviously get that error message because you are not specifying which file do you like to compile.
Below, I'm pointing out some other threads with the same problem you detailed. I hope they could be useful to you:
Visual Studio 2010 - how to fix Error MSB3721 - exiting with code 1
CUDA Visual Studio 2010 Express build error
Fixing Visual Studio Express error when cleaning 64-bit projects using CUDA 4.1 nvcc compiler
I was trying to compile some CUDA codes under visual studio 2010 with CUDA 4.2 (I created this CUDA project using Parallel Nsight 2.2), but I encountered an atomic problem "error : identifier "atomicAdd" is undefined", which I still can't solve after checking several forums.
So I tried to get some information from CUDA SDK Samples. First, I ran the simpleAtomicIntrinsics sample in CUDA SDK, which passed its test. Then, I copied all the files in this sample to a new CUDA 4.2 project in visual studio 2010 and compiled them, Here is the result.
1> E:\CUDA exercise Codes\CUDA_EXERCISES\CUDA_EXERCISES\CUDA_EXERCISES>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2010 -ccbin "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include" -G --keep-dir "Debug" -maxrregcount=0 --machine 32 --compile -g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o "Debug\simpleAtomicIntrinsics.cu.obj" "E:\CUDA exercise Codes\CUDA_EXERCISES\CUDA_EXERCISES\CUDA_EXERCISES\simpleAtomicIntrinsics.cu"
1> simpleAtomicIntrinsics.cu
1> tmpxft_00007220_00000000-3_simpleAtomicIntrinsics.compute_20.cudafe1.gpu
1> tmpxft_00007220_00000000-7_simpleAtomicIntrinsics.compute_20.cudafe2.gpu
1> simpleAtomicIntrinsics.cu
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(33): error : identifier "atomicAdd" is undefined
1>
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(36): error : identifier "atomicSub" is undefined
1>
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(39): error : identifier "atomicExch" is undefined
1>
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(42): error : identifier "atomicMax" is undefined
1>
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(45): error : identifier "atomicMin" is undefined
1>
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(48): error : identifier "atomicInc" is undefined
1>
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(51): error : identifier "atomicDec" is undefined
1>
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(54): error : identifier "atomicCAS" is undefined
1>
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(59): error : identifier "atomicAnd" is undefined
1>
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(62): error : identifier "atomicOr" is undefined
1>
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(65): error : identifier "atomicXor" is undefined
1>
1> 11 errors detected in the compilation of "C:/Users/NIEXIA~1/AppData/Local/Temp/tmpxft_00007220_00000000-9_simpleAtomicIntrinsics.compute_10.cpp1.ii".
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.2.targets(361,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2010 -ccbin "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include" -G --keep-dir "Debug" -maxrregcount=0 --machine 32 --compile -g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o "Debug\simpleAtomicIntrinsics.cu.obj" "E:\CUDA exercise Codes\CUDA_EXERCISES\CUDA_EXERCISES\CUDA_EXERCISES\simpleAtomicIntrinsics.cu"" exited with code 2.
1>
1>Build FAILED.
By the way, I can run other samples such as clock, matrixMul, etc. under this vs2010 CUDA Project. (This means the include path is set correctly)
I googled it and found the following link Some issue with Atomic add in CUDA kernel operation. I changed the properties of both project and the .cu file according to it, but still can't solve the problem.
Any suggestion?
Try to compile with the flag -arch sm_20
Atomics are unavailable under compute architecture 1.0, but you're still trying to compile for it according to your build log. Try removing references to compute_10 and sm_10 from your CUDA project properties and compiling for just compute architecture 2.0 (GeForce 400 series and newer).
"Atomics are unavailable under compute architecture 1.0, but you're still trying to compile for it according to your build log. Try removing references to compute_10 and sm_10 from your CUDA project properties and compiling for just compute architecture 2.0 (GeForce 400 series and newer)."
It's absolutely right,BTW,if you guys are compiling rodrigob_doppia's source code(boosted_learning),you can just add the line in your machine configuration:
set(CUDA_NVCC_FLAGS "-arch=sm_20" CACHE STRING "nvcc flags" FORCE)
Actually,it is set to switch the arch flag to sm_20,just the same as the saying above.