# Concurrent NumPy in Python

## Concurrent NumPy in Python

### Faster NumPy With BLAS, Python Threads, and Multiprocessing

Concurrency in NumPy is not an afterthought

- Discover matrix multiplication that is 2.7x faster.
- Discover array initialization that is up to 3.2x faster.
- Discover sharing copied arrays that is up to 516.91x faster.

NumPy is how we represent arrays of numbers in Python.

An entire ecosystem of third-party libraries has been developed around NumPy arrays, from machine learning and deep learning to image and computer vision and more.

Given the wide use of NumPy, it is essential we know how to get the most out of our system when using it.

We cannot afford to have CPU cores sit idle when performing mathematical operations on arrays.

Therefore we must know how to correctly harness concurrency in NumPy, such as:

- NumPy has multithreaded algorithms and functions built-in (using BLAS).
- NumPy will release the infamous GIL so Python threads can run in parallel.
- NumPy arrays can be shared efficiently between Python processes using shared memory.

The problem is, no one is talking about how.

Introducing: "**Concurrent NumPy in Python**". A new book designed to teach you how to bring concurrency to your NumPy programs in Python, super fast!

You will get fast-paced tutorials showing you how to bring concurrency to the most common NumPy tasks.

Including:

- Parallel array multiplication, common math functions, matrix solvers, and decompositions.
- Parallel array filling and parallel creation of arrays of random numbers.
- Parallel element-wise array arithmetic and common array math functions
- Parallel programs for working with many NumPy arrays with thread and process pools.
- Efficiently share arrays directly, and copies of arrays between Python processes.

Don't worry if you are new to NumPy programming or concurrency, you will also get primers on the background required to get the most out of this book, including:

- The importance of concurrency when using NumPy and the cost of approaching it naively.
- How to perform common NumPy operations and math functions.
- How to install, query, and configure BLAS libraries for built-in multithreaded NumPy functions.
- How to use Python concurrency APIs including threading, multiprocessing, and pools of workers.

Each tutorial is carefully designed to teach one critical aspect of how to bring concurrency to your NumPy projects.

### Table of Contents

- Tutorial 01: Introduction.
- Tutorial 02: Tour of NumPy.
- Tutorial 03: Tour of Python Concurrency.
- Tutorial 04: NumPy Concurrency Matters.
- Tutorial 05: What is BLAS for NumPy
- Tutorial 06: BLAS/LAPACK Libraries for NumPy
- Tutorial 07: Install BLAS Libraries for NumPy
- Tutorial 08: Check Installed BLAS Library for NumPy
- Tutorial 09: NumPy Functions That Use BLAS/LAPACK
- Tutorial 10: How to Configure the Number of BLAS Threads
- Tutorial 11: Parallel Matrix Multiplication
- Tutorial 12: Parallel Matrix Math Functions
- Tutorial 13: Parallel Matrix Solvers
- Tutorial 14: Parallel Matrix Decompositions
- Tutorial 15: NumPy Releases the Global Interpreter Lock
- Tutorial 16: Parallel Array Fill
- Tutorial 17: Parallel Element-Wise Array Arithmetic
- Tutorial 18: Parallel Element-Wise Array Math Functions
- Tutorial 19: Parallel Arrays of Random Numbers
- Tutorial 20: Case Study: BLAS vs Python Threading
- Tutorial 21: Case Study: BLAS vs Python Multiprocessing
- Tutorial 22: How to Share a NumPy Array Between Processes
- Tutorial 23: Share NumPy Array Via Global Variable
- Tutorial 24: Share NumPy Array Via Function Argument
- Tutorial 25: Share NumPy Array Via Pipe
- Tutorial 26: Share NumPy Array Via Queue
- Tutorial 27: Share NumPy Array Via ctype
`Array`

- Tutorial 28: Share NumPy Array Via ctype
`RawArray`

- Tutorial 29: Share NumPy Array Via
`SharedMemory`

- Tutorial 30: Share NumPy Array Via Memory-Mapped File
- Tutorial 31: Share NumPy Array Via
`Manager`

- Tutorial 32: Fastest Way To Share NumPy Array
- Tutorial 33: Conclusions

Learn Python concurrency correctly, step-by-step.

**Learn more about this book here:**

### How to Buy

- Click the "
**I want this!**" button (in the upper right) - Choose Credit Card or PayPal and complete the order form then click the "
**Pay**" button. - You will be redirected to a webpage where you can
**download your bundle immediately**(you will also get an email with the download link, just in case you need it).

### About the Author

Jason Brownlee, Ph.D. helps Python developers bring modern concurrency methods to their projects with hands-on tutorials.

Jason loves Python Concurrency. It's all he does. It’s his main thing.

Jason has:

- Read all the books on Python concurrency.
- Used all of the Python concurrency APIs in the standard library.
- Written 500+ tutorials and 12+ books on Python concurrency.

Learn more at SuperFastPython.com

Jason is a software engineer and research scientist with a background in artificial intelligence and high-performance computing. He has authored more than 20 technical books on machine learning and has built, operated, and exited online businesses.

See his linkedin profile here:

- Jason Brownlee on LinkedIn (follow him!)

### Any Questions?

Hi, Jason here, do you have any questions?

Contact me directly at any time about this product or Python concurrency generally. I'm here to help as best I can.

You can send an email directly to my inbox via:

You'll get a .zip download containing both ebook formats (pdf and epub) and all .py code files.