Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
cscjlan committed May 16, 2024
2 parents 452e2fb + 9d20427 commit 750e082
Show file tree
Hide file tree
Showing 119 changed files with 4,066 additions and 422 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pages-html.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy HTML slides to Pages

on:
# Runs on pushes targeting the default branch
push:
branches:
- "master"
paths:
- "*/docs/**"
- ".github/workflows/pages.yml"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:
pages-html:
uses: ./.github/workflows/pages.yml
with:
include_pdf: false
17 changes: 17 additions & 0 deletions .github/workflows/pages-pdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Deploy HTML and PDF slides to Pages

on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:
pages-pdf:
uses: ./.github/workflows/pages.yml
with:
include_pdf: true
62 changes: 62 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Script based on examples in https://github.com/actions/starter-workflows/tree/main/pages
name: Deploy slides to Pages

on:
workflow_call:
inputs:
include_pdf:
required: true
type: boolean

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
timeout-minutes: 30
runs-on: ubuntu-latest
container:
image: ghcr.io/csc-training/slidefactory:3.1.0-beta.3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Build slides
env:
INCLUDE_PDF: ${{ inputs.include_pdf }}
run: |
git config --global --add safe.directory $PWD
GIT_SHORT_SHA=$(git rev-parse --short $GITHUB_SHA)
GIT_DATE=$(git show -s --format=%ci $GITHUB_SHA)
ARGS=""
[[ "$INCLUDE_PDF" == "true" ]] && ARGS="--with-pdf"
slidefactory pages about.yml build --info_content "Updated for [$GIT_SHORT_SHA]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$GITHUB_SHA) ($GIT_DATE)" $ARGS
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./build

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*.html
*.pdf
*.sif
build/

#ignore default binary name
a.out
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# CSC Summer School in High-Performance Computing 2023
# CSC Summer School in High-Performance Computing 2024

