portability of DLL with CUDA code - cuda

I have DLL, which contain CUDA function (image processing). This DLL is compiled with VISUAL STUDIO 2008 Express edition. I call this DLL with LabVIEW.
This DLL and LabVIEW VI are developed on one computer (office) and I need to run same program in differen computer (in lab).
Q1: Do I have to instal cuda toolkit or cuda SDK on computer in lab?
Q2: Do I have to recompile DLL on computer in lab or DLL are completly portable?
Thanks

Yes, you have to install CUDA toolkit and SDK if you use any functions/ wrappers ( like cudaSafeCall) from SDK. In general SDK is not nesessary. You need in compatible NVIDIA GPU driver instaled on Lab computer, too.
You need not recompile if Lab computer and your own have the same Microsoft Visual Studio runtime, CUDA runtime version and Lab computer have GPU device with proper compute capability that your code was compiled for. For more information about CUDA code compatibility see 3.1.2 - 3.1.4 sections in CUDA C programming Guide.

Related

Running 32-bit application on CUDA

I read on the CUDA toolkit documentation (11.3.0) that "Deployment and execution of CUDA applications on x86_32 is still supported, but is limited to use with GeForce GPUs."
This looks in conflict with the fact that I was able to run a 32-bit app on my Tesla T4. (I verified that the code was actually running on the GPU and the app was 32-bit).
Have I misinterpreted the documentation? Why am I able to run 32-bit apps on a Tesla GPU?
(I'm running Visual studio 2017 on Windows 10)
It's a question of what is supported.
Other things may work, or they may not.

Does the client need to install Cuda Toolkit to run the application?

I have finished building my cuda application and would like to install it on the clients PCs.
The cuda toolkit installer is about 2GB. It comes with the compiler, samples, tools, etc.
Is the whole toolkit definitly required to be installed on the client machine?
Is there no lighter version for just the CUDA Runtime API ?
Is the whole toolkit definitely required to be installed on the client machine?
No, it isn't.
Is there no lighter version for just the CUDA Runtime API ?
No, but the EULA allows you to redistribute the library components which your application requires with your application. The simplest solution would be to have your installation/deployment system copy the required toolkit components you built against to a private path which is known to your application or deployment environment. You obviously also need to deploy a supported driver version as well.

cudart_static - when is it necessary?

Since newer drivers ship with the CUDA runtime (I can choose 9.1 or 9.2 in the drivers download page) my question is: should my library (which uses a CUDA kernel internally) be shipped with -lcudart_static?
I had issues launching kernels compiled with 9.2 on systems which used 9.1 CUDA drivers. What's the most 'compatible' way of ensuring my library will run everywhere a recent CUDA driver is installed? (I'm already compiling for a virtual architecture)
Since newer drivers ship with the CUDA runtime (I can choose 9.1 or 9.2 in the drivers download page)
No, that's incorrect. That choice in the drivers download page is related to the fact that each CUDA version has a minimum required driver version associated with it. It does not mean that the driver ships with the CUDA runtime (stated another way, the driver does not install libcudart.so on linux and never has - with some careful experimentation on a clean install, you can prove this to yourself.)
Some additional comments:
-lcudart_static is actually the default for current/recent versions of nvcc. You can discover this by reading the nvcc manual. Therefore, by default, your executable, when compiled/built with nvcc should already be statically linked to the CUDA runtime library corresponding to the version of nvcc that you are using for compilation. The reason you might need to specify this or something like this is if you are building an application with e.g. the gnu toolchain (on linux) rather than nvcc.
The purpose of static linking to the CUDA runtime library is, as you surmise, so that an application can be built in such a way that it does not need an installation of the CUDA toolkit to run properly. It only needs a machine with a proper GPU driver install.
The most compatible way to ensure that an application will run on a range of machines with a range of GPU driver installs is to compile your application using the oldest CUDA toolkit required to meet the needs of the earliest GPU driver in the range you intend to cover. Again, you can refer to the table here.

CUDA Developer Toolkit: Display Driver failed installation

