Software to support people learning OpenMP with our book

This repository supports readers of our book:

 The OpenMP Common Core: making OpenMP Simple Again

We encourage readers to explore the material actively; mixing time spent reading with time spent coding. To that end, we provide lots of code for our readers to explore organized into the following directories.

  Book: Code used in the book.  This includes any
  code that appears in the figures as well as code
  fragments embedded in the the text of the book.
  We provide these in both C and Fortran.

  ChallengeProblems: A set of more complex problems to
  support advanced studies in OpenMP.  In each case
  we include serial code you can start with and a
  directory of solutions.  Currently, these are
  only provided in C.

  Exercises: code and solutions for the running 
  examples used in the book.  We recommend pausing 
  as you read the book and experimenting with these
  exercises ... afterall, we all learn most "by doing"
  We provide these in both C and Fortran.
  
  MakeDefs: Files included by our makefiles to support
  C and Fortran on various platforms.  You should copy
  one that is close to what you need, and modify it
  to reference the compilers you wish to use.  Put
  this copy in the MakeDefs director and call it make.def

Join the Slack workspace "OmpCommonCore-SC21" for the SC21 OpenMP Common Core Tutorial:

https://tinyurl.com/wcbbjjvt  

You can use any system with a working OpenMP compiler for the hands-on exercises in the "Exercises" directory. The templates for "make.def" to be used for different architectuers are available in the "MakeDefs" directrory.

Training accounts on the NERSC Cori system are provided from Nov 14 to Nov 17:

-- Get an account on Cori

  -- Apply for a NERSC Cori training account: https://iris.nersc.gov/train use 4-letter code erkE

-- Obtain the exercises on Cori

% ssh [email protected]
% cd $SCRATCH
% cp -r /global/cfs/cdirs/training/2021/OpenMP_SC21 . (notice the “dot” at the end) 
% cd OpenMP_SC21/Exercises/C (or % cd OpenMP_SC21/Exercises/Fortran)
% make (for all codes)

-- Compile on Cori

The default compiler is Intel. Use compiler wrappers (ftn, cc, and CC) 
and the OpenMP compiler flag to build an individual code, such as:
% cc -qopenmp -O0 mycode.c 
% ftn -qopenmp -O0 mycode.f90

To use another compiler, such as gcc: 
% module swap PrgEnv-intel PrgEnv-gnu 
% cc -fopenmp -O0 mycode.c

Here -O0 is used on purpose to prevent compiler optimizations from 
"fixing" certain OpenMP issues (such as false sharing) that we would 
like to expose.  You can set to a higher optimization level such as 
-O3 to improve performance.

-- Run on Cori

Get on a compute node with an interactive batch session first
With a node reservation during the SC21 tutorial:
– Haswell node: % salloc -N 1 -C haswell -q regular -t 1:00:00 --reservation=omp_hsw -A ntrain3
– KNL node: % salloc -N 1 -C knl -q regular -t 1:00:00 --reservation=omp_knl -A ntrain3

Without a node reservation outside the SC20 tutorial:
- Haswell node: % salloc -N 1 -C haswell -q interactive -t 30:00 
- KNL node: % salloc -N 1 -C knl -q interactive -t 30:00

