Skip to content

Commit

Permalink
deploy: 789ecd2
Browse files Browse the repository at this point in the history
  • Loading branch information
code4yonglei committed Oct 17, 2023
0 parents commit 24b498a
Show file tree
Hide file tree
Showing 92 changed files with 25,872 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 740bec8f81608ce9b21967ff23915748
tags: d77d1c0d9ca2f4c8421862c7c5a0d620
Empty file added .nojekyll
Empty file.
232 changes: 232 additions & 0 deletions 0-setup/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Setup &mdash; Introduction to GPU Programming documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" type="text/css" />
<link rel="stylesheet" href="../_static/copybutton.css" type="text/css" />
<link rel="stylesheet" href="../_static/togglebutton.css" type="text/css" />
<link rel="stylesheet" href="../_static/sphinx_lesson.css" type="text/css" />
<link rel="stylesheet" href="../_static/sphinx_rtd_theme_ext_color_contrast.css" type="text/css" />
<link rel="stylesheet" href="../_static/tabs.css" type="text/css" />
<link rel="stylesheet" href="../_static/overrides.css" type="text/css" />
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->

<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/sphinx_highlight.js"></script>
<script src="../_static/clipboard.min.js"></script>
<script src="../_static/copybutton.js"></script>
<script src="../_static/minipres.js"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
<script>let toggleOpenOnPrint = 'true';</script>
<script src="../_static/togglebutton.js"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script data-domain="enccs.github.io/gpu-programming" defer="defer" src="https://plausible.io/js/script.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex/" />
<link rel="search" title="Search" href="../search/" />
<link rel="next" title="Why GPUs?" href="../1-gpu-history/" />
<link rel="prev" title="Introduction to GPU Programming" href="../" />
</head>

<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >



<a href="../" class="icon icon-home">
Introduction to GPU Programming
<img src="../_static/ENCCS.jpg" class="logo" alt="Logo"/>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search/" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Prerequisites</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Setup</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#local-installation">Local installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#running-on-lumi">Running on LUMI</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#running-julia-on-lumi">Running Julia on LUMI</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#running-on-google-colab">Running on Google Colab</a></li>
<li class="toctree-l2"><a class="reference internal" href="#access-to-code-examples">Access to code examples</a></li>
</ul>
</li>
</ul>
<p class="caption" role="heading"><span class="caption-text">The lesson</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../1-gpu-history/">Why GPUs?</a></li>
<li class="toctree-l1"><a class="reference internal" href="../2-gpu-ecosystem/">The GPU hardware and software ecosystem</a></li>
<li class="toctree-l1"><a class="reference internal" href="../3-gpu-problems/">What problems fit to GPU?</a></li>
<li class="toctree-l1"><a class="reference internal" href="../4-gpu-concepts/">GPU programming concepts</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Instructor’s guide</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../guide/">Instructor’s guide</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">About</span></p>
<ul>
<li class="toctree-l1"><a class="reference external" href="https://enccs.se/lessons/">All lessons</a></li>
<li class="toctree-l1"><a class="reference external" href="https://enccs.se/">ENCCS</a></li>
</ul>

</div>
</div>
</nav>

<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../">Introduction to GPU Programming</a>
</nav>

<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Setup</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/ENCCS/intro-gpu-programming/blob/main/content/0-setup.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">

<section id="setup">
<span id="id1"></span><h1>Setup<a class="headerlink" href="#setup" title="Permalink to this heading"></a></h1>
<section id="local-installation">
<h2>Local installation<a class="headerlink" href="#local-installation" title="Permalink to this heading"></a></h2>
<p>Since this lesson is taught using an HPC cluster, no software installation on your own computer is needed.</p>
</section>
<section id="running-on-lumi">
<h2>Running on LUMI<a class="headerlink" href="#running-on-lumi" title="Permalink to this heading"></a></h2>
<p>Interactive job, 1 node, 1 GPU, 1 hour:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>salloc<span class="w"> </span>-A<span class="w"> </span>project_465000485<span class="w"> </span>-N<span class="w"> </span><span class="m">1</span><span class="w"> </span>-t<span class="w"> </span><span class="m">1</span>:00:0<span class="w"> </span>-p<span class="w"> </span>standard-g<span class="w"> </span>--gpus-per-node<span class="o">=</span><span class="m">1</span>
<span class="gp">$ </span>srun<span class="w"> </span>&lt;some-command&gt;
</pre></div>
</div>
<p>Exit interactive allocation with <code class="docutils literal notranslate"><span class="pre">exit</span></code>.</p>
<p>Interacive terminal session on compute node:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>srun<span class="w"> </span>--account<span class="o">=</span>project_465000485<span class="w"> </span>--partition<span class="o">=</span>standard-g<span class="w"> </span>--nodes<span class="o">=</span><span class="m">1</span><span class="w"> </span>--cpus-per-task<span class="o">=</span><span class="m">1</span><span class="w"> </span>--ntasks-per-node<span class="o">=</span><span class="m">1</span><span class="w"> </span>--gpus-per-node<span class="o">=</span><span class="m">1</span><span class="w"> </span>--time<span class="o">=</span><span class="m">1</span>:00:00<span class="w"> </span>--pty<span class="w"> </span>bash
<span class="gp">$ </span>&lt;some-command&gt;
</pre></div>
</div>
<p>Corresponding batch script <code class="docutils literal notranslate"><span class="pre">submit.sh</span></code>:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="ch">#!/bin/bash -l</span>
<span class="c1">#SBATCH --job-name=example-job</span>
<span class="c1">#SBATCH --output=examplejob.o%j</span>
<span class="c1">#SBATCH --error=examplejob.e%j</span>
<span class="c1">#SBATCH --partition=standard-g</span>
<span class="c1">#SBATCH --nodes=1</span>
<span class="c1">#SBATCH --ntasks-per-node=1</span>
<span class="c1">#SBATCH --gpus-per-node=1</span>
<span class="c1">#SBATCH --time=1:00:00</span>
<span class="c1">#SBATCH --account=project_465000485</span>

