Python Parallel Programming Cookbook
eBook - ePub

Python Parallel Programming Cookbook

Giancarlo Zaccone

Share book
  1. 286 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Python Parallel Programming Cookbook

Giancarlo Zaccone

Book details
Book preview
Table of contents
Citations

About This Book

Master efficient parallel programming to build powerful applications using Python

About This Book

  • Design and implement efficient parallel software
  • Master new programming techniques to address and solve complex programming problems
  • Explore the world of parallel programming with this book, which is a go-to resource for different kinds of parallel computing tasks in Python, using examples and topics covered in great depth

Who This Book Is For

Python Parallel Programming Cookbook is intended for software developers who are well versed with Python and want to use parallel programming techniques to write powerful and efficient code. This book will help you master the basics and the advanced of parallel computing.

What You Will Learn

  • Synchronize multiple threads and processes to manage parallel tasks
  • Implement message passing communication between processes to build parallel applications
  • Program your own GPU cards to address complex problems
  • Manage computing entities to execute distributed computational tasks
  • Write efficient programs by adopting the event-driven programming model
  • Explore the cloud technology with DJango and Google App Engine
  • Apply parallel programming techniques that can lead to performance improvements

In Detail

This book will teach you parallel programming techniques using examples in Python and will help you explore the many ways in which you can write code that allows more than one process to happen at once. Starting with introducing you to the world of parallel computing, it moves on to cover the fundamentals in Python. This is followed by exploring the thread-based parallelism model using the Python threading module by synchronizing threads and using locks, mutex, semaphores queues, GIL, and the thread pool.

Next you will be taught about process-based parallelism where you will synchronize processes using message passing along with learning about the performance of MPI Python Modules. You will then go on to learn the asynchronous parallel programming model using the Python asyncio module along with handling exceptions. Moving on, you will discover distributed computing with Python, and learn how to install a broker, use Celery Python Module, and create a worker.

You will understand anche Pycsp, the Scoop framework, and disk modules in Python. Further on, you will learnGPU programming withPython using the PyCUDA module along with evaluating performance limitations.

Style and approach

A step-by-step guide to parallel programming using Python, with recipes accompanied by one or more programming examples. It is a practically oriented book and has all the necessary underlying parallel computing concepts.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on ā€œCancel Subscriptionā€ - itā€™s as simple as that. After you cancel, your membership will stay active for the remainder of the time youā€™ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlegoā€™s features. The only differences are the price and subscription period: With the annual plan youā€™ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weā€™ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Python Parallel Programming Cookbook an online PDF/ePUB?
Yes, you can access Python Parallel Programming Cookbook by Giancarlo Zaccone in PDF and/or ePUB format, as well as other popular books in Informatica & Programmazione in Python. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781785289583

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...

Table of contents