To run on the allocated compute node:
-- Set number of threads, such as: 
% export OMP_NUM_THREADS=4 
-- Then run: % ./a.out
Owner
Tim Mattson
Tim is a senior principal Engineer at Intel. He works in Intel labs doing research on parallel programming, graph algorithms, and databases.
Tim Mattson
Comments
  • private variable

    private variable

    When reading your book, " The OpenMP Common Core", I have a question about this expression "#pragma omp parallel firstprivate(vptr[0:1000:1])" in the last few paragraphs of chapter 6, is there a syntax, "vptr[0:1000:1]" in c/c++ ?

  • Figure 7.13 line 22

    Figure 7.13 line 22

    Three variables in printf but four %l... I get a warning and wrong run_time That line works like this for me: printf("pi = %lf, %ld steps %lf secs\n ",pi, num_steps, run_time);

  • Created and Initialized NTHREADS

    Created and Initialized NTHREADS

    Fig_5.9_piloop.f90

    on line 15, OMP_SET_NUM_THREADS is passed NTHREADS, not nthreads

    hence, NTHREADS was created/initialized on line 7, and nthreads was removed from line 5

    now the code runs and prints "pi is 3.14159263 in 0.432 secs"

  • Survey Question on the For loop in source file ChallengeProblems/Stencil/solutions/stencil_par.c line 125

    Survey Question on the For loop in source file ChallengeProblems/Stencil/solutions/stencil_par.c line 125

    Hello Sir/ Madam We are from a research group at Iowa State University, USA. We want to do a survey on Github developers on the methods they used for paralleling their code. To do the survey, We want to ask three questions about this for loop:

    1. Can you briefly explain the purpose of using pragma for this case? If the pragma contained reduction and private clauses, can you briefly mention the purposes of variables in those clauses?

    2. How much confidence do you have about the correctness of this implementation? You can choose from 1-5 with 1 as the lowest confidence score and 5 as the highest confidence score.

    3. (Optional) Do you actually run (interpret the code with compilation and pass input/get output) the code and see the optimization of parallelization? Yes/No

    • If yes, can you provide the information of what are the input and expected output of this program (the input that caused the program to run through this for-loop).

    The for loop is from line 125 of file https:/github.com/tgmattso/OmpCommonCore/blob/master/ChallengeProblems/Stencil/solutions/stencil_par.c Here is a part of the code:

    omp parallel for collapse(2) private(i,j) for (j = 8; j < (n - 8); j++) for (i = 8; i < (n - 8); i++) out[i + (j * n)] = 0.0;

    Sincerely thanks

  • Survey Question on the For loop in source file https:/github.com/tgmattso/OmpCommonCore/blob/master/Exercises/C/affinity/stream_nft.c line 288

    Survey Question on the For loop in source file https:/github.com/tgmattso/OmpCommonCore/blob/master/Exercises/C/affinity/stream_nft.c line 288

    Hello Sir/ Madam We are from a research group at Iowa State University, USA. We want to do a survey on Github developers on the methods they used for paralleling their code. To do the survey, We want to ask three questions about this for loop:

    Can you briefly explain the purpose of using pragma for this case? If the pragma contained reduction and private clauses, can you briefly mention the purposes of variables in those clauses?

    How much confidence do you have about the correctness of this implementation? You can choose from 1-5 with 1 as the lowest confidence score and 5 as the highest confidence score.

    (Optional) Do you actually run (interpret the code with compilation and pass input/get output) the code and see the optimization of parallelization? Yes/No

    If yes, can you provide the information of what are the input and expected output of this program (the input that caused the program to run through this for-loop). The for loop is from line 288 of file https:/github.com/tgmattso/OmpCommonCore/blob/master/Exercises/C/affinity/stream_nft.c Here is a part of the code:

    #pragma omp parallel for for (j = 0; j < STREAM_ARRAY_SIZE; j++) a[j] = 2.0E0 * a[j];

The book and code repo for the FREE Fundamental C++ book by Kevin Thomas.
The book and code repo for the FREE Fundamental C++ book by Kevin Thomas.

FREE Reverse Engineering Self-Study Course HERE Fundamental C++ The book and code repo for the FREE Fundamental C++ book by Kevin Thomas. FREE Book Do

Nov 19, 2022
This is new projec based in apps to chat or messages people to people

Stranger This is new projec based in apps to chat or messages people to people Esta aplicacion tendra las siguientes caracteristicas: 1* Es 100% segur

Nov 3, 2021
This is our take on the digitalisation of the board game "b00le0", where you can play versus our AI, or against one of your friends in an online match.
This is our take on the digitalisation of the board game

This is our take on the digitalisation of the board game "b00le0", where you can play versus our AI, or against one of your friends in an online match.

Dec 8, 2022
Bank of challenges & solutions from r/dailyprogrammer for people learning to program

DailyProgrammerChallenges This repo contains all of the challenges from r/dailyprogrammer and also scripts used to pull challenges from the subreddit

Dec 8, 2022
Threat Emulation and Red Teaming Framework, The Hacking Software for normal people.
Threat Emulation and Red Teaming Framework, The Hacking Software for normal people.

