Jussi Enkovaara
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Hybrid CPU programming with OpenMP and MPI This note contains the up-to-date information during the course ## Important links - [Zoom](https://cscfi.zoom.us/j/61000457419) - [RocketChat](https://chat.csc.fi/invite/HarWui) - [Course github](https://github.com/csc-training/hybrid-openmp-mpi) - [Course home page](https://events.prace-ri.eu/event/1225/) - [Lecture slides](https://kannu.csc.fi/s/2jSLcFELwHB45JY) ## General instructions - During the lectures, you can ask questions via microphone or Zoom chat - During the hands-on sessions, ask questions in the RocketChat (please use Multiline formatting for error messages and code snippets). - Complex questions with screen sharing etc. can be discussed in a private break-out room in Zoom. ## Exercises for current session - Simple tasking - Parallelizing Mandelbrot with tasks - Parallel Fibonacci - Tasks and loops ## Agenda | Monday | | | -------- | -------- | |09:00 - 09:45 | Introduction to hybrid programming| |09:45 - 10:00 | Break |10:00 - 10:45 | Getting started with OpenMP |10:45 - 11:30 | Exercises |11:30 - 12:10 | Library functions and data sharing |12:10 - 13:00 | Lunch break| |13:00 - 13:45 | Exercises| |13:45 - 14:30 | Reductions and execution controls| |14:30 - 14:45 | break| |14:45 - 15:45 | Exercises| |15:45 - 16:00 | Wrap-up and exercise walk-through| | Tuesday | | | -------- | -------- | |09:00 - 09:50 | Using OpenMP with MPI| |10:05 - 10:30 | Thread and process affinity| |10:30 - 11:15 | Exercises| |11:15 - 12:00 | OpenMP tasks| |12:00 - 13:00 | Lunch break| |13:00 - 13:45 | Exercises| |13:45 - 14:30 | Task dependencies| |14:30 - 14:45 | break| |14:45 - 15:45 | Exercises |15:45 - 16:00 | Wrap-up and exercise walk-through| ## 1st Day Morning quiz 1. My choice of programming language A. Fortran B. plain C C. C++ A.xxx B.xxxxxxxxx C.xxxxxxxxxxxxxxxx 2. My motivation for learning OpenMP A. I want to quickly parallelize serial application B. I am developing a plain MPI application and want to improve scalability C. I am using a MPI+OpenMP application and want to understand it better D. General interest in parallel programming A.xxxx B.xxxxx C.xxxxxxxxxxx D.xxxxxxxxxxxxxxxx 3. Please describe briefly the application you are working with - Particle-in-Cell simulations in plasma physics - Earth System Model (climate) +1 - Solver for perturbation theory in Quantum mechanics/Solid state physics - Phase-space density simulation - Nbody and hydrodynamic astrophyiscs code - Structure optimization for atomic systems and dividing ML works - Particle in cell algorithm - Optimization programs/analyzers for GIS data - Quantum Monte Carlo - Krylov based time-evolution of quantum mechanical systems - OpenFoam framework for fluid dynamics - Discrete dislocation dynamics ## 2nd Day Morning quiz 1. How is OpenMP program executed A. Parallal program is run as a set of independent process B. Program starts with single thread, threads are then forked and joined C. A special launcher program is needed for starting the program D. Same program can be run in serial and in parallel A. B.xxxxxxxxxxxxxxx C. D.xxxxxxxxxxxxx 2. Which of the following statements are true A. OpenMP threads communicate by sending and receiving messages B. OpenMP program can be run in distributed memory supercomputer C. Number of threads is always the same as number of CPU cores D. OpenMP programs are vulnerable to race conditions A. B.xxx C. D.xxxxxxxxxxxxxxxx 3. What `omp parallel` construct does? A. Distributes the following `for` / `do` loop to threads B. Creates N threads C. Instructs the compiler to parallelize following code block the best it can D. Creates a parallel region which is executed by all the threads A.x B.xxxxxxxxxx C. D.xxxxxxxxxxxxx 4. How is data visibilty within parallel region defined? A. All the threads share always all the data B. By set of default rules C. By data sharing clauses D. Via calls to OpenMP API A. B.xxxxxxxxxxxxx C.xxxxxxxxxxxxxxxx D.x 5. Where are the threads synchronized? A. At the end of parallel region B. At the end of `for` / `do` construct with `nowait` clause C. At the end of `master` construct D. At explicit `barrier` constructs A.xxxxxxxxxxxxxx B. C. D.xxxxxxxxxxxxx 6. What is the outcome of the following code snippet when run with 4 threads ``` integer :: i, prod, vec1(6), vec2(6) vec1 = 2 vec2 = 4 prod = 0 !$omp parallel do reduction(+:prod) do i = 1, 6 prod = prod + vec1(i) * vec2(i) end do !$omp end parallel do write(*,*) prod ``` A. Code cannot be run with 4 threads as loop is not distributed evenly B. I do not know C. 0 D. 48 A. B.xxxxxxxxxxxxx C. D.xx ## Free discussion Feel free to add any general remarks, tips, tricks, comments etc. here. For questions during the exercise sessions use, however, RocketChat as that will monitored more frequently

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully