Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Master Parallel & Concurrent Programming Using Python:2 in 1
Rating: 3.3 out of 5(66 ratings)
569 students

Master Parallel & Concurrent Programming Using Python:2 in 1

Dive head-first into the world of concurrency in Python & build modern software
Last updated 9/2018
English

What you'll learn

  • Implement message passing communication between processes to build parallel applications
  • Manage computing entities to execute distributed computational tasks
  • Master the similarities between thread and process management
  • Process synchronization and interprocess communication

Course content

2 sections89 lectures6h 19m total length
  • The Parallel Computing Memory Architecture6:12

    In this video, we will take a look at Flynn's taxonomy.

    • Learn about SISD, MISD, SIMD, and MIMD

  • Memory Organization6:58

    Another aspect that we need to consider to evaluate a parallel architecture is memory organization. In this video you will understand this concept.

    • Understand shared memory systems

  • Memory Organization (Continued)5:30

    This video is the continuation of the previous video where we will take a closer look at distributed memory systems.

    • Understand distributed memory systems

  • Parallel Programming Models4:13

    In this video, you will get an overview of parallel programming models.

    • Understand the shared memory model and the multithread model

    • Understand the distributed memory or message passing model

    • Understand the data parallel model

  • Designing a Parallel Program6:18

    The design of algorithms that exploit parallelism is based on a series of operations. This video shows us how to design such parallel programs.

    • Learn task decomposition and assignment

    • Understand agglomeration and mapping

  • Evaluating the Performance of a Parallel Program5:19

    The development of parallel programming created the need of performance metrics. This video will help us evaluate the performance of a parallel program.

    • Analyze the performance with the help of performance indexes

  • Introducing Python6:19

    Python is a powerful, dynamic, and interpreted programming language that is used in a wide variety of applications. In this video, we will get introduced to Python and its features.

    • Download Python

    • Explore Python features

    • Understand Python's functionalities in parallel world

  • Working with Processes in Python2:25

    In this video, we simply demonstrate how to start a single new program from inside a Python program.

    • Start a process

    • Manage a parallel execution of more processes

  • Working with Threads in Python3:35

    This video simply shows you how to create a single thread inside a Python program.

    • Create a thread with the help of a program

  • Defining a Thread3:19

    The simplest way to use a thread is to instantiate it with a target function. This video shows us how to do that.

    • Define a thread with the threading module

    • Instantiate a thread

    • Pass an argument to the function

  • Determining the Current Thread1:04

    This video helps us in determining the thread which we created earlier.

    • Instantiate a thread with a target function

  • Using a Thread in a Subclass1:57

    This video will help us to implement a new thread using the threading module.

    • Define a new subclass of the Thread class

    • Override methods

    • Create a new subclass

  • Thread Synchronization with Lock5:22

    In this video, we describe the Python threading synchronization mechanism called lock().

    • Manage a thread through the mechanism of lock()

  • Thread Synchronization with RLock1:45

    If we want only the thread that acquires a lock to release it, we must use an RLock() object. This video will get you introduced to RLock.

    • Introduce a class with the add and remove methods

    • Carry out the RLock() call within the class

  • Thread Synchronization with Semaphores4:50

    A semaphore is an abstract data type managed by the operating system. In this video we will carry out the thread synchronization with semaphores.

    • Use the consumer-producer model

    • Initialize a semaphore to 0

  • Thread Synchronization with a Condition2:24

    A condition identifies a change of state in the application. In this video, we will carry out the thread synchronization with a condition.

    • Illustrate the condition mechanism

  • Thread Synchronization with an Event1:49

    Events are objects that are used for communication between threads. In this video, we will carry out thread synchronization with an event.

    • Understand the thread synchronization through the event object

  • Using the "with" Statement2:01

    The "with" statement is useful when you have two related operations that must be executed as a pair with a block of code in-between. This video will show us how to use the "with" statement.

    • Define a list of thread communication directives

    • Test the list

  • Thread Communication Using a Queue3:06

    Queues are much easier to deal with and make threaded programming considerably safe. In this video, we will take a look at thread communication using queue.

    • Use the threading module with the queue module

  • Evaluating the Performance of Multithread Applications4:36

    In this video, we will verify the impact of the GIL, evaluating the performance of a multithread application.

    • Perform four tests using different functions

  • Spawning a Process2:47

    Spawn means the creation of a process by a parent process. This video will show us how to spawn a process

    • Create a series (five) of processes

    • Run the process

  • Naming a Process1:13

    The procedure to name a process is similar to that described for the threading library. Let's check this out in this video

    • We create a process with and without a name

    • Run the process

  • Running a Process in the Background1:16

    Running a process in the background is a typical mode of execution of laborious processes. This video will show you how to do that.

    • Set the daemon parameter

    • Execute the process in the background

  • Killing a Process1:27

    It's possible to kill a process immediately using the terminate() method. Let's see how to do that in this video.

    • Create a process with a target function

    • Kill the process with the terminate function

  • Using a Process in a Subclass1:21

    In this video, we will see how to implement a custom subclass and process.

    • Define a new subclass of the Process class

    • Override a method to add additional arguments

    • Override a method to implement what Process should when it is started

  • Exchanging Objects between Processes2:57

    The development of parallel applications has the need for the exchange of data between processes. We will see how to do that in this video.

    • Use queue to exchange objects

    • Use pipes to exchange objects

  • Synchronizing Processes2:42

    Synchronization primitives are quite similar to those encountered for the library and threading. In this video, we will see how to synchronize the process.

    • Use barrier method to synchronize two processes

  • Managing a State between Processes1:26

    Python multiprocessing provides a manager to coordinate shared information between all its users. In this video, we will see how to manage a state between processes.

    • Declare the manager

    • Create a data structure

    • Launch the multiprocess

  • Using a Process Pool2:21

    The multiprocessing library provides the Pool class for simple parallel processing tasks. In this video, we will see how to use it.

    • Implement a process pool to perform a parallel application

    • Create a pool of four processes

    • Use the pool's map method toperform a simple calculation

  • Using the mpi4py Python Module4:11

    The Python programming language provides a number of MPI modules to write parallel programs. In this video, we will see how to use the mpi4py library

    • Examine the classic Hello world program using mpi4py

  • Point-to-Point Communication2:59

    One of the most important features among those provided by MPI is the point-to-point communication. We will check that out in this video.

    • Utilize the directives to exchange messages between different processes

  • Avoiding Deadlock Problems3:06

    A common problem we face is that of the deadlock in processes. This video will help us to avoid such problems.

    • Introduce a typical deadlock problem

    • Swap the sending and receiving functions

  • Using Broadcast for Collective Communication3:10

    In a collective communication broadcast process, a single process sends the same data to any other process.

    • Use the broadcast function

  • Using Scatter for Collective Communication2:08

    The scatter functionality sends the chunks of data in an array to different processes. This video will show us how to use scatter for collective communication.

    • Distribute data to different processes using scatter

  • Using Gather for Collective Communication1:39

    With the gather function, all processes send data to a root process that collects the data received. Let's look at using gather for collective communication.

    • Build the process data and send it to root processes

    • Collect the data in an array

  • Using Alltoall for Collective Communication3:05

    The Alltoall collective communication combines the scatter and gathers functionalities. In this video, we will see how to use Alltoall for collective communication.

    • Implement the Alltoall function

    • Run the code with a communicator group of file processes

  • The Reduction Operation2:53

    Reduction takes an array of input elements in each process and returns an array of output elements to the root process. We will take a look at this operation in this video.

    • Implement a sum of an array of elements using the reduction operation

  • Optimizing the Communication3:28

    MPI allows us to assign a virtual topology to a communicator. In this video, we will see how to optimize the communication using such mechanism

    • Implement a Cartesian topology

    • Define a set of coordinates

  • Using the concurrent.futures Python Modules5:21

    With the release of Python 3.2, the concurrent.future module was introduced. In this video, we will see how to use this module.

    • Build a list of numbers for each element in the list

    • Execute the task in a sequential mode

    • Use the concurrent.futures module for a thread pool

  • Event Loop Management with Asyncio4:20

    In this video, the focus is on handling events with the help of Asyncio.

    • Define asynchronous tasks

    • Run the code

  • Handling Coroutines with Asyncio4:06

    In this video, we will see how to use the co-routine mechanism of Asyncio to simulate a finite state machine of five states.

    • Define each state of the automata

    • Determine to which state the finite state machine will be passed

  • Manipulating a Task with Asyncio2:22

    The Asyncio module provides us with the asyncio. Task(coroutine) method to handle computations with tasks. In this video, we will see how to manipulate a task with Asyncio.

    • Execute three mathematical functions

  • Dealing with Asyncio and Futures3:04

    Another key component of the Asyncio module is the Future class. This video will teach you how to deal with Asyncio and futures.

    • Use the Futures class for the management of two coroutines

  • Using Celery to Distribute Tasks3:27

    Celery is a Python framework used to manage a distributed tasks, following the object-oriented middleware approach. In this video, we will see how to use Celery to distribute tasks.

    • Install celery, message broker, RabbitMQ, and Flower

    • Use Celery to distribute tasks

  • Creating a Task with Celery3:08

    In this video, we'll learn to create and call a task using the Celery module.

    • Create a Celery application instance

    • Introduce the task

  • Scientific Computing with SCOOP4:54

    SCOOP is a Python module to distribute concurrent tasks (called Futures) on heterogeneous computational nodes. In this video we will take a look at scientific computing with Scoop.

    • Install Scoop

    • Use the Monte Carlo method

  • Handling Map Functions with SCOOP4:03

    The SCOOP Python modules define more than one map function; and they allow asynchronous computation that could be propagated to its workers. In this video, we will see how to handle Map functions with SCOOP.

    • Compare the MapReduce version of SCOOP with its serial implementation

  • Remote Method Invocation with Pyro45:27

    Python Remote Objects (Pyro4) is a library that resembles Java's Remote Method Invocation (RMI), which allows you to invoke a method of a remote object. In this video we will see how to do that.

    • Build and use a simple client-server communication using the Pyro4

  • Chaining Objects with Pyro44:01

    Implement a chain of objects with Pyro4 using Python scripts.

    • Run the Pyro4 name server

  • Developing a Client-Server Application with Pyro44:18

    In this video, we will see how to build a simple client-server application with Pyro4.

    • Create three Python scripts

    • Enable the Pyro4 name sever and execute the code

    • Start the customer simulation

     

  • Communicating Sequential Processes with PyCSP7:02

    PyCSP is a Python module based on communicating sequential processes, which is a programming paradigm developed to build concurrent programs via message passing. We will take a look at that in this video.

    • Define processes

    • Define the communication between these processes

  • A Remote Procedure Call with RPyC3:39

    Remote Python Call (RPyC) is a Python module that is used for remote procedure calls as well as for distributed computing. In this video, we will see how to carry out a remote procedure call with RPyC.

    • Run a client that connects to the server

    • Execute the print statement on the server

  • Using the PyCUDA Module7:32

    PyCUDA is a Python wrap for Compute Unified Device Architecture (CUDA), the softwarelibrary developed by NVIDIA for GPU programming. In this video, we will see how to use PyCUDA.

    • Understand how a hybrid programming model works

    • Understand the kernel and thread hierarchy

    • Build a PyCUDA library for Python

  • Building a PyCUDA Application7:32

    The PyCUDA programming model is designed for the common execution of a program on a CPU and GPU. This video will show us how to build a PyCUDA application.

    • Create an array on CPU and transfer it to GPU

    • Building a PyCUDA application

    • Transfer the array from the GPU to the CPU

    • Print the results

  • Understanding the PyCUDA Memory Model with Matrix Manipulation5:36

    In the CUDA-capable GPU card, there are four types of memories. In this video, we will take a look at those with the help of matrix manipulation.

    • Prepare the input matrix and the output matrix

    • Transfer matrixes in the GPU device with the PyCUDA function

    • Verify whether the computation is correct

  • Kernel Invocations with GPU Array2:23

    In this video, we will see the common use case of GPU computations in order to invoke a kernel function.

    • Import all the modules required

    • Perform the computation in the GPU

  • Evaluating Element-Wise Expressions with PyCUDA3:20

    The PyCuda.elementwise.ElementwiseKernel function allows us to execute the kernel on complex expressions. We will see how to do that in this video.

    • Evaluate the linear combination of the vectors to use ElementwiseKernel call

  • The MapReduce Operation with PyCUDA3:42

    PyCUDA provides a functionality to perform reduction operations on the GPU. We will take a look at that in this video.

    • Define the inputs

    • Define the MapReduce operation and invoke the kernel function

    • Print the input vectors and the resulting dot product

  • GPU Programming with NumbaPro4:47

    NumbaPro is a Python compiler that provides a CUDA-based API to write CUDA programs. In this video we will demonstrate GPU programming with NumbaPro.

    • Give demonstration of the NumbaPro compiler using the annotation @guvectorize

  • Using GPU-Accelerated Libraries with NumbaPro5:26

    NumbaPro provides a Python wrap for CUDA libraries for numerical computing. We will understand it with the help of this video.

    • Import libraries and Define the matrix dimension along with input matrices

    • Compare the calculation done with NumPy and cuBLAS

  • Using the PyOpenCL Module4:03

    In this video, we'll examine the Python implementation of OpenCL called PyOpenCL.

    • Enumerate all major hardware features using the OpenCL library

  • Building a PyOpenCL Application4:58

    As for programming with PyCUDA, the first step to build a program for PyOpenCL is the encoding of the host application. This video will show us how to build the application.

    • Execute the parallel sum of two vectors

  • Evaluating Element-Wise Expressions with PyOpenCl3:10

    PyOpenCL provides the functionality in the pyopencl.elementwise class that allows us to evaluate the complicated expressions in a single computational pass. We will see how to do that in this video.

    • Add two integer vectors of 100 elements using ElementwiseKernel class

  • Testing Your GPU Application with PyOpenCL4:13

    In this video, we will test the GPU application by implementing the regular definition schema of an application for PyOpenCL.

    • Evaluate the kernel call and GPU time

    • Call the testing function and print_device_info method

  • Python Parallel Programming Solutions

