Stanford CS149 I Parallel Computing I 2023 I Lecture 4 - Parallel Programming Basics

15 Sep 2024 (3 days ago)
Stanford CS149 I Parallel Computing I 2023 I Lecture 4 - Parallel Programming Basics

Parallel Programming Concepts

ispc Function Execution

ispc Compiler Optimization

Work Assignment in ispc

High-Level Programming Constructs

Parallelizing Code with Independent Iterations

  • The ispc compiler excels at parallelizing code with independent iterations, such as applying the absolute value to elements of an array. However, it's crucial to ensure the program's logic remains valid when iterations are executed out of order. rel="noopener noreferrer" target="_blank">(00:20:49)
  • Attempting to compute a sum using a per-program-instance variable within a for each loop in ispc leads to incorrect results and compilation errors. This is because each program instance would have its own copy of the sum variable, and returning a value from multiple instances is not supported. rel="noopener noreferrer" target="_blank">(00:23:49)

Race Conditions in Parallel Programming

SIMD Vector Instructions

Performance Comparison of Parallel Execution Methods

ispc Thread Pool

Parallel Programming Principles

Impact of Sequential Code on Large Systems

  • Impact of Sequential Code on Large Systems: On systems with a large number of processors (e.g., supercomputers), it becomes crucial to minimize the sequential portion of code. If the sequential portion is not sufficiently small, the potential benefits of using such a large system diminish significantly. rel="noopener noreferrer" target="_blank">(00:48:17)
  • Work Assignment in Parallel Programming: A key aspect of parallel programming is assigning work to different processing units (cores, processors, etc.). This assignment can be done manually by the programmer or automatically by the programming language, compiler, or runtime system. The goal is to keep all processing units busy and maximize efficiency. rel="noopener noreferrer" target="_blank">(00:48:51)

ispc Task Assignment

Mapping Threads to Hardware

Parallelizing the Red-Black Gauss-Seidel Algorithm

Work Assignment in the Red-Black Algorithm

Parallel Implementation of the Red-Black Algorithm

Synchronization in Parallel Programming

Barriers in Parallel Programming

Contention Reduction in Parallel Programming

Overwhelmed by Endless Content?