Python Parallel Programming Cookbook
eBook - ePub

Python Parallel Programming Cookbook

Giancarlo Zaccone

Partager le livre
  1. 286 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Python Parallel Programming Cookbook

Giancarlo Zaccone

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

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.

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Python Parallel Programming Cookbook est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Python Parallel Programming Cookbook par Giancarlo Zaccone en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Informatica et Programmazione in Python. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2015
ISBN
9781785289583
Édition
1

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 des matiĂšres