The Remote Hacker Probe is a Threat Emulation and Red Teaming Framework built to be easy to use. The Remote Hacker Probe is Feature Rich! Including, K

Jan 5, 2023
Remote hacker probe - Threat Emulation and Red Teaming Framework, The Hacking Software for normal people.
Remote hacker probe - Threat Emulation and Red Teaming Framework, The Hacking Software for normal people.

The Remote Hacker Probe is a Threat Emulation and Red Teaming Framework built to be easy to use. The Remote Hacker Probe is Feature Rich! Including, K

Dec 27, 2022
a undetectable tool by modify odyssey, support sign disable & dylib injection, test on iphoneX(13.5.1 expolit by FreeTheSandbox), our qqgroup is 703156427

a undetectable ios root access tool by modify odyssey, support sign disable & dylib injection, test on iphoneX(13.5.1 expolit by FreeTheSandbox), our

Nov 22, 2021
CQC (Charmed Quark Controller) a commercial grade, full featured, software based automation system. CQC is built on our CIDLib C++ development system, which is also available here on GitHub.

The CQC Automation System What It Is CQC is a commercial quality, software based automation system, suitable for residential or commercial application

Dec 13, 2022
A place to collaborate on code for the Embedded.fm book club. Currently reading "STM32 ARM Programming for Embedded Systems".

Welcome to the Book Club Code site! This is a place for the Embedded.fm book club to collaborate and learn together. Repo Structure Guide Top-level fo

Jul 21, 2022
C++ Premier plus 6th edition book solved exercise.

c-premier-plus-6th-edition-solved-exercise C++ Premier plus 6th edition book exercise solutions. These exercise solved by me when i learning c++, so d

Nov 6, 2022
Source code for the "C Unleashed" book by Richard Heathfield, Lawrence Kirby, et al.

Source code from the book "C Unleashed" "C Unleashed" was written by Richard Heathfield, Lawrence Kirby and several other collaborators and published

Dec 13, 2022
Resolução de exercícios do e-book 300 ideias para programar

Repositório 300 ideias para programar Saudações! Este repositório é dedicado a resolução dos exercícios do e-book 300 IDÉIAS PARA PROGRAMAR COMPUTADOR

Jan 1, 2022
Repository for the book "Crafting Interpreters"

This is the repo used for the in-progress book "Crafting Interpreters". It contains the Markdown text of the book, full implementations of both interp

Dec 29, 2022
A simple wrapper for 'pacman' with a syntax similar to 'apt' to help people transitioning to Arch and Arch based distributions like Manjaro.

aptpac aptpac is a program which helps with the transition to Arch Linux and Arch based distros like Manjaro. It simplifies using pacman as it works l

Dec 4, 2022
Off The Grid (OTG) Messenger is an easy way for people to communicate through text messages when in remote areas.
Off The Grid (OTG) Messenger is an easy way for people to communicate through text messages when in remote areas.

Off The Grid (OTG) Messenger is an easy way for people to communicate through text messages when in remote areas. With a theoretical transmission range of 10 miles (16kms), OTG messenger can be used by groups of people to stay connected when they are in areas not serviced by mobile connectivity.

Dec 10, 2022
The Xnoe Operating System, for people who want an OS that is useless.

Xnoe OS An attempt at writing an "Operating System" in x86 assembler. Hi all, I have many hobbies, one of those is torturing myself with knowledge I p

Oct 7, 2022
To turn on and off the pump, most people use a manual switch.
To turn on and off the pump, most people use a manual switch.

To turn on and off the pump, most people use a manual switch. As a result, people forget to switch off the pump from time to time, resulting in water overflow. They may forget to switch on the motor at times, resulting in a water problem later on. It also wastes a lot of electricity. To solve this problem, we need a smart device to control the pump.

Aug 20, 2022
ClickLock which supports old games where the Windows ClickLock fails to work. This is a charity project, designed for people with disabilities.

Mouse ClickLock For Games This small utility works in a similar way as ClickLock available on Windows, but also supports old games where the normal Cl

Oct 8, 2022
🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.

?? ImHex A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM. Supporting If you like my work, plea

Dec 30, 2022