![]()
Python Parallel Programming Cookbook
Table of Contents
Python Parallel Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with Parallel Computing and Python
Introduction
The parallel computing memory architecture
SISD
MISD
SIMD
MIMD
Memory organization
Shared memory
Distributed memory
Massively parallel processing
A cluster of workstations
The heterogeneous architecture
Parallel programming models
The shared memory model
The multithread model
The message passing model
The data parallel model
How to design a parallel program
Task decomposition
Task assignment
Agglomeration
Mapping
Dynamic mapping
Manager/worker
Hierarchical manager/worker
Decentralize
How to evaluate the performance of a parallel program
Speedup
Efficiency
Scaling
Amdahl's law
Gustafson's law
Introducing Python
Getting ready
How to do itā¦
Python in a parallel world
Introducing processes and threads
Start working with processes in Python
Getting ready
How to do itā¦
How it worksā¦
Start working with threads in Python
How to do itā¦
How it worksā¦
2. Thread-based Parallelism
Introduction
Using the Python threading module
How to define a thread
How to do itā¦
How it worksā¦
How to determine the current thread
How to do itā¦
How it worksā¦
How to use a thread in a subclass
How to do itā¦
How it worksā¦
Thread synchronization with Lock and RLock
How to do itā¦
How it worksā¦
There's moreā¦
Thread synchronization with RLock
How to do itā¦
How it worksā¦
Thread synchronization with semaphores
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
Thread synchronization with a condition
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
Thread synchronization with an event
How to do itā¦
How it worksā¦
Using the with statement
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
Thread communication using a queue
How to do itā¦
How it worksā¦
Evaluating the performance of multithread applications
How to do itā¦
How it worksā¦
The first test
The second test
The third test
The fourth test
There's moreā¦
3. Process-based Parallelism
Introduction
How to spawn a process
How to do it...
How it works...
There's more...
How to name a process
How to do it...
How it works...
How to run a process in the background
How to do it...
How it works...
There's more...
How to kill a process
How to do it...
How it works...
How to use a process in a subclass
How to do it...
How it works...
How to exchange objects between processes
Using queue to exchange objects
How to do it...
How it works...
There's more...
Using pipes to exchange objects
How to do it...
How it works...
How to synchronize processes
How to do it...
How it works...
How to manage a state between processes
How to do it...
How it works...
How to use a process pool
How to do itā¦
How it worksā¦
Using the mpi4py Python module
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
Point-to-point communication
How to do itā¦
How it worksā¦
There's moreā¦
Avoiding deadlock problems
How to do itā¦
How it worksā¦
There's moreā¦
Collective communication using broadcast
How to do itā¦
How it worksā¦
There's moreā¦
Collective communication using scatter
How to do itā¦
How it worksā¦
There's moreā¦
Collective communication using gather
How to do itā¦
How it worksā¦
There's moreā¦
Collective communication using Alltoall
How to do itā¦
How it worksā¦
There's moreā¦
The reduction operation
How to do itā¦
How it worksā¦
How to optimize communication
How to do itā¦
How it worksā¦
There's moreā¦
4. Asynchronous Programming
Introduction
Using the concurrent.futures Python modules
Dealing with the process and thread pool
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
Event loop management with Asyncio
What is an event loop
Getting ready
How to do itā¦
How it worksā¦
Handling coroutines with Asyncio
Getting ready
How to do itā¦
How it worksā¦
Task manipulation with Asyncio
Getting ready
How to do itā¦
How it worksā¦
Dealing with Asyncio and Futures
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
5. Distributed Python
Introduction
Using Celery to distribute tasks
How to do itā¦
See also
How to create a task with Celery
How to do itā¦
How it worksā¦
There's moreā¦
Scientific computing with SCOOP
Getting ready
How to do itā¦
How it worksā¦
Handling map functions with SCOOP
Getting ready
How to do itā¦
How it worksā¦
Remote Method Invocation with Pyro4
Getting ready
How to do itā¦
How it worksā¦
Chaining objects with Pyro4
How to do itā¦
How it worksā¦
Developing a client-server application with Pyro4
How to do itā¦
How it worksā¦
Communicating sequential processes with PyCSP
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
Using MapReduce with Disco
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
A remote procedure call with RPyC
Getting ready
How to do itā¦
How it worksā¦
6. GPU Programming with Python
Introduction
Using the PyCUDA module
A hybrid programming model
The kernel and thread hierarchy
Getting ready
How to do itā¦
How it worksā¦
See also
How to build a PyCUDA application
How to do itā¦
How it worksā¦
There's moreā¦
Understanding the PyCUDA memory model with matrix manipulat...