Вы находитесь на странице: 1из 12

NETBEANS AND CUDA

HOW TO BUILD OR OPEN A CUDA PROJECT IN THE GRAPHICAL DEVELOPMENT ENVIRONMENT NETBEANS

Version 1.0 Department of Electromagnetism Faculty of Physics University of Salamanca

Index
1. Introduction ................................................................................. 1 2. Configure NetBeans to develop CUDA ....................................... 2 3. Creating a new CUDA project in NetBeans ................................ 5 4. Open a CUDA project in NetBeans ............................................. 7
4.1. 4.2. A CUDA project created previously with NetBeans ........................... 7 A CUDA project from existing code files that already have a Makefile.. ........................................................................................... 7 A CUDA project from existing code files that have not a Makefile ..... 8

4.3.

NETBEANS AND CUDA

HOW TO BUILD OR OPEN A CUDA PROJECT IN THE GRAPHICAL DEVELOPMENT ENVIRONMENT NETBEANS

1. Introduction
This document details a little tutorial of how can create a new CUDA project or load one already create in the tool or development environment NetBeans. This allows programming within a graphical environment, offering many facilities such as integration of all elements and tasks required during development in the same environment. Enables us to program, compile, debug an run applications from the same development environment, without the need for multiple windows, consoles and text editors open. Currently, at the time of writing this document, the installed version of the development environment is 6.5.1. In first, any graphical development environment is ready to develop in CUDA, so it must be configured to recognize the extensions ".cu" and compile using the NVIDIA compiler (nvcc). In this tutorial there is a section dedicated to it.

VERSION: 1.0 JAVIER GMEZ MARTN

2. Configure NetBeans to develop CUDA


First of all you must configure the development environment to associate ".cu" extensions whit C++ projects (based programming language to CUDA) and to use the NVIDIA compiler (nvcc). To do this, go to menu "Tools Options", in the "C/C++" section select the tab "Build Tools". Select GNU and click on "Duplicate...". We named the new Tool Collection as CUDA. In the form whit the routes of the compilers write the values you see in the next screenshot:

NETBEANS AND CUDA

HOW TO BUILD OR OPEN A CUDA PROJECT IN THE GRAPHICAL DEVELOPMENT ENVIRONMENT NETBEANS

Now, in the tab "Code Assistance", select as Tool Collection "CUDA" and add in "C++ Compiler" the following routes: /usr/include /usr/local/cuda/include

VERSION: 1.0 JAVIER GMEZ MARTN

Finally, in the tab "Other", in "C++ File Extensions" edit and add the extension ".cu". It should be something like this:

NETBEANS AND CUDA

HOW TO BUILD OR OPEN A CUDA PROJECT IN THE GRAPHICAL DEVELOPMENT ENVIRONMENT NETBEANS

3. Creating a new CUDA project in NetBeans


To create a new CUDA project in NetBeans, it must first load the development environment. This is on the menu Applications Programming NetBeans IDE. Then go to menu File on "Next". New Project C/C++ Application and click

Then write the project name and click on "Finish".

VERSION: 1.0 JAVIER GMEZ MARTN

Finally, we have created the project, we have got the latest details. Let the projects options on menu File Project Properties, in the category "Build" check that the Tool Collection selected is CUDA and the option "Enable Make Dependency Checking" is unchecked.

In the category "C++ Compiler", check that as Tool is "nvcc" and in "Include Directories" add /usr/include and /usr/local/cuda/include, with this:

We can add both source files (.cpp and .cu) and header files (.h) to our project.

NETBEANS AND CUDA

HOW TO BUILD OR OPEN A CUDA PROJECT IN THE GRAPHICAL DEVELOPMENT ENVIRONMENT NETBEANS

4. Open a CUDA project in NetBeans


4.1. A CUDA project created previously with NetBeans

Simply go to the menu File Open Project and search in our file system the NetBeans project that we want to open.

4.2. A CUDA project from existing code files that already have a Makefile
The process would be the same as for creating a new CUDA project, but now when selecting the type of C/C++ application in the menu File New Project would select the option C/C++ Project From Existing Code.

Then we follow the steps that the wizard give us to select the path of the "Makefile" and source files. In first, the rest of configuration and compilation options would not have to change anything. Finally it should be set up "Project Properties" as in the case of a new project. For this see section 3 of this document.

VERSION: 1.0 JAVIER GMEZ MARTN

4.3. A CUDA project from existing code files that have not a Makefile
The process would be the same as for creating a new CUDA project, but instead of adding new files to the project, add the existing files. Finally it should be set up "Project Properties" as in the case of a new project. For this see section 3 of this document.

Вам также может понравиться