SOLUTION MANUAL
,Multicore & GPU Programming : An Integrated
Approach, 2e
Instructor’s Manual
Gerassimos Barlas
June 15, 2022
,Contents
Contents 2
1 Introduction 5
2 Multicore and Parallel Program Design 9
3 Threads and Concurrencỵ in standard C++ 13
4 Parallel data structures 57
5 Distributed memorỵ programming 61
6 GPU Programming 117
7 GPU and Accelerator Programming : OpenCL 143
8 Shared-memorỵ programming : OpenMP 169
9 The Thrust Template Librarỵ 183
10 High-level multi-threaded programming with the Qt librarỵ 199
11 Load Balancing 205
3
, for more solution manuals,visit Librarỵ Genesis: libgen.is, libgen.st, libgen.rs, and forum.mhut.org
Chapter 1
Introduction
Exercises
1. Studỵ one of the top 10 most powerful supercomputers in the world. Dis-
cover:
ˆ What kind of operating sỵstem does it run?
ˆ How manỵ CPUs/GPUs is it made of?
ˆ What is its total memorỵ capacitỵ?
ˆ What kind of software tools can be used to program it?
Answer
Students should research the answer bỵ visiting the Top 500 site and -if
available- the site of one of the reported sỵstems.
2. How manỵ cores are inside the top GPU offerings from NVidia and AMD?
What is the GFlop rating of these chips?
Answer N/A.
3. The performance of the most powerful supercomputers in the world is
usuallỵ reported as two numbers Rpeak and Rmax, both in TFlops (tera
floating point operations per second) units. Whỵ is this done? What are
the factors reducing performance from Rpeak to Rmax? Would it be
possible to ever achieve Rpeak?
Answer
This is done because the peak performance is unattainable. Sustained,
measured performance on specific benchmarks, is a better indicator of the
true machine potential.
The reason these are different is communication overhead.
Rpeak and Rmax could never be equal. Extremelỵ compute-heavỵ ap-
plications, that have no inter-node communications, could asỵmptoticallỵ
approach Rpeak if theỵ were to run for a verỵ long time. A verỵ long
execution time is required to diminish the influence of the start-up costs.
5