Skip to content

ModernCPPBook/Examples

Repository files navigation

Examples Codacy Badge CircleCI

Code exmaples of the book "Parallel C++: Efficient and Scalable High-Performance Parallel Programming".

Outline

Jupyter Notebooks

The folder notebooks contains a Jupyter notebooks for each chapter of the book. In each notebook are all code examples of the Chapter. To run the notebooks a Docker image stevenrbrandt/cxxxex-src is available. To run the Docker image on your local computer, please use the following commands

curl -LO https://raw.githubusercontent.com/ stevenrbrandt/CxxExplorer/master/docker-compose.yml
docker-compose up -d

After the Docker image is started, a tab with the JupyterHub instance will be opened in your browser. For more details, we refer to Chapter 1 of the book. Recall to use the C++ 17 cling kernel to compile C++ code using the C++ Explorer [1].

C++ examples

The examples using the Message Passing Interface (MPI) or OpenMP are not working in the Jupyter Notebooks. In addition, the distrbuted HPX examples are not working within Jupyter Notebooks. Therefore, the code is available as C++ files in the cpp folder.

Benchmarks

The slurm scripts to run the benchmarks are available in the scripts folder.

The code for the benchmarks which are not discussded in detail in the book are available in the benchmark folder.

The benchmarks can be build as

cd benchmark
mkdir build 
cd build 
cmake -DWITH_MPI=ON ..
make 

and the follwoing options are availabe

  • WITH_MPI - Builds the MPI examples (Default OFF): Requires MPI
  • WITH_HPX - Builds the HPX examples (Default OFF): Requires HPX compiled with networking
  • WITH_HPX_SIMD - Builds the HPX example with SIMD (Default OFF): Requires HPX compiled with SIMD
  • WITH_HPX_COROUTINES - Builds the HPX examples with COROUTINES (Default OFF): Requires HPX compiled with C++ 20

References

  1. Diehl, Patrick, and Steven R. Brandt. "Interactive C++ code development using C++ Explorer and GitHub Classroom for educational purposes." Concurrency and Computation: Practice and Experience 35.18 (2023): e6893. 10.1002/cpe.6893