srun<span class="w"> </span>&lt;some_command&gt;
</pre></div>
</div>
<p>Submit the job: <code class="docutils literal notranslate"><span class="pre">sbatch</span> <span class="pre">submit.sh</span></code></p>
<p>Monitor your job: <code class="docutils literal notranslate"><span class="pre">squeue</span> <span class="pre">--me</span></code></p>
<p>Kill job: <code class="docutils literal notranslate"><span class="pre">scancel</span> <span class="pre">&lt;JOB_ID&gt;</span></code></p>
<section id="running-julia-on-lumi">
<h3>Running Julia on LUMI<a class="headerlink" href="#running-julia-on-lumi" title="Permalink to this heading"></a></h3>
<p>To run Julia with AMDGPU.jl on LUMI:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>srun<span class="w"> </span>--account<span class="o">=</span>project_465000485<span class="w"> </span>--partition<span class="o">=</span>standard-g<span class="w"> </span>--nodes<span class="o">=</span><span class="m">1</span><span class="w"> </span>--cpus-per-task<span class="o">=</span><span class="m">1</span><span class="w"> </span>--ntasks-per-node<span class="o">=</span><span class="m">1</span><span class="w"> </span>--gpus-per-node<span class="o">=</span><span class="m">1</span><span class="w"> </span>--time<span class="o">=</span><span class="m">1</span>:00:00<span class="w"> </span>--pty<span class="w"> </span>bash

<span class="gp">$ </span>module<span class="w"> </span>purge
<span class="gp">$ </span>module<span class="w"> </span>use<span class="w"> </span>/appl/local/csc/modulefiles
<span class="gp">$ </span>module<span class="w"> </span>load<span class="w"> </span>julia/1.9.0
</pre></div>
</div>
<p>Then in Julia session:</p>
<div class="highlight-julia notranslate"><div class="highlight"><pre><span></span><span class="c"># only needed in your first Julia session:</span>
<span class="k">using</span><span class="w"> </span><span class="n">Pkg</span>
<span class="n">Pkg</span><span class="o">.</span><span class="n">resolve</span><span class="p">()</span>

<span class="c"># load AMDGPU</span>
<span class="k">using</span><span class="w"> </span><span class="n">AMDGPU</span>
</pre></div>
</div>
</section>
</section>
<section id="running-on-google-colab">
<h2>Running on Google Colab<a class="headerlink" href="#running-on-google-colab" title="Permalink to this heading"></a></h2>
<p>Google Colaboratory, commonly referred to as “Colab”, is a cloud-based Jupyter notebook environment which runs in your web browser. Using it requires login with a Google account.</p>
<p>This is how you can get access to NVIDIA GPUs on Colab:</p>
<ul class="simple">
<li><p>Visit <a class="reference external" href="https://colab.research.google.com/">https://colab.research.google.com/</a> and sign in to your Google account</p></li>
<li><p>In the menu in front of you, click “New notebook” in the bottom right corner</p></li>
<li><p>After the notebook loads, go to the “Runtime” menu at the top and select “Change runtime type”</p></li>
<li><p>Select “GPU” under “Hardware accelerator” and choose an available type of NVIDIA GPU (e.g. T4)</p></li>
<li><p>Click “Save”. The runtime takes a few seconds to load - you can see the status in the top right corner</p></li>
<li><p>After the runtime has loaded, you can type <code class="docutils literal notranslate"><span class="pre">!nvidia-smi</span></code> to see information about the GPU.</p></li>
<li><p>You can now write Python code that runs on GPUs through e.g. the numba library.</p></li>
</ul>
</section>
<section id="access-to-code-examples">
<h2>Access to code examples<a class="headerlink" href="#access-to-code-examples" title="Permalink to this heading"></a></h2>
<p>Some exercises in this lesson rely on source code that you should download and modify in your own home directory on the cluster. All code examples are available in the same GitHub repository as this lesson itself. To download it you should use Git:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/ENCCS/gpu-programming.git
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>gpu-programming/content/examples/
<span class="gp">$ </span>ls
</pre></div>
</div>
</section>
</section>


</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="../" class="btn btn-neutral float-left" title="Introduction to GPU Programming" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../1-gpu-history/" class="btn btn-neutral float-right" title="Why GPUs?" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>

<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2023, The contributors.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.


</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>

</body>
</html>
Loading

0 comments on commit 24b498a

Please sign in to comment.