I have the Nvidia Quadro NVS4200M along with Intel Integrated Graphics (on my laptop). I can't seem to get the CUDA 5.0 toolkit installation to succeed.
I am running Windows 7 Enterprise Edition 64-bit. I tried the 64-bit desktop & notebook installers and the 32-bit installers.
All of them seem to fail with the error message "Display Driver failed installation". I installed the latest drivers from here, and it is supposed to support CUDA-5.0, and despite that, the installation fails.
After failure, the libraries and binaries are present, but NSight Eclipse (which seems to have no standalone installation link) isn't installed. What could be the possible issue?
I'm not sure why the driver install failed in your case, but if you
have a "recent" driver installed, it's not necessary to use the
driver that comes with the cuda installer. The cuda installer
offers individual options to install the toolkit (required), samples
(optional), and driver (required only if you have an older driver),
so you can just select "no" when prompted for the driver install, to
avoid this, assuming you have a recent driver or installed one such
as the 307.45 driver.
You should always use a 64 bit installer if you have a 64 bit OS.
The only officially supported C/C++ compiler for windows is cl.exe, the microsoft compiler that ships with either Microsoft Visual Studio (the Express edition will do, it is free), or the Windows SDK (for command line use only). You're free to experiment with other stuff, but your mileage may vary. MS VS 2010 (and 2008) are the easiest to use. MS VS 2012 can be made to work but may require extra steps.
I recommend installing cuda after installing Microsoft Visual Studio. This is because the cuda installer should automatically find your VS installation and update some important files to make building cuda projects easier.
nsight Eclipse Edition is a linux-only tool (or mac). It is not for windows use, and will not be installed by the windows cuda installers. nsight EE provides an environment for code building, debugging, and profiling. In windows, the corresponding operations can be done via MS VS IDE for code building, the standalone visual profiler for profiling, and using a separate plug-in, nsight visual studio edition, for debugging and profiling within visual studio. Due to the way visual studio is constructed, nsight visual studio edition will not work with the free versions of visual studio. nsight visual studio has it's own separate installer.
The windows getting started guide may also be of interest.

How to create 64-bit CUDA applications? (Win7 x64, CUDA 4, VS 2010 Express)

I'm mostly set up for CUDA development. I've installed the developer drivers, CUDA 4.0 toolkit, and the 4.0 SDK, as well as the bugfix. I'm running Windows 7 x64, and am using Visual C++ 2010 Express. For 32-bit applications, I perform the following steps and my CUDA applications work properly.
Create new empty project
make sure Platform Toolset is set to v100 (normally the default)
check the CUDA 4.0 Build Customization for the project
set the item type of my .cu file to CUDA C/C++
add 'cudart.lib' to Properties->Linker->Input->Additional Dependencies
I can also run non-CUDA 64-bit applications. Visual C++ 2010 Express does not come with 64-bit dependencies automatically, so I had to install the Windows 7.1 SDK w/ .NET Framework 4.0. Then I simply set the Platform Toolset for the VC++ project to Windows7.1SDK, change the Active solution platform to x64, and I'm good to go.
However, I can't seem to do both at the same time - I can't create a 64-bit CUDA application. If I change the Platform Toolset of a CUDA application to Windows7.1SDK, whether the Active solution platform is x64 or Win32, I get the compile error that nvcc.exe exited with code -1. And if I leave the Platform Toolset set to v100 and change the Active solution platform to x64, I get the compile error "fatal error LNK1104: cannot open file 'kernel32.lib'. The only combination that works is v100 and Win32, and obviously that prevents me from running a 64-bit application.
Is there a procedure for enabling this functionality that I just haven't been able to find online? Any ideas or suggestions? Thanks for your time.
Not possible in express edition , ( does not support plugins ) unless you want to setup nvcc manually , and use notepad to write cu files, I very much prefer the VS integration .
You could check that the host compiler properties for the .cu files are set to 64-bit.
Right-click the "Code.cu" file and click 'Properties'.
Expand the "CUDA C/C++" item and select "Common".
Change "Target Machine Platform" to 64-bit.