Skip to content

Commit

Permalink
Deployed 1a83d9c with MkDocs version: 1.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Jan 9, 2024
1 parent 77e9392 commit 07770de
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 1 deletion.
2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

Binary file modified sitemap.xml.gz
Binary file not shown.
201 changes: 201 additions & 0 deletions user-guide/python/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,63 @@
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#conda-on-archer2" class="md-nav__link">
<span class="md-ellipsis">
Conda on ARCHER2
</span>
</a>

<nav class="md-nav" aria-label="Conda on ARCHER2">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#conda-install-location" class="md-nav__link">
<span class="md-ellipsis">
Conda install location
</span>
</a>

<nav class="md-nav" aria-label="Conda install location">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#use-a-conda-container-image" class="md-nav__link">
<span class="md-ellipsis">
Use a conda container image
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#install-conda-on-the-solid-state-storage" class="md-nav__link">
<span class="md-ellipsis">
Install conda on the solid state storage
</span>
</a>

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
<a href="#conda-addtions-to-shell-configuration-files" class="md-nav__link">
<span class="md-ellipsis">
Conda addtions to shell configuration files
</span>
</a>

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -2277,6 +2334,63 @@
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#conda-on-archer2" class="md-nav__link">
<span class="md-ellipsis">
Conda on ARCHER2
</span>
</a>

<nav class="md-nav" aria-label="Conda on ARCHER2">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#conda-install-location" class="md-nav__link">
<span class="md-ellipsis">
Conda install location
</span>
</a>