Requirements

  • Basic Prior knowledge of Python Programming is assumed.

Description

Are you looking forward to get well versed with Parallel & Concurrent Programming Using Python? Then this is the perfect course for you!

The terms concurrency and parallelism are often used in relation to multithreaded programs. Parallel programming is not a walk in the park and sometimes confuses even some of the most experienced developers.

This comprehensive 2-in-1 course will take you smoothly through this difficult journey of current programming in Python, including common thread programming techniques and approaches to parallel processing. Similarly with parallel programming techniques you explore the ways in which you can write code that allows more than one process to happen at once.

After taking this course you will have gained an in-depth knowledge of using threads and processes with the help of real-world examples along with hands-on in GPU programming with Python using the PyCUDA module and will evaluate performance limitations.

Contents and Overview

This training program includes 2 complete courses, carefully chosen to give you the most comprehensive training possible.

The first course, Python Parallel Programming Solutions will teach you parallel programming techniques using examples in Python and 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, we move 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 and will learn about the performance of MPI Python Modules.

Moving on, you’ll get to grips with the asynchronous parallel programming model using the Python asyncio module, and will see how to handle exceptions. You will discover distributed computing with Python, and learn how to install a broker, use Celery Python Module, and create a worker.

The second course, Concurrent Programming in Python will skill-up with techniques related to various aspects of concurrent programming in Python, including common thread programming techniques and approaches to parallel processing.

Filled with examples, this course will show you all you need to know to start using concurrency in Python. You will learn about the principal approaches to concurrency that Python has to offer, including libraries and tools needed to exploit the performance of your processor. Learn the basic theory and history of parallelism and choose the best approach when it comes to parallel processing.

About the Authors:

  • Giancarlo Zaccone, a physicist, has been involved in scientific computing projects among firms and research institutions. He currently works in an IT company that designs software systems with high technological content.

  •  BignumWorks Software LLP is an India-based software consultancy that provides consultancy services in the area of software development and technical training. Our domain expertise includes web, mobile, cloud app development, data science projects, in-house software training services, and up-skilling services

Who this course is for:

  • This course is for software developers who are well versed with Python and want to use parallel programming techniques to write powerful and efficient code & it also aims at Python developers who want to learn how to write concurrent applications to speed up the execution of their programs, and to provide interactivity for users, will greatly benefit from this course.