Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On GPU-Accelerated Computer Vision with OpenCV and CUDA

You're reading from   Hands-On GPU-Accelerated Computer Vision with OpenCV and CUDA Effective techniques for processing complex image data in real time using GPUs

Arrow left icon
Product type Paperback
Published in Sep 2018
Publisher Packt
ISBN-13 9781789348293
Length 380 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Bhaumik Vaidya Bhaumik Vaidya
Author Profile Icon Bhaumik Vaidya
Bhaumik Vaidya
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Introducing CUDA and Getting Started with CUDA 2. Parallel Programming using CUDA C FREE CHAPTER 3. Threads, Synchronization, and Memory 4. Advanced Concepts in CUDA 5. Getting Started with OpenCV with CUDA Support 6. Basic Computer Vision Operations Using OpenCV and CUDA 7. Object Detection and Tracking Using OpenCV and CUDA 8. Introduction to the Jetson TX1 Development Board and Installing OpenCV on Jetson TX1 9. Deploying Computer Vision Applications on Jetson TX1 10. Getting Started with PyCUDA 11. Working with PyCUDA 12. Basic Computer Vision Applications Using PyCUDA 13. Assessments 14. Other Books You May Enjoy

CUDA development environment

To start developing an application using CUDA, you will need to set up the development environment for it. There are some prerequisites for setting up a development environment for CUDA. These include the following:

  • A CUDA-supported GPU
  • An NVIDIA graphics card driver
  • A standard C compiler
  • A CUDA development kit

How to check for these prerequisites and install them is discussed in the following sub section.

CUDA-supported GPU

As discussed earlier, CUDA architecture is only supported on NVIDIA GPUs. It is not supported on other GPUs such as AMD and Intel. Almost all GPUs developed by NVIDIA in the last decade support CUDA architecture and can be used to develop and execute CUDA applications. A detailed list of CUDA-supported GPUs can be found on the NVIDIA website: https://developer.nvidia.com/cuda-gpus. If you can find your GPU in this list, you will be able to run CUDA applications on your PC.

If you don't know which GPU is on your PC, then you can find it by following these steps:

  • On windows:
    1. In the Start menu, type device manager and press Enter.
    2. In the device manager, expand the display adaptors. There, you will find the name of your NVIDIA GPU.
  • On Linux:
    1. Open Terminal.
    2. Run sudo lshw -C video.

This will list information regarding your graphics card, usually including its make and model.

  • On macOS:
    1. Go to the Apple Menu | About this Mac | More info.
    2. Select Graphics/Displays under Contents list. There, you will find the name of your NVIDIA GPU.

If you have a CUDA-enabled GPU, then you are good to proceed to the next step.

NVIDIA graphics card driver

If you want to communicate with NVIDIA GPU hardware, then you will need a system software for it. NVIDIA provides a device driver to communicate with the GPU hardware. If the NVIDIA graphics card is properly installed, then these drivers are installed automatically with it on your PC. Still, it is good practice to check for driver updates periodically from the NVIDIA website: http://www.nvidia.in/Download/index.aspx?lang=en-in. You can select your graphics card and operating system for driver download from this link.

Standard C compiler

Whenever you are running a CUDA application, it will need two compilers: one for GPU code and one for CPU code. The compiler for the GPU code will come with an installation of CUDA toolkit, which will be discussed in the next section. You also need to install a standard C compiler for executing CPU code. There are different C compilers based on the operating systems:

  • On Windows: For all Microsoft Windows editions, it is recommended to use Microsoft Visual Studio C compiler. It comes with Microsoft Visual Studio and can be downloaded from its official website: https://www.visualstudio.com/downloads/.

The express edition for commercial applications needs to be purchased, but you can use community editions for free in non-commercial applications. For running the CUDA application, install Microsoft Visual Studio with a Microsoft Visual Studio C compiler selected. Different CUDA versions support different Visual Studio editions, so you can refer to the NVIDIA CUDA website for Visual Studio version support.

  • On Linux: Mostly, all Linux distributions come with a standard GNU C Complier (GCC), and hence it can be used to compile CPU code for CUDA applications.
  • On Mac: On the Mac operating system, you can install a GCC compiler by downloading and installing Xcode for macOS. It is freely available and can be downloaded from Apple's website:

https://developer.apple.com/xcode/

CUDA development kit

CUDA needs a GPU compiler for compiling GPU code. This compiler comes with a CUDA development toolkit. If you have an NVIDIA GPU with the latest driver update and have installed a standard C compiler for your operating system, you are good to proceed to the final step of installing the CUDA development toolkit. A step-by-step guide for installing the CUDA toolkit is discussed in the next section.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image