Skip to content

Commit

Permalink
updated the structure and readme files, added a deployment guide
Browse files Browse the repository at this point in the history
  • Loading branch information
mozhgan-kch committed Sep 7, 2023
1 parent 5771493 commit 9381b0d
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 140 deletions.
72 changes: 72 additions & 0 deletions Deployment_Guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# N-ways to GPU programming Deployment Guide
The N-Ways to GPU Programming Bootcamp covers the basics of GPU programming and provides an overview of different methods for porting scientific application to GPUs using NVIDIA® CUDA®, OpenACC, standard languages, OpenMP offloading, and/or CuPy and Numba. Throughout the bootcamp, attendees with learn how to analyze GPU-enabled applications using NVIDIA Nsight™ Systems and participate in hands-on activities to apply these learned skills to real-world problems.

## Deploying the materials

### Prerequisites
To run this tutorial, you will need a machine with NVIDIA GPU.

- Install the latest [Docker](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker) or [Singularity](https://sylabs.io/docs/).

- Install the latest [NVIDIA Nsight™ Systems](https://developer.nvidia.com/nsight-systems).

- The base containers required for the lab may require users to create an NGC account and generate an API key (https://docs.nvidia.com/ngc/ngc-catalog-user-guide/index.html#registering-activating-ngc-account)

The material is also tested to be working with NVIDIA V100 and T4 GPUs, please contact us if you require assistance in deploying the content.


### Tested environment

These materials was tested with both Docker and Singularity on an NVIDIA A100 GPU in an x86-64 platform installed with a driver version of `525.105.17`.

### Deploying with container

These materials can be deployed with either Docker or Singularity container, refer to the respective sections for the instructions.

#### Docker Container

To build a docker container, specify the dockerfile name using `-f` flag:
`sudo docker build -f <dockerfile name> -t <imagename>:<tagnumber> .`

For instance:

- To build the docker container, for N-Ways to GPU Programming-Python, follow the below steps:

1. `sudo docker build -f nways_Dockerfile_python -t openhackathons:nways_python .`
2. `sudo docker run --rm -it --gpus=all -p 8888:8888 openhackathons:nways_python`
3. To access the labs, run: `jupyter-lab --ip 0.0.0.0 --port 8888 --no-browser --allow-root`
4. Now, open the jupyter lab in browser: http://localhost:8888, and start working on the lab by clicking on the `_start_nways.ipynb` notebook


- To build the singularity container, for N-Ways to GPU Programming-C-Fortran, follow the below steps:

1. `sudo docker build -f nways_Dockerfile -t openhackathons:nways_CFortran .`
2. `sudo docker run --rm -it --gpus=all -p 8888:8888 openhackathons:nways_CFortran`
3. To access the labs, run: `jupyter-lab --ip 0.0.0.0 --port 8888 --no-browser --allow-root`
4. Now, open the jupyter lab in browser: http://localhost:8888, and start working on the lab by clicking on the `_start_nways.ipynb` notebook

Please note, if you are to run both contents, you would need to change the ports to access them seperately.

#### Singularity Container

- To build the singularity container, for N-Ways to GPU Programming-Python, follow the below steps:

1. `singularity build --fakeroot nways_python.simg nways_Singularity_python`
2. `singularity run nways_python.simg cp -rT /labs ~/labs`
3. `singularity run --nv nways_python.simg jupyter-lab --notebook-dir=~/labs`
4. Now, open the jupyter lab in browser: http://localhost:8888, and start working on the lab by clicking on the `_start_nways.ipynb` notebook


- To build the singularity container, for N-Ways to GPU Programming-C-Fortran, follow the below steps:

1. `singularity build --fakeroot nways_CFortran.simg nways_Singularity`
2. `singularity run nways_CFortran.simg cp -rT /labs ~/labs`
3. `singularity run --nv nways_CFortran.simg jupyter-lab --notebook-dir=~/labs`
4. Now, open the jupyter lab in browser: http://localhost:8888, and start working on the lab by clicking on the `_start_nways.ipynb` notebook

### Known issues

- Please go through the list of exisiting bugs/issues or file a new issue at [Github](https://github.com/openhackathons-org/nways_accelerated_programming/issues).



65 changes: 38 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,50 @@
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

# HPC_Bootcamp
# N-ways to GPU programming
The N-Ways to GPU Programming Bootcamp covers the basics of GPU programming and provides an overview of different methods for porting scientific application to GPUs using NVIDIA® CUDA®, OpenACC, standard languages, OpenMP offloading, and/or CuPy and Numba. Throughout the bootcamp, attendees with learn how to analyze GPU-enabled applications using NVIDIA Nsight™ Systems and participate in hands-on activities to apply these learned skills to real-world problems.

This repository contains training content for the HPC_Bootcamp materials. This repository includes the following file structure in the initial two levels:
## Bootcamp contents:

```
│ ├──
├── _basic
│ ├── cuda
│ ├── iso
│ ├── openacc
│ ├── openmp
│ └── python
├── LICENSE
├── README.md
├── _scripts
└── start_notebook
```
The content is structured in multiple options covering the following:

- The __basic_ directory contains all of the introductory training materials for CUDA, Standard Languages, OpenMP Offloading, and OpenACC.
- The __scripts_ directory contains container definition files for each bootcamp type.
- The __start_notebook_ directory contains started notebooks and it is optional to use.
- Option 1: N-Ways to GPU Programming-C-Fortran
- NVIDIA® Nsight™ Systems
- NVIDIA® Nsight™ Compute (Optional, lecture only)
- Lab 1: ISO C++ and ISO Fortran
- Lab 2: OpenACC
- Lab 3: OpenMP offloading
- Lab 4: CUDA

<!--Please note there is a container definition file for each content in `_advanced` and `_basic` directories that can be found inside each folder.-->
- Option 2: N-Ways to GPU Programming-Python
- NVIDIA® Nsight™ Systems
- NVIDIA® Nsight™ Compute (Optional, lecture only)
- Lab 1: CuPy
- Lab 2: Numba

### Building the container using the definition files inside the `_script` folder
## Tools and frameworks:

To build the singularity container, run:
`sudo singularity build miniapp.simg {Name of the content}_Singularity` , alternatively you can use `singularity build --fakeroot miniapp.simg {Name of the content}_Singularity` if you do not have `sudo` rights.
The tools and frameworks used in the bootcamp are as follows:
- [NVIDIA HPC SDK](https://developer.nvidia.com/hpc-sdk)
- [NVIDIA Nsight™ Systems](https://developer.nvidia.com/nsight-systems)

Next, copy the files to a local directory to make sure changes are stored locally:
`singularity run miniapp.simg cp -rT /labs ~/labs`
## Bootcamp duration:

Then, run the container:
`singularity run --nv miniapp.simg jupyter-lab --notebook-dir=~/labs`
The N-Ways to GPU Programming-C-Fortran Bootcamp will take approximately 6 hours and the N-Ways to GPU Programming-Python Bootcamp will take approximately 4.5 hours.

Once inside the container, open the jupyter lab in browser: http://localhost:8888, and start the lab by clicking on the `_start_{Name of the content}.ipynb` notebook.
## Bootcamp prerequisites:

Basic experience with C/C++ or Fortran is needed for the "N-Ways to GPU Programming-C-Fortran" Bootcamp and Python is needed for the "N-Ways to GPU Programming-Python" Bootcamp. No GPU programming experience is required.

## Deploying the Bootcamp materials:

For deploying the materials, please refer to the Deployment guide present [here](Deployment_Guide.md)

## Attribution

This material originates from the OpenHackathons Github repository. Check out additional materials [here](https://github.com/openhackathons-org).

Don't forget to check out additional [Open Hackathons Resources](https://www.openhackathons.org/s/technical-resources) and join our [OpenACC and Hackathons Slack Channel](https://www.openacc.org/community#slack) to share your experience and get more help from the community.

## Licensing

Copyright © 2023 OpenACC-Standard.org. This material is released by OpenACC-Standard.org, in collaboration with NVIDIA Corporation, under the Creative Commons Attribution 4.0 International (CC BY 4.0). These materials may include references to hardware and software developed by other entities; all applicable licensing and copyrights apply.
45 changes: 45 additions & 0 deletions Repo_Structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

# HPC_Bootcamp

This repository contains training content for the HPC_Bootcamp materials. This repository includes the following file structure in the initial two levels:

```
│ ├──
├── _basic
│ ├── cuda
│ ├── iso
│ ├── openacc
│ ├── openmp
│ └── python
├── LICENSE
├── README.md
├── nways_Dockerfile
├── nways_Dockerfile_python
├── nways_Singularity
├── nways_Singularity_python
├── CONTRIBUTING.md
├── Deployment_Guide.md
├── _scripts
└── start_notebook
```

- The __basic_ directory contains all of the introductory training materials for CUDA, Standard Languages, OpenMP Offloading, and OpenACC.
- The __scripts_ directory contains container definition files for each bootcamp type. This is not needed at the moment. Please refer to the [Deployment_Guide](Deployment_Guide.md).
- The __start_notebook_ directory contains started notebooks and it is optional to use. This is not needed at the moment.

<!--Please note there is a container definition file for each content in `_advanced` and `_basic` directories that can be found inside each folder.-->

### Building the container using the definition files inside the `_script` folder

To build the singularity container, run:
`sudo singularity build miniapp.simg {Name of the content}_Singularity` , alternatively you can use `singularity build --fakeroot miniapp.simg {Name of the content}_Singularity` if you do not have `sudo` rights.

Next, copy the files to a local directory to make sure changes are stored locally:
`singularity run miniapp.simg cp -rT /labs ~/labs`

Then, run the container:
`singularity run --nv miniapp.simg jupyter-lab --notebook-dir=~/labs`

Once inside the container, open the jupyter lab in browser: http://localhost:8888, and start the lab by clicking on the `_start_{Name of the content}.ipynb` notebook.

95 changes: 0 additions & 95 deletions _basic/README.md

This file was deleted.

12 changes: 6 additions & 6 deletions _basic/nways_Dockerfile → nways_Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ RUN pip3 install ipywidgets
RUN apt-get update -y

# TO COPY the data
COPY openacc/ /labs/openacc
COPY openmp/ /labs/openmp
COPY _common/ /labs/_common
COPY iso/ /labs/iso
COPY cuda/ /labs/cuda
COPY _start_nways.ipynb /labs
COPY _basic/openacc/ /labs/openacc
COPY _basic/openmp/ /labs/openmp
COPY _basic/_common/ /labs/_common
COPY _basic/iso/ /labs/iso
COPY _basic/cuda/ /labs/cuda
COPY _basic/_start_nways.ipynb /labs

RUN python3 /labs/_common/dataset.py

Expand Down
6 changes: 3 additions & 3 deletions _basic/nways_Dockerfile_python → nways_Dockerfile_python
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ RUN apt-get update -y && \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends nsight-systems-cli-2022.1.1 nsight-compute-2022.1.1

# TO COPY the data
COPY python/ /labs/python
COPY _common/ /labs/_common
COPY _start_nways.ipynb /labs
COPY _basic/python/ /labs/python
COPY _basic/_common/ /labs/_common
COPY _basic/_start_nways.ipynb /labs

RUN python3 /labs/_common/dataset_python.py

Expand Down
12 changes: 6 additions & 6 deletions _basic/nways_Singularity → nways_Singularity
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ FROM: nvcr.io/nvidia/nvhpc:23.5-devel-cuda_multi-ubuntu20.04
rm -rf ${build_tmp}

%files
../_basic/openacc/ /labs/openacc
../_basic/openmp/ /labs/openmp
../_basic/_common/ /labs/_common
../_basic/iso/ /labs/iso
../_basic/cuda/ /labs/cuda
../_basic/_start_nways.ipynb /labs
_basic/openacc/ /labs/openacc
_basic/openmp/ /labs/openmp
_basic/_common/ /labs/_common
_basic/iso/ /labs/iso
_basic/cuda/ /labs/cuda
_basic/_start_nways.ipynb /labs

%runscript
"$@"
Expand Down
6 changes: 3 additions & 3 deletions _basic/nways_Singularity_python → nways_Singularity_python
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ FROM: nvidia/cuda:11.4.2-devel-ubuntu20.04
rm -rf ${build_tmp}

%files
../_basic/python/ /labs/python
../_basic/_common/ /labs/_common
../_basic/_start_nways.ipynb /labs
_basic/python/ /labs/python
_basic/_common/ /labs/_common
_basic/_start_nways.ipynb /labs

%runscript
"$@"
Expand Down

0 comments on commit 9381b0d

Please sign in to comment.