Skip to Content
Applied Natural Language Processing in the Enterprise
book

Applied Natural Language Processing in the Enterprise

by Ankur A. Patel, Ajay Uppili Arasanipalai
May 2021
Beginner to intermediate
333 pages
8h 45m
English
O'Reilly Media, Inc.
Content preview from Applied Natural Language Processing in the Enterprise

Appendix B. CUDA

Throughout the book, we’ve mostly been using PyTorch or tools built on top of it, such as fastai and Hugging Face transformers. When we first introduced it in this book, we pitched PyTorch as a low-level framework, where you build architectures and write training loops “from scratch” using your knowledge of linear algebra.

But PyTorch may not be the lowest level of abstraction you deal with in machine learning.

PyTorch itself is written in C++, to which the CUDA language is an extension. CUDA is self-described as a “programming model” that allows you to write code for Nvidia GPUs. When writing your C++ code, you include certain functions called “CUDA kernels” that perform a portion of the work on the GPU.

Who’s That Pokémon? CUDA Kernels

A kernel is a function that is compiled for and designed to run on special accelerator hardware like GPUs (graphics processing units), FPGAs (field-programmable gate arrays), and ASICs (application-specific integrated circuits). They are generally written by engineers who are very familiar with the hardware architecture, and are extensively tuned to perform a single task very well, such as matrix multiplication or convolution. CUDA kernels are kernels run on devices that use CUDA—Nvidia’s GPUs and accelerators.

PyTorch and many other deep learning frameworks use a handful of CUDA kernels to implement their backend, and then build a higher-level interface to a language like Python. This allows you to run super-fast, hand-tuned ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Natural Language Processing with Flair

Natural Language Processing with Flair

Tadej Magajna

Publisher Resources

ISBN: 9781492062561Errata Page