Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Hands-On GPU Computing with Python

You're reading from  Hands-On GPU Computing with Python

Product type Book
Published in May 2019
Publisher Packt
ISBN-13 9781789341072
Pages 452 pages
Edition 1st Edition
Languages
Author (1):
Avimanyu Bandyopadhyay Avimanyu Bandyopadhyay
Profile icon Avimanyu Bandyopadhyay

Table of Contents (17) Chapters

Preface Section 1: Computing with GPUs Introduction, Fundamental Concepts, and Hardware
Introducing GPU Computing Designing a GPU Computing Strategy Setting Up a GPU Computing Platform with NVIDIA and AMD Section 2: Hands-On Development with GPU Programming
Fundamentals of GPU Programming Setting Up Your Environment for GPU Programming Working with CUDA and PyCUDA Working with ROCm and PyOpenCL Working with Anaconda, CuPy, and Numba for GPUs Section 3: Containerization and Machine Learning with GPU-Powered Python
Containerization on GPU-Enabled Platforms Accelerated Machine Learning on GPUs GPU Acceleration for Scientific Applications Using DeepChem Other Books You May Enjoy Appendix A

How computing in CuPy works on Python

The basics of GPU computing with CuPy can be very easily understood with a side-by-side comparison with the traditional use of NumPy code on Python.

Once we explore the simple terminologies, we will shift our focus towards actual GPU-accelerated computations for solving specific computational problems with CuPy.

If you recall our traditional NumPy program that was first described in the PyCUDA chapter, we implemented a function to multiply two array elements through numpy. The syntax we used to import numpy was the following:

import numpy as np

As you can see, numpy is abbreviated as np for convenience of use throughout the program code.

In case of CuPy, too, we can use a similar syntax, as shown here:

import cupy as cp

In our NumPy code, we used the following syntax to initialize two arrays of the double data type for N elements with zero...

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 $15.99/month. Cancel anytime}