CUDA Compilation and execution in Visual Studio Dr Paul Richmond

Compiling a CUDA program CUDA C Code is compiled using nvcc e.g. Will compile host AND device code to produce an executable

nvcc –o example example.cu We will be using Visual Studio to build our CUDA code so we will not need to compile at the command line

Creating a CUDA Project Create New CUDA Project Select NVIDIA -> CUDA 7.0 This will create a project with a default kernels.cu file containing a basic vector addition example

Preferred Method!

Adding a CUDA source file Alternatively add a CUDA source file to an existing application If you do this you must modify the project properties to include CUDA build customisations http://developer.downlo ad.nvidia.com/compute/c uda/6_5/rel/docs/CUDA_ Getting_Started_Window s.pdf (section 3.4)

Compilation CUDA source file (*.cu) are compiled by nvcc An existing cuda.rules file creates property page for CUDA source files Configures nvcc in the same way as configuring the C compiler Options such as optimisation and include directories can be inherited from project defaults

C and C++ files are compiled with cl (MSVS compiler)

.c / .cpp

.cu

cl.exe

nvcc.exe

Host .obj

Host functions

CUDA kernels

cl.exe

cudaacc

Host .obj

CUDA .obj

linker

Executable

Device Versions Different generations of NVIDIA hardware have different compatibility In the last lecture we saw product families and chip variants These are classified by CUDA compute versions

Compilation normally builds for CUDA compute version 2 See Project Properties, CUDA C/C++Device->Code Generation Default value is “compute_20,sm_20” Any hardware with greater than the compiled compute version can execute the code (backwards compatibility)

You can build for multiple versions using separator E.g. “compute_20,sm_20;compute_30,sm_30;compute_35,sm_35” All Diamond and Lewin Labs GPUs

This will increase build time and execution file size Runtime will select the best version for your hardware https://en.wikipedia.org/wiki/CUDA#Supported_GPUs

Device Versions of Available GPUs Diamond High Spec Lab (lab machines) Quadro 5200 compute_35;sm_35;

Lewin Lab Main Room GeForce GT 520 compute_20;sm_20;

Lewin Lab Quiet Room GeForce GT 630 compute_30;sm_30;

For Maxwell you can use Iceberg Tesla K40 compute_50;sm_50;

CUDA Properties

Debugging NSIGHT is a GPU debugger for debugging GPU kernel code It does not debug breakpoints in host code

To launch select insert a breakpoint and select NSIGHT-> Start CUDA Debugging You must be in the debug build configuration. When stepping all warps except the debugger focus will be paused

Use conditional breakpoints to focus on specific threads Right click on break point and select Condition

Error Checking cudaError_t: enumerator for runtime errors

Can be converted to an error string (const char *) using cudaGetErrorString(cudaError_t)

Many host functions (e.g. cudaMalloc, cudaMemcpy) return a cudaError_t which can be used to handle errors gracefully cudaError_t cudaStatus; cudaStatus = cudaMemcpy(dev_a, a, size * sizeof(int), cudaMemcpyHostToDevice); if (cudaStatus != cudaSuccess) { //handle error }

Kernels do not return an error but if one is raised it can be queried using the cudaGetLastError() function addKernel<<<1, size>>>(dev_c, dev_a, dev_b); cudaStatus = cudaGetLastError();

CUDA Compilation and execution in Visual Studio.pdf

There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. CUDA ...

815KB Sizes 8 Downloads 152 Views

Recommend Documents

Program Modules, $eparate Compilation, and ...
agated to other modules and ( 2 ) no code is generated for module language ..... The specialisation of ModML functors is much similar to ho w Ada generic.

Compilation of SACP, SADTU and ANC statements
Mar 6, 2013 - NEC Lekgotla on the issues of making education an essential service. ... individuals but individuals who are able to interpret and make sense .... that call others “funny people” and appeal to members to crush leaders to stop.

Digests Compilation
technology (e.g. Sociology) or (3) a creator of business value derived from technological and social structures of the new web (e.g. Business Administration). From the perspective of the authors of this paper, Web 2.0 is a natural evolution of the we

JETSCAPE Framework: Installation, Compilation And ...
Windows: Windows is currently not supported. We recommend you install a virtual machine https://www.storagecraft.com/blog/the-dead-simple-guide-to-installing-a-linux-virtual-machine-on-windows and a recent version of Scientific Linux. Then follow the

Digests Compilation
annotate the content and express implicit relations among wiki concepts. This aids users to gradually ... typed links, concept types and properties. In addition, it ...

Custom execution environments in the BOINC middleware
such as VMWare[6] and Xen[2], or application level sandboxes such as Native ..... B. Customizable execution environments with virtual desktop grid computing.

Custom execution environments in the BOINC middleware
where applications are confined to a closed environment, to prevent them from causing any harm to the hosting system. To provide the security that volunteers expect, .... supports the platform and operating system where it is executed. By using Libbo

Custom execution environments in the BOINC middleware
large user base, it suffers from two fundamental limitations: first, it can only ... pend on external software, having the same dependencies as BOINC itself. This ... advantage of not requiring any modifications to the BOINC client but is tied to ...

FPLLL - Installation, Compilation, Dependencies - GitHub
Jul 6, 2017 - 2. ./configure (optional: --prefix=$PREFIX). 3. make (optional: -jX for X ... .gnu.org/software/libtool/manual/html_node/Updating-version-info.html ...

compilation asa akira.pdf
cumpilation. Spankwire. asa akira compilation. Asa akira anal crazyjizz.comfree porn videos. Asa akira compilation,. free asian porn video 3c xhamster. Asa akira compilation. pornhub.com. Youporn compilation videos xxx, free porn movies. Asa akira ho

Execution of Execution of Asynchronous Substitution ...
2Assistant Professor, Department of ECE,Velalar College of Engineering and Technology, Anna University. Chennai ... substitution box design essentially matches all the important security properties. ... using Mentor Graphics EDA (Electronic Design Au

Stereo Imaging with CUDA
Dec 17, 2007 - Also, this is one case where is it acceptable to mix a driver API function (cuMemGetInfo) .... worksheet included with the CUDA SDK will aid in.

pdf-1443\supplemental-a-compilation-of-the-messages-and ...
... the apps below to open or edit this item. pdf-1443\supplemental-a-compilation-of-the-messages-a ... 1-1906-from-bureau-of-national-literature-and-art.pdf.

A Compilation of all MCA circulars and notifications ... -
notification dated. 12.9.2013. Statement to be annexed to notice shall be under Sec. 102 for statements after 11 Sep 2013. Circular. 2013 General Circular No.

Stereo Imaging with CUDA
Dec 17, 2007 - The strategy employed in this example is highly optimized ... Changing image source data type is trivial and does not require re-optimization.

Open BEAGLE Compilation HOWTO
Oct 10, 2005 - This document is on the compilation of the Open BEAGLE1 C++ framework for evolutionary computations. ..... #define BEAGLE_FULL_DEBUG.

With Examples in R, C++ and CUDA (Chapman & Hall ...
graphics processing units (GPUs). It also discusses software packages that span more than one type of hardware and can be used from more than one type of programming language. Readers will find that the foundation established in this book will genera