Title Page Copyright and Credits Python Parallel Programming Cookbook Second Edition Dedication About Packt Why subscribe? Contributors About the author About the reviewer Packt is searching for authors like you Preface Who this book is for What this book covers To get the most out of this book Download the example code files Download the color images Conventions used Sections Getting ready How to do it… How it works… There's more… See also Get in touch Reviews Getting Started with Parallel Computing and Python Why do we need parallel computing? Flynn's taxonomy Single Instruction Single Data (SISD) Multiple Instruction Single Data (MISD) Single Instruction Multiple Data (SIMD) Multiple Instruction Multiple Data (MIMD) Memory organization Shared memory Distributed memory Massively Parallel Processing (MPP) Clusters of workstations Heterogeneous architectures Parallel programming models Shared memory model Multithread model Message passing model Data-parallel model Designing a parallel program Task decomposition Task assignment Agglomeration Mapping Dynamic mapping Evaluating the performance of a parallel program Speedup Efficiency Scaling Amdahl's law Gustafson's law Introducing Python Help functions Syntax Comments Assignments Data types Strings Flow control Functions Classes Exceptions Importing libraries Managing files List comprehensions Running Python scripts Installing Python packages using pip Installing pip Updating pip Using pip Introducing Python parallel programming Processes and threads Thread-Based Parallelism What is a thread? Python threading module Defining a thread Getting ready How to do it... How it works... There's more... Determining the current thread Getting ready How to do it... How it works... Defining a thread subclass Getting ready How to do it... How it works... There's more... Thread synchronization with a lock Getting ready How to do it... How it works... There's more... Thread synchronization with RLock Getting ready How to do it... How it works... There's more... 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 Getting ready How to do it... How it works... Thread synchronization with a barrier Getting ready How to do it... How it works... Thread communication using a queue Getting ready How to do it... How it works... There's more... Process-Based Parallelism Understanding Python's multiprocessing module  Spawning a process  Getting ready How to do it... How it works... There's more... See also Naming a process Getting ready How to do it... How it works... There's more... See also Running processes in the background Getting ready How to do it... How it works... See also Killing a process Getting ready How to do it... How it works... See also Defining processes in a subclass Getting ready How to do it... How it works... There's more... See also Using a queue to exchange data Getting ready How to do it... How it works... There's more... See also Using pipes to exchange objects Getting ready How to do it... How it works... There's more...  See also Synchronizing processes Getting ready How to do it... How it works... There's more... See also Using a process pool Getting ready How to do it… How it works… There's more... See also Message Passing Technical requirements Understanding the MPI structure Using the mpi4py Python module How to do it... How it works... There's more... See also Implementing point-to-point communication How to do it... How it works... There's more... See also Avoiding deadlock problems How to do it... How it works... There's more... See also Collective communication using a broadcast Getting ready How to do it... How it works... There's more... See also Collective communication using the scatter function How to do it... How it works... There's more... See also Collective communication using the gather function Getting ready How to do it... How it works... There's more... See also Collective communication using Alltoall How to do it... How it works... There's more... See also The reduction operation Getting ready How to do it... How it works... There's more... See also Optimizing communication How to do it... How it works... There's more... See also Asynchronous Programming Using the concurrent.futures Python module Getting ready How to do it... How it works... There's more... See also Managing the event loop with asyncio Understanding event loops How to do it... How it works... There's more... See also Handling coroutines with asyncio Getting ready How to do it... How it works... There's more... See also Manipulating tasks with asyncio How to do it... How it works... There's more... See also Dealing with asyncio and futures Getting ready How to do it... How it works... There's more... See also Distributed Python Introducing distributed computing Types of distributed applications Client-server applications Client-server architecture Client-server communications TCP/IP client-server architecture Multi-level applications Using the Python socket module Getting ready How to do it... How it works... There's more... Types of sockets Stream sockets See also Distributed task management with Celery Getting ready Windows setup How to do it... How it works... There's more... See also RMI with Pyro4 Getting ready How to do it... How it works... There's more... Implementing chain topology See also Cloud Computing What is cloud computing? Understanding the cloud computing architecture Service models SaaS PaaS IaaS Distribution models Public cloud Private cloud Cloud community Hybrid cloud Cloud computing platforms Developing web applications with PythonAnywhere Getting ready How to do it... How it works... There's more... See also Dockerizing a Python application Getting ready Installing Docker for Windows How to do it... How it works... There's more... See also Introducing serverless computing Getting ready How to do it... How it works... There's more... What is a Lambda function? Why serverless? Possible problems and limitations See also Heterogeneous Computing Understanding heterogeneous computing Understanding the GPU architecture Understanding GPU programming CUDA OpenCL Dealing with PyCUDA Getting ready How to do it... How it works... There's more... See also Heterogeneous programming with PyCUDA How to do it... How it works... There's more... See also Implementing memory management with PyCUDA Getting ready How to do it... How it works... There's more... See also Introducing PyOpenCL Getting ready How to do it... How it works... There's more... See also Building applications with PyOpenCL How to do it... How it works... There's more... See also Element-wise expressions with PyOpenCL Getting started How to do it... How it works... There's more... See also Evaluating PyOpenCL applications Getting started How to do it... How it works... There's more... Pros of OpenCL and PyOpenCL Cons of OpenCL and PyOpenCL Pros of CUDA and PyCUDA Cons of CUDA and PyCUDA See also GPU programming with Numba Getting ready How to do it... How it works... There's more... See also Python Debugging and Testing What is debugging? What is software testing? Debugging using Winpdb Reborn Getting ready How to do it... How it works... There's more... See also Interacting with pdb Getting ready Interacting with the command line Using the Python interpreter Inserting a directive in the code to debug How to do it... How it works... There's more... See also Implementing rpdb for debugging Getting ready How to do it... How it works... There's more... See also Dealing with unittest Getting ready How to do it... How it works... There's more... See also Application testing using nose Getting ready How to do it... How it works... There's more... See also Other Books You May Enjoy Leave a review - let other readers know what you think