8
1 csinparallel.org An Introduction to Parallel Computing on the Raspberry Pi Suzanne J. Matthews, West Point Richard A. Brown, St. Olaf Joel C. Adams, Calvin College Elizabeth Shoop, Macalester College

An Introduction to Parallel Computing on the Raspberry Pi...An Introduction to Parallel Computing on the Raspberry Pi Suzanne J. Matthews, West Point Richard A. Brown, St. Olaf Joel

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: An Introduction to Parallel Computing on the Raspberry Pi...An Introduction to Parallel Computing on the Raspberry Pi Suzanne J. Matthews, West Point Richard A. Brown, St. Olaf Joel

1

csinparallel.org

An Introduction to Parallel Computing on the Raspberry Pi

Suzanne J. Matthews, West PointRichard A. Brown, St. Olaf

Joel C. Adams, Calvin CollegeElizabeth Shoop, Macalester College

Page 2: An Introduction to Parallel Computing on the Raspberry Pi...An Introduction to Parallel Computing on the Raspberry Pi Suzanne J. Matthews, West Point Richard A. Brown, St. Olaf Joel

2

csinparallel.org

Getting to Know the Pimeroni

Page 3: An Introduction to Parallel Computing on the Raspberry Pi...An Introduction to Parallel Computing on the Raspberry Pi Suzanne J. Matthews, West Point Richard A. Brown, St. Olaf Joel

3

csinparallel.org

A Closer Look at the Raspberry Pi

HDMI

Ethernet

USB

USB

powerpowercam

era

disp

lay

CPU/RAM

EthernetController

Single Board ComputerQuad-Core Multicore CPU1 GB RAM$35.00

Page 4: An Introduction to Parallel Computing on the Raspberry Pi...An Introduction to Parallel Computing on the Raspberry Pi Suzanne J. Matthews, West Point Richard A. Brown, St. Olaf Joel

4

csinparallel.org

What is a Multicore CPU?

Memory

C1

C2

C3

C4

L2 Cache

control

CPU

Interco

nn

ect (B

us)

Page 5: An Introduction to Parallel Computing on the Raspberry Pi...An Introduction to Parallel Computing on the Raspberry Pi Suzanne J. Matthews, West Point Richard A. Brown, St. Olaf Joel

5

csinparallel.org

Advantage of Multicore• A process is the abstraction of a

running program.– Processes do not share memory with

each other.

• A single-core CPU only operates on one process at a time.– Round-Robin Scheduling Algorithm

• More CPU cores = OS can execute more processes at once! (Concurrency)– Increases throughput of system.

– Does this shorten the amount of time it takes to execute a single process?

Memory

Control Unit

ALU

CPU Interco

nn

ect (B

us)

Process 1 Process 3 Process n…

Process 2

Page 6: An Introduction to Parallel Computing on the Raspberry Pi...An Introduction to Parallel Computing on the Raspberry Pi Suzanne J. Matthews, West Point Richard A. Brown, St. Olaf Joel

6

csinparallel.org

Programming Multicore Architectures

Memory

C1

C2

C3

C4

L3 Cache

control

CPU

Process 1 Process 1

Multithreadedprocess

S

HS S

S S

S

H

• Thread: a lightweight process that allows a single executable/process to be decomposed to smaller, independent parts.

− All threads share the common memory of the process they belong to.

• An OS will schedule threads on separate cores/CPUs, as available.

Interco

nn

ect (B

us)

Page 7: An Introduction to Parallel Computing on the Raspberry Pi...An Introduction to Parallel Computing on the Raspberry Pi Suzanne J. Matthews, West Point Richard A. Brown, St. Olaf Joel

7

csinparallel.org

Programming Multicore ArchitecturesC1

C2

C3

C4

L3 Cache

control

CPU

Process 1 Process 1

Multithreadedprocess

S S S S

S

H

S

H

Memory

Interco

nn

ect (B

us)

• Thread: a lightweight process that allows a single executable/process to be decomposed to smaller, independent parts.

− All threads share the common memory of the process they belong to.

• An OS will schedule threads on separate cores/CPUs, as available.

Page 8: An Introduction to Parallel Computing on the Raspberry Pi...An Introduction to Parallel Computing on the Raspberry Pi Suzanne J. Matthews, West Point Richard A. Brown, St. Olaf Joel

8

csinparallel.org

There are many libraries/languages available:• POSIX Threads

• OpenMP

• C++11 threads, TBB, …

In today’s workshop, we will cover OpenMP

• Industry standard since late 1990s.

• Native support with GCC compilers (> 4.3.x)

• Easier to program than POSIX threads.

Programming Multicore Architectures