Level-1 AXPY with cuBLAS

Let's start with a basic level-1 ax + y (or AXPY) operation with cuBLAS. Let's stop for a moment and review a bit of linear algebra and think about what this means. Here, a is considered to be a scalar; that is, a real number, such as -10, 0, 1.345, or 100. x and y are considered to be vectors in some vector space, . This means that x and y are n-tuples of real numbers, so in the case of , these could be values such as [1,2,3] or [-0.345, 8.15, -15.867]. ax means the scaling of x by a, so if a is 10 and x is the first ...

Get Hands-On GPU Programming with Python and CUDA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.