This is the material repository for the high-performance computing summer school by CSC - Finnish IT Center for Science.
This is the material repository for the High-Performance Computing Summer School organized by [CSC - IT Center for Science](https://csc.fi/en/).

Feel free to fork this repository and work through the exercises, see more details in
[exercise instructions](exercise-instructions.md). You can also add general notes to yourself (like how to compile files etc.) at the end of this readme file (`README.md`).
Feel free to fork this repository to work through the exercises.

Versions from previous years can be found in tags.

## Presentation slides

The slides are available [here](https://csc-training.github.io/summerschool/).

## Exercises

- [General instructions](exercise-instructions.md)
Expand All @@ -16,7 +19,3 @@ Versions from previous years can be found in tags.
- [Hybrid MPI/OpenMP](hybrid)
- [GPU programming with OpenMP](gpu-openmp)
- [GPU programming with HIP](gpu-hip)

---
## Notes
- [x] Have fun!
12 changes: 12 additions & 0 deletions about.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is used in the generation of the web page
title: CSC Summer School in High-Performance Computing
modules:
- intro-to-hpc
- computer-platforms
- mpi
- parallel-io
- hybrid
- gpu-openmp
- gpu-hip
- application-performance
- application-design
2 changes: 1 addition & 1 deletion application-design/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Exercieses
## Exercises

- [Continuous integration](ci/)
3 changes: 3 additions & 0 deletions application-design/about.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is used in the generation of the web page
title: Application Design
slidesdir: docs
2 changes: 1 addition & 1 deletion application-design/docs/01_design_choices.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Application design
event: CSC Summer School in High-Performance Computing 2023
event: CSC Summer School in High-Performance Computing 2024
lang: en
---

Expand Down
2 changes: 1 addition & 1 deletion application-design/docs/02-documentation-testing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Documenting and testing
event: CSC Summer School in High-Performance Computing 2023
event: CSC Summer School in High-Performance Computing 2024
lang: en
---

Expand Down
2 changes: 1 addition & 1 deletion application-design/docs/03-collaboration-release.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Collaboration and release
event: CSC Summer School in High-Performance Computing 2023
event: CSC Summer School in High-Performance Computing 2024
lang: en
---

Expand Down
3 changes: 3 additions & 0 deletions application-performance/about.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is used in the generation of the web page
title: Application Performance
slidesdir: docs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Introduction to Application Performance
event: CSC Summer School in High-Performance Computing 2023
event: CSC Summer School in High-Performance Computing 2024
lang: en
---

Expand Down Expand Up @@ -41,7 +41,7 @@ Have you profiled your code?

- Profiled the code: 99.9% of the execution time was being spent on these lines:

```fortran
```fortranfree
do i=1,n ! Removing these unnecessary loop iterations reduced the
do j=1,m ! wall-time of one simulation run from 17 hours to 3 seconds…
do k=1,fact(x)
Expand Down
2 changes: 1 addition & 1 deletion application-performance/docs/02-gpu-performance.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Single node performance optimization
event: CSC Summer School in High-Performance Computing 2023
event: CSC Summer School in High-Performance Computing 2024
lang: en
---

Expand Down
2 changes: 1 addition & 1 deletion application-performance/docs/03-mpi-performance.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: MPI performance analysis
event: CSC Summer School in High-Performance Computing 2023
event: CSC Summer School in High-Performance Computing 2024
lang: en
---

Expand Down
2 changes: 1 addition & 1 deletion application-performance/docs/03-single-node-performance.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Single node performance optimization
event: CSC Summer School in High-Performance Computing 2023
event: CSC Summer School in High-Performance Computing 2024
lang: en
---

Expand Down
8 changes: 8 additions & 0 deletions build-systems/demos/01-makefile/hello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include<stdlib.h>
#include<stdio.h>

int main(int argc, char *argv[])
{
printf("Hello, world!\n");
return EXIT_SUCCESS;
}
16 changes: 16 additions & 0 deletions build-systems/demos/02-makefiles/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

.PHONY: clean all install

%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

hello: hello.o module.o

clean:
rm *.o hello

install: hello
mkdir -p ./bin/
cp hello ./bin/

all: hello
9 changes: 9 additions & 0 deletions build-systems/demos/02-makefiles/hello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include<stdlib.h>

void hello();

int main(int argc, char *argv[])
{
hello();
return EXIT_SUCCESS;
}
5 changes: 5 additions & 0 deletions build-systems/demos/02-makefiles/module.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include<stdio.h>
void hello()
{
printf("Hello, world!\n");
}
23 changes: 23 additions & 0 deletions build-systems/demos/03-cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Makes cmake act like its version 3.18 (this is a comment)
cmake_minimum_required(VERSION 3.18)

project(project_hello VERSION 0.1 DESCRIPTION "Hello project" LANGUAGES C)

set(BUILDER_NAME "Default" CACHE STRING "Variable description")

configure_file (
"${PROJECT_SOURCE_DIR}/include/config.h.in"
"${PROJECT_BINARY_DIR}/include/config.h")

add_library(module STATIC module.c)
target_include_directories(module PUBLIC include)

add_executable(hello hello.c)
target_include_directories(hello PUBLIC include ${PROJECT_BINARY_DIR}/include)

target_link_libraries(hello PUBLIC module)

install(TARGETS hello module
RUNTIME DESTINATION "bin"
ARCHIVE DESTINATION "lib"
LIBRARY DESTINATION "LIB")
14 changes: 14 additions & 0 deletions build-systems/demos/03-cmake/hello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include<stdlib.h>
#include<stdio.h>
#include"config.h"
#include"module.h"

int main(int argc, char *argv[])
{
printf("Hello version %i.%i\nBuilt by %s\n",
HELLO_VERSION_MAJOR,
HELLO_VERSION_MINOR,
HELLO_BUILDER_NAME);
hello();
return EXIT_SUCCESS;
}
7 changes: 7 additions & 0 deletions build-systems/demos/03-cmake/include/config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#define HELLO_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define HELLO_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define HELLO_VERSION @PROJECT_VERSION@

#define HELLO_BUILDER_NAME "@BUILDER_NAME@"
3 changes: 3 additions & 0 deletions build-systems/demos/03-cmake/include/module.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@


void hello();
9 changes: 9 additions & 0 deletions build-systems/demos/03-cmake/module.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include<stdio.h>
#include"module.h"

const char *message = "Hello, world!\n";

void hello()
{
printf("%s", message);
}
15 changes: 15 additions & 0 deletions build-systems/demos/04-kokkos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.18)

project(something_kokkos VERSION 0.1 DESCRIPTION "Computes something with kokkos" LANGUAGES C CXX)


# Search internet for "cmake kokkos find_package"
set(Kokkos_ROOT "/home/jkataja/opt/kokkos/4.2.01" CACHE PATH "Where to find kokkos")
set(Kokkos_DIR "${Kokkos_ROOT}" CACHE PATH "kokkos_DIR" FORCE) # Non cache variable!
# set(Kokkos_DIR "/home/jkataja/opt/kokkos/4.2.01" CACHE PATH "Kokkos" directory)
find_package(Kokkos REQUIRED)

set(CMAKE_EXPORT_COMPILE_COMMANDS true)

add_executable(something reduce.cpp)
target_link_libraries(something Kokkos::kokkos)
23 changes: 23 additions & 0 deletions build-systems/demos/04-kokkos/reduce.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <Kokkos_Core.hpp>
#include <iostream>
#include <iomanip>

constexpr size_t N = 10000;
typedef float numtype;

int main(int argc, char* argv[]) {
Kokkos::initialize(argc, argv);
{
numtype sum=0;
Kokkos::parallel_reduce(N+1, KOKKOS_LAMBDA(const int i, numtype &lsum) {
lsum += 1.0*i;
}, Kokkos::Sum<numtype>(sum));
Kokkos::fence();

std::cout << "reduction sum is " << std::setprecision(18)
<< sum << std::endl;
std::cout << "error to exact is " << std::setprecision(18)
<< (N*(1+N) - sum*2)/2 << std::endl << "... or is it?\n";
}
Kokkos::finalize();
}
18 changes: 18 additions & 0 deletions build-systems/demos/06-heat-equation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.18)

project(heat VERSION 1.0 DESCRIPTION "Heat equation w/ cmake" LANGUAGES CXX C)
find_package(OpenMP)
find_package(PNG REQUIRED)

add_executable(heat_omp core.cpp heat.cpp main.cpp
setup.cpp utilities.cpp io.cpp "../../../hybrid/heat-hybrid/common/pngwriter.c")
target_link_libraries(heat_omp PRIVATE png)
target_include_directories(heat_omp PUBLIC "../../../hybrid/heat-hybrid/common")

if(OpenMP_CXX_FOUND)
target_link_libraries(heat_omp PUBLIC OpenMP::OpenMP_CXX)
endif()


install(TARGETS heat_omp RUNTIME DESTINATION "heat" )
install(FILES "bottle.dat" DESTINATION "heat")
Loading

0 comments on commit 750e082

Please sign in to comment.