<nav class="md-nav" aria-label="Conda install location">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#use-a-conda-container-image" class="md-nav__link">
<span class="md-ellipsis">
Use a conda container image
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#install-conda-on-the-solid-state-storage" class="md-nav__link">
<span class="md-ellipsis">
Install conda on the solid state storage
</span>
</a>

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
<a href="#conda-addtions-to-shell-configuration-files" class="md-nav__link">
<span class="md-ellipsis">
Conda addtions to shell configuration files
</span>
</a>

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -2458,6 +2572,93 @@ <h2 id="installing-your-own-python-packages-with-pip">Installing your own Python
<p class="admonition-title">Note</p>
<p>The ML modules are themselves based on <code>cray-python</code>. For example, <code>tensorflow/2.12.0</code> is based on the <code>cray-python/3.9.13.1</code> module.</p>
</div>
<h2 id="conda-on-archer2">Conda on ARCHER2</h2>
<p>Conda-based Python distributions (e.g. Anaconda, Mamba, Miniconda) are an extremely popular way of installing and
accessing software on many systems, including ARCHER2. Although conda-based distributions can be used on ARCHER2,
care is needed in how they are installed and configured so that the installation does not adversely effect your use
of ARCHER2. In particular, you should be careful of:</p>
<ul>
<li>Where you install conda on ARCHER2</li>
<li>Conda additions to shell configuration files such as <code>.bashrc</code></li>
</ul>
<p>We cover each of these points in more detail below.</p>
<h3 id="conda-install-location">Conda install location</h3>
<p>If you only need to use the files and executables from your conda installation on the login and data analysis nodes
(via the <code>serial</code> QoS) then the best place to install conda is in your home directory structure - this will usually
be the default install location provided by the installation script.</p>
<p>If you need to access the files and executables from conda on the compute nodes then you will need to install to a
different location as the home file systems are not available on the compute nodes. The work file systems are not
well suited to hosting Python software natively due to the way in which file access work, particularly during
Python startup. There are two main options for using conda from ARCHER2 compute nodes:</p>
<ol>
<li>Use a conda container image </li>
<li>Install conda on the solid state storage</li>
</ol>
<h4 id="use-a-conda-container-image">Use a conda container image</h4>
<p>You can pull official conda-based container images from Dockerhub that you can use if you want just the standard
set of Python modules that come with the distribution. For example, to get the latest Anaconda distribution as a
Singularity container image on the ARCHER2 work file system, you would use (on an ARCHER2 login node, from the
directory on the work file system where you want to store the container image):</p>
<div class="highlight"><pre><span></span><code>singularity build anaconda3.sif docker://continuumio/anaconda3
</code></pre></div>
<p>Once you have the container image, you can run scripts in it with a command like:</p>
<div class="highlight"><pre><span></span><code>singularity exec -B $PWD anaconda3.sif python my_script.py
</code></pre></div>
<p>As the container image is a single large file, you end up doing a single large read from the work file system rather
than lots of small reads of individual Python files, this improves the performance of Python and reduces the
detrimental impact on the wider file system performance for all users.</p>
<p>We have pre-built a Singularity container with the Anaconda distribution in on
ARCHER2. Users can access it at <code>$EPCC_SINGULARITY_DIR/anaconda3.sif</code>. To run a Python
script with the centrally-installed image, you can use:</p>
<div class="highlight"><pre><span></span><code>singularity exec -B $PWD $EPCC_SINGULARITY_DIR/anaconda3.sif python my_script.py
</code></pre></div>
<p>If you want additional packages that are not available in the standard container images then
you will need to build your own container images. If you need help to do this, then please
contact the <a href="mailto:[email protected]">ARCHER2 Service Desk</a></p>
<h4 id="install-conda-on-the-solid-state-storage">Install conda on the solid state storage</h4>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>You must have applied for and been granted access to the solid state storage on ARCHER2
to use this approach. See the <a href="../data/#solid-state-nvme-file-system">Data Management section</a> for more details.</p>
</div>
<p>The ARCHER2 solid state storage is better suited to accessing many small files and so performs better
for Python imports. You can install your conda distribution on the solid state storage to see better
performance than you would from the work file systems. To do this, specify an install location
in your directories on the solid state storage when prompted in the conda installation process.</p>
<h3 id="conda-addtions-to-shell-configuration-files">Conda addtions to shell configuration files</h3>
<p>During the install process most conda-based distributions will ask a question like:</p>
<blockquote>
<p>Do you wish the installer to initialize Miniconda3 by running conda init?</p>
</blockquote>
<p>If you are installing to the ARCHER2 work directories or the solid state storage, you
should answer "no" to this question.</p>
<p>Adding the initialisation to shell startup scripts (typically <code>.bashrc</code>) means that every time
you login to ARCHER2, the conda environment will try to initialise by reading lots of files
within the conda installation. This approach was designed for the case where a user has installed
conda on their personal device and so is the only user of the file system. For shared file systems
such as those on ARCHER2, this places a large load on the file system and will lead to you seeing
slow login times and slow response from your command line on ARCHER2. It will also lead to degraded
read/write performance from the work file systems for you and other users so should be avoided at
all costs.</p>
<p>If you have previously installed a conda distribution and answered "yes" to the question about
adding the initialisation to shell configuration files, you should edit your <code>~/.bashrc</code> file
to remove the conda initialisation entries. This means deleting the lines that look something
like:</p>
<div class="highlight"><pre><span></span><code># &gt;&gt;&gt; conda initialize &gt;&gt;&gt;
# !! Contents within this block are managed by &#39;conda init&#39; !!
__conda_setup=&quot;$(&#39;/work/t01/t01/auser/miniconda3/bin/conda&#39; &#39;shell.bash&#39; &#39;hook&#39; 2&gt; /dev/null)&quot;
if [ $? -eq 0 ]; then
eval &quot;$__conda_setup&quot;
else
if [ -f &quot;/work/t01/t01/auser/miniconda3/etc/profile.d/conda.sh&quot; ]; then
. &quot;/work/t01/t01/auser/miniconda3/etc/profile.d/conda.sh&quot;
else
export PATH=&quot;/work/t01/t01/auser/miniconda3/bin:$PATH&quot;
fi
fi
unset __conda_setup
# &lt;&lt;&lt; conda initialize &lt;&lt;&lt;
</code></pre></div>
<h2 id="running-python">Running Python</h2>
<h3 id="example-serial-python-submission-script">Example serial Python submission script</h3>
<div class="highlight"><pre><span></span><code>#!/bin/bash --login
Expand Down

0 comments on commit 07770de

Please sign in to comment.