Tutorial: Creating a simple application
In this tutorial, you will use Nsight to create a simple CUDA application. This tutorial describes the process of creating a new CUDA C/C++ project where the build is automatically managed by Nsight, and running the program.
To create a simple CUDA application using Nsight, perform the following general steps:
Step 1: Create a new project
- Select File > New > Project.
- Select the type of project to create. For this tutorial, expand the C/C++ folder and select CUDA C/C++ Project and click Next.

-
The CUDA C/C++ Project wizard opens.

- In the Project name field, type a name for the project, such as bitreverse.
- From the Project type list, expand Executable and select CUDA Runtime Project. This project type provides a simple application in CUDA C, and the makefile is automatically created by Nsight.
- Click Next.
- In the Project name field, type a name for the project, such as bitreverse.
Specify the Basic Settings for the new project, such as your target hardware, device code linking type and source folder location, then click Next.

NOTE: Nsight, Eclipse Edition will detect CUDA hardware installed on the local system and will pick defaults that enable all the features of available GPUs. It will set defaults compatible with any CUDA hardware if hardware detection fails. Note that some CUDA functions and APIs may become unavailable.
-
The Select Configurations page displays a list of configurations based on the project type selected earlier.

OPTIONAL: If you want to change the default project settings, click Advanced Setting to open the Project Properties dialog for your new project allowing you change any of the project specific settings, such as includes paths, compiler options, and libraries.
Click Finish.
A project is created with the default settings and a full set of configurations based on the project type you selected. You should now see the new project in Project Explorer view.

Step 2: Review the code and build the project
- From the Project Explorer view, double-click the .cu file created for your project, for example, bitreverse.cu. You'll find it within the project "src" folder.
This file opens in a default editor. It contains CUDA C template code for the bitreverse example project you selected earlier. In addition, the Outline view has also been populated with objects created from your code.

NOTE: You can specify a different editor, and add or modify existing code templates in Window > Preferences.
OPTIONAL: You can type additional code in this file, and then save the changes by clicking File > Save, or pressing CTRL+S.
Next, you will need to build your project before you can run it.
- Build your project by pressing CTRL+B, or select the project in the Project Explorer view and select File > Build Project.
NOTE: If a build generates any errors or warnings, you can see those in the Problems view. If you encounter difficulty, see the topics Building projects
. Read through the build messages in the Console view. The project should build successfully.
You will also see the Outline view has also been populated with objects created from your code. If you select an item from the Outline view, the corresponding text in the editor is highlighted.
Step 3: Run the application
To run your application:
- Within the C/C++ Perspective, click Run > Run Configurations....
- Select C/C++ Application.
- Click New.
A new Run Configuration is created. Its name and path to the executable are provided by the project ('bitreverse' in our case).
- Click Run.
Now, you should see the bitreverse application running in the Console view. The Console also shows which application is running in a title bar.
- You can click the other views to see the information that they contain.
See Creating a new project from CUDA sample to learn how to import CUDA sample as a Nsight, Eclipse Edition project.