CUDA Driver API Usage notes

Source: Internet
Author: User
Tags cuda toolkit

CUDA Driver API Usage notes

1. Introduction

The Cuda Driver API is implemented in the Cuda Dynamic Library (libcuda.so). If you are developing in an eclipse environment, you need to add the path to the libcuda.so file and reference the Cuda.h file in your program.

2. Environment configuration

2.1 Source Program

For the use of the driver API simply include the corresponding header file Cuda.h in the source program, and before using the other driver APIs, you need to call the Cuinit () function to initialize the driver, as shown in the following program.

1#include <stdlib.h>
2
3#include <stdio.h>
4
5#include <cuda.h>
6
7intMainvoid){
8
9intDriverVersion;
Ten
OneCuinit (0);
A
-Cudrivergetversion (&driverversion);
-
theprintf"after:%d\n", driverversion);
-
-return 0;
-
+}

2.2 Eclipse Environment

If you develop cuda with the Eclipse platform, you need to add the directory where the libcuda.so library file is located, which is added in the Eclipse environment by Right-clicking the project àPropertiesàBuild à SettingsàTool Settingsànvcc lickerà miscellaneousàother objects, Then add the directory where the libcuda.so file is located in other objects.

Figure 1

Reference documents

Refer to Cuda Toolkit's own file,

  1. the cuda_c_programming_guide.pdf " Driver API section: Introduction to Using Driver API the way that quite is an introductory level introduction;
  2. vectoradddrv Project: This project is a driver API sample /root/nvidia_cuda-7.0_samples/0_simple/ Vectoradddrv
  3. the cuda_driver_api.pdf ": This document provides all relevant API , but does not describe how to use it, it is a API User Manual.

CUDA Driver API Usage notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.