<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.bwhpc.de/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=R+Keller</id>
	<title>bwHPC Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.bwhpc.de/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=R+Keller"/>
	<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/e/Special:Contributions/R_Keller"/>
	<updated>2026-06-01T00:51:52Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Jupyter&amp;diff=15954</id>
		<title>DACHS/Jupyter</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Jupyter&amp;diff=15954"/>
		<updated>2026-04-20T10:04:20Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Software Stacks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Short description of Jupyter =&lt;br /&gt;
Jupyter (an acronym for &#039;&#039;Ju&#039;&#039;lia, &#039;&#039;Py&#039;&#039;thon and &#039;&#039;R&#039;&#039;) is a web application, allowing interactive programming and visualization in a browser. Jupyter uses so-called Jupyter-Notebooks to load and store the program, input data and it&#039;s output (including visualization) in a JSON-based file, allowing exchange between different implementations (like Visual Studio Code plus a Jupyter Extension) and specifically allowing incrementally editing using a version-control system like git.&lt;br /&gt;
&lt;br /&gt;
We provide [https://jupyter.org/hub JupyterHub] at [https://dachs-jupyter.hs-esslingen.de https://dachs-jupyter.hs-esslingen.de/] as described below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Access requirements =&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
Access to Jupyter is &#039;&#039;&#039;limited to IP addresses from the BelWü network&#039;&#039;&#039;.&lt;br /&gt;
All partners of DACHS are connected to BelWü, so if you are on your campus network (e.g. in your office or on the Campus WiFi) you should be able to connect without restrictions. Otherwise, You will see a hint about having to connect using VPN to Your home institution (and make sure, that all packets are routed through your home institution&#039;s VPN, and not in SPLIT tunneling mode, see [[DACHS/Login|Login]] page.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
# Register as described on the [[DACHS/Registration|Registration]]&lt;br /&gt;
# Then [[DACHS/Login|login to DACHS]] via SSH &#039;&#039;&#039;at least once&#039;&#039;&#039;: This ensures that your home directory is setup properly on DACHS&lt;br /&gt;
# Make sure you&#039;re &#039;&#039;&#039;connected to the VPN of your university&#039;&#039;&#039; (see above)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Login Process =&lt;br /&gt;
After having logged into&lt;br /&gt;
  https://dachs-jupyter.hs-esslingen.de&lt;br /&gt;
You will need to specify the resources, as described in the next section.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Logout Process =&lt;br /&gt;
&lt;br /&gt;
Your Jupyter Notebook ist started as any other Slurm job.&lt;br /&gt;
If you just close your web browser, the Slurm job will continue to run in the background until it hits the time limit.&lt;br /&gt;
Therefore, you should explicitly stop your server or log out from JupyterHub so that&lt;br /&gt;
* your Slurm job is stopped, and your allocated resources do not count towards your personal and organizational usage quota.&lt;br /&gt;
* resources are returned so that they can be used by others.&lt;br /&gt;
 &lt;br /&gt;
To do this, got to &#039;&#039;&#039;File &amp;gt; Hub Control Panel&#039;&#039;&#039; and click &#039;&#039;&#039;Stop My Server&#039;&#039;&#039;.&lt;br /&gt;
Alternatively, you can also log out via &#039;&#039;&#039;File &amp;gt; Log Out&#039;&#039;&#039;. When you log out, your Jupyter Notebook is also stored.&lt;br /&gt;
&lt;br /&gt;
= Selection of Compute Resources =&lt;br /&gt;
&lt;br /&gt;
After you logged in via bwIDM, you can select the resources for your Jupyter Notebook.&lt;br /&gt;
&lt;br /&gt;
Preselected are the following values, but you can adjust them as needed:&lt;br /&gt;
* 1 CPU core&lt;br /&gt;
* 16 GB of RAM&lt;br /&gt;
* No GPU&lt;br /&gt;
* Job runtime of 30 minutes&lt;br /&gt;
* Load the &amp;lt;code&amp;gt;jupyter/ai&amp;lt;/code&amp;gt; module (a virtual environment containing libraries typically needed for machine learning)&lt;br /&gt;
* Use the default JupyterHub reservation. From Monday to Friday, from 08:00 to 20:00 o&#039;clock there are four nodes reserved for interactive JupyterHub use. You can still try to start a Juptyer Notebook outside of this time window, however, this job requests is treated as any other job, meaning if the cluster has no available resources the job cannot be started.&lt;br /&gt;
&lt;br /&gt;
When you adjusted your resources, press start and the Notebook is started for you.&lt;br /&gt;
&lt;br /&gt;
[[Image:20260324-dachs-jupyter-resource-selection.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If you want to use a custom reservation, for example a reservation you previously requested, then un-check the box after &#039;&#039;&#039;Use default reservation&#039;&#039;&#039; and enter your custom reservation name and the token that you received from us.&lt;br /&gt;
You can also try to start the Jupyter Notebook without a custom reservation (and without the default reservation)&lt;br /&gt;
This job is treated as any other by Slurm, meaning it is scheduled if there are available resources.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:20260324-dachs-jupyter-custom-reservation.png|500px]]&lt;br /&gt;
&lt;br /&gt;
= Software Stacks = &lt;br /&gt;
&lt;br /&gt;
We provide two Python environments:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;jupyter/minimal&amp;lt;/code&amp;gt;: This Python environment contains just the basic packages to run the Jupyter notebook. You can use this Python environment as base for your own environment, or you can load an environment that you completely build yourself.&lt;br /&gt;
* &amp;lt;code&amp;gt;jupyter/ai&amp;lt;/code&amp;gt; (&#039;&#039;&#039;default&#039;&#039;&#039;): This Python environment is pre-selected in the resource selection dialog. Additional to the minimal environment, it contains &amp;lt;code&amp;gt;plotly, scikit-learn, seaborn, tensorflow, torchvision&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also build and use your own environment in a Jupyter notebook.&lt;br /&gt;
This is a two step process:&lt;br /&gt;
# First you create the Python environment with your required dependencies.&lt;br /&gt;
# Then you make this environment available as kernel for the Jupyter notebook that you can select.&lt;br /&gt;
Take a look at the [[BwUniCluster3.0/Jupyter#Usage_of_virtual_environment_in_JupyterLab|bwUnicluster documentation]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= R statistical Software =&lt;br /&gt;
In order to start using the statistical software R in Your Jupyter Notebooks do the following steps&lt;br /&gt;
# In the JupyterHub Tab &amp;quot;Software Modules&amp;quot; load the &amp;lt;code&amp;gt;math/R&amp;lt;/code&amp;gt; module&lt;br /&gt;
# In the Launcher Tab, You should see the R logo.&lt;br /&gt;
# Otherwise start a new Terminal, and use the following command:&lt;br /&gt;
  USERNAME@login:~&amp;gt; R   # hit enter to start R&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; install.packages(&#039;IRkernel&#039;)&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; IRkernel::installspec()&lt;br /&gt;
&lt;br /&gt;
= Request a Reservation for Your Lecture =&lt;br /&gt;
&lt;br /&gt;
Requesting a unique reservation for JupyterHub has the advantage that the requested resources will be available to you for sure at the time you need them.&lt;br /&gt;
Furthermore, it&#039;s easy:&lt;br /&gt;
&lt;br /&gt;
1. Send an [mailto:dachs-admin@hs-esslingen?Subject=DACHS%20JupyterHub%20Reservation%20Request email] with the following information:&lt;br /&gt;
* Start time and duration&lt;br /&gt;
* How many nodes do you request? Generally, we assign nodes from the [[ DACHS/Hardware | &amp;lt;code&amp;gt;gpu1&amp;lt;/code&amp;gt; partition ]] to JupyterHub jobs.&lt;br /&gt;
* Do you request a one-time or periodic reservation?&lt;br /&gt;
* The usernames that should have access to the reservation. This is at least your username. (For example &amp;lt;code&amp;gt;es_username&amp;lt;/code&amp;gt;). If you want the students of your lecture to have access as well, export a list of their usernames and send these as well. We need to know the usernames to assign the correct entitlement to access the resource.&lt;br /&gt;
&lt;br /&gt;
2. Wait for a reply. You&#039;ll get a &#039;&#039;reservation name&#039;&#039; and a &#039;&#039;reservation token&#039;&#039; that must be entered in the [[#Selection_of_Compute_Resources|resource selection]] dialog of JupyterHub.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Jupyter&amp;diff=15520</id>
		<title>DACHS/Jupyter</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Jupyter&amp;diff=15520"/>
		<updated>2025-11-25T16:06:18Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Short description of Jupyter =&lt;br /&gt;
Jupyter (an acronym for &#039;&#039;Ju&#039;&#039;lia, &#039;&#039;Py&#039;&#039;thon and &#039;&#039;R&#039;&#039;) is a web application, allowing interactive programming and visualization in a browser. Jupyter uses so-called Jupyter-Notebooks to load and store the program, input data and it&#039;s output (including visualization) in a JSON-based file, allowing exchange between different implementations (like Visual Studio Code plus a Jupyter Extension) and specifically allowing incrementally editing using a version-control system like git.&lt;br /&gt;
&lt;br /&gt;
We provide [https://jupyter.org/hub JupyterHub] at [https://dachs-jupyter.hs-esslingen.de https://dachs-jupyter.hs-esslingen.de/] as described below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Access requirements =&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
Access to Jupyter is &#039;&#039;&#039;limited to IP addresses from the BelWü network&#039;&#039;&#039;.&lt;br /&gt;
All partners of DACHS are connected to BelWü, so if you are on your campus network (e.g. in your office or on the Campus WiFi) you should be able to connect without restrictions. Otherwise, You will see a hint about having to connect using VPN to Your home institution (and make sure, that all packets are routed through your home institution&#039;s VPN, and not in SPLIT tunneling mode, see [[DACHS/Login|Login]] page.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
# Register as described on the [[DACHS/Registration|Registration]]&lt;br /&gt;
# Then [[DACHS/Login|login to DACHS]] via SSH &#039;&#039;&#039;at least once&#039;&#039;&#039;: This ensures that your home directory is setup properly on DACHS&lt;br /&gt;
# Make sure you&#039;re &#039;&#039;&#039;connected to the VPN of your university&#039;&#039;&#039; (see above)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Login process =&lt;br /&gt;
After having logged into&lt;br /&gt;
  https://dachs-jupyter.hs-esslingen.de&lt;br /&gt;
You will need to specify the resources, as described in the next section.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Selection of the compute resources =&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Jupyter&amp;diff=15517</id>
		<title>DACHS/Jupyter</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Jupyter&amp;diff=15517"/>
		<updated>2025-11-25T09:59:12Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Short description of Jupyter =&lt;br /&gt;
Jupyter (an acronym for &#039;&#039;Ju&#039;&#039;lia, &#039;&#039;Py&#039;&#039;thon and &#039;&#039;R&#039;&#039;) is a web application, allowing interactive programming and visualization in a browser. Jupyter uses so-called Jupyter-Notebooks to load and store the program, input data and it&#039;s output (including visualization) in a JSON-based file, allowing exchange between different implementations (like Visual Studio Code plus a Jupyter Extension) and specifically allowing incrementally editing using a version-control system like git.&lt;br /&gt;
&lt;br /&gt;
We provide [https://jupyter.org/hub JupyterHub] at [https://dachs-jupyter.hs-esslingen.de https://dachs-jupyter.hs-esslingen.de/] as described below-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Access requirements =&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
Access to Jupyter is &#039;&#039;&#039;limited to IP addresses from the BelWü network&#039;&#039;&#039;.&lt;br /&gt;
All partners of DACHS are connected to BelWü, so if you are on your campus network (e.g. in your office or on the Campus WiFi) you should be able to connect without restrictions. Otherwise, You will see a hint about having to connect using VPN to Your home institution (and make sure, that all packets are routed through your home institution&#039;s VPN, and not in SPLIT tunneling mode, see [[DACHS/Login|Login]] page.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
# Register as described on the [[DACHS/Registration|Registration]]&lt;br /&gt;
# Then [[DACHS/Login|login to DACHS]] via SSH &#039;&#039;&#039;at least once&#039;&#039;&#039;: This ensures that your home directory is setup properly on DACHS&lt;br /&gt;
# Make sure you&#039;re &#039;&#039;&#039;connected to the VPN of your university&#039;&#039;&#039; (see above)&lt;br /&gt;
&lt;br /&gt;
= Login process =&lt;br /&gt;
After having logged into&lt;br /&gt;
  https://dachs-jupyter.hs-esslingen.de&lt;br /&gt;
You will need to specify the resources, as described in the next section.&lt;br /&gt;
&lt;br /&gt;
= Selection of the compute resources =&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS&amp;diff=15490</id>
		<title>DACHS</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS&amp;diff=15490"/>
		<updated>2025-11-24T08:34:21Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;width: 100%; border-spacing: 5px;&amp;quot;&lt;br /&gt;
| style=&amp;quot;text-align:center; color:#000;vertical-align:middle;font-size:75%;&amp;quot; |&lt;br /&gt;
[[File:DACHS_Logo.png|center|border|250px||]] &lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Datenanalyse Cluster der Hochschulen (DACHS) supports data scientists, machine learning experts and in general engineers for research and education, specifically teaching of the participating Universities of Applied Science.&lt;br /&gt;
&lt;br /&gt;
You can always reach us via Email at [mailto:dachs-admin@hs-esslingen.de dachs-admin@hs-esslingen.de].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;  background:#eeeefe; width:100%;&amp;quot; &lt;br /&gt;
| style=&amp;quot;padding:8px; background:#dedefe; font-size:120%; font-weight:bold;  text-align:left&amp;quot; | Training &amp;amp; Support&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
* [[DACHS/Getting_Started|Getting Started]]&lt;br /&gt;
&amp;lt;!-- * [http://dachs.hs-esslingen.de/ Cluster Status and Usage] --&amp;gt;&lt;br /&gt;
* [https://training.bwhpc.de E-Learning Courses]&lt;br /&gt;
* [[DACHS/Support|Contact and Support]]&lt;br /&gt;
* Send [[:Category:Feedback|Feedback]] about Wiki pages&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
| style=&amp;quot;padding:8px; background:#cef2e0; font-size:120%; font-weight:bold;  text-align:left&amp;quot; | User Documentation&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* [[DACHS/Registration|Registration]]&lt;br /&gt;
* [[DACHS/Login|Login]]&lt;br /&gt;
* [[DACHS/Hardware_and_Architecture|Hardware and Architecture]]&lt;br /&gt;
* Usage of [[DACHS/Software|Software]] on DACHS&lt;br /&gt;
* Running Jobs&lt;br /&gt;
** [[BwUniCluster2.0/Slurm|Batch System]] (page of bwUniCluster2.0)&lt;br /&gt;
** [[DACHS/Queues|Queues]]&lt;br /&gt;
** [[DACHS/Jupyter|Interactive Computing with Jupyter]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
{| style=&amp;quot;  background:#e6e9eb; width:100%;&amp;quot;&lt;br /&gt;
| style=&amp;quot;padding:8px; background:#d1dadf; font-size:120%; font-weight:bold;  text-align:left&amp;quot; | Cluster Funding&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Please [[DACHS/Acknowledgement|acknowledge]] the cluster in your publications.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Queues&amp;diff=15192</id>
		<title>DACHS/Queues</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Queues&amp;diff=15192"/>
		<updated>2025-08-12T09:53:41Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Partitions ==&lt;br /&gt;
DACHS offers three partitions in Slurm, which map directly to the node types: nodes with one NVIDIA L40S GPU, a node with 4 AMD MI300A APUs and the node with 8 NVIDIA H100 GPUs.&lt;br /&gt;
&lt;br /&gt;
== sinfo_t_idle ==&lt;br /&gt;
To see the available nodes, DACHS offers the tool &#039;&#039;sinfo_t_info&#039;&#039;, which any user may call.&lt;br /&gt;
&lt;br /&gt;
== sbatch -p &#039;&#039;partition&#039;&#039; ==&lt;br /&gt;
Batch jobs specify compute requirements, which must fit the resources as in maximum (wall-)time, memory and GPU resources.&lt;br /&gt;
If You require a GPU, You must specify this with your request.&lt;br /&gt;
These are restricted and must fit the available &#039;&#039;&#039;partitions&#039;&#039;&#039;.&lt;br /&gt;
Since requested compute resources are NOT always automatically mapped to the correct queue class, &#039;&#039;&#039;you must add the correct queue class to your sbatch command &#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;font color=red&amp;gt;As with bwUniCluster, the specification of a partition is required.&amp;lt;/font&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Details are:&lt;br /&gt;
&lt;br /&gt;
{| width=750px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | DACHS &amp;lt;br&amp;gt; sbatch -p &#039;&#039;partition&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;text-align:left;&amp;quot;&lt;br /&gt;
! partition !! node !! default resources !! maximum resources&lt;br /&gt;
|- style=&amp;quot;text-align:left&amp;quot;&lt;br /&gt;
| gpu1&lt;br /&gt;
| gpu1[01-45]&lt;br /&gt;
| time=30, mem-per-node=5000mb&lt;br /&gt;
| time=72:00:00, nodes=16, mem-per-node=300000mb, res=gpu:1&lt;br /&gt;
|- style=&amp;quot;text-align:left;&amp;quot;&lt;br /&gt;
| gpu4&lt;br /&gt;
| gpu401&lt;br /&gt;
| time=30, mem-per-cpu=5000mb&lt;br /&gt;
| time=72:00:00, nodes=1, mem=500000mb, ntasks-per-node=96&lt;br /&gt;
|- style=&amp;quot;vertical-align:top; text-align:left&amp;quot;&lt;br /&gt;
| gpu8&lt;br /&gt;
| gpu801&lt;br /&gt;
| time=30, mem-per-cpu=5000mb, cpus-per-gpu=8&lt;br /&gt;
| time=48:00:00, mem=752000mb, ntasks-per-node=96&lt;br /&gt;
|- &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Default resources of a queue class defines time, #tasks and memory if not explicitly given with sbatch command. Resource list acronyms &amp;lt;code&amp;gt;--time&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--ntasks&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--nodes&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--mem-per-cpu&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A typical Slurm batch script (called for brevity &amp;lt;code&amp;gt;python_run.slurm&amp;lt;/code&amp;gt;) for 1-node requiring one NVIDIA L40S GPU:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --ntasks-per-gpu=48&lt;br /&gt;
 #SBATCH --gres=gpu:1&lt;br /&gt;
 #SBATCH --time=1:00:00&lt;br /&gt;
 #SBATCH --mail-type=all&lt;br /&gt;
 #SBATCH --mail-user=my_email@hs-esslingen.de&lt;br /&gt;
 module load devel/cuda/12.4&lt;br /&gt;
 cd $TMPDIR&lt;br /&gt;
 python3 -m venv my_environment&lt;br /&gt;
 . my_environment/bin/activate&lt;br /&gt;
 python3 -m pip install -r $HOME/my_requirements.txt&lt;br /&gt;
 rsync -avz $HOME/my_data_dir/ .&lt;br /&gt;
 time python3 $HOME/python_script.py&lt;br /&gt;
&lt;br /&gt;
Submitting &amp;lt;code&amp;gt;sbatch python_run.slurm&amp;lt;/code&amp;gt; will allocate one compute node and allocate the one available GPU for 1 hour. Furthermore, this will load the CUDA module version 12.4. It will then change to the &#039;&#039;&#039;fast&#039;&#039;&#039; scratch directory specified in the environment variable &amp;lt;code&amp;gt;TMPDIR&amp;lt;/code&amp;gt;.&lt;br /&gt;
You &#039;&#039;&#039;have&#039;&#039;&#039; to allocate the GPU, otherwise You may not use it.&lt;br /&gt;
It will then follow Python&#039;s best practices and create a new Virtual Environment in that directory, then installing the dependencies of the projects detailed in &amp;lt;code&amp;gt;my_requirements.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
It then copies the data directory in &amp;lt;code&amp;gt;my_data_dir&amp;lt;/code&amp;gt; to this directory using &amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;.&lt;br /&gt;
Finally, it executes your main python script, using the time command to figure out, how much time actually was used.&lt;br /&gt;
Alternatively you may time all the commands to get an estimate for Your next batch job.&lt;br /&gt;
&lt;br /&gt;
Here, Slurm will email to the specified address upon start and completion of the job with a summary.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;better&#039;&#039;&#039; your approximation, the better the Slurm scheduler may allocate resources to all users.&lt;br /&gt;
&lt;br /&gt;
== Interactive usage ==&lt;br /&gt;
To &#039;&#039;&#039;get a good estimation&#039;&#039;&#039; of runtime, You may first want to try the resource &#039;&#039;interactively&#039;&#039;:&lt;br /&gt;
    srun --partition=gpu1 --ntasks-per-gpu=48 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
&lt;br /&gt;
Then You may execute the steps in &amp;lt;code&amp;gt;python_run.slurm&amp;lt;/code&amp;gt; script interactively, noting differences and amend your Slurm batch script.&lt;br /&gt;
&#039;&#039;Please note&#039;&#039; the &amp;lt;code&amp;gt;--pty&amp;lt;/code&amp;gt; which forwards the standard output and takes standard input to allow working with the Shell.&lt;br /&gt;
&lt;br /&gt;
== Multiple nodes ==&lt;br /&gt;
Of course You may allocate multiple GPUs across nodes running:&lt;br /&gt;
    sbatch --nodes 4 ./python_run.slurm&lt;br /&gt;
Please be aware, that TMPDIR is still local. For the time being run from Your $HOME or better yet from an allocated [[Workspace]].&lt;br /&gt;
&lt;br /&gt;
== Nodes with multiple GPUs == &lt;br /&gt;
The partitions &amp;lt;code&amp;gt;gpu4&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;gpu8&amp;lt;/code&amp;gt; feature multiple GPUs.&lt;br /&gt;
The &amp;lt;code&amp;gt;gpu4&amp;lt;/code&amp;gt; partition contains the node &amp;lt;code&amp;gt;gpu401&amp;lt;/code&amp;gt; featuring 4x AMD MI300A APUs each with 128GB of fast HMB3e memory shared between the 24 cores and the GPU.&lt;br /&gt;
You may use AMD&#039;s ROCm employing HIP, OpenACC or OpenCL to parallelize for the GPU. Please refer to the documentation on this node.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;gpu8&amp;lt;/code&amp;gt; partition contains the node &amp;lt;code&amp;gt;gpu801&amp;lt;/code&amp;gt; featuring 8x NVIDIA H100 offering 80GB of VRAM each, interconnected using SXM5.&lt;br /&gt;
Please refer to the documentation on this node.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Acknowledgement&amp;diff=15042</id>
		<title>DACHS/Acknowledgement</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Acknowledgement&amp;diff=15042"/>
		<updated>2025-07-02T13:56:36Z</updated>

		<summary type="html">&lt;p&gt;R Keller: Citation of Cluster in publications&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;====== Acknowledgements ======&lt;br /&gt;
Remember to acknowledge our resources in your publications!&lt;br /&gt;
&lt;br /&gt;
Such recognition is important for acquiring funding for the next generation of hardware, support services, data storage, and infrastructure. &lt;br /&gt;
In publications, please **cite the usage** of the DACHS Cluster using a text like:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;We thank the DACHS data analysis cluster, hosted at Hochschule Esslingen and co-funded by the MWK within the DFG&#039;s &amp;quot;Großgeräte der Länder&amp;quot; program, for providing the computational resources necessary for this research.&amp;quot;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Hardware&amp;diff=14869</id>
		<title>DACHS/Hardware</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Hardware&amp;diff=14869"/>
		<updated>2025-05-20T07:57:12Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Components of DACHS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Architecture of DACHS =&lt;br /&gt;
The Datenanalyse Cluster der Hochschulen (DACHS) is a parallel computer with distributed memory connected over Infiniband and Ethernet. The compute nodes contain at least dual AMD processors, at least 384GB of local memory, 2 TB local NVMe-based disc storage and accelerators as shown in the table below. With BeeGFS a fast and scalable filesystem is provided via Infiniband to all login and compute nodes&lt;br /&gt;
&lt;br /&gt;
The Operating System is Rocky-Linux 9.4 (which is based on RHEL).&lt;br /&gt;
The setup is kept in-line (with regard to Software, Setup and general usage) and thus mostly equivalent to bwHPC and bwUniCluster in particular.&lt;br /&gt;
&lt;br /&gt;
= Components of DACHS =&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! style=&amp;quot;width:9%&amp;quot;|&lt;br /&gt;
! style=&amp;quot;width:13%&amp;quot;| Compute nodes &amp;quot;L40S&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:13%&amp;quot;| Compute nodes &amp;quot;H100&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:13%&amp;quot;| Compute nodes &amp;quot;AMD_APU&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:13%&amp;quot;| Login&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Availability in Queue&lt;br /&gt;
| &amp;lt;code&amp;gt;gpu1&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;gpu8&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;gpu4&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Number of nodes&lt;br /&gt;
| 45&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Processors&lt;br /&gt;
| AMD EPYC 9254&lt;br /&gt;
| AMD EPYC 9454&lt;br /&gt;
| AMD MI300A&lt;br /&gt;
| AMD EPYC 9254&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Number of sockets&lt;br /&gt;
| 2&lt;br /&gt;
| 2&lt;br /&gt;
| 4&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Processor frequency (GHz)&lt;br /&gt;
| 2.9 Ghz&lt;br /&gt;
| 2.75 Ghz&lt;br /&gt;
| 2.1 Ghz&lt;br /&gt;
| 2.9 Ghz&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Total number of cores&lt;br /&gt;
| 48&lt;br /&gt;
| 96&lt;br /&gt;
| 96&lt;br /&gt;
| 48&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Main memory&lt;br /&gt;
| 384 GB&lt;br /&gt;
| 1536 GB&lt;br /&gt;
| 512 GB&lt;br /&gt;
| 384 GB&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Local SSD&lt;br /&gt;
| 1,92 TB NVMe&lt;br /&gt;
| 1,92 TB NVMe&lt;br /&gt;
| 1,92 TB NVMe&lt;br /&gt;
| 1,92 TB NVMe&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Accelerators&lt;br /&gt;
| 1x NVIDIA L40S&lt;br /&gt;
| 8x NVIDIA H100&lt;br /&gt;
| 4x AMD MI300A&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Accelerator memory&lt;br /&gt;
| 48 GB&lt;br /&gt;
| 8x 80 GB&lt;br /&gt;
| 4x 128 GB&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Interconnect&lt;br /&gt;
| IB HDR100&lt;br /&gt;
| IB HDR100&lt;br /&gt;
| IB HDR100&lt;br /&gt;
| IB HDR100&lt;br /&gt;
|}&lt;br /&gt;
Table 1: Properties of the nodes&lt;br /&gt;
&lt;br /&gt;
== Storage Architecture ==&lt;br /&gt;
The system features a 700 TB large BeeGFS filesystem available on login and compute nodes.&lt;br /&gt;
Please note: there is a hard file size quota per partner organization and a soft quota per user on Your HOME.&lt;br /&gt;
Users will be notified by E-Mail if the quota is to be reached.&lt;br /&gt;
&lt;br /&gt;
Please &#039;&#039;&#039;do make usage&#039;&#039;&#039; of [[Workspace | Work Space mechanism]] for larger files.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Hardware&amp;diff=14868</id>
		<title>DACHS/Hardware</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Hardware&amp;diff=14868"/>
		<updated>2025-05-20T07:53:36Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Components of DACHS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Architecture of DACHS =&lt;br /&gt;
The Datenanalyse Cluster der Hochschulen (DACHS) is a parallel computer with distributed memory connected over Infiniband and Ethernet. The compute nodes contain at least dual AMD processors, at least 384GB of local memory, 2 TB local NVMe-based disc storage and accelerators as shown in the table below. With BeeGFS a fast and scalable filesystem is provided via Infiniband to all login and compute nodes&lt;br /&gt;
&lt;br /&gt;
The Operating System is Rocky-Linux 9.4 (which is based on RHEL).&lt;br /&gt;
The setup is kept in-line (with regard to Software, Setup and general usage) and thus mostly equivalent to bwHPC and bwUniCluster in particular.&lt;br /&gt;
&lt;br /&gt;
= Components of DACHS =&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! style=&amp;quot;width:9%&amp;quot;|&lt;br /&gt;
! style=&amp;quot;width:13%&amp;quot;| Compute nodes &amp;quot;L40S&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:13%&amp;quot;| Compute nodes &amp;quot;H100&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:13%&amp;quot;| Compute nodes &amp;quot;AMD_APU&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:13%&amp;quot;| Login&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Availability in Queue&lt;br /&gt;
| gpu1&lt;br /&gt;
| gpu8&lt;br /&gt;
| gpu401&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Number of nodes&lt;br /&gt;
| 45&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Processors&lt;br /&gt;
| AMD EPYC 9254&lt;br /&gt;
| AMD EPYC 9454&lt;br /&gt;
| AMD MI300A&lt;br /&gt;
| AMD EPYC 9254&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Number of sockets&lt;br /&gt;
| 2&lt;br /&gt;
| 2&lt;br /&gt;
| 4&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Processor frequency (GHz)&lt;br /&gt;
| 2.9 Ghz&lt;br /&gt;
| 2.75 Ghz&lt;br /&gt;
| 2.1 Ghz&lt;br /&gt;
| 2.9 Ghz&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Total number of cores&lt;br /&gt;
| 48&lt;br /&gt;
| 96&lt;br /&gt;
| 96&lt;br /&gt;
| 48&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Main memory&lt;br /&gt;
| 384 GB&lt;br /&gt;
| 1536 GB&lt;br /&gt;
| 512 GB&lt;br /&gt;
| 384 GB&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Local SSD&lt;br /&gt;
| 1,92 TB NVMe&lt;br /&gt;
| 1,92 TB NVMe&lt;br /&gt;
| 1,92 TB NVMe&lt;br /&gt;
| 1,92 TB NVMe&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Accelerators&lt;br /&gt;
| 1x NVIDIA L40S&lt;br /&gt;
| 8x NVIDIA H100&lt;br /&gt;
| 4x AMD MI300A&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Accelerator memory&lt;br /&gt;
| 48 GB&lt;br /&gt;
| 8x 80 GB&lt;br /&gt;
| 4x 128 GB&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Interconnect&lt;br /&gt;
| IB HDR100&lt;br /&gt;
| IB HDR100&lt;br /&gt;
| IB HDR100&lt;br /&gt;
| IB HDR100&lt;br /&gt;
|}&lt;br /&gt;
Table 1: Properties of the nodes&lt;br /&gt;
&lt;br /&gt;
== Storage Architecture ==&lt;br /&gt;
The system features a 700 TB large BeeGFS filesystem available on login and compute nodes.&lt;br /&gt;
Please note: there is a hard file size quota per partner organization and a soft quota per user on Your HOME.&lt;br /&gt;
Users will be notified by E-Mail if the quota is to be reached.&lt;br /&gt;
&lt;br /&gt;
Please &#039;&#039;&#039;do make usage&#039;&#039;&#039; of [[Workspace | Work Space mechanism]] for larger files.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Registration/bwUniCluster/Entitlement&amp;diff=14860</id>
		<title>Registration/bwUniCluster/Entitlement</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Registration/bwUniCluster/Entitlement&amp;diff=14860"/>
		<updated>2025-05-19T04:58:15Z</updated>

		<summary type="html">&lt;p&gt;R Keller: Update web-link to HS Esslingen&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
The bwUniCluster entitlement (see [https://www.bwidm.de/attribute.php#Berechtigung eduPersonEntitlement]) issued by a university assures the operator of the clusters, that its university member&#039;s compute activities comply with the German Foreign Trade Act (Außenwirtschaftsgesetz - AWG) and German Foreign Trade Regulations (Außenwirtschaftsverordnung - AWV). &#039;&#039;Please check&#039;&#039; the regulations at the Federal Office of Economics and Export Control (BAFA) under [https://www.bafa.de/DE/Aussenwirtschaft/Ausfuhrkontrolle/Allgemeine_Einfuehrung/allgemeine_einfuehrung_node.html BAFA Aussenwirtschaft Ausfuhrkontrolle]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Step A: bwUniCluster Entitlement =&lt;br /&gt;
&lt;br /&gt;
To register for the bwUniCluster 3.0 you need the  &#039;&#039;&#039;bwUniCluster Entitlement&#039;&#039;&#039; issued by your university.&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
The entitlement is called &#039;&#039;&#039;bwUniCluster&#039;&#039;&#039; (and not bwUniCluster 3.0) and each university assigns the entitlement &#039;&#039;&#039;only&#039;&#039;&#039; for its own members.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you are not sure if you already have an entitlement, please check it first with the [[Registration/bwUniCluster/Entitlement#Check_your_Entitlements|&#039;&#039;&#039;Check your Entitlements&#039;&#039;&#039;]] guide below.&lt;br /&gt;
If you need the entitlement, please follow the link for your institution or contact your local service desk if no information is provided:&lt;br /&gt;
* [https://www.hs-esslingen.de/informatik-und-informationstechnik/forschung-labore/forschung/laufende-projekte/bwhpc-s5 Hochschule Esslingen]&lt;br /&gt;
* [[BwCluster_User_Access_Uni_Freiburg|Universität Freiburg]]&lt;br /&gt;
* [https://heiservices.uni-heidelberg.de/entitlement Universität Heidelberg] (access only within Uni Heidelberg network)&lt;br /&gt;
* [https://kim.uni-hohenheim.de/bwhpc-account Universität Hohenheim]&lt;br /&gt;
* [https://www.scc.kit.edu/downloads/ISM/SD-HPC-Formulare/Accessform_bwUniCluster3_v1_DE_EN_2025.pdf Karlsruhe Institute of Technology (KIT)]&lt;br /&gt;
* [https://www.kim.uni-konstanz.de/en/services/research-and-teaching/high-performance-computing/access-to-bwunicluster Universität Konstanz]&lt;br /&gt;
* [[BWUniCluster_User_Access_Members_Uni_Mannheim|Universität Mannheim]]&lt;br /&gt;
* [https://www.hlrs.de/apply-for-computing-time/bw-uni-cluster Universität Stuttgart]&lt;br /&gt;
* [https://uni-tuebingen.de/de/155157 Universität Tübingen]&lt;br /&gt;
* [[BWUniCluster_User_Access_Members_Uni_Ulm|Universität Ulm]]&lt;br /&gt;
* [[Registration/HAW|HAW BW e.V.]] and Duale Hochschule Baden-Württemberg: Please contact your local service desk / compute center in case of question contact  [mailto:hpc-at-haw@hs-esslingen.de mailto:hpc-at-haw@hs-esslingen.de]&lt;br /&gt;
&lt;br /&gt;
== Check your Entitlements ==&lt;br /&gt;
&lt;br /&gt;
To make sure you do not already have the entitlement, please log in to &#039;&#039;&#039;https://login.bwidm.de/user/index.xhtml&#039;&#039;&#039;.&lt;br /&gt;
To see the list of your entitlements, first select the &#039;&#039;&#039;Shibboleth&#039;&#039;&#039; tab at the top.&lt;br /&gt;
If the list below &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;urn:oid:1.3.6.1.4.1.5923.1.1.1.7&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; contains&lt;br /&gt;
&amp;lt;pre&amp;gt;http://bwidm.de/entitlement/bwUniCluster&amp;lt;/pre&amp;gt;&lt;br /&gt;
you already have the entitlement and can skip step A.&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://bwidm.de/entitlement/bwUniCluster&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is an attribute and not a link!&lt;br /&gt;
See [https://www.bwidm.de/dienste.php bwUniCluster und bwForCluster] for more information about needed attributes for this service.&lt;br /&gt;
|}&lt;br /&gt;
[[File:BwIDM-idp.png|center|600px|thumb|Verify Entitlement.]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align:right;&amp;quot;&amp;gt;[[Registration/bwUniCluster/Service | Go to step B]]&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Queues&amp;diff=14836</id>
		<title>DACHS/Queues</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Queues&amp;diff=14836"/>
		<updated>2025-05-14T08:46:29Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* sbatch -p partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Partitions ==&lt;br /&gt;
DACHS offers three partitions in Slurm, which map directly to the node types: nodes with one NVIDIA L40S GPU, a node with 4 AMD MI300A APUs and the node with 8 NVIDIA H100 GPUs.&lt;br /&gt;
&lt;br /&gt;
== sinfo_t_idle ==&lt;br /&gt;
To see the available nodes, DACHS offers the tool &#039;&#039;sinfo_t_info&#039;&#039;, which any user may call.&lt;br /&gt;
&lt;br /&gt;
== sbatch -p &#039;&#039;partition&#039;&#039; ==&lt;br /&gt;
Batch jobs specify compute requirements, which must fit the resources as in maximum (wall-)time, memory and GPU resources.&lt;br /&gt;
If You require a GPU, You must specify this with your request.&lt;br /&gt;
These are restricted and must fit the available &#039;&#039;&#039;partitions&#039;&#039;&#039;.&lt;br /&gt;
Since requested compute resources are NOT always automatically mapped to the correct queue class, &#039;&#039;&#039;you must add the correct queue class to your sbatch command &#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;font color=red&amp;gt;As with bwUniCluster, the specification of a partition is required.&amp;lt;/font&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Details are:&lt;br /&gt;
&lt;br /&gt;
{| width=750px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | DACHS &amp;lt;br&amp;gt; sbatch -p &#039;&#039;partition&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;text-align:left;&amp;quot;&lt;br /&gt;
! partition !! node !! default resources !! maximum resources&lt;br /&gt;
|- style=&amp;quot;text-align:left&amp;quot;&lt;br /&gt;
| gpu1&lt;br /&gt;
| gpu1[01-45]&lt;br /&gt;
| time=30, mem-per-node=5000mb&lt;br /&gt;
| time=72:00:00, nodes=16, mem-per-node=300000mb, res=gpu:1&lt;br /&gt;
|- style=&amp;quot;text-align:left;&amp;quot;&lt;br /&gt;
| gpu4&lt;br /&gt;
| gpu401&lt;br /&gt;
| time=30, mem-per-cpu=5000mb&lt;br /&gt;
| time=72:00:00, nodes=1, mem=500000mb, ntasks-per-node=96&lt;br /&gt;
|- style=&amp;quot;vertical-align:top; text-align:left&amp;quot;&lt;br /&gt;
| gpu8&lt;br /&gt;
| gpu801&lt;br /&gt;
| time=30, mem-per-cpu=5000mb, cpus-per-gpu=8&lt;br /&gt;
| time=48:00:00, mem=752000mb, ntasks-per-node=96&lt;br /&gt;
|- &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Default resources of a queue class defines time, #tasks and memory if not explicitly given with sbatch command. Resource list acronyms &amp;lt;code&amp;gt;--time&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--ntasks&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--nodes&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--mem-per-cpu&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A typical Slurm batch script (called for brevity &amp;lt;code&amp;gt;python_run.slurm&amp;lt;/code&amp;gt;) for 1-node requiring one NVIDIA L40S GPU:&lt;br /&gt;
  #!/bin/bash&lt;br /&gt;
  #SBATCH --partition=gpu1&lt;br /&gt;
  #SBATCH --ntasks-per-gpu=48&lt;br /&gt;
  #SBATCH --gres=gpu:1&lt;br /&gt;
  #SBATCH --time=1:00:00&lt;br /&gt;
  #SBATCH --mail-type=all&lt;br /&gt;
  #SBATCH --mail-user=my_email@hs-esslingen.de&lt;br /&gt;
  module load devel/cuda/12.4&lt;br /&gt;
  cd $TMPDIR&lt;br /&gt;
  python3 -m venv my_environment&lt;br /&gt;
  . my_environment/bin/activate&lt;br /&gt;
  python3 -m pip install -r $HOME/my_requirements.txt&lt;br /&gt;
  rsync -avz $HOME/my_data_dir/ .&lt;br /&gt;
  time python3 $HOME/python_script.py&lt;br /&gt;
&lt;br /&gt;
Submitting &amp;lt;code&amp;gt;sbatch python_run.slurm&amp;lt;/code&amp;gt; will allocate one compute node and allocate the one available GPU for 1 hour. Furthermore, this will load the CUDA module version 12.4. It will then change to the &#039;&#039;&#039;fast&#039;&#039;&#039; scratch directory specified in the environment variable &amp;lt;code&amp;gt;TMPDIR&amp;lt;/code&amp;gt;.&lt;br /&gt;
You &#039;&#039;&#039;have&#039;&#039;&#039; to allocate the GPU, otherwise You may not use it.&lt;br /&gt;
It will then follow Python&#039;s best practices and create a new Virtual Environment in that directory, then installing the dependencies of the projects detailed in &amp;lt;code&amp;gt;my_requirements.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
It then copies the data directory in &amp;lt;code&amp;gt;my_data_dir&amp;lt;/code&amp;gt; to this directory using &amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;.&lt;br /&gt;
Finally, it executes your main python script, using the time command to figure out, how much time actually was used.&lt;br /&gt;
Alternatively you may time all the commands to get an estimate for Your next batch job.&lt;br /&gt;
&lt;br /&gt;
Here, Slurm will email to the specified address upon start and completion of the job with a summary.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;better&#039;&#039;&#039; your approximation, the better the Slurm scheduler may allocate resources to all users.&lt;br /&gt;
&lt;br /&gt;
== Interactive usage ==&lt;br /&gt;
To &#039;&#039;&#039;get a good estimation&#039;&#039;&#039; of runtime, You may first want to try the resource &#039;&#039;interactively&#039;&#039;:&lt;br /&gt;
    srun --partition=gpu1 --ntasks-per-gpu=48 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
&lt;br /&gt;
Then You may execute the steps in &amp;lt;code&amp;gt;python_run.slurm&amp;lt;/code&amp;gt; script interactively, noting differences and amend your Slurm batch script.&lt;br /&gt;
&#039;&#039;Please note&#039;&#039; the &amp;lt;code&amp;gt;--pty&amp;lt;/code&amp;gt; which forwards the standard output and takes standard input to allow working with the Shell.&lt;br /&gt;
&lt;br /&gt;
== Multiple nodes ==&lt;br /&gt;
Of course You may allocate multiple GPUs across nodes running:&lt;br /&gt;
    sbatch --nodes 4 ./python_run.slurm&lt;br /&gt;
Please be aware, that TMPDIR is still local. For the time being run from Your $HOME or better yet from an allocated [[Workspace]].&lt;br /&gt;
&lt;br /&gt;
== Nodes with multiple GPUs == &lt;br /&gt;
The partitions &amp;lt;code&amp;gt;gpu4&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;gpu8&amp;lt;/code&amp;gt; feature multiple GPUs.&lt;br /&gt;
The &amp;lt;code&amp;gt;gpu4&amp;lt;/code&amp;gt; partition contains the node &amp;lt;code&amp;gt;gpu401&amp;lt;/code&amp;gt; featuring 4x AMD MI300A APUs each with 128GB of fast HMB3e memory shared between the 24 cores and the GPU.&lt;br /&gt;
You may use AMD&#039;s ROCm employing HIP, OpenACC or OpenCL to parallelize for the GPU. Please refer to the documentation on this node.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;gpu8&amp;lt;/code&amp;gt; partition contains the node &amp;lt;code&amp;gt;gpu801&amp;lt;/code&amp;gt; featuring 8x NVIDIA H100 offering 80GB of VRAM each, interconnected using SXM5.&lt;br /&gt;
Please refer to the documentation on this node.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Queues&amp;diff=14835</id>
		<title>DACHS/Queues</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Queues&amp;diff=14835"/>
		<updated>2025-05-14T08:45:55Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Multiple nodes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Partitions ==&lt;br /&gt;
DACHS offers three partitions in Slurm, which map directly to the node types: nodes with one NVIDIA L40S GPU, a node with 4 AMD MI300A APUs and the node with 8 NVIDIA H100 GPUs.&lt;br /&gt;
&lt;br /&gt;
== sinfo_t_idle ==&lt;br /&gt;
To see the available nodes, DACHS offers the tool &#039;&#039;sinfo_t_info&#039;&#039;, which any user may call.&lt;br /&gt;
&lt;br /&gt;
== sbatch -p &#039;&#039;partition&#039;&#039; ==&lt;br /&gt;
Batch jobs specify compute requirements, which must fit the resources as in maximum (wall-)time, memory and GPU resources.&lt;br /&gt;
If You require a GPU, You must specify this with your request.&lt;br /&gt;
These are restricted and must fit the available &#039;&#039;&#039;partitions&#039;&#039;&#039;.&lt;br /&gt;
Since requested compute resources are NOT always automatically mapped to the correct queue class, &#039;&#039;&#039;you must add the correct queue class to your sbatch command &#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;font color=red&amp;gt;As with BwUniCluster 2.0, the specification of a partition is required.&amp;lt;/font&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Details are:&lt;br /&gt;
&lt;br /&gt;
{| width=750px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | DACHS &amp;lt;br&amp;gt; sbatch -p &#039;&#039;partition&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;text-align:left;&amp;quot;&lt;br /&gt;
! partition !! node !! default resources !! maximum resources&lt;br /&gt;
|- style=&amp;quot;text-align:left&amp;quot;&lt;br /&gt;
| gpu1&lt;br /&gt;
| gpu1[01-45]&lt;br /&gt;
| time=30, mem-per-node=5000mb&lt;br /&gt;
| time=72:00:00, nodes=16, mem-per-node=300000mb, res=gpu:1&lt;br /&gt;
|- style=&amp;quot;text-align:left;&amp;quot;&lt;br /&gt;
| gpu4&lt;br /&gt;
| gpu401&lt;br /&gt;
| time=30, mem-per-cpu=5000mb&lt;br /&gt;
| time=72:00:00, nodes=1, mem=500000mb, ntasks-per-node=96&lt;br /&gt;
|- style=&amp;quot;vertical-align:top; text-align:left&amp;quot;&lt;br /&gt;
| gpu8&lt;br /&gt;
| gpu801&lt;br /&gt;
| time=30, mem-per-cpu=5000mb, cpus-per-gpu=8&lt;br /&gt;
| time=48:00:00, mem=752000mb, ntasks-per-node=96&lt;br /&gt;
|- &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Default resources of a queue class defines time, #tasks and memory if not explicitly given with sbatch command. Resource list acronyms &amp;lt;code&amp;gt;--time&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--ntasks&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--nodes&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--mem-per-cpu&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A typical Slurm batch script (called for brevity &amp;lt;code&amp;gt;python_run.slurm&amp;lt;/code&amp;gt;) for 1-node requiring one NVIDIA L40S GPU:&lt;br /&gt;
  #!/bin/bash&lt;br /&gt;
  #SBATCH --partition=gpu1&lt;br /&gt;
  #SBATCH --ntasks-per-gpu=48&lt;br /&gt;
  #SBATCH --gres=gpu:1&lt;br /&gt;
  #SBATCH --time=1:00:00&lt;br /&gt;
  #SBATCH --mail-type=all&lt;br /&gt;
  #SBATCH --mail-user=my_email@hs-esslingen.de&lt;br /&gt;
  module load devel/cuda/12.4&lt;br /&gt;
  cd $TMPDIR&lt;br /&gt;
  python3 -m venv my_environment&lt;br /&gt;
  . my_environment/bin/activate&lt;br /&gt;
  python3 -m pip install -r $HOME/my_requirements.txt&lt;br /&gt;
  rsync -avz $HOME/my_data_dir/ .&lt;br /&gt;
  time python3 $HOME/python_script.py&lt;br /&gt;
&lt;br /&gt;
Submitting &amp;lt;code&amp;gt;sbatch python_run.slurm&amp;lt;/code&amp;gt; will allocate one compute node and allocate the one available GPU for 1 hour. Furthermore, this will load the CUDA module version 12.4. It will then change to the &#039;&#039;&#039;fast&#039;&#039;&#039; scratch directory specified in the environment variable &amp;lt;code&amp;gt;TMPDIR&amp;lt;/code&amp;gt;.&lt;br /&gt;
You &#039;&#039;&#039;have&#039;&#039;&#039; to allocate the GPU, otherwise You may not use it.&lt;br /&gt;
It will then follow Python&#039;s best practices and create a new Virtual Environment in that directory, then installing the dependencies of the projects detailed in &amp;lt;code&amp;gt;my_requirements.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
It then copies the data directory in &amp;lt;code&amp;gt;my_data_dir&amp;lt;/code&amp;gt; to this directory using &amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;.&lt;br /&gt;
Finally, it executes your main python script, using the time command to figure out, how much time actually was used.&lt;br /&gt;
Alternatively you may time all the commands to get an estimate for Your next batch job.&lt;br /&gt;
&lt;br /&gt;
Here, Slurm will email to the specified address upon start and completion of the job with a summary.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;better&#039;&#039;&#039; your approximation, the better the Slurm scheduler may allocate resources to all users.&lt;br /&gt;
&lt;br /&gt;
== Interactive usage ==&lt;br /&gt;
To &#039;&#039;&#039;get a good estimation&#039;&#039;&#039; of runtime, You may first want to try the resource &#039;&#039;interactively&#039;&#039;:&lt;br /&gt;
    srun --partition=gpu1 --ntasks-per-gpu=48 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
&lt;br /&gt;
Then You may execute the steps in &amp;lt;code&amp;gt;python_run.slurm&amp;lt;/code&amp;gt; script interactively, noting differences and amend your Slurm batch script.&lt;br /&gt;
&#039;&#039;Please note&#039;&#039; the &amp;lt;code&amp;gt;--pty&amp;lt;/code&amp;gt; which forwards the standard output and takes standard input to allow working with the Shell.&lt;br /&gt;
&lt;br /&gt;
== Multiple nodes ==&lt;br /&gt;
Of course You may allocate multiple GPUs across nodes running:&lt;br /&gt;
    sbatch --nodes 4 ./python_run.slurm&lt;br /&gt;
Please be aware, that TMPDIR is still local. For the time being run from Your $HOME or better yet from an allocated [[Workspace]].&lt;br /&gt;
&lt;br /&gt;
== Nodes with multiple GPUs == &lt;br /&gt;
The partitions &amp;lt;code&amp;gt;gpu4&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;gpu8&amp;lt;/code&amp;gt; feature multiple GPUs.&lt;br /&gt;
The &amp;lt;code&amp;gt;gpu4&amp;lt;/code&amp;gt; partition contains the node &amp;lt;code&amp;gt;gpu401&amp;lt;/code&amp;gt; featuring 4x AMD MI300A APUs each with 128GB of fast HMB3e memory shared between the 24 cores and the GPU.&lt;br /&gt;
You may use AMD&#039;s ROCm employing HIP, OpenACC or OpenCL to parallelize for the GPU. Please refer to the documentation on this node.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;gpu8&amp;lt;/code&amp;gt; partition contains the node &amp;lt;code&amp;gt;gpu801&amp;lt;/code&amp;gt; featuring 8x NVIDIA H100 offering 80GB of VRAM each, interconnected using SXM5.&lt;br /&gt;
Please refer to the documentation on this node.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Queues&amp;diff=14834</id>
		<title>DACHS/Queues</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Queues&amp;diff=14834"/>
		<updated>2025-05-14T08:44:51Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Nodes with multiple GPUs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Partitions ==&lt;br /&gt;
DACHS offers three partitions in Slurm, which map directly to the node types: nodes with one NVIDIA L40S GPU, a node with 4 AMD MI300A APUs and the node with 8 NVIDIA H100 GPUs.&lt;br /&gt;
&lt;br /&gt;
== sinfo_t_idle ==&lt;br /&gt;
To see the available nodes, DACHS offers the tool &#039;&#039;sinfo_t_info&#039;&#039;, which any user may call.&lt;br /&gt;
&lt;br /&gt;
== sbatch -p &#039;&#039;partition&#039;&#039; ==&lt;br /&gt;
Batch jobs specify compute requirements, which must fit the resources as in maximum (wall-)time, memory and GPU resources.&lt;br /&gt;
If You require a GPU, You must specify this with your request.&lt;br /&gt;
These are restricted and must fit the available &#039;&#039;&#039;partitions&#039;&#039;&#039;.&lt;br /&gt;
Since requested compute resources are NOT always automatically mapped to the correct queue class, &#039;&#039;&#039;you must add the correct queue class to your sbatch command &#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;font color=red&amp;gt;As with BwUniCluster 2.0, the specification of a partition is required.&amp;lt;/font&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Details are:&lt;br /&gt;
&lt;br /&gt;
{| width=750px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | DACHS &amp;lt;br&amp;gt; sbatch -p &#039;&#039;partition&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;text-align:left;&amp;quot;&lt;br /&gt;
! partition !! node !! default resources !! maximum resources&lt;br /&gt;
|- style=&amp;quot;text-align:left&amp;quot;&lt;br /&gt;
| gpu1&lt;br /&gt;
| gpu1[01-45]&lt;br /&gt;
| time=30, mem-per-node=5000mb&lt;br /&gt;
| time=72:00:00, nodes=16, mem-per-node=300000mb, res=gpu:1&lt;br /&gt;
|- style=&amp;quot;text-align:left;&amp;quot;&lt;br /&gt;
| gpu4&lt;br /&gt;
| gpu401&lt;br /&gt;
| time=30, mem-per-cpu=5000mb&lt;br /&gt;
| time=72:00:00, nodes=1, mem=500000mb, ntasks-per-node=96&lt;br /&gt;
|- style=&amp;quot;vertical-align:top; text-align:left&amp;quot;&lt;br /&gt;
| gpu8&lt;br /&gt;
| gpu801&lt;br /&gt;
| time=30, mem-per-cpu=5000mb, cpus-per-gpu=8&lt;br /&gt;
| time=48:00:00, mem=752000mb, ntasks-per-node=96&lt;br /&gt;
|- &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Default resources of a queue class defines time, #tasks and memory if not explicitly given with sbatch command. Resource list acronyms &amp;lt;code&amp;gt;--time&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--ntasks&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--nodes&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--mem-per-cpu&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A typical Slurm batch script (called for brevity &amp;lt;code&amp;gt;python_run.slurm&amp;lt;/code&amp;gt;) for 1-node requiring one NVIDIA L40S GPU:&lt;br /&gt;
  #!/bin/bash&lt;br /&gt;
  #SBATCH --partition=gpu1&lt;br /&gt;
  #SBATCH --ntasks-per-gpu=48&lt;br /&gt;
  #SBATCH --gres=gpu:1&lt;br /&gt;
  #SBATCH --time=1:00:00&lt;br /&gt;
  #SBATCH --mail-type=all&lt;br /&gt;
  #SBATCH --mail-user=my_email@hs-esslingen.de&lt;br /&gt;
  module load devel/cuda/12.4&lt;br /&gt;
  cd $TMPDIR&lt;br /&gt;
  python3 -m venv my_environment&lt;br /&gt;
  . my_environment/bin/activate&lt;br /&gt;
  python3 -m pip install -r $HOME/my_requirements.txt&lt;br /&gt;
  rsync -avz $HOME/my_data_dir/ .&lt;br /&gt;
  time python3 $HOME/python_script.py&lt;br /&gt;
&lt;br /&gt;
Submitting &amp;lt;code&amp;gt;sbatch python_run.slurm&amp;lt;/code&amp;gt; will allocate one compute node and allocate the one available GPU for 1 hour. Furthermore, this will load the CUDA module version 12.4. It will then change to the &#039;&#039;&#039;fast&#039;&#039;&#039; scratch directory specified in the environment variable &amp;lt;code&amp;gt;TMPDIR&amp;lt;/code&amp;gt;.&lt;br /&gt;
You &#039;&#039;&#039;have&#039;&#039;&#039; to allocate the GPU, otherwise You may not use it.&lt;br /&gt;
It will then follow Python&#039;s best practices and create a new Virtual Environment in that directory, then installing the dependencies of the projects detailed in &amp;lt;code&amp;gt;my_requirements.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
It then copies the data directory in &amp;lt;code&amp;gt;my_data_dir&amp;lt;/code&amp;gt; to this directory using &amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;.&lt;br /&gt;
Finally, it executes your main python script, using the time command to figure out, how much time actually was used.&lt;br /&gt;
Alternatively you may time all the commands to get an estimate for Your next batch job.&lt;br /&gt;
&lt;br /&gt;
Here, Slurm will email to the specified address upon start and completion of the job with a summary.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;better&#039;&#039;&#039; your approximation, the better the Slurm scheduler may allocate resources to all users.&lt;br /&gt;
&lt;br /&gt;
== Interactive usage ==&lt;br /&gt;
To &#039;&#039;&#039;get a good estimation&#039;&#039;&#039; of runtime, You may first want to try the resource &#039;&#039;interactively&#039;&#039;:&lt;br /&gt;
    srun --partition=gpu1 --ntasks-per-gpu=48 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
&lt;br /&gt;
Then You may execute the steps in &amp;lt;code&amp;gt;python_run.slurm&amp;lt;/code&amp;gt; script interactively, noting differences and amend your Slurm batch script.&lt;br /&gt;
&#039;&#039;Please note&#039;&#039; the &amp;lt;code&amp;gt;--pty&amp;lt;/code&amp;gt; which forwards the standard output and takes standard input to allow working with the Shell.&lt;br /&gt;
&lt;br /&gt;
== Multiple nodes ==&lt;br /&gt;
Of course You may allocate multiple GPUs across nodes running:&lt;br /&gt;
    sbatch --nodes 4 ./python_run.slurm&lt;br /&gt;
Please be aware, that TMPDIR is still local. For the time being run from Your $HOME.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Nodes with multiple GPUs == &lt;br /&gt;
The partitions &amp;lt;code&amp;gt;gpu4&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;gpu8&amp;lt;/code&amp;gt; feature multiple GPUs.&lt;br /&gt;
The &amp;lt;code&amp;gt;gpu4&amp;lt;/code&amp;gt; partition contains the node &amp;lt;code&amp;gt;gpu401&amp;lt;/code&amp;gt; featuring 4x AMD MI300A APUs each with 128GB of fast HMB3e memory shared between the 24 cores and the GPU.&lt;br /&gt;
You may use AMD&#039;s ROCm employing HIP, OpenACC or OpenCL to parallelize for the GPU. Please refer to the documentation on this node.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;gpu8&amp;lt;/code&amp;gt; partition contains the node &amp;lt;code&amp;gt;gpu801&amp;lt;/code&amp;gt; featuring 8x NVIDIA H100 offering 80GB of VRAM each, interconnected using SXM5.&lt;br /&gt;
Please refer to the documentation on this node.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Queues&amp;diff=14379</id>
		<title>DACHS/Queues</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Queues&amp;diff=14379"/>
		<updated>2025-03-18T13:25:20Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Interactive usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Partitions ==&lt;br /&gt;
DACHS offers three partitions in Slurm, which map directly to the node types: nodes with one NVIDIA L40S GPU, a node with 4 AMD MI300A APUs and the node with 8 NVIDIA H100 GPUs.&lt;br /&gt;
&lt;br /&gt;
== sinfo_t_idle ==&lt;br /&gt;
To see the available nodes, DACHS offers the tool &#039;&#039;sinfo_t_info&#039;&#039;, which any user may call.&lt;br /&gt;
&lt;br /&gt;
== sbatch -p &#039;&#039;partition&#039;&#039; ==&lt;br /&gt;
Batch jobs specify compute requirements, which must fit the resources as in maximum (wall-)time, memory and GPU resources.&lt;br /&gt;
If You require a GPU, You must specify this with your request.&lt;br /&gt;
These are restricted and must fit the available &#039;&#039;&#039;partitions&#039;&#039;&#039;.&lt;br /&gt;
Since requested compute resources are NOT always automatically mapped to the correct queue class, &#039;&#039;&#039;you must add the correct queue class to your sbatch command &#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;font color=red&amp;gt;As with BwUniCluster 2.0, the specification of a partition is required.&amp;lt;/font&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Details are:&lt;br /&gt;
&lt;br /&gt;
{| width=750px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | DACHS &amp;lt;br&amp;gt; sbatch -p &#039;&#039;partition&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;text-align:left;&amp;quot;&lt;br /&gt;
! partition !! node !! default resources !! maximum resources&lt;br /&gt;
|- style=&amp;quot;text-align:left&amp;quot;&lt;br /&gt;
| gpu1&lt;br /&gt;
| gpu1[01-45]&lt;br /&gt;
| time=30, mem-per-node=5000mb&lt;br /&gt;
| time=72:00:00, nodes=16, mem-per-node=300000mb, res=gpu:1&lt;br /&gt;
|- style=&amp;quot;text-align:left;&amp;quot;&lt;br /&gt;
| gpu4&lt;br /&gt;
| gpu401&lt;br /&gt;
| time=30, mem-per-cpu=5000mb&lt;br /&gt;
| time=72:00:00, nodes=1, mem=500000mb, ntasks-per-node=96&lt;br /&gt;
|- style=&amp;quot;vertical-align:top; text-align:left&amp;quot;&lt;br /&gt;
| gpu8&lt;br /&gt;
| gpu801&lt;br /&gt;
| time=30, mem-per-cpu=5000mb, cpus-per-gpu=8&lt;br /&gt;
| time=48:00:00, mem=752000mb, ntasks-per-node=96&lt;br /&gt;
|- &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Default resources of a queue class defines time, #tasks and memory if not explicitly given with sbatch command. Resource list acronyms &amp;lt;code&amp;gt;--time&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--ntasks&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--nodes&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--mem-per-cpu&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A typical Slurm batch script (called for brevity &amp;lt;code&amp;gt;python_run.slurm&amp;lt;/code&amp;gt;) for 1-node requiring one NVIDIA L40S GPU:&lt;br /&gt;
  #!/bin/bash&lt;br /&gt;
  #SBATCH --partition=gpu1&lt;br /&gt;
  #SBATCH --ntasks-per-gpu=48&lt;br /&gt;
  #SBATCH --gres=gpu:1&lt;br /&gt;
  #SBATCH --time=1:00:00&lt;br /&gt;
  #SBATCH --mail-type=all&lt;br /&gt;
  #SBATCH --mail-user=my_email@hs-esslingen.de&lt;br /&gt;
  module load devel/cuda/12.4&lt;br /&gt;
  cd $TMPDIR&lt;br /&gt;
  python3 -m venv my_environment&lt;br /&gt;
  . my_environment/bin/activate&lt;br /&gt;
  python3 -m pip install -r $HOME/my_requirements.txt&lt;br /&gt;
  rsync -avz $HOME/my_data_dir/ .&lt;br /&gt;
  time python3 $HOME/python_script.py&lt;br /&gt;
&lt;br /&gt;
Submitting &amp;lt;code&amp;gt;sbatch python_run.slurm&amp;lt;/code&amp;gt; will allocate one compute node and allocate the one available GPU for 1 hour. Furthermore, this will load the CUDA module version 12.4. It will then change to the &#039;&#039;&#039;fast&#039;&#039;&#039; scratch directory specified in the environment variable &amp;lt;code&amp;gt;TMPDIR&amp;lt;/code&amp;gt;.&lt;br /&gt;
You &#039;&#039;&#039;have&#039;&#039;&#039; to allocate the GPU, otherwise You may not use it.&lt;br /&gt;
It will then follow Python&#039;s best practices and create a new Virtual Environment in that directory, then installing the dependencies of the projects detailed in &amp;lt;code&amp;gt;my_requirements.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
It then copies the data directory in &amp;lt;code&amp;gt;my_data_dir&amp;lt;/code&amp;gt; to this directory using &amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;.&lt;br /&gt;
Finally, it executes your main python script, using the time command to figure out, how much time actually was used.&lt;br /&gt;
Alternatively you may time all the commands to get an estimate for Your next batch job.&lt;br /&gt;
&lt;br /&gt;
Here, Slurm will email to the specified address upon start and completion of the job with a summary.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;better&#039;&#039;&#039; your approximation, the better the Slurm scheduler may allocate resources to all users.&lt;br /&gt;
&lt;br /&gt;
== Interactive usage ==&lt;br /&gt;
To &#039;&#039;&#039;get a good estimation&#039;&#039;&#039; of runtime, You may first want to try the resource &#039;&#039;interactively&#039;&#039;:&lt;br /&gt;
    srun --partition=gpu1 --ntasks-per-gpu=48 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
&lt;br /&gt;
Then You may execute the steps in &amp;lt;code&amp;gt;python_run.slurm&amp;lt;/code&amp;gt; script interactively, noting differences and amend your Slurm batch script.&lt;br /&gt;
&#039;&#039;Please note&#039;&#039; the &amp;lt;code&amp;gt;--pty&amp;lt;/code&amp;gt; which forwards the standard output and takes standard input to allow working with the Shell.&lt;br /&gt;
&lt;br /&gt;
== Multiple nodes ==&lt;br /&gt;
Of course You may allocate multiple GPUs across nodes running:&lt;br /&gt;
    sbatch --nodes 4 ./python_run.slurm&lt;br /&gt;
Please be aware, that TMPDIR is still local. For the time being run from Your $HOME.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Nodes with multiple GPUs == &lt;br /&gt;
The partitions &amp;lt;code&amp;gt;gpu4&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;gpu8&amp;lt;/code&amp;gt; feature multiple GPUs.&lt;br /&gt;
The &amp;lt;code&amp;gt;gpu4&amp;lt;/code&amp;gt; partition contains the node &amp;lt;code&amp;gt;gpu401&amp;lt;/code&amp;gt; featuring 4 AMD MI300A APUs with 128GB of memory each using ROCm.&lt;br /&gt;
Please refer to the documentation on this node.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;gpu8&amp;lt;/code&amp;gt; partition contains the node &amp;lt;code&amp;gt;gpu401&amp;lt;/code&amp;gt; featuring 4 AMD MI300A APUs with 128GB of memory each using ROCm.&lt;br /&gt;
Please refer to the documentation on this node.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Login&amp;diff=14169</id>
		<title>DACHS/Login</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Login&amp;diff=14169"/>
		<updated>2025-02-26T22:09:46Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
Access to DACHS is &#039;&#039;&#039;limited to IP addresses from the BelWü network&#039;&#039;&#039;.&lt;br /&gt;
All home institutions of our current users are connected to BelWü, so if you are on your campus network (e.g. in your office or on the Campus WiFi) you should be able to connect to DACHS without restrictions.&lt;br /&gt;
If you are outside one of the BelWü networks (e.g. at home), a VPN connection to the home institution or a connection to an SSH jump host at the home institution must be established first.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
VPN configured with [https://de.wikipedia.org/wiki/Split_Tunneling SPLIT tunneling mode] will &#039;&#039;&#039;not&#039;&#039;&#039; work, as any traffic not destined to your organizations IP range will not pass through your organizations VPN and hence will again be blocked by the Firewall.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The login nodes of the DACHS cluster are the access points to the compute system, your &amp;lt;code&amp;gt;$HOME&amp;lt;/code&amp;gt; directory and your workspaces.&lt;br /&gt;
All users must log in through these nodes to submit jobs to the cluster.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites for successful login:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You need to have&lt;br /&gt;
* completed the 3-step [[registration]] procedure.&lt;br /&gt;
* [[Registration/Password|set a service password]] for DACHS.&lt;br /&gt;
* [[Registration/2FA|set up a second factor]] for the time-based one-time password (TOTP).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Login to the DACHS =&lt;br /&gt;
&lt;br /&gt;
Login to the DACHS is only possible with a Secure Shell (SSH) client for which you must know your username on the cluster and the hostname of the login nodes.&lt;br /&gt;
For more general information on SSH clients, visit the [[Registration/Login/Client|SSH clients Guide]].&lt;br /&gt;
&lt;br /&gt;
== Username ==&lt;br /&gt;
&lt;br /&gt;
If you want to use DACHS, you need to add a prefix to your local username: &amp;lt;code&amp;gt;prefix_username&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! University !! Prefix&lt;br /&gt;
|-&lt;br /&gt;
| HS Aalen || aa&lt;br /&gt;
|-&lt;br /&gt;
| HS Albstadt-Sigmaringen || as&lt;br /&gt;
|-&lt;br /&gt;
| HS Esslingen || es&lt;br /&gt;
|-&lt;br /&gt;
| HS Heilbronn || hn&lt;br /&gt;
|-&lt;br /&gt;
| HS Karlsruhe || hk&lt;br /&gt;
|-&lt;br /&gt;
| HTWG Konstanz || ht&lt;br /&gt;
|-&lt;br /&gt;
| HS Mannheim || mn&lt;br /&gt;
|-&lt;br /&gt;
| HS Offenburg || of&lt;br /&gt;
|-&lt;br /&gt;
| HS Reutlingen || hr&lt;br /&gt;
|-&lt;br /&gt;
| HfT-Stuttgart || hs&lt;br /&gt;
|-&lt;br /&gt;
| THU-Ulm || hu&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For a full list of user names, you can check the [https://www.bwidm.de/hochschulen.php bwIDM Hochschulen page].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example:&#039;&#039;&#039;&amp;lt;br/&amp;gt;&lt;br /&gt;
If your local username for the University is &amp;lt;code&amp;gt;vwxyz1234&amp;lt;/code&amp;gt; and you are a user from the University of Esslingen this would combine to: &amp;lt;code&amp;gt;es_vwxyz1234&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Hostnames ==&lt;br /&gt;
&lt;br /&gt;
The system has two login nodes.&lt;br /&gt;
The selection of the login node is done automatically.&lt;br /&gt;
If you are logging in multiple times, different sessions might run on different login nodes.&lt;br /&gt;
&lt;br /&gt;
Login to DACHS:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Hostname !! Node type&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;dachs-login.hs-esslingen.de&#039;&#039;&#039; || login to one of the two login nodes&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In general, you should use automatic selection to allow us to balance the load over the two login nodes.&lt;br /&gt;
If you need to connect to specific login node, you can use the following hostnames:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Hostname !! Node type&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;dachs-login1.hs-esslingen.de&#039;&#039;&#039; || DACHS first login node&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;dachs-login2.hs-esslingen.de&#039;&#039;&#039; || DACHS second login node&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you explicitly connect to dachs-login1 but end up on dachs-login2 (or the other way around), then of of them might not be available at the time and you&#039;re automatically redirected to the other one.&lt;br /&gt;
&lt;br /&gt;
== Host Keys ==&lt;br /&gt;
&lt;br /&gt;
When you log in, you may receive the message &amp;lt;code&amp;gt;The authenticity of host &#039;&amp;lt;host address&amp;gt;&#039; can&#039;t be established.&amp;lt;/code&amp;gt; along with the host key fingerprint. This is intended so you can verify the authenticity of the host you are connecting to. Before you continue you should verify, if this fingerprint matches one of the following:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Algorithm !! Fingerprint (SHA256)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;RSA&#039;&#039;&#039; || SHA256:kdvbATXbd/ggG33G7VEw+O+FpJPcZU6XDeFyWXvBkhc&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;ECDSA&#039;&#039;&#039; || SHA256:4Y/LvkPL9g9DZ8JrmTxXsMTIWyM/u/mEEmSB7S/2yyA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;ED25519&#039;&#039;&#039; || SHA256:X9eRJepYD3da3BM1pgiWxnvRc/Pt5eBLUr18tDUsZjU&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Login with SSH command (Linux, Mac, Windows) ==&lt;br /&gt;
&lt;br /&gt;
Most Unix and Unix-like operating systems like Linux, Mac OS and *BSD come with a built-in SSH client provided by the OpenSSH project.&lt;br /&gt;
More recent versions of Windows 10 and Windows 11 using the [https://docs.microsoft.com/en-us/windows/wsl/install Windows Subsystem for Linux] (WSL) also come with a built-in OpenSSH client.&lt;br /&gt;
&lt;br /&gt;
For login use one of the following ssh commands:&lt;br /&gt;
&lt;br /&gt;
 ssh &amp;lt;username&amp;gt;@dachs-login.hs-esslingen.de&lt;br /&gt;
 ssh -l &amp;lt;username&amp;gt; dachs-login.hs-esslingen.de&lt;br /&gt;
&lt;br /&gt;
To run graphical applications, you can use the &amp;lt;code&amp;gt;-X&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-Y&amp;lt;/code&amp;gt; flag to &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 ssh -Y -l &amp;lt;username&amp;gt; dachs-login.hs-esslingen.de&lt;br /&gt;
&lt;br /&gt;
For better performance, we recommend using [[VNC]].&lt;br /&gt;
&lt;br /&gt;
== Login with graphical SSH client (Windows) ==&lt;br /&gt;
&lt;br /&gt;
For Windows we suggest using MobaXterm for login and file transfer.&lt;br /&gt;
 &lt;br /&gt;
Start &#039;&#039;MobaXterm&#039;&#039;, fill in the following fields:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Remote name              : dachs-login.hs-esslingen.de&lt;br /&gt;
Specify user name        : &amp;lt;username&amp;gt;&lt;br /&gt;
Port                     : 22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that click on &#039;ok&#039;. Then a terminal will be opened and there you can enter your credentials.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; When using File transfer with MobaXterm version 23.6 the following configuration change has to be made:&lt;br /&gt;
In the settings in the tab &amp;quot;SSH&amp;quot;, change the option &amp;quot;SSH engine&amp;quot; from &amp;quot;&amp;lt;new&amp;gt;&amp;quot; to &amp;quot;&amp;lt;legacy&amp;gt;&amp;quot;. Then restart MobaXterm&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TODO: We&#039;ll include this when we got Jupyterhub working.&lt;br /&gt;
&lt;br /&gt;
== Login with Jupyterhub ==&lt;br /&gt;
&lt;br /&gt;
TODO: will there be another URL for this? &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Login takes place at:&lt;br /&gt;
* bwUniCluster 2.0: [https://uc2-jupyter.scc.kit.edu uc2-jupyter.scc.kit.edu]&lt;br /&gt;
* SDIL: [https://sdil-jupyter.scc.kit.edu sdil-jupyter.scc.kit.edu]&lt;br /&gt;
&lt;br /&gt;
More Information can be found [[BwUniCluster2.0/Jupyter#Login_process|here]].&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Login Example ==&lt;br /&gt;
&lt;br /&gt;
To log in to DACHS, you must provide your [[Registration/Password|service password]].&lt;br /&gt;
Proceed as follows:&lt;br /&gt;
# Use SSH for a login node.&lt;br /&gt;
# The system will ask for a one-time password &amp;lt;code&amp;gt;Your OTP:&amp;lt;/code&amp;gt;. Please enter your OTP and confirm it with Enter/Return. If you do not have a second factor yet, please create one (see [[Registration/2FA]]).&lt;br /&gt;
# The system will ask you for your service password &amp;lt;code&amp;gt;Password:&amp;lt;/code&amp;gt;. Please enter it and confirm it with Enter/Return. If you do not have a service password yet or have forgotten it, please create one (see [[Registration/Password]]).&lt;br /&gt;
# You will be greeted by the DACHS cluster, followed by a shell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~ $ ssh -l es_vwxyz1234 dachs-login.hs-esslingen.de&lt;br /&gt;
(es_vwxyz1234@dachs-login.hs-esslingen.de) Your OTP: 123456&lt;br /&gt;
(es_vwxyz1234@dachs-login.hs-esslingen.de) Password: &lt;br /&gt;
********************************************************************************&lt;br /&gt;
Last login: Thu Jul  7 18:09:43 2022 from dachs-login.hs-esslingen.de&lt;br /&gt;
********************************************************************************&lt;br /&gt;
[es_vwxyz1234@login1 ~]$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
If your OTP code doesn&#039;t get accepted multiple times in a row, you should first check that the second factor works and is active in the [https://login.bwidm.de/user/twofa.xhtml bwIDM My Tokens section]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- See [[BwUniCluster_2.0/FAQ#Login_Issues|bwUniCluster FAQ]]. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Allowed Activities on Login Nodes =&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
To guarantee usability for all the users of clusters you must not run your compute jobs on the login nodes.&lt;br /&gt;
Compute jobs must be submitted to the queuing system.&lt;br /&gt;
Any compute job running on the login nodes will be terminated without any notice.&lt;br /&gt;
Any long-running compilation or any long-running pre- or post-processing of batch jobs must also be submitted to the queuing system.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The login nodes of the DACHS cluster are the access point to the compute system, your &amp;lt;code&amp;gt;$HOME&amp;lt;/code&amp;gt; directory and your workspaces.&lt;br /&gt;
These nodes are shared with all the users therefore, your activities on the login nodes are limited to primarily set up your batch jobs.&lt;br /&gt;
Your activities may also be:&lt;br /&gt;
* &#039;&#039;&#039;short&#039;&#039;&#039; compilation of your program code and&lt;br /&gt;
* &#039;&#039;&#039;short&#039;&#039;&#039; pre- and post-processing of your batch jobs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
TODO:&lt;br /&gt;
We advise users to use [[BwUniCluster_2.0_Batch_Queues#Interactive_Jobs|interactive jobs]] for compute and memory intensive tasks like compiling.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We advise users to use [[DACHS/Queues|interactive jobs]] for compute and memory intensive tasks like compiling.&lt;br /&gt;
&lt;br /&gt;
= Related Information =&lt;br /&gt;
&lt;br /&gt;
* If you want to reset your service password, consult the [[Registration/Password|Password Guide]].&lt;br /&gt;
* If you want to register a new token for the two factor authentication (2FA), consult the [[Registration/2FA|2FA Guide]].&lt;br /&gt;
* If you want to de-register, consult the [[Registration/Deregistration|De-registration Guide]].&lt;br /&gt;
* If you need an SSH key for your workflow, read [[Registration/SSH|Registering SSH Keys with your Cluster]].&lt;br /&gt;
* Configuring your shell: [[.bashrc Do&#039;s and Don&#039;ts]]&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=14036</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=14036"/>
		<updated>2025-02-21T15:37:21Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Best Practice */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU -&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#FEF4AB; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#FEF4AB; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#FEF4AB; text-align:left&amp;quot;|&lt;br /&gt;
Please note: this module started off in the Category &amp;lt;code&amp;gt;devel&amp;lt;/code&amp;gt;, but has been moved to the correct category computer science, or short &amp;lt;code&amp;gt;cs&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
 ws_allocate ollama_models 60&lt;br /&gt;
 ln -s `ws_find ollama_models`/ ~/.ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
 srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the node&#039;s name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and pull a LLM (please check [https://ollama.com/search] for available models):&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
 export OLLAMA_HOST=uc2n520&lt;br /&gt;
 ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#dedefe; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#dedefe; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Info.svg|center]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#dedefe; text-align:left&amp;quot;|&lt;br /&gt;
On GPUs with 48GB VRAM like NVIDIA L40S, you may want to use the 70b model of Deepseek, i.e. &amp;lt;code&amp;gt;ollama pull deepseek-r1:70b&amp;lt;/code&amp;gt; and amend the below commands accordingly.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
 ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
 Your OTP: 123456&lt;br /&gt;
 Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
 python -m venv ollama_test&lt;br /&gt;
 source ollama_test/bin/activate&lt;br /&gt;
 python -m pip install ollama&lt;br /&gt;
 export OLLAMA_HOST=localhost&lt;br /&gt;
&lt;br /&gt;
and call &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt; to run the following code:&lt;br /&gt;
 import ollama&lt;br /&gt;
 response = ollama.chat(model=&#039;deepseek-r1&#039;, messages=[ { &#039;role&#039;: &#039;user&#039;, &#039;content&#039;: &#039;why is the sky blue?&#039;},])&lt;br /&gt;
 print(response)&lt;br /&gt;
&lt;br /&gt;
You should now see DeepSeek&#039;s response regarding Rayleigh Scattering.&lt;br /&gt;
&lt;br /&gt;
On the compute node, You will see the computation:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus_computing.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Enjoy!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Best Practice ==&lt;br /&gt;
Running interactively is generally &#039;&#039;&#039;not&#039;&#039;&#039; a good idea, especially not with very large models. Better submit Your job with mail notification, here file &amp;lt;code&amp;gt;ollama.slurm&amp;lt;/code&amp;gt;:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --partition=gpu_h100     # bwUniCluster3, for DACHS: gpu8&lt;br /&gt;
 #SBATCH --gres=gpu:h100:4        # bwUniCluster3, for DACHS: gpu:h100:8&lt;br /&gt;
 #SBATCH --ntasks-per-node=96     # considering bwUniCluster3 AMD EPYC9454, same on DACHS&lt;br /&gt;
 #SBATCH --mem=500G               # considering bwUniCluster3 768GB, enough on DACHS&lt;br /&gt;
 #SBATCH --time=2:00:00           # Please be courteous to other users&lt;br /&gt;
 #SBATCH --mail-type=BEGIN        # Email when the job starts&lt;br /&gt;
 #SBATCH --mail-user=my@mail.de   # Your email address&lt;br /&gt;
 &lt;br /&gt;
 module load cs/ollama            # Load the the&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0       # Serve on global interface&lt;br /&gt;
 export OLLAMA_KEEP_ALIVE=-1      # Do not unload model (default is 5 minutes)&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
After starting the SSH for portforwarding or on the login-node after setting &amp;lt;code&amp;gt;export OLLAMA_HOST=&amp;lt;/code&amp;gt; to the allocated node (see output of &amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt;):&lt;br /&gt;
 ollama run deepseek-r1:671b&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; /?              # Shows the help&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; /? shortcuts    # Shows the keyboard shortcuts&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; /show           # Show information regarding model, prompt&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; What is log(e)? # Returns explanation of logarithm under the assumption of base 10 and the natural logarithm including LaTeX Math notation.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=14035</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=14035"/>
		<updated>2025-02-21T15:35:54Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Best Practice */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU -&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#FEF4AB; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#FEF4AB; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#FEF4AB; text-align:left&amp;quot;|&lt;br /&gt;
Please note: this module started off in the Category &amp;lt;code&amp;gt;devel&amp;lt;/code&amp;gt;, but has been moved to the correct category computer science, or short &amp;lt;code&amp;gt;cs&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
 ws_allocate ollama_models 60&lt;br /&gt;
 ln -s `ws_find ollama_models`/ ~/.ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
 srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the node&#039;s name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and pull a LLM (please check [https://ollama.com/search] for available models):&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
 export OLLAMA_HOST=uc2n520&lt;br /&gt;
 ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#dedefe; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#dedefe; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Info.svg|center]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#dedefe; text-align:left&amp;quot;|&lt;br /&gt;
On GPUs with 48GB VRAM like NVIDIA L40S, you may want to use the 70b model of Deepseek, i.e. &amp;lt;code&amp;gt;ollama pull deepseek-r1:70b&amp;lt;/code&amp;gt; and amend the below commands accordingly.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
 ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
 Your OTP: 123456&lt;br /&gt;
 Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
 python -m venv ollama_test&lt;br /&gt;
 source ollama_test/bin/activate&lt;br /&gt;
 python -m pip install ollama&lt;br /&gt;
 export OLLAMA_HOST=localhost&lt;br /&gt;
&lt;br /&gt;
and call &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt; to run the following code:&lt;br /&gt;
 import ollama&lt;br /&gt;
 response = ollama.chat(model=&#039;deepseek-r1&#039;, messages=[ { &#039;role&#039;: &#039;user&#039;, &#039;content&#039;: &#039;why is the sky blue?&#039;},])&lt;br /&gt;
 print(response)&lt;br /&gt;
&lt;br /&gt;
You should now see DeepSeek&#039;s response regarding Rayleigh Scattering.&lt;br /&gt;
&lt;br /&gt;
On the compute node, You will see the computation:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus_computing.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Enjoy!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Best Practice ==&lt;br /&gt;
Running interactively is generally &#039;&#039;&#039;not&#039;&#039;&#039; a good idea, especially not with very large models. Better submit Your job with mail notification, here file &amp;lt;code&amp;gt;ollama.slurm&amp;lt;/code&amp;gt;:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --partition=gpu_h100     # bwUniCluster3, for DACHS: gpu8&lt;br /&gt;
 #SBATCH --gres=gpu:h100:4        # bwUniCluster3, for DACHS: gpu:h100:8&lt;br /&gt;
 #SBATCH --ntasks-per-node=96     # considering bwUniCluster3 AMD EPYC9454, same on DACHS&lt;br /&gt;
 #SBATCH --mem=500G               # considering bwUniCluster3 768GB, enough on DACHS&lt;br /&gt;
 #SBATCH --time=2:00:00           # Please be courteous to other users&lt;br /&gt;
 module load cs/ollama            # Load the the&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0       # Serve on global interface&lt;br /&gt;
 export OLLAMA_KEEP_ALIVE=-1      # Do not unload model (default is 5 minutes)&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
After starting the SSH for portforwarding or on the login-node after setting &amp;lt;code&amp;gt;export OLLAMA_HOST=&amp;lt;/code&amp;gt; to the allocated node (see output of &amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt;):&lt;br /&gt;
 ollama run deepseek-r1:671b&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; /?              # Shows the help&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; /? shortcuts    # Shows the keyboard shortcuts&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; /show           # Show information regarding model, prompt&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; What is log(e)? # Returns explanation of logarithm under the assumption of base 10 and the natural logarithm including LaTeX Math notation.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=14034</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=14034"/>
		<updated>2025-02-21T15:35:16Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Local programming */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU -&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#FEF4AB; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#FEF4AB; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#FEF4AB; text-align:left&amp;quot;|&lt;br /&gt;
Please note: this module started off in the Category &amp;lt;code&amp;gt;devel&amp;lt;/code&amp;gt;, but has been moved to the correct category computer science, or short &amp;lt;code&amp;gt;cs&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
 ws_allocate ollama_models 60&lt;br /&gt;
 ln -s `ws_find ollama_models`/ ~/.ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
 srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the node&#039;s name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and pull a LLM (please check [https://ollama.com/search] for available models):&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
 export OLLAMA_HOST=uc2n520&lt;br /&gt;
 ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#dedefe; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#dedefe; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Info.svg|center]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#dedefe; text-align:left&amp;quot;|&lt;br /&gt;
On GPUs with 48GB VRAM like NVIDIA L40S, you may want to use the 70b model of Deepseek, i.e. &amp;lt;code&amp;gt;ollama pull deepseek-r1:70b&amp;lt;/code&amp;gt; and amend the below commands accordingly.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
 ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
 Your OTP: 123456&lt;br /&gt;
 Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
 python -m venv ollama_test&lt;br /&gt;
 source ollama_test/bin/activate&lt;br /&gt;
 python -m pip install ollama&lt;br /&gt;
 export OLLAMA_HOST=localhost&lt;br /&gt;
&lt;br /&gt;
and call &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt; to run the following code:&lt;br /&gt;
 import ollama&lt;br /&gt;
 response = ollama.chat(model=&#039;deepseek-r1&#039;, messages=[ { &#039;role&#039;: &#039;user&#039;, &#039;content&#039;: &#039;why is the sky blue?&#039;},])&lt;br /&gt;
 print(response)&lt;br /&gt;
&lt;br /&gt;
You should now see DeepSeek&#039;s response regarding Rayleigh Scattering.&lt;br /&gt;
&lt;br /&gt;
On the compute node, You will see the computation:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus_computing.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Enjoy!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Best Practice ==&lt;br /&gt;
Running interactively is generally **not** a good idea, especially not with very large models. Better submit Your job with mail notification, here file &amp;lt;code&amp;gt;ollama.slurm&amp;lt;/code&amp;gt;:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --partition=gpu_h100     # bwUniCluster3, for DACHS: gpu8&lt;br /&gt;
 #SBATCH --gres=gpu:h100:4        # bwUniCluster3, for DACHS: gpu:h100:8&lt;br /&gt;
 #SBATCH --ntasks-per-node=96     # considering bwUniCluster3 AMD EPYC9454, same on DACHS&lt;br /&gt;
 #SBATCH --mem=500G               # considering bwUniCluster3 768GB, enough on DACHS&lt;br /&gt;
 #SBATCH --time=2:00:00           # Please be courteous to other users&lt;br /&gt;
 module load cs/ollama            # Load the the&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0       # Serve on global interface&lt;br /&gt;
 export OLLAMA_KEEP_ALIVE=-1      # Do not unload model (default is 5 minutes)&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
After starting the SSH for portforwarding or on the login-node after setting &amp;lt;code&amp;gt;export OLLAMA_HOST=&amp;lt;/code&amp;gt; to the allocated node (see output of &amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt;):&lt;br /&gt;
 ollama run deepseek-r1:671b&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; /?              # Shows the help&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; /? shortcuts    # Shows the keyboard shortcuts&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; /show           # Show information regarding model, prompt&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; What is log(e)? # Returns explanation of logarithm under the assumption of base 10 and the natural logarithm including LaTeX Math notation.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=14023</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=14023"/>
		<updated>2025-02-20T13:07:21Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Local programming */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU -&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#FEF4AB; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#FEF4AB; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#FEF4AB; text-align:left&amp;quot;|&lt;br /&gt;
Please note: this module started off in the Category &amp;lt;code&amp;gt;devel&amp;lt;/code&amp;gt;, but has been moved to the correct category computer science, or short &amp;lt;code&amp;gt;cs&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
 ws_allocate ollama_models 60&lt;br /&gt;
 ln -s `ws_find ollama_models`/ ~/.ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
 srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the node&#039;s name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and pull a LLM (please check [https://ollama.com/search] for available models):&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
 export OLLAMA_HOST=uc2n520&lt;br /&gt;
 ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#dedefe; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#dedefe; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Info.svg|center]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#dedefe; text-align:left&amp;quot;|&lt;br /&gt;
On GPUs with 48GB VRAM like NVIDIA L40S, you may want to use the 70b model of Deepseek, i.e. &amp;lt;code&amp;gt;ollama pull deepseek-r1:70b&amp;lt;/code&amp;gt; and amend the below commands accordingly.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
 ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
 Your OTP: 123456&lt;br /&gt;
 Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
 python -m venv ollama_test&lt;br /&gt;
 source ollama_test/bin/activate&lt;br /&gt;
 python -m pip install ollama&lt;br /&gt;
 export OLLAMA_HOST=localhost&lt;br /&gt;
&lt;br /&gt;
and call &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt; to run the following code:&lt;br /&gt;
 import ollama&lt;br /&gt;
 response = ollama.chat(model=&#039;deepseek-r1&#039;, messages=[ { &#039;role&#039;: &#039;user&#039;, &#039;content&#039;: &#039;why is the sky blue?&#039;},])&lt;br /&gt;
 print(response)&lt;br /&gt;
&lt;br /&gt;
You should now see DeepSeek&#039;s response regarding Rayleigh Scattering.&lt;br /&gt;
&lt;br /&gt;
On the compute node, You will see the computation:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus_computing.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Enjoy!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=14022</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=14022"/>
		<updated>2025-02-20T13:06:13Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU -&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#FEF4AB; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#FEF4AB; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#FEF4AB; text-align:left&amp;quot;|&lt;br /&gt;
Please note: this module started off in the Category &amp;lt;code&amp;gt;devel&amp;lt;/code&amp;gt;, but has been moved to the correct category computer science, or short &amp;lt;code&amp;gt;cs&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
 ws_allocate ollama_models 60&lt;br /&gt;
 ln -s `ws_find ollama_models`/ ~/.ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
 srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the node&#039;s name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and pull a LLM (please check [https://ollama.com/search] for available models):&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
 export OLLAMA_HOST=uc2n520&lt;br /&gt;
 ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#dedefe; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#dedefe; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Info.svg|center]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#dedefe; text-align:left&amp;quot;|&lt;br /&gt;
On GPUs with 48GB VRAM like NVIDIA L40S, you may want to use the 70b model of Deepseek, i.e. &amp;lt;code&amp;gt;ollama pull deepseek-r1:70b&amp;lt;/code&amp;gt; and amend the below commands accordingly.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
 ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
 Your OTP: 123456&lt;br /&gt;
 Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
 python -m venv ollama_test&lt;br /&gt;
 . ollama_test/bin/activate&lt;br /&gt;
 python -m pip install ollama&lt;br /&gt;
 export OLLAMA_HOST=localhost&lt;br /&gt;
&lt;br /&gt;
and call &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt; to run the following code:&lt;br /&gt;
 import ollama&lt;br /&gt;
 response = ollama.chat(model=&#039;deepseek-r1&#039;, messages=[ { &#039;role&#039;: &#039;user&#039;, &#039;content&#039;: &#039;why is the sky blue?&#039;},])&lt;br /&gt;
 print(response)&lt;br /&gt;
&lt;br /&gt;
You should now see DeepSeek&#039;s response regarding Rayleigh Scattering.&lt;br /&gt;
&lt;br /&gt;
On the compute node, You will see the computation:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus_computing.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Enjoy!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=14021</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=14021"/>
		<updated>2025-02-20T13:02:09Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Accessing from login nodes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU -&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
 ws_allocate ollama_models 60&lt;br /&gt;
 ln -s `ws_find ollama_models`/ ~/.ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
 srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the node&#039;s name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and pull a LLM (please check [https://ollama.com/search] for available models):&lt;br /&gt;
 module load cs/ollama&lt;br /&gt;
 export OLLAMA_HOST=uc2n520&lt;br /&gt;
 ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#dedefe; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#dedefe; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Info.svg|center]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#dedefe; text-align:left&amp;quot;|&lt;br /&gt;
On GPUs with 48GB VRAM like NVIDIA L40S, you may want to use the 70b model of Deepseek, i.e. &amp;lt;code&amp;gt;ollama pull deepseek-r1:70b&amp;lt;/code&amp;gt; and amend the below commands accordingly.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
 ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
 Your OTP: 123456&lt;br /&gt;
 Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
 python -m venv ollama_test&lt;br /&gt;
 . ollama_test/bin/activate&lt;br /&gt;
 python -m pip install ollama&lt;br /&gt;
 export OLLAMA_HOST=localhost&lt;br /&gt;
&lt;br /&gt;
and call &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt; to run the following code:&lt;br /&gt;
 import ollama&lt;br /&gt;
 response = ollama.chat(model=&#039;deepseek-r1&#039;, messages=[ { &#039;role&#039;: &#039;user&#039;, &#039;content&#039;: &#039;why is the sky blue?&#039;},])&lt;br /&gt;
 print(response)&lt;br /&gt;
&lt;br /&gt;
You should now see DeepSeek&#039;s response regarding Rayleigh Scattering.&lt;br /&gt;
&lt;br /&gt;
On the compute node, You will see the computation:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus_computing.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Enjoy!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=File:Info.svg&amp;diff=14020</id>
		<title>File:Info.svg</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=File:Info.svg&amp;diff=14020"/>
		<updated>2025-02-20T12:57:37Z</updated>

		<summary type="html">&lt;p&gt;R Keller: Info-Icon: an icon from the OOjs UI MediaWiki lib.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Info-Icon: an icon from the OOjs UI MediaWiki lib.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13982</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13982"/>
		<updated>2025-02-13T08:48:42Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Preparation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
 ws_allocate ollama_models 60&lt;br /&gt;
 ln -s `ws_find ollama_models`/ ~/.ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
 srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the node&#039;s name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and pull a LLM (please check [https://ollama.com/search] for available models):&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=uc2n520&lt;br /&gt;
 ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
 ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
 Your OTP: 123456&lt;br /&gt;
 Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
 python -m venv ollama_test&lt;br /&gt;
 . ollama_test/bin/activate&lt;br /&gt;
 python -m pip install ollama&lt;br /&gt;
 export OLLAMA_HOST=localhost&lt;br /&gt;
&lt;br /&gt;
and call &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt; to run the following code:&lt;br /&gt;
 import ollama&lt;br /&gt;
 response = ollama.chat(model=&#039;deepseek-r1&#039;, messages=[ { &#039;role&#039;: &#039;user&#039;, &#039;content&#039;: &#039;why is the sky blue?&#039;},])&lt;br /&gt;
 print(response)&lt;br /&gt;
&lt;br /&gt;
You should now see DeepSeek&#039;s response regarding Rayleigh Scattering.&lt;br /&gt;
&lt;br /&gt;
On the compute node, You will see the computation:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus_computing.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Enjoy!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13961</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13961"/>
		<updated>2025-02-11T20:06:53Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Preparation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
 ws_allocate ollama_models 60&lt;br /&gt;
 ln -s `ws_find ollama_models`/ .ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
 srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the node&#039;s name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and pull a LLM (please check [https://ollama.com/search] for available models):&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=uc2n520&lt;br /&gt;
 ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
 ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
 Your OTP: 123456&lt;br /&gt;
 Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
 python -m venv ollama_test&lt;br /&gt;
 . ollama_test/bin/activate&lt;br /&gt;
 python -m pip install ollama&lt;br /&gt;
 export OLLAMA_HOST=localhost&lt;br /&gt;
&lt;br /&gt;
and call &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt; to run the following code:&lt;br /&gt;
 import ollama&lt;br /&gt;
 response = ollama.chat(model=&#039;deepseek-r1&#039;, messages=[ { &#039;role&#039;: &#039;user&#039;, &#039;content&#039;: &#039;why is the sky blue?&#039;},])&lt;br /&gt;
 print(response)&lt;br /&gt;
&lt;br /&gt;
You should now see DeepSeek&#039;s response regarding Rayleigh Scattering.&lt;br /&gt;
&lt;br /&gt;
On the compute node, You will see the computation:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus_computing.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Enjoy!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13960</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13960"/>
		<updated>2025-02-11T19:55:47Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Preparation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
 ws_allocate ollama_models 60&lt;br /&gt;
 ln -s `ws_find ollama_models`/ .ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
 srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the nodes name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and pull a LLM (please check [https://ollama.com/search] for available models):&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=uc2n520&lt;br /&gt;
 ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
 ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
 Your OTP: 123456&lt;br /&gt;
 Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
 python -m venv ollama_test&lt;br /&gt;
 . ollama_test/bin/activate&lt;br /&gt;
 python -m pip install ollama&lt;br /&gt;
 export OLLAMA_HOST=localhost&lt;br /&gt;
&lt;br /&gt;
and call &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt; to run the following code:&lt;br /&gt;
 import ollama&lt;br /&gt;
 response = ollama.chat(model=&#039;deepseek-r1&#039;, messages=[ { &#039;role&#039;: &#039;user&#039;, &#039;content&#039;: &#039;why is the sky blue?&#039;},])&lt;br /&gt;
 print(response)&lt;br /&gt;
&lt;br /&gt;
You should now see DeepSeek&#039;s response regarding Rayleigh Scattering.&lt;br /&gt;
&lt;br /&gt;
On the compute node, You will see the computation:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus_computing.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Enjoy!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13959</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13959"/>
		<updated>2025-02-11T19:09:58Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
 ws_allocate ollama_models 60&lt;br /&gt;
 ln -s /pfs/work7/workspace/scratch/es_rakeller-ollama_models/ .ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
 srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the nodes name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and pull a LLM (please check [https://ollama.com/search] for available models):&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=uc2n520&lt;br /&gt;
 ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
 ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
 Your OTP: 123456&lt;br /&gt;
 Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
 python -m venv ollama_test&lt;br /&gt;
 . ollama_test/bin/activate&lt;br /&gt;
 python -m pip install ollama&lt;br /&gt;
 export OLLAMA_HOST=localhost&lt;br /&gt;
&lt;br /&gt;
and call &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt; to run the following code:&lt;br /&gt;
 import ollama&lt;br /&gt;
 response = ollama.chat(model=&#039;deepseek-r1&#039;, messages=[ { &#039;role&#039;: &#039;user&#039;, &#039;content&#039;: &#039;why is the sky blue?&#039;},])&lt;br /&gt;
 print(response)&lt;br /&gt;
&lt;br /&gt;
You should now see DeepSeek&#039;s response regarding Rayleigh Scattering.&lt;br /&gt;
&lt;br /&gt;
On the compute node, You will see the computation:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus_computing.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Enjoy!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=File:Ollama_gpus_computing.png&amp;diff=13958</id>
		<title>File:Ollama gpus computing.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=File:Ollama_gpus_computing.png&amp;diff=13958"/>
		<updated>2025-02-11T19:09:29Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13957</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13957"/>
		<updated>2025-02-11T19:09:20Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
 ws_allocate ollama_models 60&lt;br /&gt;
 ln -s /pfs/work7/workspace/scratch/es_rakeller-ollama_models/ .ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
 srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the nodes name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and pull a LLM (please check [https://ollama.com/search] for available models):&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=uc2n520&lt;br /&gt;
 ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
 ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
 Your OTP: 123456&lt;br /&gt;
 Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
 python -m venv ollama_test&lt;br /&gt;
 . ollama_test/bin/activate&lt;br /&gt;
 python -m pip install ollama&lt;br /&gt;
 export OLLAMA_HOST=localhost&lt;br /&gt;
&lt;br /&gt;
and call &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt; to run the following code:&lt;br /&gt;
 import ollama&lt;br /&gt;
 response = ollama.chat(model=&#039;deepseek-r1&#039;, messages=[ { &#039;role&#039;: &#039;user&#039;, &#039;content&#039;: &#039;why is the sky blue?&#039;},])&lt;br /&gt;
 print(response)&lt;br /&gt;
&lt;br /&gt;
You should now see DeepSeek&#039;s response regarding Rayleigh Scattering.&lt;br /&gt;
&lt;br /&gt;
On the compute node, You will see the computation:&lt;br /&gt;
[[File:ollama_gpus_computing.png|850x329px]]&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13956</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13956"/>
		<updated>2025-02-11T19:05:33Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
 ws_allocate ollama_models 60&lt;br /&gt;
 ln -s /pfs/work7/workspace/scratch/es_rakeller-ollama_models/ .ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
 srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the nodes name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
 ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and pull a LLM (please check [https://ollama.com/search] for available models):&lt;br /&gt;
 module load devel/ollama&lt;br /&gt;
 export OLLAMA_HOST=uc2n520&lt;br /&gt;
 ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
 ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
 Your OTP: 123456&lt;br /&gt;
 Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
 python -m venv ollama_test&lt;br /&gt;
 . ollama_test/bin/activate&lt;br /&gt;
 python -m pip install ollama&lt;br /&gt;
 export OLLAMA_HOST=localhost&lt;br /&gt;
&lt;br /&gt;
and call &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt; to run the following code:&lt;br /&gt;
 import ollama&lt;br /&gt;
 response = ollama.chat(model=&#039;deepseek-r1&#039;, messages=[ { &#039;role&#039;: &#039;user&#039;, &#039;content&#039;: &#039;why is the sky blue?&#039;},])&lt;br /&gt;
 print(response)&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=File:Ollama_gpus.png&amp;diff=13955</id>
		<title>File:Ollama gpus.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=File:Ollama_gpus.png&amp;diff=13955"/>
		<updated>2025-02-11T18:59:23Z</updated>

		<summary type="html">&lt;p&gt;R Keller: R Keller uploaded a new version of File:Ollama gpus.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13954</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13954"/>
		<updated>2025-02-11T18:59:10Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
  ws_allocate ollama_models 60&lt;br /&gt;
  ln -s /pfs/work7/workspace/scratch/es_rakeller-ollama_models/ .ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
  srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the nodes name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
  [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
  export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
  ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and install a LLM:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
  export OLLAMA_HOST=uc2n520&lt;br /&gt;
  ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
  ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
  Your OTP: 123456&lt;br /&gt;
  Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
  python -m venv ollama_test&lt;br /&gt;
  . ollama_test/bin/activate&lt;br /&gt;
  python -m pip install ipykernel gradio llama-index llama-index-llms-ollama llama-index-embeddings-ollama rich ollama&lt;br /&gt;
&lt;br /&gt;
and run the file&lt;br /&gt;
from llama_index.llms.ollama import Ollama&lt;br /&gt;
llm = Ollama(model=&amp;quot;deepseek-r1&amp;quot;, request_timeout=120.0)&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=File:Ollama_gpus.png&amp;diff=13953</id>
		<title>File:Ollama gpus.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=File:Ollama_gpus.png&amp;diff=13953"/>
		<updated>2025-02-11T18:56:29Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13952</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13952"/>
		<updated>2025-02-11T18:56:18Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
  ws_allocate ollama_models 60&lt;br /&gt;
  ln -s /pfs/work7/workspace/scratch/es_rakeller-ollama_models/ .ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
  srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the nodes name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
  [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
  export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
  ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
[[File:ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and install a LLM:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
  export OLLAMA_HOST=uc2n520&lt;br /&gt;
  ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
  ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
  Your OTP: 123456&lt;br /&gt;
  Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
  python -m venv ollama_test&lt;br /&gt;
  . ollama_test/bin/activate&lt;br /&gt;
  python -m pip install ipykernel gradio llama-index llama-index-llms-ollama llama-index-embeddings-ollama rich ollama&lt;br /&gt;
&lt;br /&gt;
and run the file&lt;br /&gt;
from llama_index.llms.ollama import Ollama&lt;br /&gt;
llm = Ollama(model=&amp;quot;deepseek-r1&amp;quot;, request_timeout=120.0)&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13951</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13951"/>
		<updated>2025-02-11T18:55:38Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside, aka the login nodes.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models&lt;br /&gt;
and create a soft-link into this directory for Ollama:&lt;br /&gt;
  ws_allocate ollama_models 60&lt;br /&gt;
  ln -s /pfs/work7/workspace/scratch/es_rakeller-ollama_models/ .ollama&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
  srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the nodes name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
  [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node and make sure using &amp;lt;code&amp;gt;OLLAMA_HOST&amp;lt;/code&amp;gt; that it serves to the external IP address:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
  export OLLAMA_HOST=0.0.0.0:11434&lt;br /&gt;
  ollama serve&lt;br /&gt;
&lt;br /&gt;
You should be able to see the usage of the accelerator:&lt;br /&gt;
[[ollama_gpus.png|850x329px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing from login nodes ==&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and install a LLM:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
  export OLLAMA_HOST=uc2n520&lt;br /&gt;
  ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
  ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
  Your OTP: 123456&lt;br /&gt;
  Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU, you may develop on your local system:&lt;br /&gt;
  python -m venv ollama_test&lt;br /&gt;
  . ollama_test/bin/activate&lt;br /&gt;
  python -m pip install ipykernel gradio llama-index llama-index-llms-ollama llama-index-embeddings-ollama rich ollama&lt;br /&gt;
&lt;br /&gt;
and run the file&lt;br /&gt;
from llama_index.llms.ollama import Ollama&lt;br /&gt;
llm = Ollama(model=&amp;quot;deepseek-r1&amp;quot;, request_timeout=120.0)&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13950</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13950"/>
		<updated>2025-02-11T18:00:49Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (multi-gigabyte) models,&lt;br /&gt;
a sub-directory and create a soft-link into this directory for Ollama:&lt;br /&gt;
  ws_allocate ollama_models 60&lt;br /&gt;
  mkdir -p /pfs/work7/workspace/scratch/es_rakeller-ollama_models/.ollama/&lt;br /&gt;
  ln -s /pfs/work7/workspace/scratch/es_rakeller-ollama_models/.ollama .&lt;br /&gt;
&lt;br /&gt;
Now we may allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
  srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the nodes name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
  [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node:  &lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
  ollama serve&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and install a LLM:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
  export OLLAMA_HOST=uc2n520&lt;br /&gt;
  ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
On the previous terminal on the compute node, You should see the model being downloaded and installed into the workspace.&lt;br /&gt;
Of course developing on the login nodes is not viable, therefore You may want to forward the ports.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
  ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
  Your OTP: 123456&lt;br /&gt;
  Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png|645x325px]]&lt;br /&gt;
&lt;br /&gt;
== Local programming ==&lt;br /&gt;
Now that You made sure You have access to the compute nodes GPU:&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=File:Firefox_ollama.png&amp;diff=13949</id>
		<title>File:Firefox ollama.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=File:Firefox_ollama.png&amp;diff=13949"/>
		<updated>2025-02-11T17:42:29Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13948</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13948"/>
		<updated>2025-02-11T17:42:13Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like the AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama by default assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is &#039;&#039;&#039;not&#039;&#039;&#039; sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]] including binaries and libraries for CPU (if available AVX-512), AMD ROCm (if available) and NVIDIA CUDA using:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
First, we need to allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
  srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the nodes name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
  [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Prior to starting and pulling models, it is a &#039;&#039;&#039;good idea&#039;&#039;&#039; to allocate a proper [[Workspace]] for the (large) models, a sub-directory and create a soft-link into this directory for Ollama:&lt;br /&gt;
  ws_allocate ollama_models 60&lt;br /&gt;
  mkdir -p /pfs/work7/workspace/scratch/es_rakeller-ollama_models/.ollama/&lt;br /&gt;
  ln -s /pfs/work7/workspace/scratch/es_rakeller-ollama_models/.ollama .&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server on the compute node:  &lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
  ollama serve &amp;amp;&lt;br /&gt;
&lt;br /&gt;
From another terminal You may log into the Cluster&#039;s login node a second time and install a LLM:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
  export OLLAMA_HOST=uc2n520&lt;br /&gt;
  ollama pull deepseek-r1&lt;br /&gt;
&lt;br /&gt;
Of course, You may want to &#039;&#039;&#039;locally on Your laptop&#039;&#039;&#039;.&lt;br /&gt;
Open another terminal and start the Secure shell using the port forwarding:&lt;br /&gt;
  ssh -L 11434:uc2n520:11434 USERNAME@bwunicluster.scc.kit.edu&lt;br /&gt;
  Your OTP: 123456&lt;br /&gt;
  Password:&lt;br /&gt;
&lt;br /&gt;
You may check using whether this worked using Your local browser on Your Laptop:&lt;br /&gt;
  [[File:firefox_ollama.png]]&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13947</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13947"/>
		<updated>2025-02-11T13:22:38Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is not sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]], here:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
First, we need to allocate a compute node using [[BwUniCluster2.0/Slurm|Slurm]].&lt;br /&gt;
At first You may start with interactively checking out the method in one terminal:&lt;br /&gt;
  srun --time=00:30:00 --gres=gpu:1 --pty /bin/bash&lt;br /&gt;
Please note that on bwUniCluster, You need to provide a partition, here containing a GPU, e.g. for this 30 minute run, we may select &amp;lt;code&amp;gt;--partition=dev_gpu_4&amp;lt;/code&amp;gt;, on DACHS &amp;lt;code&amp;gt;--partition=gpu1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Your Shell&#039;s prompt will list the nodes name, e.g. on bwUniCluster node &amp;lt;code&amp;gt;uc2n520&amp;lt;/code&amp;gt;:&lt;br /&gt;
  [USERNAME@uc2n520 ~]$&lt;br /&gt;
&lt;br /&gt;
Now You may load the Ollama module and start the server:&lt;br /&gt;
  module load devel/ollama&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13946</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13946"/>
		<updated>2025-02-11T13:08:36Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is not sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules|Environment Modules]], here:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
First, we need to allocate a compute node using [[BwUniCluster2.0/Slurm]].&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13945</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13945"/>
		<updated>2025-02-11T13:08:14Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is not sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules Environment Modules]], here:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
First, we need to allocate a compute node using [[BwUniCluster2.0/Slurm]].&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13944</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13944"/>
		<updated>2025-02-11T13:07:49Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
Installing the inference server Ollama assumes you have root permission to install the server globally for all users&lt;br /&gt;
into the directory &amp;lt;code&amp;gt;/usr/local/bin&amp;lt;/code&amp;gt;. Of course, this is not sensible.&lt;br /&gt;
Therefore the clusters provide the [[Environment_Modules Environment Modules]], here:&lt;br /&gt;
  module load devel/ollama&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside.&lt;br /&gt;
&lt;br /&gt;
== Port forwarding ==&lt;br /&gt;
&lt;br /&gt;
The login nodes of course have externally visible IP addresses, e.g. &amp;lt;code&amp;gt;bwunicluster.scc.kit.edu&amp;lt;/code&amp;gt; which get to resolved to one of the multiple login nodes.&lt;br /&gt;
Using the Secure shell &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; one may forward a port from the login node to the compute node.&lt;br /&gt;
&lt;br /&gt;
First, we need to allocate a compute node using [[BwUniCluster2.0/Slurm Slurm]].&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13943</id>
		<title>Development/ollama</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/ollama&amp;diff=13943"/>
		<updated>2025-02-11T12:50:49Z</updated>

		<summary type="html">&lt;p&gt;R Keller: Introduction to Ollama&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using LLMs even for inferencing requires large computational resources - currently at best a powerful GPU --&lt;br /&gt;
as provided by the bwHPC clusters.&lt;br /&gt;
This page explains to how to make usage of bwHPC resources, using Ollama as an example to show best practices at work.&lt;br /&gt;
&lt;br /&gt;
==== Introduction ====&lt;br /&gt;
Ollama is an inferencing framework that provides access to a multitude of powerful, large models and allows&lt;br /&gt;
performant access to a variety of accelerators, e.g. from CPUs using AVX-512 to APUs like AMD MI-300A,&lt;br /&gt;
as well as GPUs like multiple NVIDIA H100.&lt;br /&gt;
&lt;br /&gt;
More information is available in [https://github.com/ollama/ollama/tree/main/docs Ollamas Github documentation] page.&lt;br /&gt;
&lt;br /&gt;
The inference server Ollama opens the well-known port 11434. The compute node&#039;s IP is on the internal network, e.g. 10.1.0.101,&lt;br /&gt;
which is not visible to any outside computer like Your laptop.&lt;br /&gt;
Therefore we need a way to forward this port on an IP visible to the outside.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/General_compiler_usage&amp;diff=13664</id>
		<title>Development/General compiler usage</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/General_compiler_usage&amp;diff=13664"/>
		<updated>2025-01-23T10:54:31Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Description !! Content&lt;br /&gt;
|-&lt;br /&gt;
| module load&lt;br /&gt;
| compiler/gnu or compiler/intel or compiler/llvm and others...  &lt;br /&gt;
|-&lt;br /&gt;
| License&lt;br /&gt;
| [[Development/Intel_Compiler|Intel]]: Commercial &amp;amp;#124; [[Development/GCC|GNU]]: GPL &amp;amp;#124; LLVM: Apache 2 &amp;amp;#124; PGI/NVIDIA: Commercial&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Description =&lt;br /&gt;
&lt;br /&gt;
Basically, compilers translate human-readable source code (e.g. C++ interpreted as adhering to ISO/IEC 14882:2014, encoded in UTF-8 text) into binary byte code (e.g. x86-64 with Linux ABI in ELF-format).&lt;br /&gt;
Compilers are complex software and have become very powerful in the last decades, to &#039;&#039;&#039;guide&#039;&#039;&#039; you as a programmer writing better, more portable, more performant programs. Use the compiler as a tool -- and best use multiple compilers on the same source code for best results.&lt;br /&gt;
The basic operations and hints can be performed with the same or similar commands on all available compilers. For advanced usage such as optimization and profiling you should consult the best practice guide of the compiler you intend to use ([[Development/GCC|GCC]], [[Development/Intel_Compiler|Intel Suite]]).&lt;br /&gt;
&lt;br /&gt;
More information about the MPI versions of the GNU and Intel Compilers is available here:&lt;br /&gt;
* [[Development/Parallel_Programming|Best Practices Guide for Parallel Programming]].&lt;br /&gt;
&lt;br /&gt;
= Loading compilers as modules =&lt;br /&gt;
&lt;br /&gt;
Modules and loading of modules is described in general in [[Environment_Modules|here for traditional Environment Modules]] and about the Lmod implementation of Environment modules in [[Software_Modules_Lmod|here for Lmod]].&lt;br /&gt;
&lt;br /&gt;
Modules need to be mentioned, since on any system there&#039;s a pre-installed set of compilers (for C, C++ and usually Fortran) -- the so-called system compilers -- provided by the Linux distribution. The system compiler however may lack certain options for optimization, are typically optimizing for older and more architectures (think SSE vs. AVX2 and AVX-512/AVX10.2). Also they may lack useful warnings or other features. On RedHat Enterprise Linux 9.4 this is GNU compiler v11.4.1.&lt;br /&gt;
Be advised to check out the newer compilers available as modules.&lt;br /&gt;
&lt;br /&gt;
Since Fortran (and very old C++) requires compiling and linking libraries with the very same compiler, many libraries, first-and-foremost the MPI libraries need to be provided for specific versions of a compiler.&lt;br /&gt;
On [[BwUniCluster_2.0]], these provided libraries will only be visible to &amp;lt;kbd&amp;gt;module avail&amp;lt;/kbd&amp;gt;, once a compiler is loaded.&lt;br /&gt;
Hence, check out loading&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module avail compiler/intel&lt;br /&gt;
...&lt;br /&gt;
$ module load compiler/intel/2023.1.0&lt;br /&gt;
...&lt;br /&gt;
$ module avail&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to see the available MPI modules.&lt;br /&gt;
&lt;br /&gt;
All vendors whether it&#039;s Intel, GNU, LLVM or the Nvidia toolkit (see module group toolkit) have compilers for different programming languages which will be available &lt;br /&gt;
only after loading the module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Linux Default Compiler ==&lt;br /&gt;
&lt;br /&gt;
The default Compiler installed on all compute nodes is the GNU Compiler Collection (GCC) or in short GNU compiler.&lt;br /&gt;
* Don&#039;t get distracted with the available compiler modules.&lt;br /&gt;
* Only the modules are loading the complete environments needed.  &lt;br /&gt;
&amp;lt;u&amp;gt;Example&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module purge                   # unload all modules&lt;br /&gt;
$ module list                    # check which modules are loaded, we expect none&lt;br /&gt;
No Modulefiles Currently Loaded.&lt;br /&gt;
$ gcc --version                  # see version of default Linux GNU compiler&lt;br /&gt;
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18)&lt;br /&gt;
[...]&lt;br /&gt;
$ module load compiler/gnu       # load default GNU compiler module&lt;br /&gt;
$ module list                    # check which modules are loaded, we expect the default GNU compiler&lt;br /&gt;
Currently Loaded Modulefiles:&lt;br /&gt;
  1) compiler/gnu/13.3&lt;br /&gt;
$ gcc --version                  # now, check the current (loaded) version of the GNU C compiler&lt;br /&gt;
gcc (GCC) 13.3.0&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Synoptical Tables =&lt;br /&gt;
&lt;br /&gt;
== Compilers (no MPI) ==&lt;br /&gt;
&lt;br /&gt;
{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Compiler Suite&lt;br /&gt;
! Language&lt;br /&gt;
! Command&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;Intel Composer (pre-OneAPI)&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[Development/Intel_Compiler|&amp;amp;bull;&amp;amp;nbsp;Best Practice Guides on Intel Compiler Software]] &lt;br /&gt;
| C&lt;br /&gt;
| icc&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| icpc&lt;br /&gt;
|-&lt;br /&gt;
| Fortran&lt;br /&gt;
| ifort&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;Intel OneAPI (llvm-based)&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[Development/Intel_Compiler|&amp;amp;bull;&amp;amp;nbsp;Best Practice Guides on Intel Compiler Software]] &lt;br /&gt;
| C&lt;br /&gt;
| icx&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| icpx&lt;br /&gt;
|-&lt;br /&gt;
| Fortran&lt;br /&gt;
| ifx&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;GCC&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[Development/GCC|&amp;amp;bull;&amp;amp;nbsp;Best Practice Guides on GNU Compiler Software]]&lt;br /&gt;
| C&lt;br /&gt;
| gcc&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| g++&lt;br /&gt;
|-&lt;br /&gt;
| Fortran&lt;br /&gt;
| gfortran&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;LLVM&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
| C&lt;br /&gt;
| clang&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| clang++&lt;br /&gt;
|-&lt;br /&gt;
| Fortran 77/90&lt;br /&gt;
| flang&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;PGI/NVIDIA&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
| C&lt;br /&gt;
| pgcc&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| pgCC&lt;br /&gt;
|-&lt;br /&gt;
| Fortran 77/90&lt;br /&gt;
| pgf77 or pgf90&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MPI compiler and Underlying Compilers ==&lt;br /&gt;
&lt;br /&gt;
MPI implementations such as MPIch, Intel-MPI (derived from MPIch) or Open MPI provide compiler wrappers, easing the usage of MPI by providing the Include-Directory &amp;lt;kbd&amp;gt;-I&amp;lt;/kbd&amp;gt; and required libraries as well as the implementation&#039;s library directory flag &amp;lt;kbd&amp;gt;-L&amp;lt;/kbd&amp;gt; for linking.&lt;br /&gt;
The following table lists available MPI compiler commands and the underlying compilers, compiler families, languages, and application binary interfaces (ABIs) that they support.&lt;br /&gt;
&lt;br /&gt;
{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! MPI Compiler Command !! Default Compiler !! Supported Language(s) !! Supported ABI&#039;s&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 style=&amp;quot;background-color:#DCDCDC;&amp;quot; | Generic Compilers &lt;br /&gt;
|-&lt;br /&gt;
| mpicc || gcc, cc  || C || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpicxx || g++ || C/C++ || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpifc || gfortran || Fortran77/Fortran 95 || 32/64 bit&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 style=&amp;quot;background-color:#DCDCDC;&amp;quot; | [[Development/GCC|GNU Compiler]] Versions 3 and higher &lt;br /&gt;
|-&lt;br /&gt;
| mpigcc || gcc || C || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpigxx || g++  || C/C++ || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpif77 || g77 || Fortran 77 || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpif90 || gfortran || Fortran 95 || 32/64 bit&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 style=&amp;quot;background-color:#DCDCDC;&amp;quot; | [[Development/Intel_Compiler|Intel Fortran, C++ Compilers]] Versions 13.1 through 14.0 and Higher&lt;br /&gt;
|-&lt;br /&gt;
| mpiicc || icc || C || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpiicpc || icpc || C++ || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
|impiifort  || ifort || Fortran77/Fortran 95 || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= How to use =&lt;br /&gt;
&lt;br /&gt;
The following compiler commands work for all the compilers in the list above even though&lt;br /&gt;
the examples will be for &#039;&#039;&#039;icc&#039;&#039;&#039; only.&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
The typical introduction is a &amp;quot;Hello World&amp;quot; program. The following C source code shows best practices:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;                   // for printf&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;                  // for EXIT_SUCCESS and EXIT_FAILURE&lt;br /&gt;
int main (int argc, char * argv[]) { // std. definition of a program taking arguments&lt;br /&gt;
    printf(&amp;quot;Hello World\n&amp;quot;);         // Unix Output is line-buffered, end line with New-line.&lt;br /&gt;
    return EXIT_SUCCESS;             // End program by returning 0 (No Error)&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
After loading the Intel Compiler module using &amp;lt;kbd&amp;gt;module load compiler/intel/&amp;lt;/kbd&amp;gt;, the source may be compiled and linked with the single command&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
to produce an executable named &amp;lt;kbd&amp;gt;hello&amp;lt;/kbd&amp;gt;. This may be executed using the command &amp;lt;kbd&amp;gt;./hello&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This process can be divided into two steps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ icc -c hello.c        # Compile .c File into object file (ending in .o)&lt;br /&gt;
$ icc hello.o -o hello  # Link the object file with the system libc library)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
When using libraries you must sometimes specify the directories where the &lt;br /&gt;
* include files (option &amp;lt;kbd&amp;gt;-I&amp;lt;/kbd&amp;gt;) and where the &lt;br /&gt;
* library files (option &amp;lt;kbd&amp;gt;-L&amp;lt;/kbd&amp;gt;) are located. &lt;br /&gt;
In addition you have to tell the compiler which &lt;br /&gt;
* library you want to link to (option &amp;lt;kbd&amp;gt;-l&amp;lt;/kbd&amp;gt;). &lt;br /&gt;
For example after &amp;lt;kbd&amp;gt;module load numlib/fftw&amp;lt;/kbd&amp;gt; you can compile code for fftw using&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ icc -c hello.c -I$FFTW_INC_DIR&lt;br /&gt;
$ icc hello.o -o hello -L$FFTW_LIB_DIR -lfftw3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
When the program crashes or doesn&#039;t produce the expected output the compiler can &lt;br /&gt;
help you by printing all warning messages &amp;lt;kbd&amp;gt;-Wall&amp;lt;/kbd&amp;gt; and adding flags for debugging &amp;lt;kbd&amp;gt;-g&amp;lt;/kbd&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc -Wall -g hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
&lt;br /&gt;
If the problem can&#039;t be solved this way you can inspect what exactly your program &lt;br /&gt;
does using a debugger, e.g. [[Development/GDB|GDB]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=green&amp;gt;To use the debugger properly with your program you have to compile it with debug information (option &amp;lt;kbd&amp;gt;-g&amp;lt;/kbd&amp;gt;)&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Example&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc -g hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
Although the compiler option &amp;lt;kbd&amp;gt;-Wall&amp;lt;/kbd&amp;gt; (and possibly others) should always be set, the &amp;lt;kbd&amp;gt;-g&amp;lt;/kbd&amp;gt; option should only be passed for&lt;br /&gt;
debugging purposes to find bugs.&lt;br /&gt;
It may slow down execution and enlarges the binary due to debugging symbols.&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
The usual and common way to compile your source is to apply compiler optimization.&lt;br /&gt;
&lt;br /&gt;
Since there are many optimization options, as a start for now the &amp;lt;font color=green&amp;gt;optimization level -O2&amp;lt;/font&amp;gt; is recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc -O2 hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;font color=red&amp;gt;Beware:&amp;lt;/font&amp;gt;&amp;amp;nbsp;The optimization-flag used is a capital-O (like Otto) and not a 0 (Zero)!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All compilers offer a multitude of optimization options, &lt;br /&gt;
one may check the complete list of options with short explanation on [[Development/GCC|GCC]], [[LLVM|LLVM]] and &lt;br /&gt;
[[Development/Intel_Compiler|Intel Suite]] using option &#039;&#039;&#039;-v&#039;&#039;&#039; &#039;&#039;&#039;--help&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ icc -v --help | less&lt;br /&gt;
$ gcc -v --help | less&lt;br /&gt;
$ clang -v --help | less&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note, that the optimization level &amp;lt;kbd&amp;gt;-O2&amp;lt;/kbd&amp;gt; produces code for a general instruction set.&lt;br /&gt;
If you want to set the instruction set available, and take advantage of AVX2 or AVX512f/AVX10.2, you have to&lt;br /&gt;
either add the machine-dependent &amp;lt;kbd&amp;gt;-mavx512f&amp;lt;/kbd&amp;gt; or set the specific architecture of your&lt;br /&gt;
target processor.&lt;br /&gt;
For [[BwUniCluster_2.0]] this depends on whether you run your application on any node, then you would select&lt;br /&gt;
the older Broadwell CPU, or whether You target the newer HPC nodes (which feature Xeon Gold 6230, aka &amp;quot;Cascade Lake&amp;quot;&lt;br /&gt;
architecture).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gcc -O2 -o hello hello.c                        # General optimization for any architecture&lt;br /&gt;
$ gcc -O2 -march=broadwell -o hello hello.c       # Will work on any compute node on bwUniCluster 2.0&lt;br /&gt;
$ gcc -O2 -march=cascadelake -o hello hello.c     # This may not run on Broadwell nodes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While adding &amp;lt;kbd&amp;gt;-march=broadwell&amp;lt;/kbd&amp;gt; adds the compiler options such as &amp;lt;kbd&amp;gt;-mavx -mavx2 -msse3 -msse4 -msse4.1 -msse4.2 -mssse3&amp;lt;/kbd&amp;gt;,&lt;br /&gt;
adding &amp;lt;kbd&amp;gt;-march=cascadelake&amp;lt;/kbd&amp;gt; will further this by &amp;lt;kbd&amp;gt;-mavx512bw -mavx512cd -mavx512dq -mavx512f -mavx512vl -mavx512vnni -mfma&amp;lt;/kbd&amp;gt;,&lt;br /&gt;
where &amp;lt;kbd&amp;gt;-mfma&amp;lt;/kbd&amp;gt; is the setting for allowing fused-multiply-add.&lt;br /&gt;
These options may provide considerable speed-up to your code as is.&lt;br /&gt;
&#039;&#039;&#039;Please note&#039;&#039;&#039; however, that Cascade Lake may throttle the processor&#039;s clock speed, when executing AVX-512 instructions, possibly running slower than&lt;br /&gt;
(older) AVX2 code paths would have.&lt;br /&gt;
&lt;br /&gt;
You should then pay attention to vectorization attained by the compiler -- and concentrate on the time-consuming loops,&lt;br /&gt;
where the compiler was not able to vectorize.&lt;br /&gt;
Further vectorization as described in the Best Practice Guides may help.&lt;br /&gt;
This information is available with the Intel compiler using &amp;lt;kbd&amp;gt;-qopt-report=5&amp;lt;/kbd&amp;gt; producing a lot of output in &amp;lt;kbd&amp;gt;hello.optrpt&amp;lt;/kbd&amp;gt;,&lt;br /&gt;
while GCC offers this information using &amp;lt;kbd&amp;gt;-fopt-info-all&amp;lt;/kbd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For GCC the options in use are best visible by calling &amp;lt;kbd&amp;gt;gcc -O2 -fverbose-asm -S -o hello.S hello.c&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
The option &amp;lt;kbd&amp;gt;-fverbose-asm&amp;lt;/kbd&amp;gt; stores all the options in the assembler file &amp;lt;kbd&amp;gt;hello.S&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Warnings and Error detection ==&lt;br /&gt;
All compilers have improved tremendously with regards to analyzing and detecting suspicious code: do make &#039;&#039;&#039;use&#039;&#039;&#039; of such warnings and hints.&lt;br /&gt;
The amount of false positives has reduced and it will make your code more accessible, less error-prone and more portable.&lt;br /&gt;
&lt;br /&gt;
The typical warning flags are &amp;lt;kbd&amp;gt;-Wall&amp;lt;/kbd&amp;gt; to turn on &#039;&#039;all&#039;&#039; warnings.&lt;br /&gt;
However, there&#039;s multiple other worthwhile warnings, which are not covered (since they might increase false positives, or since they are not yet considered so prominent).&lt;br /&gt;
E.g. &amp;lt;kbd&amp;gt;-Wextra&amp;lt;/kbd&amp;gt; turns on several other warnings, which will in the above example show that neither &amp;lt;kbd&amp;gt;argc&amp;lt;/kbd&amp;gt; nor &amp;lt;kbd&amp;gt;argv&amp;lt;/kbd&amp;gt; have been used inside of &amp;lt;kbd&amp;gt;main&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For LLVM&#039;s &amp;lt;kbd&amp;gt;clang&amp;lt;/kbd&amp;gt; the flag &amp;lt;kbd&amp;gt;-Weverything&amp;lt;/kbd&amp;gt; turns on all available warnings, albeit leading to many warnings (even false positives) on larger projects.&lt;br /&gt;
However, the fix-it hints are very helpful as well.&lt;br /&gt;
&lt;br /&gt;
All the compilers offer the flag &amp;lt;kbd&amp;gt;-Werror&amp;lt;/kbd&amp;gt; which turns any warning (allowing completion of compilation) into hard errors.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:static_code_analysis.png|right|border|513px|Copyright: HS Esslingen)]]&lt;br /&gt;
Another powerful feature available in GNU- and LLVM-based compilers is &#039;&#039;&#039;static code analysis&#039;&#039;&#039;, otherwise only available in Commercial tools, like [https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html Coverity].&lt;br /&gt;
Static code analysis evaluates &#039;&#039;&#039;each&#039;&#039;&#039; and &#039;&#039;&#039;every&#039;&#039;&#039; code path, making assumptions on input values and branches taken, detecting corner cases which might lead to real errors -- without having to actually execute this code path.&lt;br /&gt;
&lt;br /&gt;
For GCC this is turned on using &amp;lt;kbd&amp;gt;-fanalyzer&amp;lt;/kbd&amp;gt; which will detect e.g. cases of memory usage after a &amp;lt;kbd&amp;gt;free()&amp;lt;/kbd&amp;gt; of said memory and many others. [https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#Static-Analyzer-Options GCC&#039;s documentation] on Static Analysis provides further details.&lt;br /&gt;
&lt;br /&gt;
For LLVM recompile your project using &amp;lt;kbd&amp;gt;scan-build&amp;lt;/kbd&amp;gt;, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ scan-build make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This produces warnings on &amp;lt;kbd&amp;gt;stdout&amp;lt;/kbd&amp;gt;, but more importantly scan reports in directory &amp;lt;kbd&amp;gt;/scratch/scan-build-XXX&amp;lt;/kbd&amp;gt;, where XXX is date and time of the build.&lt;br /&gt;
For example the output of Open MPI includes real issues of missed memory releases in error code paths -- as shown in the following picture.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/General_compiler_usage&amp;diff=13663</id>
		<title>Development/General compiler usage</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/General_compiler_usage&amp;diff=13663"/>
		<updated>2025-01-23T10:51:35Z</updated>

		<summary type="html">&lt;p&gt;R Keller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Description !! Content&lt;br /&gt;
|-&lt;br /&gt;
| module load&lt;br /&gt;
| compiler/gnu or compiler/intel or compiler/llvm and others...  &lt;br /&gt;
|-&lt;br /&gt;
| License&lt;br /&gt;
| [[Development/Intel_Compiler|Intel]]: Commercial &amp;amp;#124; [[Development/GCC|GNU]]: GPL &amp;amp;#124; LLVM: Apache 2 &amp;amp;#124; PGI/NVIDIA: Commercial&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Description =&lt;br /&gt;
&lt;br /&gt;
Basically, compilers translate human-readable source code (e.g. C++ interpreted as adhering to ISO/IEC 14882:2014, encoded in UTF-8 text) into binary byte code (e.g. x86-64 with Linux ABI in ELF-format).&lt;br /&gt;
Compilers are complex software and have become very powerful in the last decades, to &#039;&#039;&#039;guide&#039;&#039;&#039; you as a programmer writing better, more portable, more performant programs. Use the compiler as a tool -- and best use multiple compilers on the same source code for best results.&lt;br /&gt;
The basic operations and hints can be performed with the same or similar commands on all available compilers. For advanced usage such as optimization and profiling you should consult the best practice guide of the compiler you intend to use ([[Development/GCC|GCC]], [[Development/Intel_Compiler|Intel Suite]]).&lt;br /&gt;
&lt;br /&gt;
More information about the MPI versions of the GNU and Intel Compilers is available here:&lt;br /&gt;
* [[Development/Parallel_Programming|Best Practices Guide for Parallel Programming]].&lt;br /&gt;
&lt;br /&gt;
= Loading compilers as modules =&lt;br /&gt;
&lt;br /&gt;
Modules and loading of modules is described in general in [[Environment_Modules|here for traditional Environment Modules]] and about the Lmod implementation of Environment modules in [[Software_Modules_Lmod|here for Lmod]].&lt;br /&gt;
&lt;br /&gt;
Modules need to be mentioned, since on any system there&#039;s a pre-installed set of compilers (for C, C++ and usually Fortran) -- the so-called system compilers -- provided by the Linux distribution. The system compiler however may lack certain options for optimization, are typically optimizing for older and more architectures (think SSE vs. AVX2 and AVX-512/AVX10.2). Also they may lack useful warnings or other features. On RedHat Enterprise Linux 9.4 this is GNU compiler v11.4.1.&lt;br /&gt;
Be advised to check out the newer compilers available as modules.&lt;br /&gt;
&lt;br /&gt;
Since Fortran (and very old C++) requires compiling and linking libraries with the very same compiler, many libraries, first-and-foremost the MPI libraries need to be provided for specific versions of a compiler.&lt;br /&gt;
On [[BwUniCluster_2.0]], these provided libraries will only be visible to &amp;lt;kbd&amp;gt;module avail&amp;lt;/kbd&amp;gt;, once a compiler is loaded.&lt;br /&gt;
Hence, check out loading&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module avail compiler/intel&lt;br /&gt;
...&lt;br /&gt;
$ module load compiler/intel/2023.1.0&lt;br /&gt;
...&lt;br /&gt;
$ module avail&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to see the available MPI modules.&lt;br /&gt;
&lt;br /&gt;
All vendors whether it&#039;s Intel, GNU, LLVM or the Nvidia toolkit (see module group toolkit) have compilers for different programming languages which will be available &lt;br /&gt;
only after loading the module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Linux Default Compiler ==&lt;br /&gt;
&lt;br /&gt;
The default Compiler installed on all compute nodes is the GNU Compiler Collection (GCC) or in short GNU compiler.&lt;br /&gt;
* Don&#039;t get distracted with the available compiler modules.&lt;br /&gt;
* Only the modules are loading the complete environments needed.  &lt;br /&gt;
&amp;lt;u&amp;gt;Example&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module purge                   # unload all modules&lt;br /&gt;
$ module list                    # check which modules are loaded, we expect none&lt;br /&gt;
No Modulefiles Currently Loaded.&lt;br /&gt;
$ gcc --version                  # see version of default Linux GNU compiler&lt;br /&gt;
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18)&lt;br /&gt;
[...]&lt;br /&gt;
$ module load compiler/gnu       # load default GNU compiler module&lt;br /&gt;
$ module list                    # check which modules are loaded, we expect the default GNU compiler&lt;br /&gt;
Currently Loaded Modulefiles:&lt;br /&gt;
  1) compiler/gnu/13.3&lt;br /&gt;
$ gcc --version                  # now, check the current (loaded) version of the GNU C compiler&lt;br /&gt;
gcc (GCC) 13.3.0&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Synoptical Tables =&lt;br /&gt;
&lt;br /&gt;
== Compilers (no MPI) ==&lt;br /&gt;
&lt;br /&gt;
{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Compiler Suite&lt;br /&gt;
! Language&lt;br /&gt;
! Command&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;Intel Composer (pre-OneAPI)&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[Development/Intel_Compiler|&amp;amp;bull;&amp;amp;nbsp;Best Practice Guides on Intel Compiler Software]] &lt;br /&gt;
| C&lt;br /&gt;
| icc&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| icpc&lt;br /&gt;
|-&lt;br /&gt;
| Fortran&lt;br /&gt;
| ifort&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;Intel OneAPI (llvm-based)&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[Development/Intel_Compiler|&amp;amp;bull;&amp;amp;nbsp;Best Practice Guides on Intel Compiler Software]] &lt;br /&gt;
| C&lt;br /&gt;
| icx&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| icpx&lt;br /&gt;
|-&lt;br /&gt;
| Fortran&lt;br /&gt;
| ifx&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;GCC&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[Development/GCC|&amp;amp;bull;&amp;amp;nbsp;Best Practice Guides on GNU Compiler Software]]&lt;br /&gt;
| C&lt;br /&gt;
| gcc&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| g++&lt;br /&gt;
|-&lt;br /&gt;
| Fortran&lt;br /&gt;
| gfortran&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;LLVM&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
| C&lt;br /&gt;
| clang&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| clang++&lt;br /&gt;
|-&lt;br /&gt;
| Fortran 77/90&lt;br /&gt;
| flang&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;PGI/NVIDIA&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
| C&lt;br /&gt;
| pgcc&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| pgCC&lt;br /&gt;
|-&lt;br /&gt;
| Fortran 77/90&lt;br /&gt;
| pgf77 or pgf90&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MPI compiler and Underlying Compilers ==&lt;br /&gt;
&lt;br /&gt;
MPI implementations such as MPIch, Intel-MPI (derived from MPIch) or Open MPI provide compiler wrappers, easing the usage of MPI by providing the Include-Directory &amp;lt;kbd&amp;gt;-I&amp;lt;/kbd&amp;gt; and required libraries as well as the implementation&#039;s library directory flag &amp;lt;kbd&amp;gt;-L&amp;lt;/kbd&amp;gt; for linking.&lt;br /&gt;
The following table lists available MPI compiler commands and the underlying compilers, compiler families, languages, and application binary interfaces (ABIs) that they support.&lt;br /&gt;
&lt;br /&gt;
{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! MPI Compiler Command !! Default Compiler !! Supported Language(s) !! Supported ABI&#039;s&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 style=&amp;quot;background-color:#DCDCDC;&amp;quot; | Generic Compilers &lt;br /&gt;
|-&lt;br /&gt;
| mpicc || gcc, cc  || C || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpicxx || g++ || C/C++ || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpifc || gfortran || Fortran77/Fortran 95 || 32/64 bit&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 style=&amp;quot;background-color:#DCDCDC;&amp;quot; | [[Development/GCC|GNU Compiler]] Versions 3 and higher &lt;br /&gt;
|-&lt;br /&gt;
| mpigcc || gcc || C || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpigxx || g++  || C/C++ || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpif77 || g77 || Fortran 77 || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpif90 || gfortran || Fortran 95 || 32/64 bit&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 style=&amp;quot;background-color:#DCDCDC;&amp;quot; | [[Development/Intel_Compiler|Intel Fortran, C++ Compilers]] Versions 13.1 through 14.0 and Higher&lt;br /&gt;
|-&lt;br /&gt;
| mpiicc || icc || C || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpiicpc || icpc || C++ || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
|impiifort  || ifort || Fortran77/Fortran 95 || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= How to use =&lt;br /&gt;
&lt;br /&gt;
The following compiler commands work for all the compilers in the list above even though&lt;br /&gt;
the examples will be for &#039;&#039;&#039;icc&#039;&#039;&#039; only.&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
The typical introduction is a &amp;quot;Hello World&amp;quot; program. The following C source code shows best practices:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;                   // for printf&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;                  // for EXIT_SUCCESS and EXIT_FAILURE&lt;br /&gt;
int main (int argc, char * argv[]) { // std. definition of a program taking arguments&lt;br /&gt;
    printf(&amp;quot;Hello World\n&amp;quot;);         // Unix Output is line-buffered, end line with New-line.&lt;br /&gt;
    return EXIT_SUCCESS;             // End program by returning 0 (No Error)&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
After loading the Intel Compiler module &#039;&#039;module load compiler/intel/&#039;&#039;, the source may be compiled and linked with the single command&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
to produce an executable named &#039;&#039;hello&#039;&#039;. This may be executed using the command &#039;&#039;./hello&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This process can be divided into two steps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ icc -c hello.c         # Compile .c File into object file (ending in .o)&lt;br /&gt;
$ icc hello.o -o hello   # Link the object file with the system libc library)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
When using libraries you must sometimes specify the directories where the &lt;br /&gt;
* include files (option &amp;lt;kbd&amp;gt;-I&amp;lt;/kbd&amp;gt;) and where the &lt;br /&gt;
* library files (option &amp;lt;kbd&amp;gt;-L&amp;lt;/kbd&amp;gt;) are located. &lt;br /&gt;
In addition you have to tell the compiler which &lt;br /&gt;
* library you want to link to (option &amp;lt;kbd&amp;gt;-l&amp;lt;/kbd&amp;gt;). &lt;br /&gt;
For example after &amp;lt;kbd&amp;gt;module load numlib/fftw&amp;lt;/kbd&amp;gt; you can compile code for fftw using&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ icc -c hello.c -I$FFTW_INC_DIR&lt;br /&gt;
$ icc hello.o -o hello -L$FFTW_LIB_DIR -lfftw3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
When the program crashes or doesn&#039;t produce the expected output the compiler can &lt;br /&gt;
help you by printing all warning messages &amp;lt;kbd&amp;gt;-Wall&amp;lt;/kbd&amp;gt; and adding flags for debugging &amp;lt;kbd&amp;gt;-g&amp;lt;/kbd&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc -Wall -g hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
&lt;br /&gt;
If the problem can&#039;t be solved this way you can inspect what exactly your program &lt;br /&gt;
does using a debugger, e.g. [[Development/GDB|GDB]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=green&amp;gt;To use the debugger properly with your program you have to compile it with debug information (option &amp;lt;kbd&amp;gt;-g&amp;lt;/kbd&amp;gt;)&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Example&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc -g hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
Although the compiler option &amp;lt;kbd&amp;gt;-Wall&amp;lt;/kbd&amp;gt; (and possibly others) should always be set, the &amp;lt;kbd&amp;gt;-g&amp;lt;/kbd&amp;gt; option should only be passed for&lt;br /&gt;
debugging purposes to find bugs.&lt;br /&gt;
It may slow down execution and enlarges the binary due to debugging symbols.&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
The usual and common way to compile your source is to apply compiler optimization.&lt;br /&gt;
&lt;br /&gt;
Since there are many optimization options, as a start for now the &amp;lt;font color=green&amp;gt;optimization level -O2&amp;lt;/font&amp;gt; is recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc -O2 hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;font color=red&amp;gt;Beware:&amp;lt;/font&amp;gt;&amp;amp;nbsp;The optimization-flag used is a capital-O (like Otto) and not a 0 (Zero)!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All compilers offer a multitude of optimization options, &lt;br /&gt;
one may check the complete list of options with short explanation on [[Development/GCC|GCC]], [[LLVM|LLVM]] and &lt;br /&gt;
[[Development/Intel_Compiler|Intel Suite]] using option &#039;&#039;&#039;-v&#039;&#039;&#039; &#039;&#039;&#039;--help&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ icc -v --help | less&lt;br /&gt;
$ gcc -v --help | less&lt;br /&gt;
$ clang -v --help | less&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note, that the optimization level &amp;lt;kbd&amp;gt;-O2&amp;lt;/kbd&amp;gt; produces code for a general instruction set.&lt;br /&gt;
If you want to set the instruction set available, and take advantage of AVX2 or AVX512f/AVX10.2, you have to&lt;br /&gt;
either add the machine-dependent &amp;lt;kbd&amp;gt;-mavx512f&amp;lt;/kbd&amp;gt; or set the specific architecture of your&lt;br /&gt;
target processor.&lt;br /&gt;
For [[BwUniCluster_2.0]] this depends on whether you run your application on any node, then you would select&lt;br /&gt;
the older Broadwell CPU, or whether You target the newer HPC nodes (which feature Xeon Gold 6230, aka &amp;quot;Cascade Lake&amp;quot;&lt;br /&gt;
architecture).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gcc -O2 -o hello hello.c                        # General optimization for any architecture&lt;br /&gt;
$ gcc -O2 -march=broadwell -o hello hello.c       # Will work on any compute node on bwUniCluster 2.0&lt;br /&gt;
$ gcc -O2 -march=cascadelake -o hello hello.c     # This may not run on Broadwell nodes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While adding &amp;lt;kbd&amp;gt;-march=broadwell&amp;lt;/kbd&amp;gt; adds the compiler options such as &amp;lt;kbd&amp;gt;-mavx -mavx2 -msse3 -msse4 -msse4.1 -msse4.2 -mssse3&amp;lt;/kbd&amp;gt;,&lt;br /&gt;
adding &amp;lt;kbd&amp;gt;-march=cascadelake&amp;lt;/kbd&amp;gt; will further this by &amp;lt;kbd&amp;gt;-mavx512bw -mavx512cd -mavx512dq -mavx512f -mavx512vl -mavx512vnni -mfma&amp;lt;/kbd&amp;gt;,&lt;br /&gt;
where &amp;lt;kbd&amp;gt;-mfma&amp;lt;/kbd&amp;gt; is the setting for allowing fused-multiply-add.&lt;br /&gt;
These options may provide considerable speed-up to your code as is.&lt;br /&gt;
&#039;&#039;&#039;Please note&#039;&#039;&#039; however, that Cascade Lake may throttle the processor&#039;s clock speed, when executing AVX-512 instructions, possibly running slower than&lt;br /&gt;
(older) AVX2 code paths would have.&lt;br /&gt;
&lt;br /&gt;
You should then pay attention to vectorization attained by the compiler -- and concentrate on the time-consuming loops,&lt;br /&gt;
where the compiler was not able to vectorize.&lt;br /&gt;
Further vectorization as described in the Best Practice Guides may help.&lt;br /&gt;
This information is available with the Intel compiler using &amp;lt;kbd&amp;gt;-qopt-report=5&amp;lt;/kbd&amp;gt; producing a lot of output in &amp;lt;kbd&amp;gt;hello.optrpt&amp;lt;/kbd&amp;gt;,&lt;br /&gt;
while GCC offers this information using &amp;lt;kbd&amp;gt;-fopt-info-all&amp;lt;/kbd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For GCC the options in use are best visible by calling &amp;lt;kbd&amp;gt;gcc -O2 -fverbose-asm -S -o hello.S hello.c&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
The option &amp;lt;kbd&amp;gt;-fverbose-asm&amp;lt;/kbd&amp;gt; stores all the options in the assembler file &amp;lt;kbd&amp;gt;hello.S&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Warnings and Error detection ==&lt;br /&gt;
All compilers have improved tremendously with regards to analyzing and detecting suspicious code: do make &#039;&#039;&#039;use&#039;&#039;&#039; of such warnings and hints.&lt;br /&gt;
The amount of false positives has reduced and it will make your code more accessible, less error-prone and more portable.&lt;br /&gt;
&lt;br /&gt;
The typical warning flags are &amp;lt;kbd&amp;gt;-Wall&amp;lt;/kbd&amp;gt; to turn on &#039;&#039;all&#039;&#039; warnings.&lt;br /&gt;
However, there&#039;s multiple other worthwhile warnings, which are not covered (since they might increase false positives, or since they are not yet considered so prominent).&lt;br /&gt;
E.g. &amp;lt;kbd&amp;gt;-Wextra&amp;lt;/kbd&amp;gt; turns on several other warnings, which will in the above example show that neither &amp;lt;kbd&amp;gt;argc&amp;lt;/kbd&amp;gt; nor &amp;lt;kbd&amp;gt;argv&amp;lt;/kbd&amp;gt; have been used inside of &amp;lt;kbd&amp;gt;main&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For LLVM&#039;s &amp;lt;kbd&amp;gt;clang&amp;lt;/kbd&amp;gt; the flag &amp;lt;kbd&amp;gt;-Weverything&amp;lt;/kbd&amp;gt; turns on all available warnings, albeit leading to many warnings (even false positives) on larger projects.&lt;br /&gt;
However, the fix-it hints are very helpful as well.&lt;br /&gt;
&lt;br /&gt;
All the compilers offer the flag &amp;lt;kbd&amp;gt;-Werror&amp;lt;/kbd&amp;gt; which turns any warning (allowing completion of compilation) into hard errors.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:static_code_analysis.png|right|border|513px|Copyright: HS Esslingen)]]&lt;br /&gt;
Another powerful feature available in GNU- and LLVM-based compilers is &#039;&#039;static code analysis&#039;&#039;&#039;, otherwise only available in Commercial tools, like [https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html Coverity].&lt;br /&gt;
Static code analysis evaluates &#039;&#039;&#039;each&#039;&#039;&#039; and &#039;&#039;&#039;every&#039;&#039;&#039; code path, making assumptions on input values and branches taken, detecting corner cases which might lead to real errors -- without having to actually execute this code path.&lt;br /&gt;
&lt;br /&gt;
For GCC this is turned on using &amp;lt;kbd&amp;gt;-fanalyzer&amp;lt;/kbd&amp;gt; which will detect e.g. cases of memory usage after a &amp;lt;kbd&amp;gt;free()&amp;lt;/kbd&amp;gt; of said memory and many others. [https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#Static-Analyzer-Options GCC&#039;s documentation] on Static Analysis provides further details.&lt;br /&gt;
&lt;br /&gt;
For LLVM recompile your project using &amp;lt;kbd&amp;gt;scan-build&amp;lt;/kbd&amp;gt;, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ scan-build make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This produces warnings on &amp;lt;kbd&amp;gt;stdout&amp;lt;/kbd&amp;gt;, but more importantly scan reports in directory &amp;lt;kbd&amp;gt;/scratch/scan-build-XXX&amp;lt;/kbd&amp;gt;, where XXX is date and time of the build.&lt;br /&gt;
For example the output of Open MPI includes real issues of missed memory releases in error code paths -- as shown in the following picture.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/General_compiler_usage&amp;diff=13662</id>
		<title>Development/General compiler usage</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/General_compiler_usage&amp;diff=13662"/>
		<updated>2025-01-23T10:20:18Z</updated>

		<summary type="html">&lt;p&gt;R Keller: Update the versions to match the current (bwUniCluster 2.0) expectations&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Description !! Content&lt;br /&gt;
|-&lt;br /&gt;
| module load&lt;br /&gt;
| compiler/gnu or compiler/intel or compiler/llvm and others...  &lt;br /&gt;
|-&lt;br /&gt;
| License&lt;br /&gt;
| [[Development/Intel_Compiler|Intel]]: Commercial &amp;amp;#124; [[Development/GCC|GNU]]: GPL &amp;amp;#124; LLVM: Apache 2 &amp;amp;#124; PGI/NVIDIA: Commercial&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Description =&lt;br /&gt;
&lt;br /&gt;
Basically, compilers translate human-readable source code (e.g. C++ interpreted as adhering to ISO/IEC 14882:2014, encoded in UTF-8 text) into binary byte code (e.g. x86-64 with Linux ABI in ELF-format).&lt;br /&gt;
Compilers are complex software and have become very powerful in the last decades, to &#039;&#039;&#039;guide&#039;&#039;&#039; you as a programmer writing better, more portable, more performant programs. Use the compiler as a tool -- and best use multiple compilers on the same source code for best results.&lt;br /&gt;
The basic operations and hints can be performed with the same or similar commands on all available compilers. For advanced usage such as optimization and profiling you should consult the best practice guide of the compiler you intend to use ([[Development/GCC|GCC]], [[Development/Intel_Compiler|Intel Suite]]).&lt;br /&gt;
&lt;br /&gt;
More information about the MPI versions of the GNU and Intel Compilers is available here:&lt;br /&gt;
* [[Development/Parallel_Programming|Best Practices Guide for Parallel Programming]].&lt;br /&gt;
&lt;br /&gt;
= Loading compilers as modules =&lt;br /&gt;
&lt;br /&gt;
Modules and loading of modules is described in general in [[Environment_Modules|here for traditional Environment Modules]] and about the Lmod implementation of Environment modules in [[Software_Modules_Lmod|here for Lmod]].&lt;br /&gt;
&lt;br /&gt;
Modules need to be mentioned, since on any system there&#039;s a pre-installed set of compilers (for C, C++ and usually Fortran) -- the so-called system compilers -- provided by the Linux distribution. The system compiler however may lack certain options for optimization, are typically optimizing for older and more architectures (think SSE vs. AVX2 and AVX-512/AVX10.2). Also they may lack useful warnings or other features. On RedHat Enterprise Linux 9.4 this is GNU compiler v11.4.1.&lt;br /&gt;
Be advised to check out the newer compilers available as modules.&lt;br /&gt;
&lt;br /&gt;
Since Fortran (and very old C++) requires compiling and linking libraries with the very same compiler, many libraries, first-and-foremost the MPI libraries need to be provided for specific versions of a compiler.&lt;br /&gt;
On [[BwUniCluster_2.0]], these provided libraries will only be visible to &amp;lt;kbd&amp;gt;module avail&amp;lt;/kbd&amp;gt;, once a compiler is loaded.&lt;br /&gt;
Hence, check out loading&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module avail compiler/intel&lt;br /&gt;
...&lt;br /&gt;
$ module load compiler/intel/2023.1.0&lt;br /&gt;
...&lt;br /&gt;
$ module avail&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to see the available MPI modules.&lt;br /&gt;
&lt;br /&gt;
All vendors whether it&#039;s Intel, GNU, LLVM or the Nvidia toolkit (see toolkit) have compilers for different programming languages which will be available &lt;br /&gt;
only after loading the module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Linux Default Compiler ==&lt;br /&gt;
&lt;br /&gt;
The default Compiler installed on all compute nodes is the GNU Compiler Collection (GCC) or in short GNU compiler.&lt;br /&gt;
* Don&#039;t get distracted with the available compiler modules.&lt;br /&gt;
* Only the modules are loading the complete environments needed.  &lt;br /&gt;
&amp;lt;u&amp;gt;Example&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module purge                   # unload all modules&lt;br /&gt;
$ module list                    # check which modules are loaded, we expect none&lt;br /&gt;
No Modulefiles Currently Loaded.&lt;br /&gt;
$ gcc --version                  # see version of default Linux GNU compiler&lt;br /&gt;
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18)&lt;br /&gt;
[...]&lt;br /&gt;
$ module load compiler/gnu       # load default GNU compiler module&lt;br /&gt;
$ module list                    # check which modules are loaded, we expect the default GNU compiler&lt;br /&gt;
Currently Loaded Modulefiles:&lt;br /&gt;
  1) compiler/gnu/13.3&lt;br /&gt;
$ gcc --version                  # now, check the current (loaded) version of the GNU C compiler&lt;br /&gt;
gcc (GCC) 13.3.0&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Synoptical Tables =&lt;br /&gt;
&lt;br /&gt;
== Compilers (no MPI) ==&lt;br /&gt;
&lt;br /&gt;
{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Compiler Suite&lt;br /&gt;
! Language&lt;br /&gt;
! Command&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;Intel Composer (pre-OneAPI)&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[Development/Intel_Compiler|&amp;amp;bull;&amp;amp;nbsp;Best Practice Guides on Intel Compiler Software]] &lt;br /&gt;
| C&lt;br /&gt;
| icc&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| icpc&lt;br /&gt;
|-&lt;br /&gt;
| Fortran&lt;br /&gt;
| ifort&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;Intel OneAPI (llvm-based)&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[Development/Intel_Compiler|&amp;amp;bull;&amp;amp;nbsp;Best Practice Guides on Intel Compiler Software]] &lt;br /&gt;
| C&lt;br /&gt;
| icx&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| icpx&lt;br /&gt;
|-&lt;br /&gt;
| Fortran&lt;br /&gt;
| ifx&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;GCC&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[Development/GCC|&amp;amp;bull;&amp;amp;nbsp;Best Practice Guides on GNU Compiler Software]]&lt;br /&gt;
| C&lt;br /&gt;
| gcc&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| g++&lt;br /&gt;
|-&lt;br /&gt;
| Fortran&lt;br /&gt;
| gfortran&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;LLVM&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
| C&lt;br /&gt;
| clang&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| clang++&lt;br /&gt;
|-&lt;br /&gt;
| Fortran 77/90&lt;br /&gt;
| flang&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;PGI/NVIDIA&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
| C&lt;br /&gt;
| pgcc&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| pgCC&lt;br /&gt;
|-&lt;br /&gt;
| Fortran 77/90&lt;br /&gt;
| pgf77 or pgf90&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MPI compiler and Underlying Compilers ==&lt;br /&gt;
&lt;br /&gt;
MPI implementations such as MPIch, Intel-MPI (derived from MPIch) or Open MPI provide compiler wrappers, easing the usage of MPI by providing the Include-Directory &amp;lt;kbd&amp;gt;-I&amp;lt;/kbd&amp;gt; and required libraries as well as the MPI implementations library directorie &amp;lt;kbd&amp;gt;-L&amp;lt;/kbd&amp;gt; for linking.&lt;br /&gt;
The following table lists available MPI compiler commands and the underlying compilers, compiler families, languages, and application binary interfaces (ABIs) that they support.&lt;br /&gt;
&lt;br /&gt;
{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! MPI Compiler Command !! Default Compiler !! Supported Language(s) !! Supported ABI&#039;s&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 style=&amp;quot;background-color:#DCDCDC;&amp;quot; | Generic Compilers &lt;br /&gt;
|-&lt;br /&gt;
| mpicc || gcc, cc  || C || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpicxx || g++ || C/C++ || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpifc || gfortran || Fortran77/Fortran 95 || 32/64 bit&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 style=&amp;quot;background-color:#DCDCDC;&amp;quot; | [[Development/GCC|GNU Compiler]] Versions 3 and higher &lt;br /&gt;
|-&lt;br /&gt;
| mpigcc || gcc || C || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpigxx || g++  || C/C++ || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpif77 || g77 || Fortran 77 || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpif90 || gfortran || Fortran 95 || 32/64 bit&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 style=&amp;quot;background-color:#DCDCDC;&amp;quot; | [[Development/Intel_Compiler|Intel Fortran, C++ Compilers]] Versions 13.1 through 14.0 and Higher&lt;br /&gt;
|-&lt;br /&gt;
| mpiicc || icc || C || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpiicpc || icpc || C++ || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
|impiifort  || ifort || Fortran77/Fortran 95 || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= How to use =&lt;br /&gt;
&lt;br /&gt;
The following compiler commands work for all the compilers in the list above even though&lt;br /&gt;
the examples will be for &#039;&#039;&#039;icc&#039;&#039;&#039; only.&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
The typical introduction is a &amp;quot;Hello World&amp;quot; program. The following C source code shows best practices:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;                   // for printf&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;                  // for EXIT_SUCCESS and EXIT_FAILURE&lt;br /&gt;
int main (int argc, char * argv[]) { // std. definition of a program taking arguments&lt;br /&gt;
    printf(&amp;quot;Hello World\n&amp;quot;);         // Unix Output is line-buffered, end line with New-line.&lt;br /&gt;
    return EXIT_SUCCESS;             // End program by returning 0 (No Error)&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
It may be compiled and linked with the single command&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
to produce an executable named &#039;&#039;hello&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This process can be divided into two steps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ icc -c hello.c&lt;br /&gt;
$ icc hello.o -o hello&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
When using libraries you must sometimes specify where the &lt;br /&gt;
* include files are (option &amp;lt;kbd&amp;gt;-I&amp;lt;/kbd&amp;gt;) and where the &lt;br /&gt;
* library files are (option &amp;lt;kbd&amp;gt;-L&amp;lt;/kbd&amp;gt;). &lt;br /&gt;
In addition you have to tell the compiler which &lt;br /&gt;
* library you want to use (option &amp;lt;kbd&amp;gt;-l&amp;lt;/kbd&amp;gt;). &lt;br /&gt;
For example after loading the module numlib/fftw you can compile code for fftw using&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ icc -c hello.c -I$FFTW_INC_DIR&lt;br /&gt;
$ icc hello.o -o hello -L$FFTW_LIB_DIR -lfftw3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
When the program crashes or doesn&#039;t produce the expected output the compiler can &lt;br /&gt;
help you by printing all warning messages &amp;lt;kbd&amp;gt;-Wall&amp;lt;/kbd&amp;gt; and adding flags for debugging &amp;lt;kbd&amp;gt;-g&amp;lt;/kbd&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc -Wall -g hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
&lt;br /&gt;
If the problem can&#039;t be solved this way you can inspect what exactly your program &lt;br /&gt;
does using a debugger, e.g. [[Development/GDB|GDB]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=green&amp;gt;To use the debugger properly with your program you have to compile it with debug information (option &amp;lt;kbd&amp;gt;-g&amp;lt;/kbd&amp;gt;)&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Example&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc -g hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
Although the compiler option &amp;lt;kbd&amp;gt;-Wall&amp;lt;/kbd&amp;gt; (and possibly others) should always be set, the &amp;lt;kbd&amp;gt;-g&amp;lt;/kbd&amp;gt; option should only be passed for&lt;br /&gt;
debugging purposes to find bugs.&lt;br /&gt;
It may slow down execution and enlarges the binary due to debugging symbols.&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
The usual and common way to compile your source is to apply compiler optimization.&lt;br /&gt;
&lt;br /&gt;
Since there are many optimization options, as a start for now the &amp;lt;font color=green&amp;gt;optimization level -O2&amp;lt;/font&amp;gt; is recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc -O2 hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;font color=red&amp;gt;Beware:&amp;lt;/font&amp;gt;&amp;amp;nbsp;The optimization-flag used is a capital-O (like Otto) and not a 0 (Zero)!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All compilers offer a multitude of optimization options, &lt;br /&gt;
one may check the complete list of options with short explanation on [[Development/GCC|GCC]], [[LLVM|LLVM]] and &lt;br /&gt;
[[Development/Intel_Compiler|Intel Suite]] using option &#039;&#039;&#039;-v&#039;&#039;&#039; &#039;&#039;&#039;--help&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ icc -v --help | less&lt;br /&gt;
$ gcc -v --help | less&lt;br /&gt;
$ clang -v --help | less&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note, that the optimization level &amp;lt;kbd&amp;gt;-O2&amp;lt;/kbd&amp;gt; produces code for a general instruction set.&lt;br /&gt;
If you want to set the instruction set available, and take advantage of AVX2 or AVX512f, you have to&lt;br /&gt;
either add the machine-dependent &amp;lt;kbd&amp;gt;-mavx512f&amp;lt;/kbd&amp;gt; or set the specific architecture of your&lt;br /&gt;
target processor.&lt;br /&gt;
For [[BwUniCluster_2.0]] this depends on whether you run your application on any node, then you would select&lt;br /&gt;
the older Broadwell CPU, or whether You target the newer HPC nodes (which feature Xeon Gold 6230, aka &amp;quot;Cascade Lake&amp;quot;&lt;br /&gt;
architecture).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gcc -O2 -o hello hello.c                        # General optimization for any architecture&lt;br /&gt;
$ gcc -O2 -march=broadwell -o hello hello.c       # Will work on any compute node on bwUniCluster 2.0&lt;br /&gt;
$ gcc -O2 -march=cascadelake -o hello hello.c     # This may not run on Broadwell nodes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While adding &amp;lt;kbd&amp;gt;-march=broadwell&amp;lt;/kbd&amp;gt; adds the compiler options such as &amp;lt;kbd&amp;gt;-mavx -mavx2 -msse3 -msse4 -msse4.1 -msse4.2 -mssse3&amp;lt;/kbd&amp;gt;,&lt;br /&gt;
adding &amp;lt;kbd&amp;gt;-march=cascadelake&amp;lt;/kbd&amp;gt; will further this by &amp;lt;kbd&amp;gt;-mavx512bw -mavx512cd -mavx512dq -mavx512f -mavx512vl -mavx512vnni -mfma&amp;lt;/kbd&amp;gt;,&lt;br /&gt;
where &amp;lt;kbd&amp;gt;-mfma&amp;lt;/kbd&amp;gt; is the setting for allowing fused-multiply-add.&lt;br /&gt;
These options may provide considerable speed-up to your code as is.&lt;br /&gt;
&#039;&#039;&#039;Please note&#039;&#039;&#039; however, that Cascade Lake may throttle the processor&#039;s clock speed, when executing AVX-512 instructions, possibly running slower than&lt;br /&gt;
(older) AVX2 code paths would have.&lt;br /&gt;
&lt;br /&gt;
You should then pay attention to vectorization attained by the compiler -- and concentrate on the time-consuming loops,&lt;br /&gt;
where the compiler was not able to vectorize.&lt;br /&gt;
Further vectorization as described in the Best Practice Guides may help.&lt;br /&gt;
This information is available with the Intel compiler using &amp;lt;kbd&amp;gt;-qopt-report=5&amp;lt;/kbd&amp;gt; producing a lot of output in &amp;lt;kbd&amp;gt;hello.optrpt&amp;lt;/kbd&amp;gt;,&lt;br /&gt;
while GCC offers this information using &amp;lt;kbd&amp;gt;-fopt-info-all&amp;lt;/kbd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For GCC the options in use are best visible by calling &amp;lt;kbd&amp;gt;gcc -O2 -fverbose-asm -S -o hello.S hello.c&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
The option &amp;lt;kbd&amp;gt;-fverbose-asm&amp;lt;/kbd&amp;gt; stores all the options in the assembler file &amp;lt;kbd&amp;gt;hello.S&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Warnings and Error detection ==&lt;br /&gt;
All compilers have improved tremendously with regards to analyzing and detecting suspicious code: do make &#039;&#039;&#039;use&#039;&#039;&#039; of such warnings and hints.&lt;br /&gt;
The amount of false positives has reduced and it will make your code more accessible, less error-prone and more portable.&lt;br /&gt;
&lt;br /&gt;
The typical warning flags are &amp;lt;kbd&amp;gt;-Wall&amp;lt;/kbd&amp;gt; to turn on &#039;&#039;all&#039;&#039; warnings.&lt;br /&gt;
However, there&#039;s multiple other worthwhile warnings, which are not covered (since they might increase false positives, or since they are not yet considered so prominent).&lt;br /&gt;
E.g. &amp;lt;kbd&amp;gt;-Wextra&amp;lt;/kbd&amp;gt; turns on several other warnings, which will in the above example show that neither &amp;lt;kbd&amp;gt;argc&amp;lt;/kbd&amp;gt; nor &amp;lt;kbd&amp;gt;argv&amp;lt;/kbd&amp;gt; have been used inside of &amp;lt;kbd&amp;gt;main&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For LLVM&#039;s &amp;lt;kbd&amp;gt;clang&amp;lt;/kbd&amp;gt; the flag &amp;lt;kbd&amp;gt;-Weverything&amp;lt;/kbd&amp;gt; turns on all available warnings, albeit leading to many warnings on larger projects.&lt;br /&gt;
However, the fix-it hints are very helpful as well.&lt;br /&gt;
&lt;br /&gt;
All the compilers offer the flag &amp;lt;kbd&amp;gt;-Werror&amp;lt;/kbd&amp;gt; which turns any warning (allowing completion of compilation) into hard errors.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:static_code_analysis.png|right|border|513px|Copyright: HS Esslingen)]]&lt;br /&gt;
Another powerful feature available in GNU- and LLVM-compilers is &#039;&#039;static code analysis&#039;&#039;&#039;, otherwise only available in Commercial tools, like [https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html Coverity].&lt;br /&gt;
Static code analysis evaluates &#039;&#039;&#039;each&#039;&#039;&#039; and &#039;&#039;&#039;every&#039;&#039;&#039; code path, making assumptions on input values and branches taken, detecting corner cases which might lead to real errors -- without having to actually execute this code path.&lt;br /&gt;
&lt;br /&gt;
For GCC this is turned on using &amp;lt;kbd&amp;gt;-fanalyzer&amp;lt;/kbd&amp;gt; which will detect e.g. cases of memory usage after a &amp;lt;kbd&amp;gt;free()&amp;lt;/kbd&amp;gt; of said memory and many others. [https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#Static-Analyzer-Options GCC&#039;s documentation] on Static Analysis provides further details.&lt;br /&gt;
&lt;br /&gt;
For LLVM recompile your project using &amp;lt;kbd&amp;gt;scan-build&amp;lt;/kbd&amp;gt;, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ scan-build make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This produces warnings on &amp;lt;kbd&amp;gt;stdout&amp;lt;/kbd&amp;gt;, but more importantly scan reports in directory &amp;lt;kbd&amp;gt;/scratch/scan-build-XXX&amp;lt;/kbd&amp;gt;, where XXX is date and time of the build.&lt;br /&gt;
For example the output of Open MPI includes real issues of missed memory releases in error code paths:&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Development/General_compiler_usage&amp;diff=13661</id>
		<title>Development/General compiler usage</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Development/General_compiler_usage&amp;diff=13661"/>
		<updated>2025-01-23T09:28:21Z</updated>

		<summary type="html">&lt;p&gt;R Keller: Order of links switched, since the latter is much more thorough&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Description !! Content&lt;br /&gt;
|-&lt;br /&gt;
| module load&lt;br /&gt;
| compiler/gnu or compiler/intel or compiler/llvm and others...  &lt;br /&gt;
|-&lt;br /&gt;
| License&lt;br /&gt;
| [[Development/Intel_Compiler|Intel]]: Commercial &amp;amp;#124; [[Development/GCC|GNU]]: GPL &amp;amp;#124; LLVM: Apache 2 &amp;amp;#124; PGI/NVIDIA: Commercial&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Description =&lt;br /&gt;
&lt;br /&gt;
Basically, compilers translate human-readable source code (e.g. C++ interpreted as adhering to ISO/IEC 14882:2014, encoded in UTF-8 text) into binary byte code (e.g. x86-64 with Linux ABI in ELF-format).&lt;br /&gt;
Compilers are complex software and have become very powerful in the last decades, to &#039;&#039;&#039;guide&#039;&#039;&#039; you as a programmer writing better, more portable, more performant programs. Use the compiler as a tool -- and best use multiple compilers on the same source code for best results.&lt;br /&gt;
The basic operations and hints can be performed with the same or similar commands on all available compilers. For advanced usage such as optimization and profiling you should consult the best practice guide of the compiler you intend to use ([[Development/GCC|GCC]], [[Development/Intel_Compiler|Intel Suite]]).&lt;br /&gt;
&lt;br /&gt;
More information about the MPI versions of the GNU and Intel Compilers is available here:&lt;br /&gt;
* [[Development/Parallel_Programming|Best Practices Guide for Parallel Programming]].&lt;br /&gt;
&lt;br /&gt;
= Loading compilers as modules =&lt;br /&gt;
&lt;br /&gt;
Modules and loading of modules is described in general in [[Environment_Modules|here for traditional Environment Modules]] and about the Lmod implementation of Environment modules in [[Software_Modules_Lmod|here for Lmod]].&lt;br /&gt;
&lt;br /&gt;
However, modules need to be mentioned, since on any system there&#039;s a pre-installed set of compilers (for C, C++ and usually Fortran), which are provided by the Linux distribution -- the so-called system compilers. Which however may lack certain options for optimization, for warnings or other features. On RedHat Enterprise Linux this is GNU compiler v8.3.1.&lt;br /&gt;
Be advised to check out the newer compilers available as modules.&lt;br /&gt;
&lt;br /&gt;
Since Fortran (and very old C++) requires compiling and linking libraries with the very same compiler, many libraries, first-and-foremost the MPI libraries need to be provided for specific versions of a compiler.&lt;br /&gt;
On [[BwUniCluster_2.0]], these provided libraries will only be visible to &amp;lt;kbd&amp;gt;module avail&amp;lt;/kbd&amp;gt;, once a compiler is loaded.&lt;br /&gt;
Hence, check out loading&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module avail compiler/intel&lt;br /&gt;
...&lt;br /&gt;
$ module load compiler/intel/2021.4.0&lt;br /&gt;
...&lt;br /&gt;
$ module avail&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to see the available MPI modules.&lt;br /&gt;
&lt;br /&gt;
All Intel, GCC and PGI have compilers for different programming languages which will be available &lt;br /&gt;
after the module is loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Linux Default Compiler ==&lt;br /&gt;
&lt;br /&gt;
The default Compiler installed on all compute nodes is the GNU Compiler Collection (GCC) or in short GNU compiler.&lt;br /&gt;
* Don&#039;t get distracted with the available compiler modules.&lt;br /&gt;
* Only the modules are loading the complete environments needed.  &lt;br /&gt;
&amp;lt;u&amp;gt;Example&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module purge                     # unload all modules&lt;br /&gt;
$ module list                      # control&lt;br /&gt;
No Modulefiles Currently Loaded.&lt;br /&gt;
$ gcc --version                    # see version of default Linux GNU compiler&lt;br /&gt;
gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)&lt;br /&gt;
[...]&lt;br /&gt;
$ module load compiler/gnu         # load default GNU compiler module&lt;br /&gt;
$ module list                      # control&lt;br /&gt;
Currently Loaded Modulefiles:&lt;br /&gt;
  1) compiler/gnu/10.2(default)&lt;br /&gt;
$ gcc --version                    # now, check the current (loaded) module&lt;br /&gt;
gcc (GCC) 10.2.0&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Synoptical Tables =&lt;br /&gt;
&lt;br /&gt;
== Compilers (no MPI) ==&lt;br /&gt;
&lt;br /&gt;
{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Compiler Suite&lt;br /&gt;
! Language&lt;br /&gt;
! Command&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;Intel Composer (pre-OneAPI)&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[Development/Intel_Compiler|&amp;amp;bull;&amp;amp;nbsp;Best Practice Guides on Intel Compiler Software]] &lt;br /&gt;
| C&lt;br /&gt;
| icc&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| icpc&lt;br /&gt;
|-&lt;br /&gt;
| Fortran&lt;br /&gt;
| ifort&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;Intel OneAPI (llvm-based)&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[Development/Intel_Compiler|&amp;amp;bull;&amp;amp;nbsp;Best Practice Guides on Intel Compiler Software]] &lt;br /&gt;
| C&lt;br /&gt;
| icx&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| icpx&lt;br /&gt;
|-&lt;br /&gt;
| Fortran&lt;br /&gt;
| ifx&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;GCC&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[Development/GCC|&amp;amp;bull;&amp;amp;nbsp;Best Practice Guides on GNU Compiler Software]]&lt;br /&gt;
| C&lt;br /&gt;
| gcc&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| g++&lt;br /&gt;
|-&lt;br /&gt;
| Fortran&lt;br /&gt;
| gfortran&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;LLVM&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
| C&lt;br /&gt;
| clang&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| clang++&lt;br /&gt;
|-&lt;br /&gt;
| Fortran 77/90&lt;br /&gt;
| flang&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;vertical-align:top;&amp;quot; rowspan=&amp;quot;3&amp;quot; | &amp;lt;font color=green&amp;gt;&amp;lt;big&amp;gt;PGI/NVIDIA&amp;lt;/big&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
| C&lt;br /&gt;
| pgcc&lt;br /&gt;
|-&lt;br /&gt;
| C++&lt;br /&gt;
| pgCC&lt;br /&gt;
|-&lt;br /&gt;
| Fortran 77/90&lt;br /&gt;
| pgf77 or pgf90&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MPI compiler and Underlying Compilers ==&lt;br /&gt;
&lt;br /&gt;
MPI implementations such as MPIch, Intel-MPI (derived from MPIch) or Open MPI provide compiler wrappers, easing the usage of MPI by providing the Include-Directory &amp;lt;kbd&amp;gt;-I&amp;lt;/kbd&amp;gt; and required libraries as well as the MPI implementations library directorie &amp;lt;kbd&amp;gt;-L&amp;lt;/kbd&amp;gt; for linking.&lt;br /&gt;
The following table lists available MPI compiler commands and the underlying compilers, compiler families, languages, and application binary interfaces (ABIs) that they support.&lt;br /&gt;
&lt;br /&gt;
{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! MPI Compiler Command !! Default Compiler !! Supported Language(s) !! Supported ABI&#039;s&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 style=&amp;quot;background-color:#DCDCDC;&amp;quot; | Generic Compilers &lt;br /&gt;
|-&lt;br /&gt;
| mpicc || gcc, cc  || C || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpicxx || g++ || C/C++ || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpifc || gfortran || Fortran77/Fortran 95 || 32/64 bit&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 style=&amp;quot;background-color:#DCDCDC;&amp;quot; | [[Development/GCC|GNU Compiler]] Versions 3 and higher &lt;br /&gt;
|-&lt;br /&gt;
| mpigcc || gcc || C || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpigxx || g++  || C/C++ || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpif77 || g77 || Fortran 77 || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpif90 || gfortran || Fortran 95 || 32/64 bit&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 style=&amp;quot;background-color:#DCDCDC;&amp;quot; | [[Development/Intel_Compiler|Intel Fortran, C++ Compilers]] Versions 13.1 through 14.0 and Higher&lt;br /&gt;
|-&lt;br /&gt;
| mpiicc || icc || C || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
| mpiicpc || icpc || C++ || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
|impiifort  || ifort || Fortran77/Fortran 95 || 32/64 bit &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= How to use =&lt;br /&gt;
&lt;br /&gt;
The following compiler commands work for all the compilers in the list above even though&lt;br /&gt;
the examples will be for &#039;&#039;&#039;icc&#039;&#039;&#039; only.&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
The typical introduction is a &amp;quot;Hello World&amp;quot; program. The following C source code shows best practices:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;                   // for printf&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;                  // for EXIT_SUCCESS and EXIT_FAILURE&lt;br /&gt;
int main (int argc, char * argv[]) { // std. definition of a program taking arguments&lt;br /&gt;
    printf(&amp;quot;Hello World\n&amp;quot;);         // Unix Output is line-buffered, end line with New-line.&lt;br /&gt;
    return EXIT_SUCCESS;             // End program by returning 0 (No Error)&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
It may be compiled and linked with the single command&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
to produce an executable named &#039;&#039;hello&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This process can be divided into two steps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ icc -c hello.c&lt;br /&gt;
$ icc hello.o -o hello&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
When using libraries you must sometimes specify where the &lt;br /&gt;
* include files are (option &amp;lt;kbd&amp;gt;-I&amp;lt;/kbd&amp;gt;) and where the &lt;br /&gt;
* library files are (option &amp;lt;kbd&amp;gt;-L&amp;lt;/kbd&amp;gt;). &lt;br /&gt;
In addition you have to tell the compiler which &lt;br /&gt;
* library you want to use (option &amp;lt;kbd&amp;gt;-l&amp;lt;/kbd&amp;gt;). &lt;br /&gt;
For example after loading the module numlib/fftw you can compile code for fftw using&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ icc -c hello.c -I$FFTW_INC_DIR&lt;br /&gt;
$ icc hello.o -o hello -L$FFTW_LIB_DIR -lfftw3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
When the program crashes or doesn&#039;t produce the expected output the compiler can &lt;br /&gt;
help you by printing all warning messages &amp;lt;kbd&amp;gt;-Wall&amp;lt;/kbd&amp;gt; and adding flags for debugging &amp;lt;kbd&amp;gt;-g&amp;lt;/kbd&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc -Wall -g hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
&lt;br /&gt;
If the problem can&#039;t be solved this way you can inspect what exactly your program &lt;br /&gt;
does using a debugger, e.g. [[Development/GDB|GDB]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=green&amp;gt;To use the debugger properly with your program you have to compile it with debug information (option &amp;lt;kbd&amp;gt;-g&amp;lt;/kbd&amp;gt;)&amp;lt;/font&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Example&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc -g hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
Although the compiler option &amp;lt;kbd&amp;gt;-Wall&amp;lt;/kbd&amp;gt; (and possibly others) should always be set, the &amp;lt;kbd&amp;gt;-g&amp;lt;/kbd&amp;gt; option should only be passed for&lt;br /&gt;
debugging purposes to find bugs.&lt;br /&gt;
It may slow down execution and enlarges the binary due to debugging symbols.&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
The usual and common way to compile your source is to apply compiler optimization.&lt;br /&gt;
&lt;br /&gt;
Since there are many optimization options, as a start for now the &amp;lt;font color=green&amp;gt;optimization level -O2&amp;lt;/font&amp;gt; is recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ icc -O2 hello.c -o hello&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;font color=red&amp;gt;Beware:&amp;lt;/font&amp;gt;&amp;amp;nbsp;The optimization-flag used is a capital-O (like Otto) and not a 0 (Zero)!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All compilers offer a multitude of optimization options, &lt;br /&gt;
one may check the complete list of options with short explanation on [[Development/GCC|GCC]], [[LLVM|LLVM]] and &lt;br /&gt;
[[Development/Intel_Compiler|Intel Suite]] using option &#039;&#039;&#039;-v&#039;&#039;&#039; &#039;&#039;&#039;--help&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ icc -v --help | less&lt;br /&gt;
$ gcc -v --help | less&lt;br /&gt;
$ clang -v --help | less&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note, that the optimization level &amp;lt;kbd&amp;gt;-O2&amp;lt;/kbd&amp;gt; produces code for a general instruction set.&lt;br /&gt;
If you want to set the instruction set available, and take advantage of AVX2 or AVX512f, you have to&lt;br /&gt;
either add the machine-dependent &amp;lt;kbd&amp;gt;-mavx512f&amp;lt;/kbd&amp;gt; or set the specific architecture of your&lt;br /&gt;
target processor.&lt;br /&gt;
For [[BwUniCluster_2.0]] this depends on whether you run your application on any node, then you would select&lt;br /&gt;
the older Broadwell CPU, or whether You target the newer HPC nodes (which feature Xeon Gold 6230, aka &amp;quot;Cascade Lake&amp;quot;&lt;br /&gt;
architecture).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gcc -O2 -o hello hello.c                        # General optimization for any architecture&lt;br /&gt;
$ gcc -O2 -march=broadwell -o hello hello.c       # Will work on any compute node on bwUniCluster 2.0&lt;br /&gt;
$ gcc -O2 -march=cascadelake -o hello hello.c     # This may not run on Broadwell nodes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While adding &amp;lt;kbd&amp;gt;-march=broadwell&amp;lt;/kbd&amp;gt; adds the compiler options such as &amp;lt;kbd&amp;gt;-mavx -mavx2 -msse3 -msse4 -msse4.1 -msse4.2 -mssse3&amp;lt;/kbd&amp;gt;,&lt;br /&gt;
adding &amp;lt;kbd&amp;gt;-march=cascadelake&amp;lt;/kbd&amp;gt; will further this by &amp;lt;kbd&amp;gt;-mavx512bw -mavx512cd -mavx512dq -mavx512f -mavx512vl -mavx512vnni -mfma&amp;lt;/kbd&amp;gt;,&lt;br /&gt;
where &amp;lt;kbd&amp;gt;-mfma&amp;lt;/kbd&amp;gt; is the setting for allowing fused-multiply-add.&lt;br /&gt;
These options may provide considerable speed-up to your code as is.&lt;br /&gt;
&#039;&#039;&#039;Please note&#039;&#039;&#039; however, that Cascade Lake may throttle the processor&#039;s clock speed, when executing AVX-512 instructions, possibly running slower than&lt;br /&gt;
(older) AVX2 code paths would have.&lt;br /&gt;
&lt;br /&gt;
You should then pay attention to vectorization attained by the compiler -- and concentrate on the time-consuming loops,&lt;br /&gt;
where the compiler was not able to vectorize.&lt;br /&gt;
Further vectorization as described in the Best Practice Guides may help.&lt;br /&gt;
This information is available with the Intel compiler using &amp;lt;kbd&amp;gt;-qopt-report=5&amp;lt;/kbd&amp;gt; producing a lot of output in &amp;lt;kbd&amp;gt;hello.optrpt&amp;lt;/kbd&amp;gt;,&lt;br /&gt;
while GCC offers this information using &amp;lt;kbd&amp;gt;-fopt-info-all&amp;lt;/kbd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For GCC the options in use are best visible by calling &amp;lt;kbd&amp;gt;gcc -O2 -fverbose-asm -S -o hello.S hello.c&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
The option &amp;lt;kbd&amp;gt;-fverbose-asm&amp;lt;/kbd&amp;gt; stores all the options in the assembler file &amp;lt;kbd&amp;gt;hello.S&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Warnings and Error detection ==&lt;br /&gt;
All compilers have improved tremendously with regards to analyzing and detecting suspicious code: do make &#039;&#039;&#039;use&#039;&#039;&#039; of such warnings and hints.&lt;br /&gt;
The amount of false positives has reduced and it will make your code more accessible, less error-prone and more portable.&lt;br /&gt;
&lt;br /&gt;
The typical warning flags are &amp;lt;kbd&amp;gt;-Wall&amp;lt;/kbd&amp;gt; to turn on &#039;&#039;all&#039;&#039; warnings.&lt;br /&gt;
However, there&#039;s multiple other worthwhile warnings, which are not covered (since they might increase false positives, or since they are not yet considered so prominent).&lt;br /&gt;
E.g. &amp;lt;kbd&amp;gt;-Wextra&amp;lt;/kbd&amp;gt; turns on several other warnings, which will in the above example show that neither &amp;lt;kbd&amp;gt;argc&amp;lt;/kbd&amp;gt; nor &amp;lt;kbd&amp;gt;argv&amp;lt;/kbd&amp;gt; have been used inside of &amp;lt;kbd&amp;gt;main&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For LLVM&#039;s &amp;lt;kbd&amp;gt;clang&amp;lt;/kbd&amp;gt; the flag &amp;lt;kbd&amp;gt;-Weverything&amp;lt;/kbd&amp;gt; turns on all available warnings, albeit leading to many warnings on larger projects.&lt;br /&gt;
However, the fix-it hints are very helpful as well.&lt;br /&gt;
&lt;br /&gt;
All the compilers offer the flag &amp;lt;kbd&amp;gt;-Werror&amp;lt;/kbd&amp;gt; which turns any warning (allowing completion of compilation) into hard errors.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:static_code_analysis.png|right|border|513px|Copyright: HS Esslingen)]]&lt;br /&gt;
Another powerful feature available in GNU- and LLVM-compilers is &#039;&#039;static code analysis&#039;&#039;&#039;, otherwise only available in Commercial tools, like [https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html Coverity].&lt;br /&gt;
Static code analysis evaluates &#039;&#039;&#039;each&#039;&#039;&#039; and &#039;&#039;&#039;every&#039;&#039;&#039; code path, making assumptions on input values and branches taken, detecting corner cases which might lead to real errors -- without having to actually execute this code path.&lt;br /&gt;
&lt;br /&gt;
For GCC this is turned on using &amp;lt;kbd&amp;gt;-fanalyzer&amp;lt;/kbd&amp;gt; which will detect e.g. cases of memory usage after a &amp;lt;kbd&amp;gt;free()&amp;lt;/kbd&amp;gt; of said memory and many others. [https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#Static-Analyzer-Options GCC&#039;s documentation] on Static Analysis provides further details.&lt;br /&gt;
&lt;br /&gt;
For LLVM recompile your project using &amp;lt;kbd&amp;gt;scan-build&amp;lt;/kbd&amp;gt;, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ scan-build make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This produces warnings on &amp;lt;kbd&amp;gt;stdout&amp;lt;/kbd&amp;gt;, but more importantly scan reports in directory &amp;lt;kbd&amp;gt;/scratch/scan-build-XXX&amp;lt;/kbd&amp;gt;, where XXX is date and time of the build.&lt;br /&gt;
For example the output of Open MPI includes real issues of missed memory releases in error code paths:&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Registration/bwUniCluster/Entitlement&amp;diff=13660</id>
		<title>Registration/bwUniCluster/Entitlement</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Registration/bwUniCluster/Entitlement&amp;diff=13660"/>
		<updated>2025-01-20T11:52:05Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Step A: bwUniCluster Entitlement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
The bwUniCluster entitlement (see [https://www.bwidm.de/attribute.php#Berechtigung eduPersonEntitlement]) issued by a university assures the operator of the Clusters, that its university member&#039;s compute activities comply with the German Foreign Trade Act (Außenwirtschaftsgesetz - AWG) and German Foreign Trade Regulations (Außenwirtschaftsverordnung - AWV). &#039;&#039;Please check&#039;&#039; the regulations at the Federal Office of Economics and Export Control (BAFA) under [https://www.bafa.de/DE/Aussenwirtschaft/Ausfuhrkontrolle/Allgemeine_Einfuehrung/allgemeine_einfuehrung_node.html BAFA Aussenwirtschaft Ausfuhrkontrolle]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Step A: bwUniCluster Entitlement =&lt;br /&gt;
&lt;br /&gt;
To register for the bwUniCluster 2.0 you need the  &#039;&#039;&#039;bwUniCluster Entitlement&#039;&#039;&#039; issued by your university.&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
The entitlement is called &#039;&#039;&#039;bwUniCluster&#039;&#039;&#039; (and not bwUniCluster 2.0) and each university assigns the entitlement &#039;&#039;&#039;only&#039;&#039;&#039; for its own members.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you are not sure if you already have an entitlement, please check it first with the [[Registration/bwUniCluster/Entitlement#Check_your_Entitlements|&#039;&#039;&#039;Check your Entitlements&#039;&#039;&#039;]] guide below.&lt;br /&gt;
If you need the entitlement, please follow the link for your institution or contact your local service desk if no information is provided:&lt;br /&gt;
* [https://www.hs-esslingen.de/informatik-und-informationstechnik/forschung-labore/projekte/forschungsprojekte/high-performance-computing/ Hochschule Esslingen]&lt;br /&gt;
* [[BwCluster_User_Access_Uni_Freiburg|Universität Freiburg]]&lt;br /&gt;
* [https://heiservices.uni-heidelberg.de/entitlement Universität Heidelberg] (access only within Uni Heidelberg network)&lt;br /&gt;
* [https://kim.uni-hohenheim.de/bwhpc-account Universität Hohenheim]&lt;br /&gt;
* [https://www.scc.kit.edu/downloads/ISM/Accessform_bwUniCluster_DE_EN_new.pdf Karlsruhe Institute of Technology (KIT)]&lt;br /&gt;
* [https://www.kim.uni-konstanz.de/en/services/research-and-teaching/high-performance-computing/access-to-bwunicluster Universität Konstanz]&lt;br /&gt;
* [[BWUniCluster_User_Access_Members_Uni_Mannheim|Universität Mannheim]]&lt;br /&gt;
* [https://www.hlrs.de/apply-for-computing-time/bw-uni-cluster Universität Stuttgart]&lt;br /&gt;
* [https://uni-tuebingen.de/de/155157 Universität Tübingen]&lt;br /&gt;
* [[BWUniCluster_User_Access_Members_Uni_Ulm|Universität Ulm]]&lt;br /&gt;
* [[Registration/HAW|HAW BW e.V.]] and Duale Hochschule Baden-Württemberg: Please contact your local service desk / compute center in case of question contact  [mailto:hpc-at-haw@hs-esslingen.de mailto:hpc-at-haw@hs-esslingen.de]&lt;br /&gt;
&lt;br /&gt;
== Check your Entitlements ==&lt;br /&gt;
&lt;br /&gt;
To make sure you do not already have the entitlement, please log in to &#039;&#039;&#039;https://login.bwidm.de/user/index.xhtml&#039;&#039;&#039;.&lt;br /&gt;
To see the list of your entitlements, first select the &#039;&#039;&#039;Shibboleth&#039;&#039;&#039; tab at the top.&lt;br /&gt;
If the list below &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;urn:oid:1.3.6.1.4.1.5923.1.1.1.7&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; contains&lt;br /&gt;
&amp;lt;pre&amp;gt;http://bwidm.de/entitlement/bwUniCluster&amp;lt;/pre&amp;gt;&lt;br /&gt;
you already have the entitlement and can skip step A.&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://bwidm.de/entitlement/bwUniCluster&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is an attribute and not a link!&lt;br /&gt;
See [https://www.bwidm.de/dienste.php bwUniCluster und bwForCluster] for more information about needed attributes for this service.&lt;br /&gt;
|}&lt;br /&gt;
[[File:BwIDM-idp.png|center|600px|thumb|Verify Entitlement.]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align:right;&amp;quot;&amp;gt;[[Registration/bwUniCluster/Service | Go to step B]]&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Registration/2FA&amp;diff=13659</id>
		<title>Registration/2FA</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Registration/2FA&amp;diff=13659"/>
		<updated>2025-01-20T11:07:20Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* How 2FA works on the bwHPC Clusters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Generate a Second Factor (2FA) =&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
You or your group must take care of the hardware for the second factor yourself. We do not provide hardware keys or mobile devices.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To improve security a &#039;&#039;&#039;2-factor authentication mechanism (2FA)&#039;&#039;&#039; is being enforced for logins to bwUniCluster/bwForClusters. In addition to the service password a second value, the &#039;&#039;&#039;second factor&#039;&#039;&#039;, has to be entered on every login.&lt;br /&gt;
&lt;br /&gt;
If you only have a mobile device, you can use software-based solutions as a second factor. If you don&#039;t want to use a smartphone app, we recommend using a hardware token such as Yubikey.&lt;br /&gt;
&lt;br /&gt;
* If you have any questions about 2FA, please read the [[Registration/2FA/FAQ|FAQs]], and if your question remains unanswered, please submit a support ticket.&lt;br /&gt;
&lt;br /&gt;
* The Pros and Cons of the various solutions can be found in this [[Registration/2FA/ProCon|wiki]].&lt;br /&gt;
&lt;br /&gt;
= How 2FA works on the bwHPC Clusters =&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
It is very important that the device that generates the One-Time Passwords and the device which is used to log into the bwUniCluster/bwForClusters are not the same.&lt;br /&gt;
Otherwise an attacker who gains access to your system can steal both the service password and the secret key of the Software Token application, which allows them to generate One-Time Passwords and log into the HPC system without your knowledge.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:2fa token code.jpg|right|200px|thumb|Hardware Token for TOTP]]&lt;br /&gt;
On the bwUniCluster/bwForClusters we use either six-digit, auto-generated, time-dependent &#039;&#039;&#039;one-time passwords&#039;&#039;&#039; (TOTP) or Yubico OTP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TOTPs&#039;&#039;&#039; are generated by a piece of software which is part of a special hardware device (a &#039;&#039;&#039;hardware token&#039;&#039;&#039;) or of a normal application running on a common device (a &#039;&#039;&#039;software token&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
The Token has to be synchronized with a central server before it can be used for authentication and then generates an endless stream of six-digit values (TOTPs) which can only be used once and are only valid during a very short interval of time. This makes it much harder for potential attackers to access the HPC system, even if they know the regular service password.&lt;br /&gt;
&lt;br /&gt;
Typically a new TOTP value is generated every 30 seconds. When the current TOTP value has once been used successfully for a login, it is depleted and one has to wait up to 30 seconds for the next TOTP value. If you don&#039;t want to use a smartphone, we recommend using a hardware token, such as Yubikey or another TOTP-compatible device.&lt;br /&gt;
We do not recommend the use of TOTP generators for PCs. If the second factor is generated on the same computer on which the login takes place, it is no longer a second factor.&lt;br /&gt;
&lt;br /&gt;
[[File:Otpapp.png|right|150px|thumb|Source: https://getaegis.app]]&lt;br /&gt;
&lt;br /&gt;
The most common solution is to use a mobile device (e.g. your smartphone or tablet) as a Software Token by installing one of the following apps:&lt;br /&gt;
* 2FAS for [https://play.google.com/store/apps/details?id=com.twofasapp Android] or [https://apps.apple.com/us/app/2fa-authenticator-2fas/id1217793794 iOS] ([https://2fas.com/ Web Page] and [https://github.com/twofas GitHub], &#039;&#039;Apple and Google Cloud can be used for backups depending on the operating system.&#039;&#039;)&lt;br /&gt;
* Open Source FreeOTP ([https://github.com/freeotp GitHub]) on [https://f-droid.org/en/packages/org.fedorahosted.freeotp/ F-Droid], [https://play.google.com/store/search?q=freeotp Android] or [https://apps.apple.com/de/app/freeotp-authenticator/id872559395 iOS] with a possibility of local backup files.&lt;br /&gt;
* Google Authenticator for [https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2 Android] or [https://apps.apple.com/de/app/google-authenticator/id388497605 iOS] (&#039;&#039;Google Cloud can be used for backups, but these backups are not encrypted and can therefore be read by Google!&#039;&#039;)&lt;br /&gt;
* Microsoft Authenticator for [https://play.google.com/store/apps/details?id=com.azure.authenticator Android] or [https://apps.apple.com/de/app/microsoft-authenticator/id983156458 iOS] ([https://www.microsoft.com/de-de/security/mobile-authenticator-app Web Page])&lt;br /&gt;
* LastPass Authenticator for [https://play.google.com/store/apps/details?id=com.lastpass.authenticator Android], [https://apps.apple.com/us/app/lastpass-authenticator/id1079110004 iOS] or [https://lastpass.com/auth/ Windows]&lt;br /&gt;
* Aegis Authenticator for [https://play.google.com/store/apps/details?id=com.beemdevelopment.aegis Android (Google Play)] or [https://f-droid.org/en/packages/com.beemdevelopment.aegis/ Android (F-Droid)] ([https://getaegis.app/ Web Page])&lt;br /&gt;
* OTP Auth for [https://apps.apple.com/app/otp-auth/id659877384 iOS]&lt;br /&gt;
* (&#039;&#039;Authy for [https://play.google.com/store/apps/details?id=com.authy.authy Android], [https://apps.apple.com/us/app/authy/id494168017 iOS], [https://authy.com/download/ Mac, Windows or Linux], requires account&#039;&#039;)&lt;br /&gt;
(&#039;&#039;These are only suggestions. You can use any application compatible with the [https://tools.ietf.org/html/rfc6238 TOTP] standard.&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
[https://www.yubico.com/resources/glossary/yubico-otp/ &#039;&#039;&#039;Yubico OTP&#039;&#039;&#039;] is also supported if you want to use your Yubikey without depending on having a six-digit code displayed.&lt;br /&gt;
&lt;br /&gt;
= Token Management =&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
* Create at least two separate tokens: &#039;&#039;&#039;FIRST&#039;&#039;&#039; set up a software/hardware TOTP token. &#039;&#039;&#039;THEN&#039;&#039;&#039; create and print a &amp;quot;backup TAN list&amp;quot;. Never create the &amp;quot;backup TAN list&amp;quot; first.&lt;br /&gt;
* If you lose access to all your tokens, you will not be able to create new tokens and support will have to reset your tokens manually.&lt;br /&gt;
* The &amp;quot;backup TAN list&amp;quot; should always be created and printed in a &#039;&#039;&#039;second step&#039;&#039;&#039;. The printout should be kept in a separate place for emergencies.&lt;br /&gt;
* Please clean up your second factors as soon as you have created new tokens. Tokens that can no longer be used (e.g. because not initialized, smartphone/Yubikey lost, etc.) or an old backup TAN list where you have already used all TANs or there is no printout should be deactivated and deleted.&lt;br /&gt;
* Returning users who have already activated one or more tokens must first verify their token before they can create new tokens, see section [[Registration/2FA#Returning_Users|Returning Users]].&lt;br /&gt;
* &#039;&#039;&#039;Please disable all privacy tools, ad blockers and further add-ons when registering new tokens.&#039;&#039;&#039; These tools prevent the registration website from generating new security tokens. When the problems remains (you can not generate the QR code or can not confirm it by clicking CHECK), please try once more with an entirely new unmodified web browser profile.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;bwUniCluster/bwForCluster Tokens&#039;&#039;&#039; are generally managed via the &#039;&#039;&#039;Index -&amp;gt; My Tokens&#039;&#039;&#039; menu entry on the registration pages for the clusters. Here you can register, activate, deactivate and delete tokens.&lt;br /&gt;
&lt;br /&gt;
To activate the second factor, &#039;&#039;&#039;please perform the following steps:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Select the registration server of the cluster&#039;&#039;&#039; for which you want to create a second factor and login to it:&amp;lt;/br&amp;gt; &amp;amp;rarr; [https://login.bwidm.de/user/twofa.xhtml Registration server for &#039;&#039;&#039;bwUniCluster 2.0&#039;&#039;&#039;, &#039;&#039;&#039;bwForCluster JUSTUS 2&#039;&#039;&#039; and &#039;&#039;&#039;bwForCluster NEMO&#039;&#039;&#039;] (2FA tokens are valid for all three clusters; KIT members can reuse their existing hardware and software tokens)&amp;lt;/br&amp;gt; &amp;amp;rarr; [https://bwservices.uni-heidelberg.de/user/twofa.xhtml Registration server for &#039;&#039;&#039;bwForCluster Helix&#039;&#039;&#039;]&lt;br /&gt;
[[File:BwIDM-twofa.png|center|600px|thumb|My Tokens]]&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Register a new &amp;quot;[[Registration/2FA#Registering_a_new_Software_Token_using_a_Mobile_APP|Smartphone Token]]&amp;quot;&#039;&#039;&#039; or if you own a [https://www.yubico.com/ Yubikey]&#039;&#039;&#039; register a new &amp;quot;[[Registration/2FA#Registering_a_new_Yubikey_OTP_Token|Yubikey Token]]&amp;quot;&#039;&#039;&#039; or &#039;&#039;&#039;&amp;quot;[[Registration/2FA#Registering_a_new_Yubikey_OATH_TOTP_Token|Yubikey OATH TOTP Token]]&amp;quot;&#039;&#039;&#039; ([[Registration/2FA#Pros_and_Cons_of_the_different_Solutions|pros ans cons]]).&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Register a new &amp;quot;[[Registration/2FA#Backup_TAN_List|TAN List]]&amp;quot; (backup TAN list)&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Repeat step 2. for additional tokens.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Registering a new Software Token using a Mobile APP ==&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
Please disable all privacy tools, ad blockers and further add-ons when registering new tokens.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
1. Select the [[Registration/2FA#Token_Management|registration server]] of the cluster for which you want to create a second factor and login to it.&lt;br /&gt;
&lt;br /&gt;
2. Registering a new Token starts with a click &#039;&#039;&#039;NEW SMARTPHONE TOKEN&#039;&#039;&#039;.&lt;br /&gt;
[[File:BwIDM-token.png|center|600px|thumb|Create a new Token]]&lt;br /&gt;
&lt;br /&gt;
3. A new window opens. Click &#039;&#039;&#039;Start&#039;&#039;&#039; to generate a new &#039;&#039;&#039;QR code&#039;&#039;&#039;.&lt;br /&gt;
This may take a while.&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
The QR code contains a key which has to remain secret.&lt;br /&gt;
Only use the QR code to link your software token app with bwIDM/bwServices in the next step.&lt;br /&gt;
Do not save the QR code, print it out or share it with someone else.&lt;br /&gt;
|}&lt;br /&gt;
[[File:BwIDM-qr.png|center|600px|thumb|QR Code for Mobile App]]&lt;br /&gt;
&lt;br /&gt;
4. Start the software token app on your separate device and scan the QR code.&lt;br /&gt;
The exact process is a little bit different in every app, but is usually started by pressing on a button with a plus (+) sign or an icon of a QR code.&lt;br /&gt;
&lt;br /&gt;
5. Once the QR code has been loaded into your Software Token app there should be a new entry called &#039;&#039;&#039;bwIDM&#039;&#039;&#039; (bwUniCluster, JUSTUS 2 and NEMO) or &#039;&#039;&#039;bwServices&#039;&#039;&#039; (Helix).&lt;br /&gt;
Generate an One-Time-Password by pressing on this entry or selecting the appropriate button/menu item.&lt;br /&gt;
You will receive a six-digit code.&lt;br /&gt;
Enter this code into the field labeled &amp;quot;Current code:&amp;quot; in your bwIDM browser window to prove that the connection has worked and then click &#039;&#039;&#039;CHECK&#039;&#039;&#039;.&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
If you do not confirm the token by entering the six-digit code in the &amp;quot;Current code:&amp;quot; field, the token will &#039;&#039;&#039;NOT&#039;&#039;&#039; be initialized!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
6. If everything worked as expected, you will be returned to the &#039;&#039;&#039;My Tokens&#039;&#039;&#039; screen and there will be a new entry for your software token.&lt;br /&gt;
[[File:BwIDM-app.png|center|400px|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
7. Repeat the process to register additional tokens.&lt;br /&gt;
Please register at least the &amp;quot;Backup TAN list&amp;quot; in addition to the hardware/software token you plan to use regularly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Registering a new Yubikey OTP Token ==&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
Please disable all privacy tools, ad blockers and further add-ons when registering new tokens.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[https://developers.yubico.com/OTP/OTPs_Explained.html Yubikey OTP] is even easier and you don&#039;t need a device that displays the six-digit code or extra software.&lt;br /&gt;
New Yubikeys are already configured to provide Yubikey OTP in slot 1.&lt;br /&gt;
If you need to configure your Yubikey, read this [[Registration/2FA/Yubikey|documentation]].&lt;br /&gt;
&lt;br /&gt;
1. Select the [[Registration/2FA#Token_Management|registration server]] of the cluster for which you want to create a second factor and login to it.&lt;br /&gt;
&lt;br /&gt;
2. If you want to use [https://www.yubico.com/resources/glossary/yubico-otp/ Yubico OTP], you can click &#039;&#039;&#039;NEW YUBIKEY TOKEN&#039;&#039;&#039; instead.&lt;br /&gt;
[[File:BwIDM-token.png|center|600px|thumb|Generate Yubikey OTP]]&lt;br /&gt;
&lt;br /&gt;
3. Yubikey OTP is configured to slot 1 on new Yubikeys, so you only need to click in the text box and then touch the metal part of your Yubikey.&lt;br /&gt;
Please refer to this [[Registration/2FA/Yubikey|documentation]] on how to configure your Yubikey.&lt;br /&gt;
[[File:BwIDM-yubikey.png|center|400px|thumb|Yubikey OTP]]&lt;br /&gt;
&lt;br /&gt;
4. If everything worked as expected, you will be returned to the &#039;&#039;&#039;My Tokens&#039;&#039;&#039; screen and there will be a new entry for your Yubikey.&lt;br /&gt;
[[File:BwIDM-yubikey2.png|center|400px|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
5. Repeat the process to register additional tokens.&lt;br /&gt;
Please register at least the &amp;quot;Backup TAN list&amp;quot; in addition to the hardware/software token you plan to use regularly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Registering a new Yubikey OATH TOTP Token ==&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
Please disable all privacy tools, ad blockers and further add-ons when registering new tokens.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[https://developers.yubico.com/OATH/ Yubikey OATH TOTP] generates the TANs on your Yubikey and therefore you can use different computers and phones to generate these codes.&lt;br /&gt;
Please download and install [https://developers.yubico.com/OATH/YubiKey_OATH_software.html Yubico Authenticator] for desktop (or Android/iOS) first.&lt;br /&gt;
Insert your Yubikey in your computer.&lt;br /&gt;
&amp;quot;Yubikey OTP&amp;quot; (not &amp;quot;Yubikey OATH TOTP&amp;quot;) is even easier and you don&#039;t need a device that displays the six-digit code or extra software (go to step [[Registration/2FA#Yubikey_OTP|Yubikey OTP]]).&lt;br /&gt;
&lt;br /&gt;
1. Select the [[Registration/2FA#Token_Management|registration server]] of the cluster for which you want to create a second factor and login to it.&lt;br /&gt;
&lt;br /&gt;
2. Registering a new Token starts with a click &#039;&#039;&#039;NEW SMARTPHONE TOKEN&#039;&#039;&#039;.&lt;br /&gt;
[[File:BwIDM-token.png|center|600px|thumb|Create a new Token]]&lt;br /&gt;
&lt;br /&gt;
3. A new window opens. Click &#039;&#039;&#039;Start&#039;&#039;&#039; to generate a new &#039;&#039;&#039;QR code&#039;&#039;&#039;.&lt;br /&gt;
This may take a while.&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
The QR code contains a key which has to remain secret.&lt;br /&gt;
Only use the QR code to link your software token app with bwIDM/bwServices in the next step.&lt;br /&gt;
Do not save the QR code, print it out or share it with someone else.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
4. Start the Yubico Authenticator on your OS, click the three vertical dots in the upper right corner and select &#039;&#039;&#039;Scan QR code&#039;&#039;&#039;.&lt;br /&gt;
[[File:BwIDM-yubi1.png|center|600px|thumb|QR Code and Yubico Authenticator on Linux]]&lt;br /&gt;
&lt;br /&gt;
5. Yubico Authenticator automatically translates the QR code to a new entry called &#039;&#039;&#039;bwIDM&#039;&#039;&#039; or &#039;&#039;&#039;bwServices&#039;&#039;&#039; (Helix).&lt;br /&gt;
Click &#039;&#039;&#039;Add account&#039;&#039;&#039;.&lt;br /&gt;
[[File:BwIDM-yubi2.png|center|600px|thumb|Create new TOTP on Yubico Authenticator]]&lt;br /&gt;
&lt;br /&gt;
6. You will receive a six-digit code.&lt;br /&gt;
Enter this code into the field labeled &amp;quot;Current code:&amp;quot; in your bwIDM browser window to prove that the connection has worked and then click &#039;&#039;&#039;CHECK&#039;&#039;&#039;.&lt;br /&gt;
[[File:BwIDM-yubi3.png|center|600px|thumb|Verify TOTP]]&lt;br /&gt;
&lt;br /&gt;
7. If everything worked as expected, you will be returned to the &#039;&#039;&#039;My Tokens&#039;&#039;&#039; screen and there will be a new entry for your software token.&lt;br /&gt;
[[File:BwIDM-app.png|center|400px|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
8. Repeat the process to register additional tokens.&lt;br /&gt;
Please register at least the &amp;quot;Backup TAN list&amp;quot; in addition to the hardware/software token you plan to use regularly.&lt;br /&gt;
&lt;br /&gt;
== Backup TAN List ==&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
Passwords from the &amp;quot;Backup TAN list&amp;quot; should only be used if no other token is left.&lt;br /&gt;
Please do not use the Backup TANs for regular cluster login, because you have only a limited number of TANs.&lt;br /&gt;
Each TAN can only be used once.&lt;br /&gt;
Please disable all privacy tools, ad blockers and further add-ons when registering a new Backup TAN list.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
1. Select the [[Registration/2FA#Token_Management|registration server]] of the cluster for which you want to create a second factor and login to it.&lt;br /&gt;
&lt;br /&gt;
2. Please create at least one &amp;quot;Backup TAN list&amp;quot; by clicking &#039;&#039;&#039;CREATE NEW TAN LIST&#039;&#039;&#039;.&lt;br /&gt;
[[File:BwIDM-token.png|center|600px|thumb|Generate Backup TAN list]]&lt;br /&gt;
&lt;br /&gt;
3. Click &#039;&#039;&#039;START&#039;&#039;&#039;. You will be redirected to the &#039;&#039;&#039;My Tokens&#039;&#039;&#039; screen and there will be a new entry for your backup TANs.&lt;br /&gt;
[[File:BwIDM-tan.png|center|400px|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
4. Click &#039;&#039;&#039;SHOW TANS&#039;&#039;&#039;, print the codes and keep then in a separate place for emergencies.&lt;br /&gt;
[[File:JUSTUS-2-2FA-backup-TAN-list.png|center|800px|thumb|Print Backup TAN List]]&lt;br /&gt;
&lt;br /&gt;
5. Repeat the process to register additional tokens.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Deactivating a Token ==&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;Disable&#039;&#039;&#039; next to the Token entry on the &#039;&#039;&#039;My Tokens&#039;&#039;&#039; screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Deleting a Token ==&lt;br /&gt;
&lt;br /&gt;
After a Token has been disabled a new button labeled &#039;&#039;&#039;Delete&#039;&#039;&#039; will appear. Click on it to delete the token.&lt;br /&gt;
&lt;br /&gt;
= Returning Users =&lt;br /&gt;
&lt;br /&gt;
Returning users who have already activated one or more tokens must first verify their token before they can create new tokens or deactivate/delete old ones.&lt;br /&gt;
If you no longer have valid tokens, you will not be able to create or manage tokens. &lt;br /&gt;
In this case, read the section [[Registration/2FA#Lost_Token|Lost Token]].&lt;br /&gt;
[[File:BwIDM-totp.png|center|400px|thumb|Returning users must first verify their token.]]&lt;br /&gt;
&lt;br /&gt;
= Lost Token =&lt;br /&gt;
&lt;br /&gt;
If you change your phone, please migrate your tokens first or register your new mobile app under &amp;quot;My Tokens&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If you no longer have valid tokens (mobile app, hardware token, Yubikey or backup TAN, i.e. lost or broken smartphone), you can not access the section &amp;quot;My Tokens&amp;quot; anymore.&lt;br /&gt;
In this case you will need to contact the [https://bw-support.scc.kit.edu/ ticket system].&#039;&#039;&#039;&lt;br /&gt;
Open a ticket, include your user name, the name of the bwHPC cluster and ask for a reset of your 2FA tokens.&lt;br /&gt;
Please note that this process may take some time and also means additional work for the operators.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Registration/2FA&amp;diff=13658</id>
		<title>Registration/2FA</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Registration/2FA&amp;diff=13658"/>
		<updated>2025-01-20T11:04:26Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* How 2FA works on the bwHPC Clusters */ Add FreeOTP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Generate a Second Factor (2FA) =&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
You or your group must take care of the hardware for the second factor yourself. We do not provide hardware keys or mobile devices.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To improve security a &#039;&#039;&#039;2-factor authentication mechanism (2FA)&#039;&#039;&#039; is being enforced for logins to bwUniCluster/bwForClusters. In addition to the service password a second value, the &#039;&#039;&#039;second factor&#039;&#039;&#039;, has to be entered on every login.&lt;br /&gt;
&lt;br /&gt;
If you only have a mobile device, you can use software-based solutions as a second factor. If you don&#039;t want to use a smartphone app, we recommend using a hardware token such as Yubikey.&lt;br /&gt;
&lt;br /&gt;
* If you have any questions about 2FA, please read the [[Registration/2FA/FAQ|FAQs]], and if your question remains unanswered, please submit a support ticket.&lt;br /&gt;
&lt;br /&gt;
* The Pros and Cons of the various solutions can be found in this [[Registration/2FA/ProCon|wiki]].&lt;br /&gt;
&lt;br /&gt;
= How 2FA works on the bwHPC Clusters =&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
It is very important that the device that generates the One-Time Passwords and the device which is used to log into the bwUniCluster/bwForClusters are not the same.&lt;br /&gt;
Otherwise an attacker who gains access to your system can steal both the service password and the secret key of the Software Token application, which allows them to generate One-Time Passwords and log into the HPC system without your knowledge.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:2fa token code.jpg|right|200px|thumb|Hardware Token for TOTP]]&lt;br /&gt;
On the bwUniCluster/bwForClusters we use either six-digit, auto-generated, time-dependent &#039;&#039;&#039;one-time passwords&#039;&#039;&#039; (TOTP) or Yubico OTP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TOTPs&#039;&#039;&#039; are generated by a piece of software which is part of a special hardware device (a &#039;&#039;&#039;hardware token&#039;&#039;&#039;) or of a normal application running on a common device (a &#039;&#039;&#039;software token&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
The Token has to be synchronized with a central server before it can be used for authentication and then generates an endless stream of six-digit values (TOTPs) which can only be used once and are only valid during a very short interval of time. This makes it much harder for potential attackers to access the HPC system, even if they know the regular service password.&lt;br /&gt;
&lt;br /&gt;
Typically a new TOTP value is generated every 30 seconds. When the current TOTP value has once been used successfully for a login, it is depleted and one has to wait up to 30 seconds for the next TOTP value. If you don&#039;t want to use a smartphone, we recommend using a hardware token, such as Yubikey or another TOTP-compatible device.&lt;br /&gt;
We do not recommend the use of TOTP generators for PCs. If the second factor is generated on the same computer on which the login takes place, it is no longer a second factor.&lt;br /&gt;
&lt;br /&gt;
[[File:Otpapp.png|right|150px|thumb|Source: https://getaegis.app]]&lt;br /&gt;
&lt;br /&gt;
The most common solution is to use a mobile device (e.g. your smartphone or tablet) as a Software Token by installing one of the following apps:&lt;br /&gt;
* 2FAS for [https://play.google.com/store/apps/details?id=com.twofasapp Android] or [https://apps.apple.com/us/app/2fa-authenticator-2fas/id1217793794 iOS] ([https://2fas.com/ Web Page] and [https://github.com/twofas GitHub], &#039;&#039;Apple and Google Cloud can be used for backups depending on the operating system.&#039;&#039;)&lt;br /&gt;
* Open Source FreeOTP on [https://f-droid.org/en/packages/org.fedorahosted.freeotp/ F-Droid], [https://play.google.com/store/search?q=freeotp Android] or [https://apps.apple.com/de/app/freeotp-authenticator/id872559395 iOS] with a possibility of local backup files.&lt;br /&gt;
* Google Authenticator for [https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2 Android] or [https://apps.apple.com/de/app/google-authenticator/id388497605 iOS] (&#039;&#039;Google Cloud can be used for backups, but these backups are not encrypted and can therefore be read by Google!&#039;&#039;)&lt;br /&gt;
* Microsoft Authenticator for [https://play.google.com/store/apps/details?id=com.azure.authenticator Android] or [https://apps.apple.com/de/app/microsoft-authenticator/id983156458 iOS] ([https://www.microsoft.com/de-de/security/mobile-authenticator-app Web Page])&lt;br /&gt;
* LastPass Authenticator for [https://play.google.com/store/apps/details?id=com.lastpass.authenticator Android], [https://apps.apple.com/us/app/lastpass-authenticator/id1079110004 iOS] or [https://lastpass.com/auth/ Windows]&lt;br /&gt;
* Aegis Authenticator for [https://play.google.com/store/apps/details?id=com.beemdevelopment.aegis Android (Google Play)] or [https://f-droid.org/en/packages/com.beemdevelopment.aegis/ Android (F-Droid)] ([https://getaegis.app/ Web Page])&lt;br /&gt;
* OTP Auth for [https://apps.apple.com/app/otp-auth/id659877384 iOS]&lt;br /&gt;
* (&#039;&#039;Authy for [https://play.google.com/store/apps/details?id=com.authy.authy Android], [https://apps.apple.com/us/app/authy/id494168017 iOS], [https://authy.com/download/ Mac, Windows or Linux], requires account&#039;&#039;)&lt;br /&gt;
(&#039;&#039;These are only suggestions. You can use any application compatible with the [https://tools.ietf.org/html/rfc6238 TOTP] standard.&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
[https://www.yubico.com/resources/glossary/yubico-otp/ &#039;&#039;&#039;Yubico OTP&#039;&#039;&#039;] is also supported if you want to use your Yubikey without depending on having a six-digit code displayed.&lt;br /&gt;
&lt;br /&gt;
= Token Management =&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
* Create at least two separate tokens: &#039;&#039;&#039;FIRST&#039;&#039;&#039; set up a software/hardware TOTP token. &#039;&#039;&#039;THEN&#039;&#039;&#039; create and print a &amp;quot;backup TAN list&amp;quot;. Never create the &amp;quot;backup TAN list&amp;quot; first.&lt;br /&gt;
* If you lose access to all your tokens, you will not be able to create new tokens and support will have to reset your tokens manually.&lt;br /&gt;
* The &amp;quot;backup TAN list&amp;quot; should always be created and printed in a &#039;&#039;&#039;second step&#039;&#039;&#039;. The printout should be kept in a separate place for emergencies.&lt;br /&gt;
* Please clean up your second factors as soon as you have created new tokens. Tokens that can no longer be used (e.g. because not initialized, smartphone/Yubikey lost, etc.) or an old backup TAN list where you have already used all TANs or there is no printout should be deactivated and deleted.&lt;br /&gt;
* Returning users who have already activated one or more tokens must first verify their token before they can create new tokens, see section [[Registration/2FA#Returning_Users|Returning Users]].&lt;br /&gt;
* &#039;&#039;&#039;Please disable all privacy tools, ad blockers and further add-ons when registering new tokens.&#039;&#039;&#039; These tools prevent the registration website from generating new security tokens. When the problems remains (you can not generate the QR code or can not confirm it by clicking CHECK), please try once more with an entirely new unmodified web browser profile.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;bwUniCluster/bwForCluster Tokens&#039;&#039;&#039; are generally managed via the &#039;&#039;&#039;Index -&amp;gt; My Tokens&#039;&#039;&#039; menu entry on the registration pages for the clusters. Here you can register, activate, deactivate and delete tokens.&lt;br /&gt;
&lt;br /&gt;
To activate the second factor, &#039;&#039;&#039;please perform the following steps:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Select the registration server of the cluster&#039;&#039;&#039; for which you want to create a second factor and login to it:&amp;lt;/br&amp;gt; &amp;amp;rarr; [https://login.bwidm.de/user/twofa.xhtml Registration server for &#039;&#039;&#039;bwUniCluster 2.0&#039;&#039;&#039;, &#039;&#039;&#039;bwForCluster JUSTUS 2&#039;&#039;&#039; and &#039;&#039;&#039;bwForCluster NEMO&#039;&#039;&#039;] (2FA tokens are valid for all three clusters; KIT members can reuse their existing hardware and software tokens)&amp;lt;/br&amp;gt; &amp;amp;rarr; [https://bwservices.uni-heidelberg.de/user/twofa.xhtml Registration server for &#039;&#039;&#039;bwForCluster Helix&#039;&#039;&#039;]&lt;br /&gt;
[[File:BwIDM-twofa.png|center|600px|thumb|My Tokens]]&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Register a new &amp;quot;[[Registration/2FA#Registering_a_new_Software_Token_using_a_Mobile_APP|Smartphone Token]]&amp;quot;&#039;&#039;&#039; or if you own a [https://www.yubico.com/ Yubikey]&#039;&#039;&#039; register a new &amp;quot;[[Registration/2FA#Registering_a_new_Yubikey_OTP_Token|Yubikey Token]]&amp;quot;&#039;&#039;&#039; or &#039;&#039;&#039;&amp;quot;[[Registration/2FA#Registering_a_new_Yubikey_OATH_TOTP_Token|Yubikey OATH TOTP Token]]&amp;quot;&#039;&#039;&#039; ([[Registration/2FA#Pros_and_Cons_of_the_different_Solutions|pros ans cons]]).&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Register a new &amp;quot;[[Registration/2FA#Backup_TAN_List|TAN List]]&amp;quot; (backup TAN list)&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Repeat step 2. for additional tokens.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Registering a new Software Token using a Mobile APP ==&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
Please disable all privacy tools, ad blockers and further add-ons when registering new tokens.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
1. Select the [[Registration/2FA#Token_Management|registration server]] of the cluster for which you want to create a second factor and login to it.&lt;br /&gt;
&lt;br /&gt;
2. Registering a new Token starts with a click &#039;&#039;&#039;NEW SMARTPHONE TOKEN&#039;&#039;&#039;.&lt;br /&gt;
[[File:BwIDM-token.png|center|600px|thumb|Create a new Token]]&lt;br /&gt;
&lt;br /&gt;
3. A new window opens. Click &#039;&#039;&#039;Start&#039;&#039;&#039; to generate a new &#039;&#039;&#039;QR code&#039;&#039;&#039;.&lt;br /&gt;
This may take a while.&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
The QR code contains a key which has to remain secret.&lt;br /&gt;
Only use the QR code to link your software token app with bwIDM/bwServices in the next step.&lt;br /&gt;
Do not save the QR code, print it out or share it with someone else.&lt;br /&gt;
|}&lt;br /&gt;
[[File:BwIDM-qr.png|center|600px|thumb|QR Code for Mobile App]]&lt;br /&gt;
&lt;br /&gt;
4. Start the software token app on your separate device and scan the QR code.&lt;br /&gt;
The exact process is a little bit different in every app, but is usually started by pressing on a button with a plus (+) sign or an icon of a QR code.&lt;br /&gt;
&lt;br /&gt;
5. Once the QR code has been loaded into your Software Token app there should be a new entry called &#039;&#039;&#039;bwIDM&#039;&#039;&#039; (bwUniCluster, JUSTUS 2 and NEMO) or &#039;&#039;&#039;bwServices&#039;&#039;&#039; (Helix).&lt;br /&gt;
Generate an One-Time-Password by pressing on this entry or selecting the appropriate button/menu item.&lt;br /&gt;
You will receive a six-digit code.&lt;br /&gt;
Enter this code into the field labeled &amp;quot;Current code:&amp;quot; in your bwIDM browser window to prove that the connection has worked and then click &#039;&#039;&#039;CHECK&#039;&#039;&#039;.&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
If you do not confirm the token by entering the six-digit code in the &amp;quot;Current code:&amp;quot; field, the token will &#039;&#039;&#039;NOT&#039;&#039;&#039; be initialized!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
6. If everything worked as expected, you will be returned to the &#039;&#039;&#039;My Tokens&#039;&#039;&#039; screen and there will be a new entry for your software token.&lt;br /&gt;
[[File:BwIDM-app.png|center|400px|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
7. Repeat the process to register additional tokens.&lt;br /&gt;
Please register at least the &amp;quot;Backup TAN list&amp;quot; in addition to the hardware/software token you plan to use regularly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Registering a new Yubikey OTP Token ==&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
Please disable all privacy tools, ad blockers and further add-ons when registering new tokens.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[https://developers.yubico.com/OTP/OTPs_Explained.html Yubikey OTP] is even easier and you don&#039;t need a device that displays the six-digit code or extra software.&lt;br /&gt;
New Yubikeys are already configured to provide Yubikey OTP in slot 1.&lt;br /&gt;
If you need to configure your Yubikey, read this [[Registration/2FA/Yubikey|documentation]].&lt;br /&gt;
&lt;br /&gt;
1. Select the [[Registration/2FA#Token_Management|registration server]] of the cluster for which you want to create a second factor and login to it.&lt;br /&gt;
&lt;br /&gt;
2. If you want to use [https://www.yubico.com/resources/glossary/yubico-otp/ Yubico OTP], you can click &#039;&#039;&#039;NEW YUBIKEY TOKEN&#039;&#039;&#039; instead.&lt;br /&gt;
[[File:BwIDM-token.png|center|600px|thumb|Generate Yubikey OTP]]&lt;br /&gt;
&lt;br /&gt;
3. Yubikey OTP is configured to slot 1 on new Yubikeys, so you only need to click in the text box and then touch the metal part of your Yubikey.&lt;br /&gt;
Please refer to this [[Registration/2FA/Yubikey|documentation]] on how to configure your Yubikey.&lt;br /&gt;
[[File:BwIDM-yubikey.png|center|400px|thumb|Yubikey OTP]]&lt;br /&gt;
&lt;br /&gt;
4. If everything worked as expected, you will be returned to the &#039;&#039;&#039;My Tokens&#039;&#039;&#039; screen and there will be a new entry for your Yubikey.&lt;br /&gt;
[[File:BwIDM-yubikey2.png|center|400px|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
5. Repeat the process to register additional tokens.&lt;br /&gt;
Please register at least the &amp;quot;Backup TAN list&amp;quot; in addition to the hardware/software token you plan to use regularly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Registering a new Yubikey OATH TOTP Token ==&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
Please disable all privacy tools, ad blockers and further add-ons when registering new tokens.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[https://developers.yubico.com/OATH/ Yubikey OATH TOTP] generates the TANs on your Yubikey and therefore you can use different computers and phones to generate these codes.&lt;br /&gt;
Please download and install [https://developers.yubico.com/OATH/YubiKey_OATH_software.html Yubico Authenticator] for desktop (or Android/iOS) first.&lt;br /&gt;
Insert your Yubikey in your computer.&lt;br /&gt;
&amp;quot;Yubikey OTP&amp;quot; (not &amp;quot;Yubikey OATH TOTP&amp;quot;) is even easier and you don&#039;t need a device that displays the six-digit code or extra software (go to step [[Registration/2FA#Yubikey_OTP|Yubikey OTP]]).&lt;br /&gt;
&lt;br /&gt;
1. Select the [[Registration/2FA#Token_Management|registration server]] of the cluster for which you want to create a second factor and login to it.&lt;br /&gt;
&lt;br /&gt;
2. Registering a new Token starts with a click &#039;&#039;&#039;NEW SMARTPHONE TOKEN&#039;&#039;&#039;.&lt;br /&gt;
[[File:BwIDM-token.png|center|600px|thumb|Create a new Token]]&lt;br /&gt;
&lt;br /&gt;
3. A new window opens. Click &#039;&#039;&#039;Start&#039;&#039;&#039; to generate a new &#039;&#039;&#039;QR code&#039;&#039;&#039;.&lt;br /&gt;
This may take a while.&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
The QR code contains a key which has to remain secret.&lt;br /&gt;
Only use the QR code to link your software token app with bwIDM/bwServices in the next step.&lt;br /&gt;
Do not save the QR code, print it out or share it with someone else.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
4. Start the Yubico Authenticator on your OS, click the three vertical dots in the upper right corner and select &#039;&#039;&#039;Scan QR code&#039;&#039;&#039;.&lt;br /&gt;
[[File:BwIDM-yubi1.png|center|600px|thumb|QR Code and Yubico Authenticator on Linux]]&lt;br /&gt;
&lt;br /&gt;
5. Yubico Authenticator automatically translates the QR code to a new entry called &#039;&#039;&#039;bwIDM&#039;&#039;&#039; or &#039;&#039;&#039;bwServices&#039;&#039;&#039; (Helix).&lt;br /&gt;
Click &#039;&#039;&#039;Add account&#039;&#039;&#039;.&lt;br /&gt;
[[File:BwIDM-yubi2.png|center|600px|thumb|Create new TOTP on Yubico Authenticator]]&lt;br /&gt;
&lt;br /&gt;
6. You will receive a six-digit code.&lt;br /&gt;
Enter this code into the field labeled &amp;quot;Current code:&amp;quot; in your bwIDM browser window to prove that the connection has worked and then click &#039;&#039;&#039;CHECK&#039;&#039;&#039;.&lt;br /&gt;
[[File:BwIDM-yubi3.png|center|600px|thumb|Verify TOTP]]&lt;br /&gt;
&lt;br /&gt;
7. If everything worked as expected, you will be returned to the &#039;&#039;&#039;My Tokens&#039;&#039;&#039; screen and there will be a new entry for your software token.&lt;br /&gt;
[[File:BwIDM-app.png|center|400px|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
8. Repeat the process to register additional tokens.&lt;br /&gt;
Please register at least the &amp;quot;Backup TAN list&amp;quot; in addition to the hardware/software token you plan to use regularly.&lt;br /&gt;
&lt;br /&gt;
== Backup TAN List ==&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;background:#deffee; width:100%;&amp;quot;&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
[[Image:Attention.svg|center|25px]]&lt;br /&gt;
|style=&amp;quot;padding:5px; background:#cef2e0; text-align:left&amp;quot;|&lt;br /&gt;
Passwords from the &amp;quot;Backup TAN list&amp;quot; should only be used if no other token is left.&lt;br /&gt;
Please do not use the Backup TANs for regular cluster login, because you have only a limited number of TANs.&lt;br /&gt;
Each TAN can only be used once.&lt;br /&gt;
Please disable all privacy tools, ad blockers and further add-ons when registering a new Backup TAN list.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
1. Select the [[Registration/2FA#Token_Management|registration server]] of the cluster for which you want to create a second factor and login to it.&lt;br /&gt;
&lt;br /&gt;
2. Please create at least one &amp;quot;Backup TAN list&amp;quot; by clicking &#039;&#039;&#039;CREATE NEW TAN LIST&#039;&#039;&#039;.&lt;br /&gt;
[[File:BwIDM-token.png|center|600px|thumb|Generate Backup TAN list]]&lt;br /&gt;
&lt;br /&gt;
3. Click &#039;&#039;&#039;START&#039;&#039;&#039;. You will be redirected to the &#039;&#039;&#039;My Tokens&#039;&#039;&#039; screen and there will be a new entry for your backup TANs.&lt;br /&gt;
[[File:BwIDM-tan.png|center|400px|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
4. Click &#039;&#039;&#039;SHOW TANS&#039;&#039;&#039;, print the codes and keep then in a separate place for emergencies.&lt;br /&gt;
[[File:JUSTUS-2-2FA-backup-TAN-list.png|center|800px|thumb|Print Backup TAN List]]&lt;br /&gt;
&lt;br /&gt;
5. Repeat the process to register additional tokens.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Deactivating a Token ==&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;Disable&#039;&#039;&#039; next to the Token entry on the &#039;&#039;&#039;My Tokens&#039;&#039;&#039; screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Deleting a Token ==&lt;br /&gt;
&lt;br /&gt;
After a Token has been disabled a new button labeled &#039;&#039;&#039;Delete&#039;&#039;&#039; will appear. Click on it to delete the token.&lt;br /&gt;
&lt;br /&gt;
= Returning Users =&lt;br /&gt;
&lt;br /&gt;
Returning users who have already activated one or more tokens must first verify their token before they can create new tokens or deactivate/delete old ones.&lt;br /&gt;
If you no longer have valid tokens, you will not be able to create or manage tokens. &lt;br /&gt;
In this case, read the section [[Registration/2FA#Lost_Token|Lost Token]].&lt;br /&gt;
[[File:BwIDM-totp.png|center|400px|thumb|Returning users must first verify their token.]]&lt;br /&gt;
&lt;br /&gt;
= Lost Token =&lt;br /&gt;
&lt;br /&gt;
If you change your phone, please migrate your tokens first or register your new mobile app under &amp;quot;My Tokens&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If you no longer have valid tokens (mobile app, hardware token, Yubikey or backup TAN, i.e. lost or broken smartphone), you can not access the section &amp;quot;My Tokens&amp;quot; anymore.&lt;br /&gt;
In this case you will need to contact the [https://bw-support.scc.kit.edu/ ticket system].&#039;&#039;&#039;&lt;br /&gt;
Open a ticket, include your user name, the name of the bwHPC cluster and ask for a reset of your 2FA tokens.&lt;br /&gt;
Please note that this process may take some time and also means additional work for the operators.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Registration/2FA/FAQ&amp;diff=13657</id>
		<title>Registration/2FA/FAQ</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Registration/2FA/FAQ&amp;diff=13657"/>
		<updated>2025-01-20T10:58:01Z</updated>

		<summary type="html">&lt;p&gt;R Keller: Mention Auto-login / auto-reconnect for editors with multiple failures.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Second Factor (2FA) FAQ =&lt;br /&gt;
&lt;br /&gt;
== How does 2FA work? ==&lt;br /&gt;
&lt;br /&gt;
2FA uses two out of multiple factors for authentication. Factors are:&lt;br /&gt;
&lt;br /&gt;
* Something you know (password or PIN)&lt;br /&gt;
* Something you own (mobile phone or security device)&lt;br /&gt;
* Something you are (biometric features)&lt;br /&gt;
&lt;br /&gt;
The principle idea is that even if an attacking party manages to get hold of one factor, it still has to acquire a second factor for a completely successful attack. Such a completely successful attack results in a theft of your identify, possibly leading to malicious acts committed on your behalf and to your disadvantage.&lt;br /&gt;
&lt;br /&gt;
== Why is 2FA necessary? ==&lt;br /&gt;
&lt;br /&gt;
2FA is the current state-of-the-art method to prevent or mitigate cyber attacks. It is far superior to using a single shared secret (i.e. &amp;quot;password&amp;quot;), even if very strong passwords are used. 2FA mitigates fishing attempts, person-in-the-middle attacks and even cases where local computers (i.e. notebooks or workstations) have been stolen or compromised.&lt;br /&gt;
&lt;br /&gt;
2FA is constantly replacing password-only authentication schemes in a networked world to improve cyber security and prevent identity theft.&lt;br /&gt;
&lt;br /&gt;
== Why is 2FA so resilient? ==&lt;br /&gt;
&lt;br /&gt;
When computers become comprised, passwords and private keys can easily be recorded, copied and used for future attacks at any time from any place. Without a second factor, an attacking party cannot proceed autonomously without further involvement of the victim. As soon as a second factor is required, i.e. something you own or something you are, an attacking party lacks an element which it cannot provide or simulate. Furthermore, these second factors are securely contained in uncompromisable areas on the respective devices (e.g. phones or hardware security keys). For authentication, a challenge is issued that only the owner of the device can answer. The secret never leaves the secure area during this challenge.&lt;br /&gt;
&lt;br /&gt;
== I am using a password manager in conjunction with passwords that are individual per service, long and complex and thus impossible to guess. Isn&#039;t this good enough? ==&lt;br /&gt;
&lt;br /&gt;
This is very good practice and in fact recommended for all systems that do not support 2FA yet. However, consider this: Your passwords need to be interpreted by the remote systems and are therefore available to the remote systems in clear text. If a remote system has been compromised, your password and thus your identity are compromised as well. And if an attacker has compromised your host, they can read or intercept the password, but not the second factor.&lt;br /&gt;
&lt;br /&gt;
== I am using SSH private keys and secure them with a passphrase. Isn&#039;t this good enough? ==&lt;br /&gt;
&lt;br /&gt;
This is very good and in fact recommended for all systems reachable via SSH that do not support 2FA yet. However, consider this: Computers are vulnerable by remote attacks (a thoughtless wrong click can be sufficient) and local attacks (somebody manipulates your machine when left unattended).&lt;br /&gt;
&lt;br /&gt;
In case you become the victim of a successful attack, your machine will be compromised and every action will be recorded and monitored without you knowing, possibly for a very long time.&lt;br /&gt;
&lt;br /&gt;
2FA offers at least some mitigation in this case.&lt;br /&gt;
&lt;br /&gt;
== What happens if my local computer is compromised? ==&lt;br /&gt;
&lt;br /&gt;
2FA does not prevent this from happening, but it offers mitigation. The services you use that are protected with 2FA are only partially compromised:&lt;br /&gt;
&lt;br /&gt;
* An attacking party cannot use the compromised secret (&amp;quot;password&amp;quot;) that it acquired from monitoring your local computer to gain remote access to the 2FA secured service. To initiate a remote session from the attacking parties&#039; computers to the 2FA secured service, the second factor is required, which the attacking party does not have and cannot simulate, since it requires physical ownership of the respective security device.&lt;br /&gt;
* An attacking party cannot initiate a session from your compromised local computer to the remote computer without your active participation. The attacking party would have to present a second factor which requires a non-automatic action originating from the respective physical security device.&lt;br /&gt;
* ATTENTION: An attacking party can still monitor and possibly hijack connections from your compromised local computer to remote systems at the time these connections are actively initiated by you. However, exploitation is much more difficult than copying a simple shared password and needs to be adapted to the service which is attacked. For the attacking party, this bears at least a heightened risk of being discovered.&lt;br /&gt;
* Your passwords, passphrases and secret SSH keys are likely to have been compromised and therefore have to be exchanged after the attack becomes known to you. Your other factors have never left the external devices you keep them on and don&#039;t need to be changed. You have only answered cryptographic challenges with them, and these challenges and their corresponding answers cannot be predetermined by an attacker.&lt;br /&gt;
&lt;br /&gt;
== What happens if I lose my security hardware token? ==&lt;br /&gt;
&lt;br /&gt;
An attacking party would need to combine a found or stolen second factor (e.g. phone or security key) with a software attack, i.e. infecting your local computer, to get hold of the secret you know (i.e. PIN or password) to access services secured by 2FA. Nevertheless, you should remove old or lost second factors and replace them with new ones.&lt;br /&gt;
&lt;br /&gt;
== What happens if I lose my phone? ==&lt;br /&gt;
&lt;br /&gt;
Modern phones are protected by biometric measures. The biometric secrets are kept in a secure enclave on the device and cannot be extracted once registered. Neither an attacking party nor you nor the manufacturer can extract the secret data after the initial transfer. It is only ever used inside the secure area on the device to answer cryptographic challenges. In case you don&#039;t trust  the manufacturers to keep your biometric data safe, you can use a PIN as an alternative. However, you still have to accept a certain level of trust towards the phone manufacturer. This is unavoidable unless you have the means to provide the complete chain of security yourself.&lt;br /&gt;
&lt;br /&gt;
To avoid losing your access, some apps allow secure backups of your secondary factors, but to be safe you should register more than one second factor including backup TANs.&lt;br /&gt;
&lt;br /&gt;
== Whats happens if I lose all secondary factors? ==&lt;br /&gt;
&lt;br /&gt;
There are recovery procedures which vary by service. A common method are recovery codes (backup TANs), which you can print out and deposit in a safe location. Recovery codes work like master keys, so they must never be kept on the same device which is used to access the 2FA protected service.&lt;br /&gt;
If all else fails, most services will grant you access again after a thorough identity verification.&lt;br /&gt;
&lt;br /&gt;
== Where should I be careful using 2FA? ==&lt;br /&gt;
Please be aware, that multiple wrong OTP authentications in-a-row may deactivate &#039;&#039;&#039;all&#039;&#039;&#039; OTP tokens (including your TAN Backup-List) -- you may need to re-activate all tokens by opening a Ticket on the bwHPC Support portal.&lt;br /&gt;
Therefore be careful using editors like EMACS or Visual Studio Code, which may auto-reconnect after your computer went to sleep or switched networks.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Hardware&amp;diff=13621</id>
		<title>DACHS/Hardware</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=DACHS/Hardware&amp;diff=13621"/>
		<updated>2025-01-14T14:01:22Z</updated>

		<summary type="html">&lt;p&gt;R Keller: /* Storage Architecture */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Architecture of DACHS =&lt;br /&gt;
The Datenanalyse Cluster der Hochschulen (DACHS) is a parallel computer with distributed memory connected over Infiniband and Ethernet. The compute nodes contain at least dual AMD processors, at least 384GB of local memory, 2 TB local NVMe-based disc storage and accelerators as shown in the table below. With BeeGFS a fast and scalable filesystem is provided via Infiniband to all login and compute nodes&lt;br /&gt;
&lt;br /&gt;
The Operating System is Rocky-Linux 9.4 (which is based on RHEL).&lt;br /&gt;
The setup is kept in-line (with regard to Software, Setup and general usage) and thus mostly equivalent to bwHPC and bwUniCluster in particular.&lt;br /&gt;
&lt;br /&gt;
= Components of DACHS =&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! style=&amp;quot;width:9%&amp;quot;|&lt;br /&gt;
! style=&amp;quot;width:13%&amp;quot;| Compute nodes &amp;quot;L40S&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:13%&amp;quot;| Compute nodes &amp;quot;H100&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:13%&amp;quot;| Compute nodes &amp;quot;AMD_APU&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:13%&amp;quot;| Login&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Number of nodes&lt;br /&gt;
| 45&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Processors&lt;br /&gt;
| AMD EPYC 9254&lt;br /&gt;
| AMD EPYC 9454&lt;br /&gt;
| AMD MI300A&lt;br /&gt;
| AMD EPYC 9254&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Number of sockets&lt;br /&gt;
| 2&lt;br /&gt;
| 2&lt;br /&gt;
| 4&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Processor frequency (GHz)&lt;br /&gt;
| 2.9 Ghz&lt;br /&gt;
| 2.75 Ghz&lt;br /&gt;
| 2.1 Ghz&lt;br /&gt;
| 2.9 Ghz&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Total number of cores&lt;br /&gt;
| 48&lt;br /&gt;
| 96&lt;br /&gt;
| 96&lt;br /&gt;
| 48&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Main memory&lt;br /&gt;
| 384 GB&lt;br /&gt;
| 1536 GB&lt;br /&gt;
| 512 GB&lt;br /&gt;
| 384 GB&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Local SSD&lt;br /&gt;
| 1,92 TB NVMe&lt;br /&gt;
| 1,92 TB NVMe&lt;br /&gt;
| 1,92 TB NVMe&lt;br /&gt;
| 1,92 TB NVMe&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Accelerators&lt;br /&gt;
| 1x NVIDIA L40S&lt;br /&gt;
| 8x NVIDIA H100&lt;br /&gt;
| 4x AMD MI300A&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Accelerator memory&lt;br /&gt;
| 48 GB&lt;br /&gt;
| 8x 80 GB&lt;br /&gt;
| 4x 128 GB&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
!scope=&amp;quot;column&amp;quot;| Interconnect&lt;br /&gt;
| IB HDR100&lt;br /&gt;
| IB HDR100&lt;br /&gt;
| IB HDR100&lt;br /&gt;
| IB HDR100&lt;br /&gt;
|}&lt;br /&gt;
Table 1: Properties of the nodes&lt;br /&gt;
&lt;br /&gt;
== Storage Architecture ==&lt;br /&gt;
The system features a 700 TB large BeeGFS filesystem available on login and compute nodes.&lt;br /&gt;
Please note: there is a hard file size quota per partner organization and a soft quota per user on Your HOME.&lt;br /&gt;
Users will be notified by E-Mail if the quota is to be reached.&lt;br /&gt;
&lt;br /&gt;
Please &#039;&#039;&#039;do make usage&#039;&#039;&#039; of [[Workspace | Work Space mechanism]] for larger files.&lt;/div&gt;</summary>
		<author><name>R Keller</name></author>
	</entry>
</feed>