<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://training.kenet.or.ke/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Atambo</id>
		<title>KENET Training - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://training.kenet.or.ke/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Atambo"/>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php/Special:Contributions/Atambo"/>
		<updated>2026-05-22T22:19:44Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.28.2</generator>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Intermediate_Usage:_PyTorch_and_Tensorflow&amp;diff=1762</id>
		<title>Intermediate Usage: PyTorch and Tensorflow</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Intermediate_Usage:_PyTorch_and_Tensorflow&amp;diff=1762"/>
				<updated>2026-05-20T18:47:46Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Modules For Machine Learning ===&lt;br /&gt;
The cluster has ready made python environments with conda, Tensorflow as well as PyTorch for machine learning users.&lt;br /&gt;
The usage will be different from a jupyter notebook interface, since everything has to be run in the background. &lt;br /&gt;
As a user, you will place all your training/inference/testing/IO code in a python script, which then will be added &lt;br /&gt;
as a command in the shell script section of the slurm job submission file. &lt;br /&gt;
&lt;br /&gt;
==Listing available modules ==&lt;br /&gt;
To view all module available, we can use the Slurm command: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  $ module av&lt;br /&gt;
   ----------------------------------------------------------------- /usr/share/modulefiles -------------------------------&lt;br /&gt;
   mpi/openmpi-x86_64&lt;br /&gt;
   ----------------------------------------------------------------- /opt/ohpc/pub/modulefiles ------------------------------&lt;br /&gt;
    applications/eng/gpu/python/conda-26.1.0-python-3.14&lt;br /&gt;
   applications/gpu/python/base-3.14   &lt;br /&gt;
   ---------------------------------------------------------- /usr/share/lmod/lmod/modulefiles/Core -------------------------&lt;br /&gt;
   lmod    settar&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Conda_logo.svg.png|250px]]&lt;br /&gt;
== Modules with Tensorflow and PyTorch ==&lt;br /&gt;
This conda  module that appear in the prior list has both TensorFlow and PyTorch installed:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  applications/eng/gpu/python/conda-26.1.0-python-3.14&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Loading The Python (Conda) Module ==&lt;br /&gt;
We can Load the module using this Slurm command: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  module load applications/eng/gpu/python/conda-26.1.0-python-3.14&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Listing Conda Environments ==&lt;br /&gt;
The loaded module gives us access to a custom conda module, and we can now list the conda environments available&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
$ conda env list&lt;br /&gt;
&lt;br /&gt;
base                     /scratch/lustre/apps/eng/gpu/miniconda3&lt;br /&gt;
&lt;br /&gt;
octave                   /scratch/lustre/apps/eng/gpu/miniconda3/envs/octave&lt;br /&gt;
&lt;br /&gt;
python-3.12              /scratch/lustre/apps/eng/gpu/miniconda3/envs/python-3.12&lt;br /&gt;
&lt;br /&gt;
python-3.14          *   /scratch/lustre/apps/eng/gpu/miniconda3/envs/python-3.14&lt;br /&gt;
qgis                     /scratch/lustre/apps/eng/gpu/miniconda3/envs/qgis&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can safely ignore the base environment, and make use of the *python-3.14* conda environment, this has the two&lt;br /&gt;
machine learning frameworks, Tensorflow and PyTorch.&lt;br /&gt;
&lt;br /&gt;
[[File:Pytorch_logo.png|250px]]&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  $ conda activate python-3.14&lt;br /&gt;
  (python-3.9.21)$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is what we will have in the Slurm submission script. &lt;br /&gt;
Lets now create the python code that will run a simple machine learning exercise, with PyTorch. We will use the&lt;br /&gt;
MNIST example from PyTorch, run these shell commands to create the working directory and retreive the files:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  $ mkdir -p ~/localscratch/mnist    # creating a working dir&lt;br /&gt;
  $ cd  ~/localscratch/mnist       # changing directory to the working dir&lt;br /&gt;
  $ wget https://raw.githubusercontent.com/pytorch/examples/refs/heads/main/mnist/main.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And now we can place the python script in our submission script, place the following in a plain text file called torch.job:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH -J  gputest               # Job name&lt;br /&gt;
 #SBATCH -o job.%j.out         # Name of stdout output file (%j expands to jobId)&lt;br /&gt;
 #SBATCH -e %j.err             # Name of std err&lt;br /&gt;
 #SBATCH --partition=gpu1    # Queue&lt;br /&gt;
 #SBATCH --nodes=1             # Total number of nodes requested&lt;br /&gt;
 #SBATCH --gres=gpu:1             # Total number of gpus requested&lt;br /&gt;
 #SBATCH --cpus-per-task=1     # &lt;br /&gt;
 #SBATCH --time=00:03:00        # Run time (hh:mm:ss) - 1.5 hours&lt;br /&gt;
   &lt;br /&gt;
 cd ~/localscratch/mnist &lt;br /&gt;
 module load applications/eng/gpu/python/conda-26.1.0-python-3.14&lt;br /&gt;
 conda activate python-3.14&lt;br /&gt;
 python  main.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Finally we can submit this script to Slurm, which will run the entire process for in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  $ sbatch torch.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== [https://asciinema.org/a/m8HJLldFQk0SrrpOYOAIQQrYj Watch Demo] ==&lt;br /&gt;
&lt;br /&gt;
== Caveat: Downloading Data Ahead of Time ==&lt;br /&gt;
Compute nodes will typically be sealed off from the internet, and as such, it is important to have all data aready on disk before a batch job submission as such, we can now refactor the mixed  data download and training in https://raw.githubusercontent.com/pytorch/examples/refs/heads/main/mnist/main.py  as shown in this repo: https://github.com/Materials-Modelling-Group/training-examples/tree/main/mnist&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
the first can be run from the login node, the latter can be run from the  batch script.&lt;br /&gt;
&lt;br /&gt;
Next:&lt;br /&gt;
[[Module_system|Module_system]]&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Intermediate_Usage:_PyTorch_and_Tensorflow&amp;diff=1761</id>
		<title>Intermediate Usage: PyTorch and Tensorflow</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Intermediate_Usage:_PyTorch_and_Tensorflow&amp;diff=1761"/>
				<updated>2026-05-20T18:33:00Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Modules For Machine Learning ===&lt;br /&gt;
The cluster has ready made python environments with conda, Tensorflow as well as PyTorch for machine learning users.&lt;br /&gt;
The usage will be different from a jupyter notebook interface, since everything has to be run in the background. &lt;br /&gt;
As a user, you will place all your training/inference/testing/IO code in a python script, which then will be added &lt;br /&gt;
as a command in the shell script section of the slurm job submission file. &lt;br /&gt;
&lt;br /&gt;
==Listing available modules ==&lt;br /&gt;
To view all module available, we can use the Slurm command: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  $ module av&lt;br /&gt;
   ----------------------------------------------------------------- /usr/share/modulefiles -------------------------------&lt;br /&gt;
   mpi/openmpi-x86_64&lt;br /&gt;
   ----------------------------------------------------------------- /opt/ohpc/pub/modulefiles ------------------------------&lt;br /&gt;
   applications/gpu/gromacs/2024.4        applications/eng/gpu/python/conda-26.1.0-python-3.14&lt;br /&gt;
   applications/gpu/python/base-3.9.21    applications/gpu/qespresso/7.3.1&lt;br /&gt;
   ---------------------------------------------------------- /usr/share/lmod/lmod/modulefiles/Core -------------------------&lt;br /&gt;
   lmod    settar&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Conda_logo.svg.png|250px]]&lt;br /&gt;
== Modules with Tensorflow and PyTorch ==&lt;br /&gt;
This conda  module that appear in the prior list has both TensorFlow and PyTorch installed:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  applications/eng/gpu/python/conda-26.1.0-python-3.14&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Loading The Python (Conda) Module ==&lt;br /&gt;
We can Load the module using this Slurm command: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  module load applications/eng/gpu/python/conda-26.1.0-python-3.14&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Listing Conda Environments ==&lt;br /&gt;
The loaded module gives us access to a custom conda module, and we can now list the conda environments available&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
$ conda env list&lt;br /&gt;
base                     /scratch/lustre/apps/eng/gpu/miniconda3&lt;br /&gt;
octave                   /scratch/lustre/apps/eng/gpu/miniconda3/envs/octave&lt;br /&gt;
python-3.12              /scratch/lustre/apps/eng/gpu/miniconda3/envs/python-3.12&lt;br /&gt;
python-3.14          *   /scratch/lustre/apps/eng/gpu/miniconda3/envs/python-3.14&lt;br /&gt;
qgis                     /scratch/lustre/apps/eng/gpu/miniconda3/envs/qgis&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
we can safely ignore the base environment, and make use of the *python-3.14* conda environment, this has the two&lt;br /&gt;
machine learning frameworks, Tensorflow and PyTorch.&lt;br /&gt;
&lt;br /&gt;
[[File:Pytorch_logo.png|250px]]&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  $ conda activate python-3.14&lt;br /&gt;
  (python-3.9.21)$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is what we will have in the Slurm submission script. &lt;br /&gt;
Lets now create the python code that will run a simple machine learning exercise, with PyTorch. We will use the&lt;br /&gt;
MNIST example from PyTorch, run these shell commands to create the working directory and retreive the files:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  $ mkdir -p ~/localscratch/mnist    # creating a working dir&lt;br /&gt;
  $ cd  ~/localscratch/mnist       # changing directory to the working dir&lt;br /&gt;
  $ wget https://raw.githubusercontent.com/pytorch/examples/refs/heads/main/mnist/main.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And now we can place the python script in our submission script, place the following in a plain text file called torch.job:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH -J  gputest               # Job name&lt;br /&gt;
 #SBATCH -o job.%j.out         # Name of stdout output file (%j expands to jobId)&lt;br /&gt;
 #SBATCH -e %j.err             # Name of std err&lt;br /&gt;
 #SBATCH --partition=gpu1    # Queue&lt;br /&gt;
 #SBATCH --nodes=1             # Total number of nodes requested&lt;br /&gt;
 #SBATCH --gres=gpu:1             # Total number of gpus requested&lt;br /&gt;
 #SBATCH --cpus-per-task=1     # &lt;br /&gt;
 #SBATCH --time=00:03:00        # Run time (hh:mm:ss) - 1.5 hours&lt;br /&gt;
   &lt;br /&gt;
 cd ~/localscratch/mnist &lt;br /&gt;
 module load applications/eng/gpu/python/conda-26.1.0-python-3.14&lt;br /&gt;
 conda activate python-3.14&lt;br /&gt;
 python  main.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Finally we can submit this script to Slurm, which will run the entire process for in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  $ sbatch torch.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== [https://asciinema.org/a/m8HJLldFQk0SrrpOYOAIQQrYj Watch Demo] ==&lt;br /&gt;
&lt;br /&gt;
== Caveat: Downloading Data Ahead of Time ==&lt;br /&gt;
Compute nodes will typically be sealed off from the internet, and as such, it is important to have all data aready on disk before a batch job submission as such, we can now refactor the mixed  data download and training in https://raw.githubusercontent.com/pytorch/examples/refs/heads/main/mnist/main.py  as shown in this repo: https://github.com/Materials-Modelling-Group/training-examples/tree/main/mnist&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
the first can be run from the login node, the latter can be run from the  batch script.&lt;br /&gt;
&lt;br /&gt;
Next:&lt;br /&gt;
[[Module_system|Module_system]]&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Intermediate_Usage:_PyTorch_and_Tensorflow&amp;diff=1749</id>
		<title>Intermediate Usage: PyTorch and Tensorflow</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Intermediate_Usage:_PyTorch_and_Tensorflow&amp;diff=1749"/>
				<updated>2026-03-26T15:37:24Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Modules For Machine Learning ===&lt;br /&gt;
The cluster has ready made python environments with conda, Tensorflow as well as PyTorch for machine learning users.&lt;br /&gt;
The usage will be different from a jupyter notebook interface, since everything has to be run in the background. &lt;br /&gt;
As a user, you will place all your training/inference/testing/IO code in a python script, which then will be added &lt;br /&gt;
as a command in the shell script section of the slurm job submission file. &lt;br /&gt;
&lt;br /&gt;
==Listing available modules ==&lt;br /&gt;
To view all module available, we can use the Slurm command: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  $ module av&lt;br /&gt;
   ----------------------------------------------------------------- /usr/share/modulefiles -------------------------------&lt;br /&gt;
   mpi/openmpi-x86_64&lt;br /&gt;
   ----------------------------------------------------------------- /opt/ohpc/pub/modulefiles ------------------------------&lt;br /&gt;
   applications/gpu/gromacs/2024.4        applications/gpu/python/conda-25.1.1-python-3.9.21 (D)&lt;br /&gt;
   applications/gpu/python/base-3.9.21    applications/gpu/qespresso/7.3.1&lt;br /&gt;
   ---------------------------------------------------------- /usr/share/lmod/lmod/modulefiles/Core -------------------------&lt;br /&gt;
   lmod    settar&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Conda_logo.svg.png|250px]]&lt;br /&gt;
== Modules with Tensorflow and PyTorch ==&lt;br /&gt;
This conda  module that appear in the prior list has both TensorFlow and PyTorch installed:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Loading The Python (Conda) Module ==&lt;br /&gt;
We can Load the module using this Slurm command: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Listing Conda Environments ==&lt;br /&gt;
The loaded module gives us access to a custom conda module, and we can now list the conda environments available&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
$ conda env list&lt;br /&gt;
  base                   /opt/ohpc/pub/conda/instdir&lt;br /&gt;
  python-3.9.21          /opt/ohpc/pub/conda/instdir/envs/python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
we can safely ignore the base environment, and make use of the *python-3.9.21* conda environment, this has the two&lt;br /&gt;
machine learning frameworks, Tensorflow and PyTorch.&lt;br /&gt;
&lt;br /&gt;
[[File:Pytorch_logo.png|250px]]&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  $ conda activate python-3.9.21&lt;br /&gt;
  (python-3.9.21)$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is what we will have in the Slurm submission script. &lt;br /&gt;
Lets now create the python code that will run a simple machine learning exercise, with PyTorch. We will use the&lt;br /&gt;
MNIST example from PyTorch, run these shell commands to create the working directory and retreive the files:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  $ mkdir -p ~/localscratch/mnist    # creating a working dir&lt;br /&gt;
  $ cd  ~/localscratch/mnist       # changing directory to the working dir&lt;br /&gt;
  $ wget https://raw.githubusercontent.com/pytorch/examples/refs/heads/main/mnist/main.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And now we can place the python script in our submission script, place the following in a plain text file called torch.job:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH -J  gputest               # Job name&lt;br /&gt;
 #SBATCH -o job.%j.out         # Name of stdout output file (%j expands to jobId)&lt;br /&gt;
 #SBATCH -e %j.err             # Name of std err&lt;br /&gt;
 #SBATCH --partition=gpu1    # Queue&lt;br /&gt;
 #SBATCH --nodes=1             # Total number of nodes requested&lt;br /&gt;
 #SBATCH --gres=gpu:1             # Total number of gpus requested&lt;br /&gt;
 #SBATCH --cpus-per-task=1     # &lt;br /&gt;
 #SBATCH --time=00:03:00        # Run time (hh:mm:ss) - 1.5 hours&lt;br /&gt;
   &lt;br /&gt;
 cd ~/localscratch/mnist &lt;br /&gt;
 module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
 conda activate python-3.9.21  &lt;br /&gt;
 python  main.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Finally we can submit this script to Slurm, which will run the entire process for in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  $ sbatch torch.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== [https://asciinema.org/a/m8HJLldFQk0SrrpOYOAIQQrYj Watch Demo] ==&lt;br /&gt;
&lt;br /&gt;
== Caveat: Downloading Data Ahead of Time ==&lt;br /&gt;
Compute nodes will typically be sealed off from the internet, and as such, it is important to have all data aready on disk before a batch job submission as such, we can now refactor the mixed  data download and training in https://raw.githubusercontent.com/pytorch/examples/refs/heads/main/mnist/main.py  as shown in this repo: https://github.com/Materials-Modelling-Group/training-examples/tree/main/mnist&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
the first can be run from the login node, the latter can be run from the  batch script.&lt;br /&gt;
&lt;br /&gt;
Next:&lt;br /&gt;
[[Module_system|Module_system]]&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Basic_Usage:_GPU_Based_Resources_With_Slurm&amp;diff=1748</id>
		<title>Basic Usage: GPU Based Resources With Slurm</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Basic_Usage:_GPU_Based_Resources_With_Slurm&amp;diff=1748"/>
				<updated>2026-03-06T08:01:11Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Slurm_logo.svg.png|150px]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
== Simple  commands with SLURM ==&lt;br /&gt;
You can obtain information on the Slurm  &amp;quot;Partitions&amp;quot; that accept jobs using the sinfo command&lt;br /&gt;
&amp;lt;code  bash&amp;gt;&lt;br /&gt;
    $ sinfo&lt;br /&gt;
    PARTITION AVAIL  TIMELIMIT  NODES  STATE NODELIST&lt;br /&gt;
    test         up       1:00      1   idle gnt-usiu-gpu-00.kenet.or.ke&lt;br /&gt;
    gpu1         up 1-00:00:00      1   idle gnt-usiu-gpu-00.kenet.or.ke&lt;br /&gt;
    normal*      up 1-00:00:00      1   idle gnt-usiu-gpu-00.kenet.or.ke&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The test partition is reserved for testing, with a very short time limit. The normal partition is to be used for CPU only jobs, &lt;br /&gt;
and the gpu1 queue is reserved for GPU jobs. Both production partitions have a time limit of 24 hours at a time for individual&lt;br /&gt;
jobs. &lt;br /&gt;
&lt;br /&gt;
== Showing The Queue ==&lt;br /&gt;
The squeue slurm command will list all submitted jobs, and will give you an indication of how busy the cluster is, as well as the status of all running or waiting jobs. Jobs that are complete will exit the queue and will not be in this list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
    $ squeue &lt;br /&gt;
    JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)&lt;br /&gt;
     63    normal     gpu1   jotuya  R       0:03      1 gnt-usiu-gpu-00.kenet.or.ke&lt;br /&gt;
    $&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Submitting Your first GPU Job ==&lt;br /&gt;
[[File:Quantum_ESPRESSO_logo.jpg|250px]]&lt;br /&gt;
==== Create a submission script for Quantum Espresso ====&lt;br /&gt;
You require a submission script, which is a plain text file with all the instructions for the command you intend to run.&lt;br /&gt;
Retreive the example files in your scratch directory from this [ https://github.com/Materials-Modelling-Group/training-examples | github repository ]&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  cd ~/localscratch/&lt;br /&gt;
  git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
  cd  training-examples&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and in this directory we will place the following text content in a file:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 &lt;br /&gt;
 #SBATCH -J  gputest               # Job name&lt;br /&gt;
 #SBATCH -o job.%j.out         # Name of stdout output file (%j expands to jobId)&lt;br /&gt;
 #SBATCH -e %j.err             # Name of std err&lt;br /&gt;
 #SBATCH --partition=gpu1    # Queue&lt;br /&gt;
 #SBATCH --nodes=1             # Total number of nodes requested&lt;br /&gt;
 #SBATCH --gres=gpu:1             # Total number of gpus requested&lt;br /&gt;
 #SBATCH --cpus-per-task=1     # &lt;br /&gt;
 #SBATCH --time=00:03:00        # Run time (hh:mm:ss) - 1.5 hours&lt;br /&gt;
 #SBATCH --gres=gpu:1&lt;br /&gt;
&lt;br /&gt;
 # Launch MPI-based executable&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
  &lt;br /&gt;
 cd $HOME/localscratch/training-examples &lt;br /&gt;
 mpirun -np 1  pw.x &amp;lt;al.scf.david.in &amp;gt; output.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put this in a file called '''test.slurm'''&lt;br /&gt;
&lt;br /&gt;
==== Submitting the Job to the Queue ====&lt;br /&gt;
The slurm sbatch command provides the means to submit batch jobs to the queue:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
    $ sbatch  test.slurm &lt;br /&gt;
    Submitted batch job 64&lt;br /&gt;
    $&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will run the named program on a single GPU,  note that the GPU acceleration is built into the program, if the program itself does not support GPU acceleration, attempting to run on the GPU will fail.&lt;br /&gt;
&lt;br /&gt;
== [https://asciinema.org/a/i0VEeL4p6CdpJA9iUFMNTvPQT Watch Demo ] ==&lt;br /&gt;
&lt;br /&gt;
Next:&lt;br /&gt;
[[Intermediate Usage: PyTorch and Tensorflow|Intermediate usage: PyTorch and Tensorflow]]&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Octave&amp;diff=1483</id>
		<title>Octave</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Octave&amp;diff=1483"/>
				<updated>2026-01-10T19:09:47Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Octave (Remote Desktop) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''GNU Octave''' is a high-level programming language primarily intended for numerical computations. It provides a convenient command-line interface for solving linear and nonlinear problems numerically and for performing other numerical experiments. Octave is largely compatible with MATLAB, making it an excellent free alternative for scientific computing and engineering applications.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' Octave is particularly well-suited for numerical analysis and linear algebra computations, signal and image processing workflows, solving differential equations and numerical integration, engineering simulations and modeling, algorithm prototyping and testing, MATLAB code compatibility verification, and educational purposes for teaching numerical methods and scientific programming.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' Octave is available through Remote Desktop sessions on the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using Octave, you should have an active KENET HPC cluster account with access to the Open OnDemand portal. Basic understanding of programming concepts and mathematical operations will be helpful. Familiarity with MATLAB syntax is advantageous but not required. Knowledge of linear algebra and calculus concepts will enhance your ability to utilize Octave's capabilities effectively.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching Octave ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Start Remote Desktop Session ===&lt;br /&gt;
Begin by logging into Open OnDemand at https://ondemand.vlab.ac.ke. Click the '''Interactive Apps''' menu and select '''Remote Desktop''' to launch a full desktop environment on a compute node.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_Desktop_Menu.png|thumb|600px|center|Navigate to Interactive Apps → Remote Desktop]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Desktop Session ===&lt;br /&gt;
Configure the resources needed for your desktop session based on your computational requirements.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; for standard computations&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; hours for interactive work&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores for parallel operations&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16-32&amp;lt;/code&amp;gt; GB depending on problem size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_Desktop_Form.png|thumb|600px|center|Desktop session configuration]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Launch Octave from Desktop ===&lt;br /&gt;
Once your remote desktop session starts, you can launch Octave in several ways. Click '''Applications''' in the top menu bar, navigate to '''Development''' or '''Education''', and select '''GNU Octave'''. Alternatively, open a terminal and type &amp;lt;code&amp;gt;octave --gui&amp;lt;/code&amp;gt; to launch the graphical interface, or simply type &amp;lt;code&amp;gt;octave&amp;lt;/code&amp;gt; for the command-line interface.&lt;br /&gt;
&lt;br /&gt;
[[File:Octave_Interface.png|thumb|600px|center|Octave GUI interface]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Understanding the Octave Interface ===&lt;br /&gt;
The Octave GUI consists of several key components. The Command Window is where you type commands and see immediate results. The Workspace panel displays all variables currently in memory with their values and types. The Command History shows previously executed commands. The File Browser allows navigation of your file system. The Editor provides a text editor for creating and modifying script files.&lt;br /&gt;
&lt;br /&gt;
=== Your First Octave Commands ===&lt;br /&gt;
Start with simple mathematical operations to familiarize yourself with Octave's syntax. The &amp;lt;code&amp;gt;octave/examples/01_basic_operations.m&amp;lt;/code&amp;gt; file in our GitHub repository demonstrates fundamental operations including arithmetic, matrix creation, and basic functions. Type commands directly in the Command Window and press Enter to execute them.&lt;br /&gt;
&lt;br /&gt;
=== Creating and Running Scripts ===&lt;br /&gt;
For reproducible analyses, save your commands in script files with a .m extension. Click '''File → New → Script''' in the Octave GUI to create a new script. Type your commands in the editor, save the file, and run it by clicking the Run button or typing the script name (without .m extension) in the Command Window.&lt;br /&gt;
&lt;br /&gt;
=== Working with Matrices ===&lt;br /&gt;
Octave excels at matrix operations. Matrices are the fundamental data type in Octave. The &amp;lt;code&amp;gt;octave/examples/02_matrix_operations.m&amp;lt;/code&amp;gt; file demonstrates creating matrices, performing matrix arithmetic, accessing elements, and using built-in matrix functions. Understanding matrix operations is crucial for effective use of Octave.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Plotting and Visualization ===&lt;br /&gt;
&lt;br /&gt;
Octave provides comprehensive plotting capabilities through its graphics functions. The &amp;lt;code&amp;gt;octave/examples/03_plotting.m&amp;lt;/code&amp;gt; file demonstrates creating line plots, scatter plots, 3D surface plots, and customizing plot appearance with titles, labels, and legends. Plots appear in separate figure windows and can be exported to various image formats including PNG, PDF, and SVG.&lt;br /&gt;
&lt;br /&gt;
Multiple plots can be displayed in a single figure using the subplot function. Plot properties can be customized extensively including colors, line styles, marker types, and font sizes. The hold command allows adding multiple plot elements to the same axes.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: Solving Linear Systems ===&lt;br /&gt;
&lt;br /&gt;
One of Octave's strengths is solving systems of linear equations. The &amp;lt;code&amp;gt;octave/examples/04_linear_systems.m&amp;lt;/code&amp;gt; file shows how to solve Ax = b using the backslash operator, compute matrix inverses and determinants, perform LU and QR decompositions, and calculate eigenvalues and eigenvectors.&lt;br /&gt;
&lt;br /&gt;
Octave uses efficient numerical algorithms from LAPACK and BLAS libraries, making it suitable for large-scale linear algebra problems. Always check the condition number of matrices before attempting to solve systems to avoid numerical instability.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: Signal Processing ===&lt;br /&gt;
&lt;br /&gt;
Octave includes signal processing capabilities through the signal package. The &amp;lt;code&amp;gt;octave/examples/05_signal_processing.m&amp;lt;/code&amp;gt; file demonstrates loading the signal package, generating and analyzing signals, applying filters, computing Fast Fourier Transforms, and designing digital filters.&lt;br /&gt;
&lt;br /&gt;
Install the signal package if not already available using &amp;lt;code&amp;gt;pkg install -forge signal&amp;lt;/code&amp;gt;. Load it before use with &amp;lt;code&amp;gt;pkg load signal&amp;lt;/code&amp;gt;. The package provides functions similar to MATLAB's Signal Processing Toolbox.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Solving Differential Equations ===&lt;br /&gt;
&lt;br /&gt;
Octave provides ODE solvers for ordinary differential equations. The &amp;lt;code&amp;gt;octave/examples/06_differential_equations.m&amp;lt;/code&amp;gt; file shows how to define ODE functions, use lsode for numerical integration, solve systems of ODEs, and visualize solutions. This is particularly useful for dynamic system modeling and simulation.&lt;br /&gt;
&lt;br /&gt;
Define your differential equation as a function that returns derivatives, specify initial conditions and time span, then call lsode or other ODE solvers to obtain the numerical solution.&lt;br /&gt;
&lt;br /&gt;
=== Task 5: Image Processing ===&lt;br /&gt;
&lt;br /&gt;
The image package provides functions for loading, processing, and analyzing images. The &amp;lt;code&amp;gt;octave/examples/07_image_processing.m&amp;lt;/code&amp;gt; file demonstrates reading images, converting between color spaces, applying filters and transformations, edge detection, and saving processed images.&lt;br /&gt;
&lt;br /&gt;
Install the image package with &amp;lt;code&amp;gt;pkg install -forge image&amp;lt;/code&amp;gt; and load it with &amp;lt;code&amp;gt;pkg load image&amp;lt;/code&amp;gt;. The package includes functions similar to MATLAB's Image Processing Toolbox.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Performance Optimization ===&lt;br /&gt;
&lt;br /&gt;
Vectorize operations whenever possible rather than using loops. Octave is optimized for vectorized code and matrix operations. Pre-allocate arrays before filling them in loops to avoid repeated memory allocation. Use built-in functions which are highly optimized rather than implementing algorithms from scratch. For very large problems, consider using sparse matrices when appropriate.&lt;br /&gt;
&lt;br /&gt;
Monitor memory usage with the whos command which displays all variables and their sizes. Clear unnecessary variables with the clear command to free memory. Use the tic and toc functions to measure execution time and identify performance bottlenecks.&lt;br /&gt;
&lt;br /&gt;
=== Code Organization ===&lt;br /&gt;
&lt;br /&gt;
Organize related code into functions saved in separate .m files. Use meaningful variable names and add comments to explain complex operations. Structure long scripts into sections using cell mode with double percent signs. Keep the workspace organized by clearing unnecessary variables periodically.&lt;br /&gt;
&lt;br /&gt;
Create a project directory structure with separate folders for scripts, functions, data, and results. Use relative paths when loading data to make code portable across different systems.&lt;br /&gt;
&lt;br /&gt;
=== Debugging and Testing ===&lt;br /&gt;
&lt;br /&gt;
Use the keyboard function to pause execution and examine variables interactively. Set breakpoints in scripts by clicking in the left margin of the editor. Step through code line by line using the debugger toolbar. Display intermediate results using disp or printf for troubleshooting.&lt;br /&gt;
&lt;br /&gt;
Test functions with simple inputs before using them on complex problems. Verify results against known solutions when available. Check for NaN or Inf values that might indicate numerical issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Engineering Simulation ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Simulate beam deflection under load and visualize results.&lt;br /&gt;
&lt;br /&gt;
Follow the complete workflow in &amp;lt;code&amp;gt;octave/workflows/01_beam_deflection.m&amp;lt;/code&amp;gt; which demonstrates defining beam parameters and loading conditions, calculating deflection using differential equations, plotting deflection curves, computing maximum deflection and stress, and exporting results to CSV and images.&lt;br /&gt;
&lt;br /&gt;
This workflow shows how to combine Octave's mathematical capabilities with visualization to solve a practical engineering problem.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Signal Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Analyze audio or sensor signals using Fourier analysis and filtering.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;octave/workflows/02_signal_analysis.m&amp;lt;/code&amp;gt; workflow demonstrates loading signal data, computing power spectral density, identifying dominant frequencies, designing and applying filters, and comparing filtered and original signals.&lt;br /&gt;
&lt;br /&gt;
This is useful for noise reduction, feature extraction, and understanding signal characteristics in various applications from audio processing to sensor data analysis.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Numerical Methods ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Solve a nonlinear equation using numerical methods and compare different approaches.&lt;br /&gt;
&lt;br /&gt;
Follow &amp;lt;code&amp;gt;octave/workflows/03_numerical_methods.m&amp;lt;/code&amp;gt; which shows implementing Newton-Raphson method, using fzero for root finding, comparing convergence rates, and visualizing solution paths.&lt;br /&gt;
&lt;br /&gt;
Understanding different numerical methods and their characteristics is crucial for choosing the right approach for specific problems.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: Octave GUI won't start ===&lt;br /&gt;
&lt;br /&gt;
If the Octave GUI fails to launch from the applications menu, try opening a terminal and running &amp;lt;code&amp;gt;octave --gui&amp;lt;/code&amp;gt; to see any error messages. Check that your desktop session has sufficient memory allocated. If the GUI is problematic, use the command-line version by typing &amp;lt;code&amp;gt;octave&amp;lt;/code&amp;gt; in the terminal, which provides full functionality without the graphical interface.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Package installation fails ===&lt;br /&gt;
&lt;br /&gt;
Package installation requires internet access and may fail due to network issues or missing dependencies. Try installing packages manually by downloading them from Octave Forge at https://octave.sourceforge.io/ and using &amp;lt;code&amp;gt;pkg install package.tar.gz&amp;lt;/code&amp;gt;. Some packages require system libraries that may need to be installed by KENET support.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Plot windows not displaying ===&lt;br /&gt;
&lt;br /&gt;
If plots do not appear, check the graphics toolkit with &amp;lt;code&amp;gt;graphics_toolkit&amp;lt;/code&amp;gt; and try switching toolkits with &amp;lt;code&amp;gt;graphics_toolkit('gnuplot')&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;graphics_toolkit('qt')&amp;lt;/code&amp;gt;. Ensure your remote desktop session has proper graphics support. If problems persist, save plots directly to files using print or saveas rather than displaying them interactively.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Out of memory errors ===&lt;br /&gt;
&lt;br /&gt;
Large matrix operations can exhaust available memory. Use sparse matrices for problems with mostly zero elements. Process data in chunks rather than loading everything into memory. Clear unnecessary variables frequently with clear. Request more memory when launching your desktop session if working with very large datasets.&lt;br /&gt;
&lt;br /&gt;
=== Problem: MATLAB compatibility issues ===&lt;br /&gt;
&lt;br /&gt;
While Octave aims for MATLAB compatibility, some functions may behave differently or not exist. Check the Octave documentation for equivalent functions. Use the exist function to test if a function is available before calling it. Some MATLAB toolboxes have equivalent Octave packages that need to be installed separately.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official GNU Octave documentation is available at https://octave.org/doc/interpreter/ and provides comprehensive coverage of all functions and features. The Octave Wiki at https://wiki.octave.org/ contains tutorials, examples, and community contributions. Octave Forge at https://octave.sourceforge.io/ hosts additional packages extending Octave's capabilities.&lt;br /&gt;
&lt;br /&gt;
For numerical methods, &amp;quot;Numerical Methods using MATLAB&amp;quot; textbooks often work well with Octave. The MATLAB documentation at https://www.mathworks.com/help/matlab/ can also be helpful as most concepts transfer directly to Octave.&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Pspp&amp;diff=1482</id>
		<title>Pspp</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Pspp&amp;diff=1482"/>
				<updated>2026-01-10T19:08:19Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= PSPP (in JupyterLab) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''PSPP''' is a free and open-source statistical analysis program, designed as a free alternative to SPSS. When integrated with JupyterLab, PSPP provides powerful statistical analysis capabilities accessible through Python notebooks, combining the ease of Jupyter's interactive environment with PSPP's comprehensive statistical procedures.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' PSPP in JupyterLab is particularly well-suited for descriptive statistics and frequency analysis, hypothesis testing including t-tests, ANOVA, and chi-square tests, linear and logistic regression modeling, factor analysis and reliability testing, survey data analysis with crosstabulation and contingency tables, data transformation and recoding operations, and generating statistical reports that combine PSPP output with Python visualizations.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' PSPP is available through JupyterLab sessions on the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using PSPP in JupyterLab, you should have an active KENET HPC cluster account with access to the Open OnDemand portal. Basic understanding of statistical concepts and hypothesis testing will be helpful. Familiarity with Python and JupyterLab is recommended, though not strictly required. Your data should be in CSV, SPSS (.sav), or tab-delimited format and stored in your home directory or scratch space.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching JupyterLab for PSPP ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
Begin by logging into Open OnDemand at https://ondemand.vlab.ac.ke using your KENET credentials. Click the '''Interactive Apps''' menu in the top navigation bar, then select '''JupyterLab''' from the dropdown list. PSPP functionality is accessed through JupyterLab rather than as a separate application.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Menu.png|thumb|600px|center|Navigate to Interactive Apps → JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
For PSPP statistical analysis, moderate resources are typically sufficient unless working with very large datasets.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; for CPU-based analysis&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;2-4&amp;lt;/code&amp;gt; hours for typical analyses&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;2-4&amp;lt;/code&amp;gt; cores for most statistical work&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;8-16&amp;lt;/code&amp;gt; GB depending on dataset size&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your data folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Connect ===&lt;br /&gt;
Click the '''Launch''' button to submit your job. Once the status changes to &amp;quot;Running&amp;quot; and the '''Connect to JupyterLab''' button appears, click it to open your session. You will access PSPP through Python notebooks or the terminal within JupyterLab.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Understanding PSPP Integration ===&lt;br /&gt;
PSPP can be accessed in JupyterLab through three main methods. The command-line interface allows you to run PSPP syntax files from a terminal within JupyterLab. Python integration using subprocess enables you to call PSPP commands from Python code cells and capture the output. For users familiar with Python statistics libraries, you can also use pandas and scipy as alternatives that provide similar functionality with better Jupyter integration.&lt;br /&gt;
&lt;br /&gt;
=== Creating Your First PSPP Analysis ===&lt;br /&gt;
Create a new Python notebook in JupyterLab by clicking the Python 3 icon in the Launcher. The &amp;lt;code&amp;gt;pspp/examples/01_basic_analysis.py&amp;lt;/code&amp;gt; file in our GitHub repository demonstrates how to run PSPP commands from within a Jupyter notebook using Python's subprocess module. This approach allows you to write PSPP syntax, execute it, and capture the results.&lt;br /&gt;
&lt;br /&gt;
=== PSPP Syntax Structure ===&lt;br /&gt;
PSPP uses a command-based syntax similar to SPSS. Each command performs a specific operation and must end with a period. Commands are case-insensitive, making DESCRIBE and describe equivalent. The &amp;lt;code&amp;gt;pspp/examples/02_pspp_syntax_basics.sps&amp;lt;/code&amp;gt; file shows the fundamental syntax structure including data loading, variable specification, and procedure execution.&lt;br /&gt;
&lt;br /&gt;
=== Alternative: Python Statistical Libraries ===&lt;br /&gt;
For users more comfortable with Python, the pandas and scipy libraries provide similar statistical capabilities with better Jupyter integration. The &amp;lt;code&amp;gt;pspp/examples/03_python_alternative.py&amp;lt;/code&amp;gt; file demonstrates how to perform common PSPP operations using pure Python, which often provides more flexible integration with Jupyter notebooks and easier result manipulation.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Loading and Describing Data ===&lt;br /&gt;
&lt;br /&gt;
PSPP can read data from CSV files, SPSS .sav files, and tab-delimited text files. The &amp;lt;code&amp;gt;pspp/examples/04_data_loading.sps&amp;lt;/code&amp;gt; file demonstrates various data loading methods. After loading data, use DESCRIPTIVES to obtain summary statistics including mean, median, standard deviation, and range for numeric variables. The FREQUENCIES command provides frequency distributions for categorical variables.&lt;br /&gt;
&lt;br /&gt;
The Python subprocess approach allows you to write PSPP syntax in a string, save it to a temporary file, execute it with PSPP, and capture the output for display in your notebook. This workflow integrates well with Jupyter's interactive environment.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: T-Tests and Group Comparisons ===&lt;br /&gt;
&lt;br /&gt;
PSPP provides comprehensive support for comparing group means through various t-test procedures. The &amp;lt;code&amp;gt;pspp/examples/05_ttests.sps&amp;lt;/code&amp;gt; file demonstrates independent samples t-tests for comparing two groups, paired samples t-tests for before-after comparisons, and one-sample t-tests for comparing a sample mean against a known value.&lt;br /&gt;
&lt;br /&gt;
Results include t-statistics, degrees of freedom, p-values, and confidence intervals. The output can be parsed from PSPP's text output or you can use Python's scipy.stats module for similar analyses with easier result handling.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: ANOVA and Post-Hoc Tests ===&lt;br /&gt;
&lt;br /&gt;
When comparing means across three or more groups, use PSPP's ONEWAY command for one-way analysis of variance. The &amp;lt;code&amp;gt;pspp/examples/06_anova.sps&amp;lt;/code&amp;gt; file shows how to perform ANOVA with descriptive statistics, homogeneity of variance tests, and post-hoc comparisons using Tukey's HSD or Bonferroni corrections.&lt;br /&gt;
&lt;br /&gt;
PSPP reports F-statistics, p-values, and effect sizes. Post-hoc tests identify which specific groups differ significantly from each other.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Crosstabulation and Chi-Square Tests ===&lt;br /&gt;
&lt;br /&gt;
For analyzing relationships between categorical variables, PSPP's CROSSTABS command creates contingency tables and performs chi-square tests. The &amp;lt;code&amp;gt;pspp/examples/07_crosstabs.sps&amp;lt;/code&amp;gt; file demonstrates creating two-way and multi-way tables, calculating row and column percentages, and computing chi-square statistics with effect size measures like Phi and Cramer's V.&lt;br /&gt;
&lt;br /&gt;
This is particularly useful for survey data analysis where you need to understand how responses vary across demographic groups or conditions.&lt;br /&gt;
&lt;br /&gt;
=== Task 5: Regression Analysis ===&lt;br /&gt;
&lt;br /&gt;
PSPP supports both linear and logistic regression through the REGRESSION and LOGISTIC REGRESSION commands. The &amp;lt;code&amp;gt;pspp/examples/08_regression.sps&amp;lt;/code&amp;gt; file shows how to fit regression models, interpret coefficients and standard errors, examine R-squared and adjusted R-squared values, and generate predicted values.&lt;br /&gt;
&lt;br /&gt;
For linear regression, PSPP provides detailed output including parameter estimates, significance tests, and model fit statistics. Diagnostic plots can be created using Python's matplotlib after extracting the data.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Workflow Optimization ===&lt;br /&gt;
&lt;br /&gt;
When working with PSPP in JupyterLab, keep your PSPP syntax in separate .sps files and load them programmatically. This allows for better version control and reusability. Use Python to pre-process data with pandas before passing it to PSPP when complex data manipulation is needed. Capture PSPP output and parse it in Python for further analysis or visualization. Consider using pure Python alternatives like scipy.stats and statsmodels when interactive iteration and result manipulation are important.&lt;br /&gt;
&lt;br /&gt;
Store PSPP syntax files alongside your notebooks for reproducibility. Comment your syntax files liberally using asterisks or the COMMENT command to explain your analytical decisions.&lt;br /&gt;
&lt;br /&gt;
=== Data Preparation ===&lt;br /&gt;
&lt;br /&gt;
PSPP is particular about data formats and missing values. Clean your data in Python first using pandas before exporting to CSV for PSPP analysis. Code missing values consistently and declare them explicitly in PSPP syntax. Ensure variable names follow PSPP conventions with no spaces or special characters except underscores. Convert date variables to appropriate formats before analysis.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;pspp/examples/09_data_preparation.py&amp;lt;/code&amp;gt; file demonstrates preparing data in pandas and exporting it in PSPP-compatible formats.&lt;br /&gt;
&lt;br /&gt;
=== Choosing Between PSPP and Python ===&lt;br /&gt;
&lt;br /&gt;
Use PSPP when you have existing SPSS syntax that needs to run without modification, when generating standardized statistical reports in familiar formats, when working with colleagues who use SPSS and need compatible output formats, or when you need exact SPSS-compatible procedures. Use Python statistical libraries when you need custom visualizations integrated with analyses, when working with complex data structures or large datasets, when you want interactive exploration in notebooks, or when integrating statistics with machine learning workflows.&lt;br /&gt;
&lt;br /&gt;
Many analyses can be performed with either approach. The &amp;lt;code&amp;gt;pspp/workflows/01_comparison_pspp_python.ipynb&amp;lt;/code&amp;gt; notebook demonstrates the same analysis performed both ways.&lt;br /&gt;
&lt;br /&gt;
=== Output Management ===&lt;br /&gt;
&lt;br /&gt;
PSPP generates text output that can be verbose. Use Python to parse output and extract relevant statistics for display. Save PSPP output to files using the OUTPUT EXPORT command for later reference. Create visualizations in Python using matplotlib or seaborn based on PSPP results. Consider generating automated reports that combine PSPP statistical output with Python-generated tables and figures.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Survey Data Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Analyze survey responses with descriptive statistics, crosstabulations, and chi-square tests to identify significant patterns.&lt;br /&gt;
&lt;br /&gt;
Launch JupyterLab with 4 cores and 8 GB memory. Create a new Python notebook and follow the workflow in &amp;lt;code&amp;gt;pspp/workflows/02_survey_analysis.ipynb&amp;lt;/code&amp;gt; from our GitHub repository.&lt;br /&gt;
&lt;br /&gt;
The workflow demonstrates loading survey data in Python, recoding variables and handling missing values, exporting to CSV for PSPP analysis, writing PSPP syntax for frequency tables and crosstabs, executing PSPP and capturing output, and creating visualizations in Python based on the statistical results.&lt;br /&gt;
&lt;br /&gt;
This integrated approach leverages both PSPP's statistical capabilities and Python's data manipulation and visualization strengths.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Experimental Data Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Compare treatment groups using ANOVA and post-hoc tests, checking assumptions and reporting effect sizes.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;pspp/workflows/03_experimental_analysis.ipynb&amp;lt;/code&amp;gt; workflow shows how to check normality assumptions using both PSPP and Python, perform one-way ANOVA with PSPP, conduct post-hoc tests to identify specific group differences, calculate effect sizes, create publication-quality plots of group means with error bars, and generate a combined report with statistical output and visualizations.&lt;br /&gt;
&lt;br /&gt;
If assumptions are violated, the workflow demonstrates using non-parametric alternatives like the Kruskal-Wallis test.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Regression Modeling ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Build and evaluate regression models to predict outcomes from multiple predictors.&lt;br /&gt;
&lt;br /&gt;
Follow the steps in &amp;lt;code&amp;gt;pspp/workflows/04_regression_modeling.ipynb&amp;lt;/code&amp;gt; which demonstrates exploratory data analysis with correlation matrices, fitting multiple linear regression models in PSPP, checking regression assumptions with diagnostic plots, comparing nested models, interpreting standardized and unstandardized coefficients, and making predictions on new data.&lt;br /&gt;
&lt;br /&gt;
The workflow shows how to extract coefficients from PSPP output and use them in Python for prediction and visualization.&lt;br /&gt;
&lt;br /&gt;
=== Example 4: Hybrid Python-PSPP Workflow ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Combine the strengths of both tools for a complete analysis pipeline.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;pspp/workflows/05_hybrid_workflow.ipynb&amp;lt;/code&amp;gt; example demonstrates using pandas for initial data exploration and cleaning, using PSPP for standard statistical tests and reports, parsing PSPP output programmatically in Python, creating custom visualizations with seaborn and matplotlib, and generating an integrated report with nbconvert that includes both statistical output and visual analysis.&lt;br /&gt;
&lt;br /&gt;
This approach is particularly effective for complex projects that benefit from both PSPP's standardized procedures and Python's flexibility.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: PSPP command not found ===&lt;br /&gt;
&lt;br /&gt;
If running PSPP from a notebook returns a &amp;quot;command not found&amp;quot; error, the PSPP module may not be loaded in your environment. Open a terminal in JupyterLab and check if PSPP is available by typing &amp;lt;code&amp;gt;pspp --version&amp;lt;/code&amp;gt;. If not available, contact KENET support to request PSPP installation or module configuration. As an alternative, use Python's statistical libraries like scipy.stats and statsmodels which are pre-installed in most JupyterLab environments.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Syntax errors in PSPP commands ===&lt;br /&gt;
&lt;br /&gt;
PSPP syntax errors typically result from missing periods at the end of commands, incorrect variable names, or unsupported syntax. Check that every command ends with a period. Verify variable names match exactly what is in your data file. Ensure you are not using SPSS syntax that differs from PSPP. The PSPP manual at https://www.gnu.org/software/pspp/manual/html_node/ provides complete syntax documentation.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Cannot read data file ===&lt;br /&gt;
&lt;br /&gt;
File reading errors usually indicate incorrect path specifications or incompatible data formats. Use absolute paths to your data files starting with /home/username/ or /scratch/username/. Ensure CSV files use standard delimiters and have consistent formatting. For SPSS .sav files, verify they are not from a very new SPSS version that PSPP might not support. Test with a small sample file first.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Missing values not handled correctly ===&lt;br /&gt;
&lt;br /&gt;
PSPP requires explicit declaration of missing values. Use the MISSING VALUES command to specify which values should be treated as missing. In CSV files, use consistent notation for missing data like NA or empty cells. When preparing data in Python, use pandas' to_csv with na_rep parameter to control missing value representation.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Output not displaying in notebook ===&lt;br /&gt;
&lt;br /&gt;
If PSPP output is not appearing in your notebook cells, check that you are capturing stdout from the subprocess call. Use &amp;lt;code&amp;gt;capture_output=True, text=True&amp;lt;/code&amp;gt; parameters in subprocess.run. Print the result.stdout to display output. If output is very long, consider writing it to a file and reading only relevant sections. For better formatting, consider parsing the output and displaying it as formatted text or pandas DataFrames.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official PSPP documentation is available at https://www.gnu.org/software/pspp/ and provides comprehensive information about all commands and procedures. The PSPP manual at https://www.gnu.org/software/pspp/manual/html_node/ includes detailed syntax reference and examples. For statistical analysis with Python, consult the scipy documentation at https://docs.scipy.org/doc/scipy/ and the statsmodels documentation at https://www.statsmodels.org/.&lt;br /&gt;
&lt;br /&gt;
KENET HPC usage guidelines are documented at https://training.kenet.or.ke/index.php/HPC_Usage. For learning statistics, the free textbook &amp;quot;OpenIntro Statistics&amp;quot; at https://www.openintro.org/book/os/ provides excellent coverage of fundamental concepts.&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
== Feedback ==&lt;br /&gt;
&lt;br /&gt;
If you encounter issues or have suggestions for improving this tutorial, please contact KENET support or submit feedback through the Open OnDemand interface using the feedback button.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Qgis&amp;diff=1481</id>
		<title>Qgis</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Qgis&amp;diff=1481"/>
				<updated>2026-01-10T19:07:52Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: Created page with &amp;quot;= QGIS (Remote Desktop) Tutorial - KENET HPC Cluster =  == Overview == '''QGIS''' is a free and open-source Geographic Information System that enables users to create, edit, v...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= QGIS (Remote Desktop) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''QGIS''' is a free and open-source Geographic Information System that enables users to create, edit, visualize, analyze, and publish geospatial information. Running on the KENET HPC cluster through Remote Desktop provides access to substantial computational resources for processing large spatial datasets, performing complex spatial analyses, and generating professional cartographic outputs.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' QGIS is particularly valuable for map creation and cartographic design, spatial data analysis and geoprocessing, remote sensing and satellite imagery processing, environmental modeling and land use analysis, urban planning and infrastructure development, analyzing GPS and field survey data, creating interactive web maps and spatial databases, and teaching GIS concepts and spatial analysis methods.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' QGIS is available through Remote Desktop sessions on the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using QGIS, you should have an active KENET HPC cluster account with access to the Open OnDemand portal. Basic understanding of geographic concepts like coordinates, projections, and spatial relationships will be helpful. Familiarity with different spatial data formats such as shapefiles, GeoJSON, and raster files is beneficial. Your spatial data should be stored in accessible directories on the cluster, preferably in standard GIS formats.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching QGIS ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Start Remote Desktop Session ===&lt;br /&gt;
Begin by logging into Open OnDemand at https://ondemand.vlab.ac.ke. Click the '''Interactive Apps''' menu and select '''Remote Desktop''' to launch a full desktop environment on a compute node.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_Desktop_Menu.png|thumb|600px|center|Navigate to Interactive Apps → Remote Desktop]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Desktop Session ===&lt;br /&gt;
Configure the resources based on the size and complexity of your spatial datasets.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; for standard GIS work&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; hours for interactive mapping, up to &amp;lt;code&amp;gt;24&amp;lt;/code&amp;gt; for large processing&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores for raster processing&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16-32&amp;lt;/code&amp;gt; GB for large datasets, &amp;lt;code&amp;gt;64&amp;lt;/code&amp;gt; GB for satellite imagery&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_Desktop_Form.png|thumb|600px|center|Desktop session configuration]]&lt;br /&gt;
&lt;br /&gt;
'''Tip:''' Large raster datasets like satellite imagery require substantial memory. Request adequate resources to avoid crashes during processing.&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Launch QGIS from Desktop ===&lt;br /&gt;
Once your remote desktop starts, launch QGIS by clicking '''Applications''' in the top menu, navigating to '''Graphics''' or '''Education''', and selecting '''QGIS Desktop'''. Alternatively, open a terminal and type &amp;lt;code&amp;gt;qgis&amp;lt;/code&amp;gt; to launch the application directly.&lt;br /&gt;
&lt;br /&gt;
[[File:QGIS_Interface.png|thumb|600px|center|QGIS Desktop interface]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Understanding the QGIS Interface ===&lt;br /&gt;
The QGIS interface consists of several key components. The Map Canvas in the center displays your spatial data and is where most visualization occurs. The Layers Panel on the left shows all loaded layers in your project with options to toggle visibility and adjust order. The Browser Panel provides file system navigation for accessing spatial data. The Toolbars at the top contain buttons for common operations like zooming, selecting features, and measuring distances. The Status Bar at the bottom displays coordinate information, scale, and projection details.&lt;br /&gt;
&lt;br /&gt;
=== Loading Your First Layer ===&lt;br /&gt;
To load spatial data, click '''Layer → Add Layer''' from the menu and choose the appropriate option based on your data type. For vector data like points, lines, or polygons, select '''Add Vector Layer''' and browse to your shapefile, GeoJSON, or GeoPackage file. For raster data like satellite imagery or elevation models, choose '''Add Raster Layer'''. The &amp;lt;code&amp;gt;qgis/examples/01_loading_data.md&amp;lt;/code&amp;gt; file in our GitHub repository provides detailed instructions for various data formats.&lt;br /&gt;
&lt;br /&gt;
Loaded layers appear in the Layers Panel and are drawn on the Map Canvas. Right-click any layer for additional options like viewing the attribute table, adjusting symbology, or accessing layer properties.&lt;br /&gt;
&lt;br /&gt;
=== Basic Navigation ===&lt;br /&gt;
Use the navigation tools to explore your data. The Pan tool (hand icon) lets you move around the map by clicking and dragging. The Zoom In and Zoom Out tools magnify or reduce the view. Zoom to Layer extent shows the full extent of a selected layer. The mouse wheel also zooms in and out centered on the cursor position. The status bar shows your current position coordinates as you move the mouse across the map.&lt;br /&gt;
&lt;br /&gt;
=== Working with Coordinate Reference Systems ===&lt;br /&gt;
Understanding coordinate systems is crucial in GIS work. Every spatial dataset has a Coordinate Reference System or CRS that defines how coordinates relate to locations on Earth. QGIS displays the current project CRS in the bottom right corner. Click it to change the project CRS. To check or change a layer's CRS, right-click the layer, select '''Properties''', and go to the '''Source''' tab. The &amp;lt;code&amp;gt;qgis/examples/02_coordinate_systems.md&amp;lt;/code&amp;gt; guide explains common CRS choices and when to use them.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Creating Thematic Maps ===&lt;br /&gt;
&lt;br /&gt;
Thematic maps visualize spatial patterns in your data through color, size, or symbols. The &amp;lt;code&amp;gt;qgis/examples/03_thematic_mapping.md&amp;lt;/code&amp;gt; guide demonstrates opening a vector layer with attributes, accessing layer properties by right-clicking and selecting '''Properties''', navigating to the '''Symbology''' tab, choosing a rendering style such as Categorized for discrete values or Graduated for continuous data, selecting the attribute column to visualize, choosing a color ramp that effectively communicates your data, clicking '''Classify''' to generate classes, and adjusting class breaks or colors as needed.&lt;br /&gt;
&lt;br /&gt;
Once styled, add a legend through '''Project → New Print Layout''' and insert '''Add Legend''' to create a complete map suitable for reports or publications.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: Spatial Analysis with Buffers ===&lt;br /&gt;
&lt;br /&gt;
Buffer analysis creates zones around features at specified distances, useful for analyzing proximity relationships. The &amp;lt;code&amp;gt;qgis/examples/04_buffer_analysis.md&amp;lt;/code&amp;gt; tutorial shows loading a point or line layer, opening the Processing Toolbox via '''Processing → Toolbox''', searching for &amp;quot;buffer&amp;quot; to find the Buffer tool, setting the input layer and buffer distance in appropriate units, choosing an output location for the buffered layer, clicking '''Run''' to execute, and examining the resulting buffer zones on your map.&lt;br /&gt;
&lt;br /&gt;
Buffers are fundamental for questions like &amp;quot;what is within 1 kilometer of this road&amp;quot; or &amp;quot;which houses are within 500 meters of the river&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: Raster Data Processing ===&lt;br /&gt;
&lt;br /&gt;
Working with raster data like elevation models or satellite imagery requires specific tools. The &amp;lt;code&amp;gt;qgis/examples/05_raster_processing.md&amp;lt;/code&amp;gt; guide demonstrates loading a raster layer, accessing raster tools through '''Raster''' menu, calculating hillshade from elevation data, performing reclassification to create categorical maps, conducting raster calculations using the Raster Calculator, clipping rasters to areas of interest, and changing color ramps to enhance visualization.&lt;br /&gt;
&lt;br /&gt;
Raster processing can be computationally intensive. The cluster's resources allow you to work with large regional or even continental datasets that would be impractical on a desktop computer.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Attribute Table Operations ===&lt;br /&gt;
&lt;br /&gt;
The attribute table stores non-spatial information about features. The &amp;lt;code&amp;gt;qgis/examples/06_attribute_operations.md&amp;lt;/code&amp;gt; tutorial shows opening the attribute table by right-clicking a layer and selecting '''Open Attribute Table''', selecting features based on attributes using '''Select features using an expression''', calculating new fields with the Field Calculator, editing existing attribute values, joining tables from different sources, and exporting selected features to new layers.&lt;br /&gt;
&lt;br /&gt;
Understanding attribute operations is essential for querying and analyzing spatial data based on their characteristics.&lt;br /&gt;
&lt;br /&gt;
=== Task 5: Geoprocessing Operations ===&lt;br /&gt;
&lt;br /&gt;
QGIS provides numerous geoprocessing tools for spatial analysis. The &amp;lt;code&amp;gt;qgis/examples/07_geoprocessing.md&amp;lt;/code&amp;gt; guide demonstrates clipping layers to study area boundaries, intersecting layers to find overlapping features, performing union operations to combine datasets, conducting spatial joins to transfer attributes between layers, dissolving features based on common attributes, and creating Voronoi polygons for proximity analysis.&lt;br /&gt;
&lt;br /&gt;
These operations form the foundation of spatial analysis workflows, enabling complex questions about spatial relationships to be answered.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Data Management ===&lt;br /&gt;
&lt;br /&gt;
Organize your GIS data in a clear folder structure with separate directories for raw data, processed outputs, and project files. Use GeoPackage format instead of shapefiles when possible as it stores multiple layers in a single file and has fewer limitations. Always maintain original data separately from processed versions. Document your data sources, processing steps, and coordinate systems in a project README or metadata file.&lt;br /&gt;
&lt;br /&gt;
Store large raster datasets on the scratch directory at &amp;lt;code&amp;gt;/scratch/username/&amp;lt;/code&amp;gt; for better I/O performance during processing operations.&lt;br /&gt;
&lt;br /&gt;
=== Performance Optimization ===&lt;br /&gt;
&lt;br /&gt;
For large datasets, create spatial indexes to improve query and rendering speed by right-clicking the layer and selecting '''Properties → Source → Create Spatial Index'''. Simplify complex geometries when appropriate using '''Vector → Geometry Tools → Simplify''' to reduce vertex counts. Use layer filtering to display only relevant features rather than the entire dataset. Turn off layers not currently needed to improve map rendering speed. Save processing results to disk rather than keeping everything as temporary layers in memory.&lt;br /&gt;
&lt;br /&gt;
=== Coordinate System Management ===&lt;br /&gt;
&lt;br /&gt;
Always check that all layers in your project use appropriate coordinate systems. For analysis, ensure all layers are in the same projected CRS to avoid measurement errors. Use projected coordinate systems like UTM for local or regional analysis where distances and areas matter. Use geographic coordinate systems like WGS84 only for global-scale visualization. When creating new layers, explicitly set the CRS rather than relying on defaults.&lt;br /&gt;
&lt;br /&gt;
The project CRS determines how layers are displayed but does not change the underlying data. Use '''Save As''' with a different CRS to actually reproject layers.&lt;br /&gt;
&lt;br /&gt;
=== Quality Control ===&lt;br /&gt;
&lt;br /&gt;
Verify data quality before analysis by checking for invalid geometries using '''Vector → Geometry Tools → Check Validity''', looking for duplicate features, examining attribute completeness, confirming coordinate system correctness, and validating topology for features that should connect properly.&lt;br /&gt;
&lt;br /&gt;
Use '''View → Panels → Log Messages''' to monitor processing operations and catch warnings or errors that might affect results.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Land Use Change Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Compare land use or land cover between two time periods to identify areas of change.&lt;br /&gt;
&lt;br /&gt;
Follow the complete workflow in &amp;lt;code&amp;gt;qgis/workflows/01_land_use_change.md&amp;lt;/code&amp;gt; which demonstrates loading land use shapefiles or rasters for two different years, ensuring both datasets use the same coordinate system and extent, using '''Vector → Geoprocessing Tools → Intersection''' to identify areas present in both datasets, calculating area changes with the Field Calculator, creating a thematic map showing gains and losses in different land use categories, generating statistics summarizing change by category, and exporting results as maps and tables.&lt;br /&gt;
&lt;br /&gt;
This workflow is valuable for environmental monitoring, urban planning, and understanding landscape dynamics over time.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Site Suitability Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Identify optimal locations for a facility based on multiple spatial criteria.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;qgis/workflows/02_suitability_analysis.md&amp;lt;/code&amp;gt; workflow shows defining your suitability criteria such as distance constraints, identifying necessary data layers including roads, water bodies, land use, and elevation, creating buffers around features to represent distance requirements, reclassifying raster data to suitability scores, using Raster Calculator to combine criteria with appropriate weights, identifying areas meeting all requirements, vectorizing suitable areas for further analysis, and validating results against ground truth or expert knowledge.&lt;br /&gt;
&lt;br /&gt;
This approach is used in urban planning, renewable energy site selection, conservation planning, and facility location problems.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: GPS Data Visualization and Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Import GPS tracking data, create visualizations, and analyze spatial patterns.&lt;br /&gt;
&lt;br /&gt;
Follow &amp;lt;code&amp;gt;qgis/workflows/03_gps_analysis.md&amp;lt;/code&amp;gt; which demonstrates loading GPX files using '''Layer → Add Layer → Add Vector Layer''', selecting the appropriate GPS data type such as tracks, routes, or waypoints, styling tracks with appropriate colors and widths, adding a basemap using '''Web → QuickMapServices''' or XYZ tiles, calculating track statistics like distance and elevation gain, creating elevation profiles using the Profile Tool plugin, performing density analysis to identify frequently visited areas, and exporting finished maps for reports or presentations.&lt;br /&gt;
&lt;br /&gt;
This workflow is applicable to wildlife tracking, recreational activity analysis, field survey data, and movement pattern studies.&lt;br /&gt;
&lt;br /&gt;
=== Example 4: Satellite Imagery Processing ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Process and analyze multispectral satellite imagery for land cover classification or change detection.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;qgis/workflows/04_satellite_imagery.md&amp;lt;/code&amp;gt; workflow demonstrates loading multispectral satellite bands as separate rasters, creating band composites using '''Raster → Miscellaneous → Build Virtual Raster''', adjusting visualization with appropriate band combinations for different purposes, calculating vegetation indices like NDVI using Raster Calculator, performing supervised or unsupervised classification, assessing accuracy with ground truth data, creating change detection maps by comparing imagery from different dates, and exporting classified maps and statistics.&lt;br /&gt;
&lt;br /&gt;
Remote sensing workflows benefit greatly from the cluster's computational resources when processing large scenes or time series.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: Layers not displaying on map ===&lt;br /&gt;
&lt;br /&gt;
If a loaded layer does not appear on the map canvas, first check that the layer is visible by looking for a checkmark in the Layers Panel. Verify the layer has a valid extent by right-clicking and selecting '''Zoom to Layer'''. If this fails, the layer may be empty or have invalid geometries. Check that the layer's coordinate system matches or is compatible with the project CRS. Look in '''View → Panels → Log Messages''' for error messages that might explain the problem.&lt;br /&gt;
&lt;br /&gt;
=== Problem: CRS mismatch warnings ===&lt;br /&gt;
&lt;br /&gt;
When loading layers with different coordinate systems, QGIS may display warnings about CRS mismatches. While QGIS can reproject layers on-the-fly for display, this can cause issues with measurements and analysis. For analysis work, ensure all layers are in the same projected coordinate system by saving them with '''Right-click → Export → Save Features As''' and selecting the target CRS. For viewing only, on-the-fly reprojection usually works fine.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Processing tools running very slowly ===&lt;br /&gt;
&lt;br /&gt;
Slow processing usually indicates insufficient memory or very large datasets. Check available memory using system monitors. Simplify geometries before processing if vertex counts are very high. Process data in smaller chunks or tiles when possible. Use spatial indexes on all layers. Close other applications to free memory. For particularly large jobs, request more resources when launching your desktop session.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Unable to edit layer ===&lt;br /&gt;
&lt;br /&gt;
If you cannot edit a layer, check that it is in a writable format. Layers from some sources like WFS services or database views may be read-only. Ensure editing is enabled by clicking the pencil icon in the toolbar. Verify you have write permissions for the file. For shapefiles, check that associated files like .shx and .dbf are present and writable. Try saving the layer to a new file with full permissions.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Basemaps not loading ===&lt;br /&gt;
&lt;br /&gt;
If web basemaps from services like OpenStreetMap fail to load, verify your desktop session has internet connectivity by opening a web browser. Check the QGIS log for connection errors. Try different basemap providers through the QuickMapServices plugin. Some institutional networks block certain map services. For offline work, use locally stored basemap tiles or data.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Plugins not installing ===&lt;br /&gt;
&lt;br /&gt;
Plugin installation requires internet access and may fail if the repository is unreachable. Check network connectivity. Try installing plugins manually by downloading from the QGIS plugin repository and using '''Plugins → Manage and Install Plugins → Install from ZIP'''. Some plugins require additional Python packages. Check the plugin documentation for dependencies. Contact KENET support if system Python packages need installation.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official QGIS documentation is available at https://docs.qgis.org/ and provides comprehensive guides covering all features and tools. The QGIS Training Manual at https://docs.qgis.org/latest/en/docs/training_manual/ offers structured tutorials for learning QGIS systematically. The QGIS community provides numerous video tutorials and blog posts covering specific workflows and techniques.&lt;br /&gt;
&lt;br /&gt;
For spatial analysis concepts, consult textbooks on Geographic Information Systems or spatial statistics. The GDAL documentation at https://gdal.org/ is valuable for understanding raster and vector data formats and conversions. For coordinate systems, the EPSG database at https://epsg.io/ provides searchable information about projections worldwide.&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Feedback ==&lt;br /&gt;
&lt;br /&gt;
If you encounter issues or have suggestions for improving this tutorial, please contact KENET support or submit feedback through the Open OnDemand interface using the feedback button.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Pspp&amp;diff=1480</id>
		<title>Pspp</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Pspp&amp;diff=1480"/>
				<updated>2026-01-10T19:04:21Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: Created page with &amp;quot;= PSPP (in JupyterLab) Tutorial - KENET HPC Cluster =  == Overview == '''PSPP''' is a free and open-source statistical analysis program, designed as a free alternative to SPSS...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= PSPP (in JupyterLab) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''PSPP''' is a free and open-source statistical analysis program, designed as a free alternative to SPSS. When integrated with JupyterLab, PSPP provides powerful statistical analysis capabilities accessible through Python notebooks, combining the ease of Jupyter's interactive environment with PSPP's comprehensive statistical procedures.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' PSPP in JupyterLab is particularly well-suited for descriptive statistics and frequency analysis, hypothesis testing including t-tests, ANOVA, and chi-square tests, linear and logistic regression modeling, factor analysis and reliability testing, survey data analysis with crosstabulation and contingency tables, data transformation and recoding operations, and generating statistical reports that combine PSPP output with Python visualizations.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' PSPP is available through JupyterLab sessions on the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using PSPP in JupyterLab, you should have an active KENET HPC cluster account with access to the Open OnDemand portal. Basic understanding of statistical concepts and hypothesis testing will be helpful. Familiarity with Python and JupyterLab is recommended, though not strictly required. Your data should be in CSV, SPSS (.sav), or tab-delimited format and stored in your home directory or scratch space.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching JupyterLab for PSPP ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
Begin by logging into Open OnDemand at https://ondemand.vlab.ac.ke using your KENET credentials. Click the '''Interactive Apps''' menu in the top navigation bar, then select '''JupyterLab''' from the dropdown list. PSPP functionality is accessed through JupyterLab rather than as a separate application.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Menu.png|thumb|600px|center|Navigate to Interactive Apps → JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
For PSPP statistical analysis, moderate resources are typically sufficient unless working with very large datasets.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; for CPU-based analysis&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;2-4&amp;lt;/code&amp;gt; hours for typical analyses&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;2-4&amp;lt;/code&amp;gt; cores for most statistical work&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;8-16&amp;lt;/code&amp;gt; GB depending on dataset size&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your data folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Connect ===&lt;br /&gt;
Click the '''Launch''' button to submit your job. Once the status changes to &amp;quot;Running&amp;quot; and the '''Connect to JupyterLab''' button appears, click it to open your session. You will access PSPP through Python notebooks or the terminal within JupyterLab.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Understanding PSPP Integration ===&lt;br /&gt;
PSPP can be accessed in JupyterLab through three main methods. The command-line interface allows you to run PSPP syntax files from a terminal within JupyterLab. Python integration using subprocess enables you to call PSPP commands from Python code cells and capture the output. For users familiar with Python statistics libraries, you can also use pandas and scipy as alternatives that provide similar functionality with better Jupyter integration.&lt;br /&gt;
&lt;br /&gt;
=== Creating Your First PSPP Analysis ===&lt;br /&gt;
Create a new Python notebook in JupyterLab by clicking the Python 3 icon in the Launcher. The &amp;lt;code&amp;gt;pspp/examples/01_basic_analysis.py&amp;lt;/code&amp;gt; file in our GitHub repository demonstrates how to run PSPP commands from within a Jupyter notebook using Python's subprocess module. This approach allows you to write PSPP syntax, execute it, and capture the results.&lt;br /&gt;
&lt;br /&gt;
=== PSPP Syntax Structure ===&lt;br /&gt;
PSPP uses a command-based syntax similar to SPSS. Each command performs a specific operation and must end with a period. Commands are case-insensitive, making DESCRIBE and describe equivalent. The &amp;lt;code&amp;gt;pspp/examples/02_pspp_syntax_basics.sps&amp;lt;/code&amp;gt; file shows the fundamental syntax structure including data loading, variable specification, and procedure execution.&lt;br /&gt;
&lt;br /&gt;
=== Alternative: Python Statistical Libraries ===&lt;br /&gt;
For users more comfortable with Python, the pandas and scipy libraries provide similar statistical capabilities with better Jupyter integration. The &amp;lt;code&amp;gt;pspp/examples/03_python_alternative.py&amp;lt;/code&amp;gt; file demonstrates how to perform common PSPP operations using pure Python, which often provides more flexible integration with Jupyter notebooks and easier result manipulation.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Loading and Describing Data ===&lt;br /&gt;
&lt;br /&gt;
PSPP can read data from CSV files, SPSS .sav files, and tab-delimited text files. The &amp;lt;code&amp;gt;pspp/examples/04_data_loading.sps&amp;lt;/code&amp;gt; file demonstrates various data loading methods. After loading data, use DESCRIPTIVES to obtain summary statistics including mean, median, standard deviation, and range for numeric variables. The FREQUENCIES command provides frequency distributions for categorical variables.&lt;br /&gt;
&lt;br /&gt;
The Python subprocess approach allows you to write PSPP syntax in a string, save it to a temporary file, execute it with PSPP, and capture the output for display in your notebook. This workflow integrates well with Jupyter's interactive environment.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: T-Tests and Group Comparisons ===&lt;br /&gt;
&lt;br /&gt;
PSPP provides comprehensive support for comparing group means through various t-test procedures. The &amp;lt;code&amp;gt;pspp/examples/05_ttests.sps&amp;lt;/code&amp;gt; file demonstrates independent samples t-tests for comparing two groups, paired samples t-tests for before-after comparisons, and one-sample t-tests for comparing a sample mean against a known value.&lt;br /&gt;
&lt;br /&gt;
Results include t-statistics, degrees of freedom, p-values, and confidence intervals. The output can be parsed from PSPP's text output or you can use Python's scipy.stats module for similar analyses with easier result handling.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: ANOVA and Post-Hoc Tests ===&lt;br /&gt;
&lt;br /&gt;
When comparing means across three or more groups, use PSPP's ONEWAY command for one-way analysis of variance. The &amp;lt;code&amp;gt;pspp/examples/06_anova.sps&amp;lt;/code&amp;gt; file shows how to perform ANOVA with descriptive statistics, homogeneity of variance tests, and post-hoc comparisons using Tukey's HSD or Bonferroni corrections.&lt;br /&gt;
&lt;br /&gt;
PSPP reports F-statistics, p-values, and effect sizes. Post-hoc tests identify which specific groups differ significantly from each other.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Crosstabulation and Chi-Square Tests ===&lt;br /&gt;
&lt;br /&gt;
For analyzing relationships between categorical variables, PSPP's CROSSTABS command creates contingency tables and performs chi-square tests. The &amp;lt;code&amp;gt;pspp/examples/07_crosstabs.sps&amp;lt;/code&amp;gt; file demonstrates creating two-way and multi-way tables, calculating row and column percentages, and computing chi-square statistics with effect size measures like Phi and Cramer's V.&lt;br /&gt;
&lt;br /&gt;
This is particularly useful for survey data analysis where you need to understand how responses vary across demographic groups or conditions.&lt;br /&gt;
&lt;br /&gt;
=== Task 5: Regression Analysis ===&lt;br /&gt;
&lt;br /&gt;
PSPP supports both linear and logistic regression through the REGRESSION and LOGISTIC REGRESSION commands. The &amp;lt;code&amp;gt;pspp/examples/08_regression.sps&amp;lt;/code&amp;gt; file shows how to fit regression models, interpret coefficients and standard errors, examine R-squared and adjusted R-squared values, and generate predicted values.&lt;br /&gt;
&lt;br /&gt;
For linear regression, PSPP provides detailed output including parameter estimates, significance tests, and model fit statistics. Diagnostic plots can be created using Python's matplotlib after extracting the data.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Workflow Optimization ===&lt;br /&gt;
&lt;br /&gt;
When working with PSPP in JupyterLab, keep your PSPP syntax in separate .sps files and load them programmatically. This allows for better version control and reusability. Use Python to pre-process data with pandas before passing it to PSPP when complex data manipulation is needed. Capture PSPP output and parse it in Python for further analysis or visualization. Consider using pure Python alternatives like scipy.stats and statsmodels when interactive iteration and result manipulation are important.&lt;br /&gt;
&lt;br /&gt;
Store PSPP syntax files alongside your notebooks for reproducibility. Comment your syntax files liberally using asterisks or the COMMENT command to explain your analytical decisions.&lt;br /&gt;
&lt;br /&gt;
=== Data Preparation ===&lt;br /&gt;
&lt;br /&gt;
PSPP is particular about data formats and missing values. Clean your data in Python first using pandas before exporting to CSV for PSPP analysis. Code missing values consistently and declare them explicitly in PSPP syntax. Ensure variable names follow PSPP conventions with no spaces or special characters except underscores. Convert date variables to appropriate formats before analysis.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;pspp/examples/09_data_preparation.py&amp;lt;/code&amp;gt; file demonstrates preparing data in pandas and exporting it in PSPP-compatible formats.&lt;br /&gt;
&lt;br /&gt;
=== Choosing Between PSPP and Python ===&lt;br /&gt;
&lt;br /&gt;
Use PSPP when you have existing SPSS syntax that needs to run without modification, when generating standardized statistical reports in familiar formats, when working with colleagues who use SPSS and need compatible output formats, or when you need exact SPSS-compatible procedures. Use Python statistical libraries when you need custom visualizations integrated with analyses, when working with complex data structures or large datasets, when you want interactive exploration in notebooks, or when integrating statistics with machine learning workflows.&lt;br /&gt;
&lt;br /&gt;
Many analyses can be performed with either approach. The &amp;lt;code&amp;gt;pspp/workflows/01_comparison_pspp_python.ipynb&amp;lt;/code&amp;gt; notebook demonstrates the same analysis performed both ways.&lt;br /&gt;
&lt;br /&gt;
=== Output Management ===&lt;br /&gt;
&lt;br /&gt;
PSPP generates text output that can be verbose. Use Python to parse output and extract relevant statistics for display. Save PSPP output to files using the OUTPUT EXPORT command for later reference. Create visualizations in Python using matplotlib or seaborn based on PSPP results. Consider generating automated reports that combine PSPP statistical output with Python-generated tables and figures.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Survey Data Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Analyze survey responses with descriptive statistics, crosstabulations, and chi-square tests to identify significant patterns.&lt;br /&gt;
&lt;br /&gt;
Launch JupyterLab with 4 cores and 8 GB memory. Create a new Python notebook and follow the workflow in &amp;lt;code&amp;gt;pspp/workflows/02_survey_analysis.ipynb&amp;lt;/code&amp;gt; from our GitHub repository.&lt;br /&gt;
&lt;br /&gt;
The workflow demonstrates loading survey data in Python, recoding variables and handling missing values, exporting to CSV for PSPP analysis, writing PSPP syntax for frequency tables and crosstabs, executing PSPP and capturing output, and creating visualizations in Python based on the statistical results.&lt;br /&gt;
&lt;br /&gt;
This integrated approach leverages both PSPP's statistical capabilities and Python's data manipulation and visualization strengths.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Experimental Data Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Compare treatment groups using ANOVA and post-hoc tests, checking assumptions and reporting effect sizes.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;pspp/workflows/03_experimental_analysis.ipynb&amp;lt;/code&amp;gt; workflow shows how to check normality assumptions using both PSPP and Python, perform one-way ANOVA with PSPP, conduct post-hoc tests to identify specific group differences, calculate effect sizes, create publication-quality plots of group means with error bars, and generate a combined report with statistical output and visualizations.&lt;br /&gt;
&lt;br /&gt;
If assumptions are violated, the workflow demonstrates using non-parametric alternatives like the Kruskal-Wallis test.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Regression Modeling ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Build and evaluate regression models to predict outcomes from multiple predictors.&lt;br /&gt;
&lt;br /&gt;
Follow the steps in &amp;lt;code&amp;gt;pspp/workflows/04_regression_modeling.ipynb&amp;lt;/code&amp;gt; which demonstrates exploratory data analysis with correlation matrices, fitting multiple linear regression models in PSPP, checking regression assumptions with diagnostic plots, comparing nested models, interpreting standardized and unstandardized coefficients, and making predictions on new data.&lt;br /&gt;
&lt;br /&gt;
The workflow shows how to extract coefficients from PSPP output and use them in Python for prediction and visualization.&lt;br /&gt;
&lt;br /&gt;
=== Example 4: Hybrid Python-PSPP Workflow ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Combine the strengths of both tools for a complete analysis pipeline.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;pspp/workflows/05_hybrid_workflow.ipynb&amp;lt;/code&amp;gt; example demonstrates using pandas for initial data exploration and cleaning, using PSPP for standard statistical tests and reports, parsing PSPP output programmatically in Python, creating custom visualizations with seaborn and matplotlib, and generating an integrated report with nbconvert that includes both statistical output and visual analysis.&lt;br /&gt;
&lt;br /&gt;
This approach is particularly effective for complex projects that benefit from both PSPP's standardized procedures and Python's flexibility.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: PSPP command not found ===&lt;br /&gt;
&lt;br /&gt;
If running PSPP from a notebook returns a &amp;quot;command not found&amp;quot; error, the PSPP module may not be loaded in your environment. Open a terminal in JupyterLab and check if PSPP is available by typing &amp;lt;code&amp;gt;pspp --version&amp;lt;/code&amp;gt;. If not available, contact KENET support to request PSPP installation or module configuration. As an alternative, use Python's statistical libraries like scipy.stats and statsmodels which are pre-installed in most JupyterLab environments.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Syntax errors in PSPP commands ===&lt;br /&gt;
&lt;br /&gt;
PSPP syntax errors typically result from missing periods at the end of commands, incorrect variable names, or unsupported syntax. Check that every command ends with a period. Verify variable names match exactly what is in your data file. Ensure you are not using SPSS syntax that differs from PSPP. The PSPP manual at https://www.gnu.org/software/pspp/manual/html_node/ provides complete syntax documentation.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Cannot read data file ===&lt;br /&gt;
&lt;br /&gt;
File reading errors usually indicate incorrect path specifications or incompatible data formats. Use absolute paths to your data files starting with /home/username/ or /scratch/username/. Ensure CSV files use standard delimiters and have consistent formatting. For SPSS .sav files, verify they are not from a very new SPSS version that PSPP might not support. Test with a small sample file first.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Missing values not handled correctly ===&lt;br /&gt;
&lt;br /&gt;
PSPP requires explicit declaration of missing values. Use the MISSING VALUES command to specify which values should be treated as missing. In CSV files, use consistent notation for missing data like NA or empty cells. When preparing data in Python, use pandas' to_csv with na_rep parameter to control missing value representation.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Output not displaying in notebook ===&lt;br /&gt;
&lt;br /&gt;
If PSPP output is not appearing in your notebook cells, check that you are capturing stdout from the subprocess call. Use &amp;lt;code&amp;gt;capture_output=True, text=True&amp;lt;/code&amp;gt; parameters in subprocess.run. Print the result.stdout to display output. If output is very long, consider writing it to a file and reading only relevant sections. For better formatting, consider parsing the output and displaying it as formatted text or pandas DataFrames.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official PSPP documentation is available at https://www.gnu.org/software/pspp/ and provides comprehensive information about all commands and procedures. The PSPP manual at https://www.gnu.org/software/pspp/manual/html_node/ includes detailed syntax reference and examples. For statistical analysis with Python, consult the scipy documentation at https://docs.scipy.org/doc/scipy/ and the statsmodels documentation at https://www.statsmodels.org/.&lt;br /&gt;
&lt;br /&gt;
KENET HPC usage guidelines are documented at https://training.kenet.or.ke/index.php/HPC_Usage. For learning statistics, the free textbook &amp;quot;OpenIntro Statistics&amp;quot; at https://www.openintro.org/book/os/ provides excellent coverage of fundamental concepts.&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Version Information ==&lt;br /&gt;
&lt;br /&gt;
This tutorial documents PSPP version 1.6.2 or later running within JupyterLab on the KENET HPC cluster. Python 3.9 or later is recommended for optimal subprocess integration. This tutorial was last updated on 2026-01-09 and is currently at version 1.0.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Feedback ==&lt;br /&gt;
&lt;br /&gt;
If you encounter issues or have suggestions for improving this tutorial, please contact KENET support or submit feedback through the Open OnDemand interface using the feedback button.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Tensorboard&amp;diff=1479</id>
		<title>Tensorboard</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Tensorboard&amp;diff=1479"/>
				<updated>2026-01-10T14:40:32Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: Created page with &amp;quot;= TensorBoard (Web) Tutorial - KENET HPC Cluster =  == Overview == '''TensorBoard''' is TensorFlow's visualization toolkit that provides comprehensive visual insights into mac...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= TensorBoard (Web) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''TensorBoard''' is TensorFlow's visualization toolkit that provides comprehensive visual insights into machine learning experiments. It allows you to track and visualize metrics like loss and accuracy, visualize model computational graphs, view histograms of weights and biases, project embeddings to lower dimensional spaces, and display images, text, and audio data. TensorBoard works with TensorFlow, PyTorch, and other frameworks through appropriate integrations.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' TensorBoard excels at visualizing neural network training progress in real-time, comparing different model architectures and hyperparameters, debugging training issues like vanishing gradients or overfitting, profiling model performance and identifying bottlenecks, analyzing model internals through weight distributions, exploring high-dimensional embeddings with dimensionality reduction, and creating publication-quality visualizations of training metrics.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' TensorBoard is available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using TensorBoard, you should have an active KENET HPC cluster account with access to Open OnDemand. Understanding of deep learning concepts and neural networks is important. Experience with TensorFlow or PyTorch will be very helpful. You should have training logs generated from your machine learning experiments stored in a logs directory on the cluster.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching TensorBoard ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
Log into Open OnDemand at https://ondemand.vlab.ac.ke. Click the '''Interactive Apps''' menu and select '''TensorBoard''' from the dropdown list.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_TensorBoard_Menu.png|thumb|600px|center|Navigate to Interactive Apps → TensorBoard]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
Configure the session parameters based on the size of your log files and expected usage.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; for visualization&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; hours for active projects&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;2-4&amp;lt;/code&amp;gt; cores sufficient&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;8-16&amp;lt;/code&amp;gt; GB depending on log size&lt;br /&gt;
|-&lt;br /&gt;
| '''Log Directory''' || Path to TensorBoard logs || &amp;lt;code&amp;gt;/home/username/logs&amp;lt;/code&amp;gt; or your logs folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_TensorBoard_Form.png|thumb|600px|center|TensorBoard configuration form with log directory]]&lt;br /&gt;
&lt;br /&gt;
'''Important:''' Specify the correct log directory where your TensorFlow or PyTorch logging callbacks have saved data. This is typically a directory containing subdirectories for different training runs.&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Connect to TensorBoard ===&lt;br /&gt;
Once the status shows &amp;quot;Running,&amp;quot; click the '''Connect to TensorBoard''' button. The TensorBoard web interface opens, displaying visualizations of your training data.&lt;br /&gt;
&lt;br /&gt;
[[File:TensorBoard_Interface.png|thumb|600px|center|TensorBoard web interface]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Understanding TensorBoard Tabs ===&lt;br /&gt;
TensorBoard organizes visualizations into several tabs. The Scalars tab shows time series of metrics like loss and accuracy. The Graphs tab visualizes your model's computational graph. The Distributions tab shows how tensor values change over time. The Histograms tab provides a different view of distribution data. The Images tab displays image data logged during training. The Embeddings tab provides interactive visualization of high-dimensional data using dimensionality reduction.&lt;br /&gt;
&lt;br /&gt;
=== Logging Data for TensorBoard ===&lt;br /&gt;
To use TensorBoard, you must first generate logs during model training. The &amp;lt;code&amp;gt;tensorboard/examples/01_tensorflow_logging.py&amp;lt;/code&amp;gt; file demonstrates setting up TensorFlow callbacks to log data, specifying the log directory, running training to generate logs, and launching TensorBoard to view results.&lt;br /&gt;
&lt;br /&gt;
For PyTorch, the process is similar using the SummaryWriter from torch.utils.tensorboard as shown in &amp;lt;code&amp;gt;tensorboard/examples/02_pytorch_logging.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Navigating the Interface ===&lt;br /&gt;
Use the left sidebar to select which runs to display and adjust visualization settings. The main panel shows the selected visualization type. Toggle between different metrics using the dropdown menus. Use the smoothing slider to reduce noise in metric plots. Hover over data points to see exact values. Use the download button to export plots as images or data as CSV files.&lt;br /&gt;
&lt;br /&gt;
=== Comparing Training Runs ===&lt;br /&gt;
One of TensorBoard's most powerful features is comparing multiple training runs. Organize runs in separate subdirectories within your log directory. Each subdirectory appears as a separate run in TensorBoard. Select multiple runs using checkboxes to overlay their metrics on the same plot. This makes it easy to compare different hyperparameters, architectures, or training strategies.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Monitoring Training Progress ===&lt;br /&gt;
&lt;br /&gt;
The most common use of TensorBoard is monitoring model training in real-time. The &amp;lt;code&amp;gt;tensorboard/examples/03_monitoring_training.py&amp;lt;/code&amp;gt; file demonstrates logging training and validation loss, recording accuracy metrics, tracking learning rate schedules, monitoring training time per epoch, and viewing updates in real-time as training progresses.&lt;br /&gt;
&lt;br /&gt;
Launch TensorBoard before or during training and refresh the browser to see new data points appear. This helps identify issues like overfitting or convergence problems early.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: Visualizing Model Architecture ===&lt;br /&gt;
&lt;br /&gt;
TensorBoard can display your neural network's computational graph. The &amp;lt;code&amp;gt;tensorboard/examples/04_model_graph.py&amp;lt;/code&amp;gt; file shows enabling graph logging in TensorFlow, viewing the graph in the Graphs tab, understanding node types and connections, identifying potential bottlenecks, and verifying model architecture matches expectations.&lt;br /&gt;
&lt;br /&gt;
The graph visualization helps understand data flow through the network and can reveal inefficiencies or errors in model design.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: Analyzing Weight Distributions ===&lt;br /&gt;
&lt;br /&gt;
Understanding how weights evolve during training provides insights into learning dynamics. The &amp;lt;code&amp;gt;tensorboard/examples/05_weight_distributions.py&amp;lt;/code&amp;gt; file demonstrates logging weight and bias histograms, viewing distributions over time, identifying vanishing or exploding gradients, monitoring batch normalization statistics, and comparing distributions across layers.&lt;br /&gt;
&lt;br /&gt;
Use the Distributions and Histograms tabs to view this data. Healthy training typically shows weights evolving smoothly without sudden changes or saturation.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Hyperparameter Comparison ===&lt;br /&gt;
&lt;br /&gt;
When running hyperparameter searches, TensorBoard helps visualize results across all configurations. The &amp;lt;code&amp;gt;tensorboard/examples/06_hyperparameter_comparison.py&amp;lt;/code&amp;gt; file shows organizing runs by hyperparameter configuration, using run names to encode hyperparameter values, comparing metrics across all runs simultaneously, identifying optimal hyperparameter ranges, and exporting comparison data for further analysis.&lt;br /&gt;
&lt;br /&gt;
This systematic approach to hyperparameter tuning makes it easy to understand which parameters matter most for model performance.&lt;br /&gt;
&lt;br /&gt;
=== Task 5: Embedding Visualization ===&lt;br /&gt;
&lt;br /&gt;
For high-dimensional data like word embeddings or image features, TensorBoard provides interactive dimensionality reduction. The &amp;lt;code&amp;gt;tensorboard/examples/07_embeddings.py&amp;lt;/code&amp;gt; file demonstrates logging embedding data with metadata, using t-SNE or PCA for visualization, coloring points by labels or attributes, exploring neighborhoods in embedding space, and understanding learned representations.&lt;br /&gt;
&lt;br /&gt;
This is particularly useful for understanding what your model has learned and validating that similar items are close in embedding space.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Logging Strategy ===&lt;br /&gt;
&lt;br /&gt;
Log data at appropriate intervals to balance detail with performance. For training metrics, logging every epoch or every few batches is usually sufficient. Avoid logging too frequently as it creates large log files and slows visualization. Use different log directories for different experiments to keep them organized. Include meaningful names in run directories like &amp;quot;model_v2_lr0.001_batch64&amp;quot; to make identification easy.&lt;br /&gt;
&lt;br /&gt;
Store logs in fast storage like scratch space during training, then move to permanent storage for long-term keeping.&lt;br /&gt;
&lt;br /&gt;
=== Organizing Experiments ===&lt;br /&gt;
&lt;br /&gt;
Create a hierarchical directory structure for logs. Use a top-level directory for the project, subdirectories for different model types or approaches, and individual run directories within those. This organization makes it easy to compare related runs while keeping unrelated experiments separate.&lt;br /&gt;
&lt;br /&gt;
Document your experiment structure in a README file in the logs directory explaining the naming conventions and organization.&lt;br /&gt;
&lt;br /&gt;
=== Performance Optimization ===&lt;br /&gt;
&lt;br /&gt;
For very large models or long training runs, log files can become quite large. Reduce logging frequency for less critical metrics. Use the purge_step parameter in TensorFlow to remove old data and keep file sizes manageable. Compress old log directories that are no longer actively viewed. When launching TensorBoard, point it to specific experiment directories rather than the entire logs tree if you only need to view certain runs.&lt;br /&gt;
&lt;br /&gt;
TensorBoard loads data lazily, so it should handle large log directories reasonably well, but more focused views will be faster.&lt;br /&gt;
&lt;br /&gt;
=== Troubleshooting Training ===&lt;br /&gt;
&lt;br /&gt;
TensorBoard is invaluable for debugging training issues. If loss is not decreasing, check for flat regions in the loss curve suggesting the learning rate is too low, or erratic jumps suggesting it is too high. If validation loss increases while training loss decreases, you are overfitting and need more regularization. If gradients shown in histograms are very small, you may have vanishing gradients. If weight distributions stop changing, the network may have stopped learning.&lt;br /&gt;
&lt;br /&gt;
Compare problematic runs with successful ones to identify differences in behavior.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Complete Training Monitoring ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Monitor a complete deep learning training run from start to finish with comprehensive logging.&lt;br /&gt;
&lt;br /&gt;
Follow the workflow in &amp;lt;code&amp;gt;tensorboard/workflows/01_complete_monitoring.py&amp;lt;/code&amp;gt; which demonstrates setting up callbacks for all relevant metrics, monitoring training and validation performance, tracking computational efficiency, visualizing model architecture, analyzing weight evolution, identifying when to stop training, and exporting final results and visualizations.&lt;br /&gt;
&lt;br /&gt;
This comprehensive approach ensures you capture all information needed to understand and reproduce training runs.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Hyperparameter Grid Search ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Run a systematic hyperparameter search and use TensorBoard to identify the best configuration.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;tensorboard/workflows/02_grid_search_tensorboard.py&amp;lt;/code&amp;gt; workflow demonstrates defining hyperparameter grid, running training for each configuration, logging all runs to organized directories, launching TensorBoard to compare results, identifying best performing configurations, analyzing relationships between hyperparameters and performance, and documenting optimal settings.&lt;br /&gt;
&lt;br /&gt;
TensorBoard makes it much easier to understand hyperparameter search results than reviewing raw numbers.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Transfer Learning Visualization ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Visualize how fine-tuning affects a pre-trained model.&lt;br /&gt;
&lt;br /&gt;
Follow &amp;lt;code&amp;gt;tensorboard/workflows/03_transfer_learning_viz.py&amp;lt;/code&amp;gt; which shows logging pre-training baseline metrics, comparing frozen versus unfrozen layer training, visualizing feature evolution through fine-tuning, monitoring learning in different network layers, and understanding which layers benefit most from fine-tuning.&lt;br /&gt;
&lt;br /&gt;
This helps optimize transfer learning strategies and understand what the model learns during adaptation to new tasks.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: TensorBoard shows &amp;quot;No dashboards active&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This message appears when no log data is found in the specified log directory. Verify the log directory path is correct and contains TensorBoard log files. Check that training has actually generated logs by looking for files in the directory. Ensure you pointed TensorBoard to the parent directory containing run subdirectories, not a specific run directory. Try manually specifying the logdir when launching TensorBoard.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Plots not updating with new data ===&lt;br /&gt;
&lt;br /&gt;
TensorBoard should automatically detect new log data, but sometimes requires refresh. Click the refresh button in the top-right of the TensorBoard interface. Check that the training process is actually writing new log data. Verify file permissions allow TensorBoard to read the log files. For very large log directories, TensorBoard may take time to scan for updates.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Port already in use error ===&lt;br /&gt;
&lt;br /&gt;
If TensorBoard fails to start because the port is already in use, another TensorBoard instance may be running. Check for existing TensorBoard sessions in Open OnDemand and terminate unused ones. The port is automatically selected when launching through Open OnDemand, so this should be rare.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Out of memory when viewing logs ===&lt;br /&gt;
&lt;br /&gt;
Very large log files or many simultaneous runs can exhaust memory. Request more memory when launching the TensorBoard session. Reduce the number of runs displayed simultaneously by using filters. Point TensorBoard to specific experiment subdirectories rather than the entire logs tree. Archive or compress old runs that are no longer needed.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Slow loading or visualization ===&lt;br /&gt;
&lt;br /&gt;
Performance issues usually result from very large log files or many runs. Reduce logging frequency in future experiments. Use the reload interval setting to control how often TensorBoard checks for updates. Close unused browser tabs showing TensorBoard. Clear browser cache if the interface becomes sluggish. For very large experiments, consider using TensorBoard.dev for cloud-based viewing.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official TensorBoard documentation is available at https://www.tensorflow.org/tensorboard and provides detailed guides for all features. The TensorBoard GitHub repository at https://github.com/tensorflow/tensorboard contains examples and issue discussions. For deep learning best practices, consult the TensorFlow tutorials at https://www.tensorflow.org/tutorials and PyTorch documentation at https://pytorch.org/docs/.&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Version Information ==&lt;br /&gt;
&lt;br /&gt;
This tutorial documents TensorBoard version 2.x running on the KENET HPC cluster. Compatible with TensorFlow 2.x and PyTorch 1.x or later. This tutorial was last updated on 2026-01-09 and is currently at version 1.0.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Octave&amp;diff=1478</id>
		<title>Octave</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Octave&amp;diff=1478"/>
				<updated>2026-01-10T14:39:41Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Octave (Remote Desktop) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''GNU Octave''' is a high-level programming language primarily intended for numerical computations. It provides a convenient command-line interface for solving linear and nonlinear problems numerically and for performing other numerical experiments. Octave is largely compatible with MATLAB, making it an excellent free alternative for scientific computing and engineering applications.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' Octave is particularly well-suited for numerical analysis and linear algebra computations, signal and image processing workflows, solving differential equations and numerical integration, engineering simulations and modeling, algorithm prototyping and testing, MATLAB code compatibility verification, and educational purposes for teaching numerical methods and scientific programming.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' Octave is available through Remote Desktop sessions on the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using Octave, you should have an active KENET HPC cluster account with access to the Open OnDemand portal. Basic understanding of programming concepts and mathematical operations will be helpful. Familiarity with MATLAB syntax is advantageous but not required. Knowledge of linear algebra and calculus concepts will enhance your ability to utilize Octave's capabilities effectively.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching Octave ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Start Remote Desktop Session ===&lt;br /&gt;
Begin by logging into Open OnDemand at https://ondemand.vlab.ac.ke. Click the '''Interactive Apps''' menu and select '''Remote Desktop''' to launch a full desktop environment on a compute node.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_Desktop_Menu.png|thumb|600px|center|Navigate to Interactive Apps → Remote Desktop]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Desktop Session ===&lt;br /&gt;
Configure the resources needed for your desktop session based on your computational requirements.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; for standard computations&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; hours for interactive work&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores for parallel operations&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16-32&amp;lt;/code&amp;gt; GB depending on problem size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_Desktop_Form.png|thumb|600px|center|Desktop session configuration]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Launch Octave from Desktop ===&lt;br /&gt;
Once your remote desktop session starts, you can launch Octave in several ways. Click '''Applications''' in the top menu bar, navigate to '''Development''' or '''Education''', and select '''GNU Octave'''. Alternatively, open a terminal and type &amp;lt;code&amp;gt;octave --gui&amp;lt;/code&amp;gt; to launch the graphical interface, or simply type &amp;lt;code&amp;gt;octave&amp;lt;/code&amp;gt; for the command-line interface.&lt;br /&gt;
&lt;br /&gt;
[[File:Octave_Interface.png|thumb|600px|center|Octave GUI interface]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Understanding the Octave Interface ===&lt;br /&gt;
The Octave GUI consists of several key components. The Command Window is where you type commands and see immediate results. The Workspace panel displays all variables currently in memory with their values and types. The Command History shows previously executed commands. The File Browser allows navigation of your file system. The Editor provides a text editor for creating and modifying script files.&lt;br /&gt;
&lt;br /&gt;
=== Your First Octave Commands ===&lt;br /&gt;
Start with simple mathematical operations to familiarize yourself with Octave's syntax. The &amp;lt;code&amp;gt;octave/examples/01_basic_operations.m&amp;lt;/code&amp;gt; file in our GitHub repository demonstrates fundamental operations including arithmetic, matrix creation, and basic functions. Type commands directly in the Command Window and press Enter to execute them.&lt;br /&gt;
&lt;br /&gt;
=== Creating and Running Scripts ===&lt;br /&gt;
For reproducible analyses, save your commands in script files with a .m extension. Click '''File → New → Script''' in the Octave GUI to create a new script. Type your commands in the editor, save the file, and run it by clicking the Run button or typing the script name (without .m extension) in the Command Window.&lt;br /&gt;
&lt;br /&gt;
=== Working with Matrices ===&lt;br /&gt;
Octave excels at matrix operations. Matrices are the fundamental data type in Octave. The &amp;lt;code&amp;gt;octave/examples/02_matrix_operations.m&amp;lt;/code&amp;gt; file demonstrates creating matrices, performing matrix arithmetic, accessing elements, and using built-in matrix functions. Understanding matrix operations is crucial for effective use of Octave.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Plotting and Visualization ===&lt;br /&gt;
&lt;br /&gt;
Octave provides comprehensive plotting capabilities through its graphics functions. The &amp;lt;code&amp;gt;octave/examples/03_plotting.m&amp;lt;/code&amp;gt; file demonstrates creating line plots, scatter plots, 3D surface plots, and customizing plot appearance with titles, labels, and legends. Plots appear in separate figure windows and can be exported to various image formats including PNG, PDF, and SVG.&lt;br /&gt;
&lt;br /&gt;
Multiple plots can be displayed in a single figure using the subplot function. Plot properties can be customized extensively including colors, line styles, marker types, and font sizes. The hold command allows adding multiple plot elements to the same axes.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: Solving Linear Systems ===&lt;br /&gt;
&lt;br /&gt;
One of Octave's strengths is solving systems of linear equations. The &amp;lt;code&amp;gt;octave/examples/04_linear_systems.m&amp;lt;/code&amp;gt; file shows how to solve Ax = b using the backslash operator, compute matrix inverses and determinants, perform LU and QR decompositions, and calculate eigenvalues and eigenvectors.&lt;br /&gt;
&lt;br /&gt;
Octave uses efficient numerical algorithms from LAPACK and BLAS libraries, making it suitable for large-scale linear algebra problems. Always check the condition number of matrices before attempting to solve systems to avoid numerical instability.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: Signal Processing ===&lt;br /&gt;
&lt;br /&gt;
Octave includes signal processing capabilities through the signal package. The &amp;lt;code&amp;gt;octave/examples/05_signal_processing.m&amp;lt;/code&amp;gt; file demonstrates loading the signal package, generating and analyzing signals, applying filters, computing Fast Fourier Transforms, and designing digital filters.&lt;br /&gt;
&lt;br /&gt;
Install the signal package if not already available using &amp;lt;code&amp;gt;pkg install -forge signal&amp;lt;/code&amp;gt;. Load it before use with &amp;lt;code&amp;gt;pkg load signal&amp;lt;/code&amp;gt;. The package provides functions similar to MATLAB's Signal Processing Toolbox.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Solving Differential Equations ===&lt;br /&gt;
&lt;br /&gt;
Octave provides ODE solvers for ordinary differential equations. The &amp;lt;code&amp;gt;octave/examples/06_differential_equations.m&amp;lt;/code&amp;gt; file shows how to define ODE functions, use lsode for numerical integration, solve systems of ODEs, and visualize solutions. This is particularly useful for dynamic system modeling and simulation.&lt;br /&gt;
&lt;br /&gt;
Define your differential equation as a function that returns derivatives, specify initial conditions and time span, then call lsode or other ODE solvers to obtain the numerical solution.&lt;br /&gt;
&lt;br /&gt;
=== Task 5: Image Processing ===&lt;br /&gt;
&lt;br /&gt;
The image package provides functions for loading, processing, and analyzing images. The &amp;lt;code&amp;gt;octave/examples/07_image_processing.m&amp;lt;/code&amp;gt; file demonstrates reading images, converting between color spaces, applying filters and transformations, edge detection, and saving processed images.&lt;br /&gt;
&lt;br /&gt;
Install the image package with &amp;lt;code&amp;gt;pkg install -forge image&amp;lt;/code&amp;gt; and load it with &amp;lt;code&amp;gt;pkg load image&amp;lt;/code&amp;gt;. The package includes functions similar to MATLAB's Image Processing Toolbox.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Performance Optimization ===&lt;br /&gt;
&lt;br /&gt;
Vectorize operations whenever possible rather than using loops. Octave is optimized for vectorized code and matrix operations. Pre-allocate arrays before filling them in loops to avoid repeated memory allocation. Use built-in functions which are highly optimized rather than implementing algorithms from scratch. For very large problems, consider using sparse matrices when appropriate.&lt;br /&gt;
&lt;br /&gt;
Monitor memory usage with the whos command which displays all variables and their sizes. Clear unnecessary variables with the clear command to free memory. Use the tic and toc functions to measure execution time and identify performance bottlenecks.&lt;br /&gt;
&lt;br /&gt;
=== Code Organization ===&lt;br /&gt;
&lt;br /&gt;
Organize related code into functions saved in separate .m files. Use meaningful variable names and add comments to explain complex operations. Structure long scripts into sections using cell mode with double percent signs. Keep the workspace organized by clearing unnecessary variables periodically.&lt;br /&gt;
&lt;br /&gt;
Create a project directory structure with separate folders for scripts, functions, data, and results. Use relative paths when loading data to make code portable across different systems.&lt;br /&gt;
&lt;br /&gt;
=== Debugging and Testing ===&lt;br /&gt;
&lt;br /&gt;
Use the keyboard function to pause execution and examine variables interactively. Set breakpoints in scripts by clicking in the left margin of the editor. Step through code line by line using the debugger toolbar. Display intermediate results using disp or printf for troubleshooting.&lt;br /&gt;
&lt;br /&gt;
Test functions with simple inputs before using them on complex problems. Verify results against known solutions when available. Check for NaN or Inf values that might indicate numerical issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Engineering Simulation ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Simulate beam deflection under load and visualize results.&lt;br /&gt;
&lt;br /&gt;
Follow the complete workflow in &amp;lt;code&amp;gt;octave/workflows/01_beam_deflection.m&amp;lt;/code&amp;gt; which demonstrates defining beam parameters and loading conditions, calculating deflection using differential equations, plotting deflection curves, computing maximum deflection and stress, and exporting results to CSV and images.&lt;br /&gt;
&lt;br /&gt;
This workflow shows how to combine Octave's mathematical capabilities with visualization to solve a practical engineering problem.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Signal Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Analyze audio or sensor signals using Fourier analysis and filtering.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;octave/workflows/02_signal_analysis.m&amp;lt;/code&amp;gt; workflow demonstrates loading signal data, computing power spectral density, identifying dominant frequencies, designing and applying filters, and comparing filtered and original signals.&lt;br /&gt;
&lt;br /&gt;
This is useful for noise reduction, feature extraction, and understanding signal characteristics in various applications from audio processing to sensor data analysis.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Numerical Methods ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Solve a nonlinear equation using numerical methods and compare different approaches.&lt;br /&gt;
&lt;br /&gt;
Follow &amp;lt;code&amp;gt;octave/workflows/03_numerical_methods.m&amp;lt;/code&amp;gt; which shows implementing Newton-Raphson method, using fzero for root finding, comparing convergence rates, and visualizing solution paths.&lt;br /&gt;
&lt;br /&gt;
Understanding different numerical methods and their characteristics is crucial for choosing the right approach for specific problems.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: Octave GUI won't start ===&lt;br /&gt;
&lt;br /&gt;
If the Octave GUI fails to launch from the applications menu, try opening a terminal and running &amp;lt;code&amp;gt;octave --gui&amp;lt;/code&amp;gt; to see any error messages. Check that your desktop session has sufficient memory allocated. If the GUI is problematic, use the command-line version by typing &amp;lt;code&amp;gt;octave&amp;lt;/code&amp;gt; in the terminal, which provides full functionality without the graphical interface.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Package installation fails ===&lt;br /&gt;
&lt;br /&gt;
Package installation requires internet access and may fail due to network issues or missing dependencies. Try installing packages manually by downloading them from Octave Forge at https://octave.sourceforge.io/ and using &amp;lt;code&amp;gt;pkg install package.tar.gz&amp;lt;/code&amp;gt;. Some packages require system libraries that may need to be installed by KENET support.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Plot windows not displaying ===&lt;br /&gt;
&lt;br /&gt;
If plots do not appear, check the graphics toolkit with &amp;lt;code&amp;gt;graphics_toolkit&amp;lt;/code&amp;gt; and try switching toolkits with &amp;lt;code&amp;gt;graphics_toolkit('gnuplot')&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;graphics_toolkit('qt')&amp;lt;/code&amp;gt;. Ensure your remote desktop session has proper graphics support. If problems persist, save plots directly to files using print or saveas rather than displaying them interactively.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Out of memory errors ===&lt;br /&gt;
&lt;br /&gt;
Large matrix operations can exhaust available memory. Use sparse matrices for problems with mostly zero elements. Process data in chunks rather than loading everything into memory. Clear unnecessary variables frequently with clear. Request more memory when launching your desktop session if working with very large datasets.&lt;br /&gt;
&lt;br /&gt;
=== Problem: MATLAB compatibility issues ===&lt;br /&gt;
&lt;br /&gt;
While Octave aims for MATLAB compatibility, some functions may behave differently or not exist. Check the Octave documentation for equivalent functions. Use the exist function to test if a function is available before calling it. Some MATLAB toolboxes have equivalent Octave packages that need to be installed separately.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official GNU Octave documentation is available at https://octave.org/doc/interpreter/ and provides comprehensive coverage of all functions and features. The Octave Wiki at https://wiki.octave.org/ contains tutorials, examples, and community contributions. Octave Forge at https://octave.sourceforge.io/ hosts additional packages extending Octave's capabilities.&lt;br /&gt;
&lt;br /&gt;
For numerical methods, &amp;quot;Numerical Methods using MATLAB&amp;quot; textbooks often work well with Octave. The MATLAB documentation at https://www.mathworks.com/help/matlab/ can also be helpful as most concepts transfer directly to Octave.&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Version Information ==&lt;br /&gt;
&lt;br /&gt;
This tutorial documents GNU Octave version 8.x or later available on the KENET HPC cluster. This tutorial was last updated on 2026-01-09 and is currently at version 1.0.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Mlflow&amp;diff=1477</id>
		<title>Mlflow</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Mlflow&amp;diff=1477"/>
				<updated>2026-01-10T14:39:25Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: Created page with &amp;quot;= MLflow (Web) Tutorial - KENET HPC Cluster =  == Overview == '''MLflow''' is an open-source platform for managing the machine learning lifecycle. It provides tools for tracki...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= MLflow (Web) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''MLflow''' is an open-source platform for managing the machine learning lifecycle. It provides tools for tracking experiments, packaging code into reproducible runs, and sharing and deploying models. The web-based interface allows you to visualize and compare experiments, making it easier to understand model performance and iterate on machine learning projects.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' MLflow is particularly valuable for tracking machine learning experiments with parameters and metrics, comparing different model architectures and hyperparameters, versioning and organizing trained models, creating reproducible ML workflows, collaborating with team members on ML projects, and maintaining a history of model development for research documentation.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' MLflow is available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using MLflow, you should have an active KENET HPC cluster account with access to Open OnDemand. Basic knowledge of machine learning concepts and Python programming is essential. Familiarity with scikit-learn, TensorFlow, or PyTorch will be helpful. You should also have a JupyterLab or VS Code session running where you will train models and log experiments to MLflow.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching MLflow ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
Log into Open OnDemand at https://ondemand.vlab.ac.ke. Click the '''Interactive Apps''' menu and select '''MLflow''' from the dropdown list.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_MLflow_Menu.png|thumb|600px|center|Navigate to Interactive Apps → MLflow]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
MLflow itself is lightweight, but configure resources based on how you will use it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; for tracking server&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;8-24&amp;lt;/code&amp;gt; hours for project duration&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;2-4&amp;lt;/code&amp;gt; cores sufficient for tracking&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;8&amp;lt;/code&amp;gt; GB for typical usage&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Where to store mlruns || Your project directory&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_MLflow_Form.png|thumb|600px|center|MLflow configuration form]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Connect to MLflow UI ===&lt;br /&gt;
Once the session status shows &amp;quot;Running,&amp;quot; click the '''Connect to MLflow''' button. This opens the MLflow web interface where you can view experiments, compare runs, and manage models.&lt;br /&gt;
&lt;br /&gt;
[[File:MLflow_Interface.png|thumb|600px|center|MLflow tracking UI]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Understanding MLflow Components ===&lt;br /&gt;
MLflow consists of several key components. MLflow Tracking logs parameters, metrics, and artifacts from your experiments. The Models component packages ML models in multiple formats for deployment. The Projects component packages code in a reusable, reproducible form. The Model Registry provides a central model store for managing model versions.&lt;br /&gt;
&lt;br /&gt;
For most users, the Tracking component accessed through the web UI is the primary interface. This allows you to visualize experiment history, compare runs, and analyze model performance.&lt;br /&gt;
&lt;br /&gt;
=== Logging Your First Experiment ===&lt;br /&gt;
From a JupyterLab notebook or Python script, connect to your MLflow tracking server and log a simple experiment. The &amp;lt;code&amp;gt;mlflow/examples/01_basic_tracking.py&amp;lt;/code&amp;gt; file demonstrates setting the tracking URI, creating experiments, logging parameters and metrics, and viewing results in the web UI.&lt;br /&gt;
&lt;br /&gt;
The tracking URI points to your MLflow server. Check the connection.yml file in your session directory to find the correct hostname and port.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the Web Interface ===&lt;br /&gt;
The MLflow web interface displays experiments in the left sidebar. Click an experiment to see all runs within it. Each run shows logged parameters, metrics, artifacts, and metadata. Use the compare feature to view multiple runs side by side. The charts visualize metric progression over time or across different runs.&lt;br /&gt;
&lt;br /&gt;
=== Organizing Experiments ===&lt;br /&gt;
Create separate experiments for different projects or model families. Within each experiment, each training run creates a new entry. Tag runs with descriptive names and notes to make them easier to find later. Use the search and filter features to find specific runs based on parameters or metrics.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Tracking Model Training ===&lt;br /&gt;
&lt;br /&gt;
The most common use of MLflow is tracking model training experiments. The &amp;lt;code&amp;gt;mlflow/examples/02_model_training.py&amp;lt;/code&amp;gt; file demonstrates logging hyperparameters before training, recording metrics during and after training, saving model artifacts, logging the trained model with MLflow's model logging functions, and adding tags and notes for organization.&lt;br /&gt;
&lt;br /&gt;
This creates a complete record of each training run that can be reviewed and compared later. The web UI shows all this information in an organized, searchable format.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: Comparing Multiple Runs ===&lt;br /&gt;
&lt;br /&gt;
When experimenting with different hyperparameters or model architectures, MLflow makes comparison easy. The &amp;lt;code&amp;gt;mlflow/examples/03_hyperparameter_tuning.py&amp;lt;/code&amp;gt; file shows running multiple training iterations with different parameters, logging each run to the same experiment, using the web UI to compare results, identifying the best performing configuration, and exporting comparison results.&lt;br /&gt;
&lt;br /&gt;
In the web UI, select multiple runs using checkboxes and click the Compare button to see side-by-side parameter and metric comparisons with visualization of metric differences.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: Logging Artifacts ===&lt;br /&gt;
&lt;br /&gt;
Beyond parameters and metrics, you can log any file as an artifact. The &amp;lt;code&amp;gt;mlflow/examples/04_logging_artifacts.py&amp;lt;/code&amp;gt; file demonstrates logging plots and visualizations, saving confusion matrices and performance charts, logging dataset samples, saving feature importance information, and storing any supporting files.&lt;br /&gt;
&lt;br /&gt;
Artifacts are stored in the mlruns directory and can be downloaded from the web UI for further analysis or inclusion in reports.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Model Registry and Versioning ===&lt;br /&gt;
&lt;br /&gt;
For production workflows, MLflow's model registry tracks model versions and their lifecycle stages. The &amp;lt;code&amp;gt;mlflow/examples/05_model_registry.py&amp;lt;/code&amp;gt; file shows registering trained models, promoting models through stages like staging and production, adding descriptions and metadata, downloading registered models for deployment, and managing model versions.&lt;br /&gt;
&lt;br /&gt;
This is particularly useful when working with teams to track which model versions are being used where.&lt;br /&gt;
&lt;br /&gt;
=== Task 5: Auto-logging with Frameworks ===&lt;br /&gt;
&lt;br /&gt;
MLflow provides auto-logging for popular frameworks that automatically captures parameters and metrics. The &amp;lt;code&amp;gt;mlflow/examples/06_autolog.py&amp;lt;/code&amp;gt; file demonstrates enabling auto-logging for scikit-learn, using auto-logging with TensorFlow and Keras, auto-logging PyTorch models, and combining auto-logging with custom logging.&lt;br /&gt;
&lt;br /&gt;
Auto-logging reduces boilerplate code and ensures consistent tracking across projects.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Experiment Organization ===&lt;br /&gt;
&lt;br /&gt;
Create meaningful experiment names that reflect the project or research question. Use consistent naming conventions for runs within an experiment. Tag runs with relevant metadata like dataset version, preprocessing steps, or model architecture. Add descriptive notes explaining the purpose of each run or any unusual configurations.&lt;br /&gt;
&lt;br /&gt;
Keep your mlruns directory organized and backed up. Consider using version control for your code alongside MLflow tracking for complete reproducibility.&lt;br /&gt;
&lt;br /&gt;
=== What to Log ===&lt;br /&gt;
&lt;br /&gt;
Log all hyperparameters that affect model behavior. Record both training and validation metrics to detect overfitting. Save learning curves showing metric progression during training. Log model evaluation metrics on test sets. Include computational metrics like training time and resource usage. Save artifacts like confusion matrices, ROC curves, and feature importance plots.&lt;br /&gt;
&lt;br /&gt;
Avoid logging too much data in metrics which can slow down the UI. Instead, save detailed data as artifacts.&lt;br /&gt;
&lt;br /&gt;
=== Performance Considerations ===&lt;br /&gt;
&lt;br /&gt;
MLflow tracking has minimal overhead, but logging very frequently can slow training. Log metrics at reasonable intervals rather than every iteration. Use batch logging when possible. For very long experiments, consider logging to local storage first and syncing to the tracking server periodically.&lt;br /&gt;
&lt;br /&gt;
Store mlruns directory in fast storage like scratch space for better performance with large experiments.&lt;br /&gt;
&lt;br /&gt;
=== Collaboration ===&lt;br /&gt;
&lt;br /&gt;
When working with a team, agree on experiment naming conventions. Use the model registry to communicate which models are ready for deployment. Add detailed notes to runs explaining decisions and results. Export important comparisons as CSV or images for sharing in presentations or papers.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Complete ML Experiment ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Track a complete machine learning project from data exploration to final model.&lt;br /&gt;
&lt;br /&gt;
Follow the workflow in &amp;lt;code&amp;gt;mlflow/workflows/01_complete_experiment.py&amp;lt;/code&amp;gt; which demonstrates creating an experiment for the project, logging data exploration steps, training multiple model types, comparing results in MLflow UI, selecting the best model, registering it in the model registry, and generating a final report with exported metrics.&lt;br /&gt;
&lt;br /&gt;
This workflow shows how to use MLflow throughout the entire ML development process.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Hyperparameter Optimization ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Systematically tune model hyperparameters and track all trials.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;mlflow/workflows/02_hyperparameter_optimization.py&amp;lt;/code&amp;gt; workflow demonstrates defining hyperparameter search space, running grid search or random search, logging each trial to MLflow, using the UI to identify best parameters, analyzing parameter importance, and documenting optimal configuration.&lt;br /&gt;
&lt;br /&gt;
MLflow's comparison features make it easy to understand which parameters have the most impact on performance.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Deep Learning Experiment Tracking ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Track neural network training with TensorFlow or PyTorch including learning curves and model checkpoints.&lt;br /&gt;
&lt;br /&gt;
Follow &amp;lt;code&amp;gt;mlflow/workflows/03_deep_learning_tracking.py&amp;lt;/code&amp;gt; which shows setting up auto-logging for deep learning frameworks, logging training and validation metrics per epoch, saving model checkpoints as artifacts, logging architecture diagrams, tracking GPU utilization, and comparing different network architectures.&lt;br /&gt;
&lt;br /&gt;
This workflow leverages MLflow's deep learning integrations for comprehensive experiment tracking.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: Cannot connect to MLflow server ===&lt;br /&gt;
&lt;br /&gt;
If your Python code cannot connect to the MLflow tracking server, verify the tracking URI is correct by checking the connection.yml file in your MLflow session directory. The URI should be in the format &amp;lt;code&amp;gt;http://hostname:port&amp;lt;/code&amp;gt;. Ensure your JupyterLab or VS Code session is running on a compute node that can reach the MLflow server. If using localhost in the URI, this will only work if MLflow and your code are on the same node.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Experiments not appearing in UI ===&lt;br /&gt;
&lt;br /&gt;
If experiments do not appear in the web interface, check that you are logging to the correct tracking URI. Verify the mlruns directory exists and has the expected structure. Refresh the web UI to see new experiments. Check file permissions on the mlruns directory. If experiments were logged before the tracking server started, they should appear after refresh.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Artifacts not uploading ===&lt;br /&gt;
&lt;br /&gt;
Artifact upload failures usually indicate permission or disk space issues. Check available disk space in your working directory. Verify write permissions on the mlruns directory. For very large artifacts, consider logging them to a shared storage location. Check that the artifact path in your code is correct and the file exists.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Slow UI performance ===&lt;br /&gt;
&lt;br /&gt;
The MLflow UI can become slow with thousands of runs. Archive old experiments by moving their directories out of mlruns. Delete unnecessary runs from experiments. Use filtering and search instead of displaying all runs. For very large deployments, consider using a database backend instead of file storage. Limit the number of metrics logged per run.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Model loading fails ===&lt;br /&gt;
&lt;br /&gt;
If loading a logged model fails, ensure the same Python environment and package versions are available. Check that required dependencies were logged with the model. Verify the model path in mlruns exists and contains the expected files. Some models require specific frameworks to be imported before loading. Check the flavor (sklearn, pytorch, etc.) matches what you are trying to load.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official MLflow documentation is available at https://mlflow.org/docs/latest/index.html and provides comprehensive guides and API reference. The MLflow GitHub repository at https://github.com/mlflow/mlflow contains examples and community discussions. For machine learning best practices, consult scikit-learn documentation at https://scikit-learn.org/ and TensorFlow at https://www.tensorflow.org/.&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Version Information ==&lt;br /&gt;
&lt;br /&gt;
This tutorial documents MLflow version 2.x running on the KENET HPC cluster. This tutorial was last updated on 2026-01-09 and is currently at version 1.0.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Octave&amp;diff=1476</id>
		<title>Octave</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Octave&amp;diff=1476"/>
				<updated>2026-01-10T14:38:36Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: Created page with &amp;quot;= Octave (Remote Desktop) Tutorial - KENET HPC Cluster =  == Overview == '''GNU Octave''' is a high-level programming language primarily intended for numerical computations. I...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Octave (Remote Desktop) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''GNU Octave''' is a high-level programming language primarily intended for numerical computations. It provides a convenient command-line interface for solving linear and nonlinear problems numerically and for performing other numerical experiments. Octave is largely compatible with MATLAB, making it an excellent free alternative for scientific computing and engineering applications.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' Octave is particularly well-suited for numerical analysis and linear algebra computations, signal and image processing workflows, solving differential equations and numerical integration, engineering simulations and modeling, algorithm prototyping and testing, MATLAB code compatibility verification, and educational purposes for teaching numerical methods and scientific programming.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' Octave is available through Remote Desktop sessions on the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using Octave, you should have an active KENET HPC cluster account with access to the Open OnDemand portal. Basic understanding of programming concepts and mathematical operations will be helpful. Familiarity with MATLAB syntax is advantageous but not required. Knowledge of linear algebra and calculus concepts will enhance your ability to utilize Octave's capabilities effectively.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching Octave ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Start Remote Desktop Session ===&lt;br /&gt;
Begin by logging into Open OnDemand at https://ondemand.vlab.ac.ke. Click the '''Interactive Apps''' menu and select '''Remote Desktop''' to launch a full desktop environment on a compute node.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_Desktop_Menu.png|thumb|600px|center|Navigate to Interactive Apps → Remote Desktop]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Desktop Session ===&lt;br /&gt;
Configure the resources needed for your desktop session based on your computational requirements.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; for standard computations&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; hours for interactive work&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores for parallel operations&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16-32&amp;lt;/code&amp;gt; GB depending on problem size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_Desktop_Form.png|thumb|600px|center|Desktop session configuration]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Launch Octave from Desktop ===&lt;br /&gt;
Once your remote desktop session starts, you can launch Octave in several ways. Click '''Applications''' in the top menu bar, navigate to '''Development''' or '''Education''', and select '''GNU Octave'''. Alternatively, open a terminal and type &amp;lt;code&amp;gt;octave --gui&amp;lt;/code&amp;gt; to launch the graphical interface, or simply type &amp;lt;code&amp;gt;octave&amp;lt;/code&amp;gt; for the command-line interface.&lt;br /&gt;
&lt;br /&gt;
[[File:Octave_Interface.png|thumb|600px|center|Octave GUI interface]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Understanding the Octave Interface ===&lt;br /&gt;
The Octave GUI consists of several key components. The Command Window is where you type commands and see immediate results. The Workspace panel displays all variables currently in memory with their values and types. The Command History shows previously executed commands. The File Browser allows navigation of your file system. The Editor provides a text editor for creating and modifying script files.&lt;br /&gt;
&lt;br /&gt;
=== Your First Octave Commands ===&lt;br /&gt;
Start with simple mathematical operations to familiarize yourself with Octave's syntax. The &amp;lt;code&amp;gt;octave/examples/01_basic_operations.m&amp;lt;/code&amp;gt; file in our GitHub repository demonstrates fundamental operations including arithmetic, matrix creation, and basic functions. Type commands directly in the Command Window and press Enter to execute them.&lt;br /&gt;
&lt;br /&gt;
=== Creating and Running Scripts ===&lt;br /&gt;
For reproducible analyses, save your commands in script files with a .m extension. Click '''File → New → Script''' in the Octave GUI to create a new script. Type your commands in the editor, save the file, and run it by clicking the Run button or typing the script name (without .m extension) in the Command Window.&lt;br /&gt;
&lt;br /&gt;
=== Working with Matrices ===&lt;br /&gt;
Octave excels at matrix operations. Matrices are the fundamental data type in Octave. The &amp;lt;code&amp;gt;octave/examples/02_matrix_operations.m&amp;lt;/code&amp;gt; file demonstrates creating matrices, performing matrix arithmetic, accessing elements, and using built-in matrix functions. Understanding matrix operations is crucial for effective use of Octave.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Plotting and Visualization ===&lt;br /&gt;
&lt;br /&gt;
Octave provides comprehensive plotting capabilities through its graphics functions. The &amp;lt;code&amp;gt;octave/examples/03_plotting.m&amp;lt;/code&amp;gt; file demonstrates creating line plots, scatter plots, 3D surface plots, and customizing plot appearance with titles, labels, and legends. Plots appear in separate figure windows and can be exported to various image formats including PNG, PDF, and SVG.&lt;br /&gt;
&lt;br /&gt;
Multiple plots can be displayed in a single figure using the subplot function. Plot properties can be customized extensively including colors, line styles, marker types, and font sizes. The hold command allows adding multiple plot elements to the same axes.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: Solving Linear Systems ===&lt;br /&gt;
&lt;br /&gt;
One of Octave's strengths is solving systems of linear equations. The &amp;lt;code&amp;gt;octave/examples/04_linear_systems.m&amp;lt;/code&amp;gt; file shows how to solve Ax = b using the backslash operator, compute matrix inverses and determinants, perform LU and QR decompositions, and calculate eigenvalues and eigenvectors.&lt;br /&gt;
&lt;br /&gt;
Octave uses efficient numerical algorithms from LAPACK and BLAS libraries, making it suitable for large-scale linear algebra problems. Always check the condition number of matrices before attempting to solve systems to avoid numerical instability.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: Signal Processing ===&lt;br /&gt;
&lt;br /&gt;
Octave includes signal processing capabilities through the signal package. The &amp;lt;code&amp;gt;octave/examples/05_signal_processing.m&amp;lt;/code&amp;gt; file demonstrates loading the signal package, generating and analyzing signals, applying filters, computing Fast Fourier Transforms, and designing digital filters.&lt;br /&gt;
&lt;br /&gt;
Install the signal package if not already available using &amp;lt;code&amp;gt;pkg install -forge signal&amp;lt;/code&amp;gt;. Load it before use with &amp;lt;code&amp;gt;pkg load signal&amp;lt;/code&amp;gt;. The package provides functions similar to MATLAB's Signal Processing Toolbox.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Solving Differential Equations ===&lt;br /&gt;
&lt;br /&gt;
Octave provides ODE solvers for ordinary differential equations. The &amp;lt;code&amp;gt;octave/examples/06_differential_equations.m&amp;lt;/code&amp;gt; file shows how to define ODE functions, use lsode for numerical integration, solve systems of ODEs, and visualize solutions. This is particularly useful for dynamic system modeling and simulation.&lt;br /&gt;
&lt;br /&gt;
Define your differential equation as a function that returns derivatives, specify initial conditions and time span, then call lsode or other ODE solvers to obtain the numerical solution.&lt;br /&gt;
&lt;br /&gt;
=== Task 5: Image Processing ===&lt;br /&gt;
&lt;br /&gt;
The image package provides functions for loading, processing, and analyzing images. The &amp;lt;code&amp;gt;octave/examples/07_image_processing.m&amp;lt;/code&amp;gt; file demonstrates reading images, converting between color spaces, applying filters and transformations, edge detection, and saving processed images.&lt;br /&gt;
&lt;br /&gt;
Install the image package with &amp;lt;code&amp;gt;pkg install -forge image&amp;lt;/code&amp;gt; and load it with &amp;lt;code&amp;gt;pkg load image&amp;lt;/code&amp;gt;. The package includes functions similar to MATLAB's Image Processing Toolbox.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Performance Optimization ===&lt;br /&gt;
&lt;br /&gt;
Vectorize operations whenever possible rather than using loops. Octave is optimized for vectorized code and matrix operations. Pre-allocate arrays before filling them in loops to avoid repeated memory allocation. Use built-in functions which are highly optimized rather than implementing algorithms from scratch. For very large problems, consider using sparse matrices when appropriate.&lt;br /&gt;
&lt;br /&gt;
Monitor memory usage with the whos command which displays all variables and their sizes. Clear unnecessary variables with the clear command to free memory. Use the tic and toc functions to measure execution time and identify performance bottlenecks.&lt;br /&gt;
&lt;br /&gt;
=== Code Organization ===&lt;br /&gt;
&lt;br /&gt;
Organize related code into functions saved in separate .m files. Use meaningful variable names and add comments to explain complex operations. Structure long scripts into sections using cell mode with double percent signs. Keep the workspace organized by clearing unnecessary variables periodically.&lt;br /&gt;
&lt;br /&gt;
Create a project directory structure with separate folders for scripts, functions, data, and results. Use relative paths when loading data to make code portable across different systems.&lt;br /&gt;
&lt;br /&gt;
=== Debugging and Testing ===&lt;br /&gt;
&lt;br /&gt;
Use the keyboard function to pause execution and examine variables interactively. Set breakpoints in scripts by clicking in the left margin of the editor. Step through code line by line using the debugger toolbar. Display intermediate results using disp or printf for troubleshooting.&lt;br /&gt;
&lt;br /&gt;
Test functions with simple inputs before using them on complex problems. Verify results against known solutions when available. Check for NaN or Inf values that might indicate numerical issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Engineering Simulation ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Simulate beam deflection under load and visualize results.&lt;br /&gt;
&lt;br /&gt;
Follow the complete workflow in &amp;lt;code&amp;gt;octave/workflows/01_beam_deflection.m&amp;lt;/code&amp;gt; which demonstrates defining beam parameters and loading conditions, calculating deflection using differential equations, plotting deflection curves, computing maximum deflection and stress, and exporting results to CSV and images.&lt;br /&gt;
&lt;br /&gt;
This workflow shows how to combine Octave's mathematical capabilities with visualization to solve a practical engineering problem.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Signal Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Analyze audio or sensor signals using Fourier analysis and filtering.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;octave/workflows/02_signal_analysis.m&amp;lt;/code&amp;gt; workflow demonstrates loading signal data, computing power spectral density, identifying dominant frequencies, designing and applying filters, and comparing filtered and original signals.&lt;br /&gt;
&lt;br /&gt;
This is useful for noise reduction, feature extraction, and understanding signal characteristics in various applications from audio processing to sensor data analysis.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Numerical Methods ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Solve a nonlinear equation using numerical methods and compare different approaches.&lt;br /&gt;
&lt;br /&gt;
Follow &amp;lt;code&amp;gt;octave/workflows/03_numerical_methods.m&amp;lt;/code&amp;gt; which shows implementing Newton-Raphson method, using fzero for root finding, comparing convergence rates, and visualizing solution paths.&lt;br /&gt;
&lt;br /&gt;
Understanding different numerical methods and their characteristics is crucial for choosing the right approach for specific problems.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: Octave GUI won't start ===&lt;br /&gt;
&lt;br /&gt;
If the Octave GUI fails to launch from the applications menu, try opening a terminal and running &amp;lt;code&amp;gt;octave --gui&amp;lt;/code&amp;gt; to see any error messages. Check that your desktop session has sufficient memory allocated. If the GUI is problematic, use the command-line version by typing &amp;lt;code&amp;gt;octave&amp;lt;/code&amp;gt; in the terminal, which provides full functionality without the graphical interface.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Package installation fails ===&lt;br /&gt;
&lt;br /&gt;
Package installation requires internet access and may fail due to network issues or missing dependencies. Try installing packages manually by downloading them from Octave Forge at https://octave.sourceforge.io/ and using &amp;lt;code&amp;gt;pkg install package.tar.gz&amp;lt;/code&amp;gt;. Some packages require system libraries that may need to be installed by KENET support.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Plot windows not displaying ===&lt;br /&gt;
&lt;br /&gt;
If plots do not appear, check the graphics toolkit with &amp;lt;code&amp;gt;graphics_toolkit&amp;lt;/code&amp;gt; and try switching toolkits with &amp;lt;code&amp;gt;graphics_toolkit('gnuplot')&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;graphics_toolkit('qt')&amp;lt;/code&amp;gt;. Ensure your remote desktop session has proper graphics support. If problems persist, save plots directly to files using print or saveas rather than displaying them interactively.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Out of memory errors ===&lt;br /&gt;
&lt;br /&gt;
Large matrix operations can exhaust available memory. Use sparse matrices for problems with mostly zero elements. Process data in chunks rather than loading everything into memory. Clear unnecessary variables frequently with clear. Request more memory when launching your desktop session if working with very large datasets.&lt;br /&gt;
&lt;br /&gt;
=== Problem: MATLAB compatibility issues ===&lt;br /&gt;
&lt;br /&gt;
While Octave aims for MATLAB compatibility, some functions may behave differently or not exist. Check the Octave documentation for equivalent functions. Use the exist function to test if a function is available before calling it. Some MATLAB toolboxes have equivalent Octave packages that need to be installed separately.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official GNU Octave documentation is available at https://octave.org/doc/interpreter/ and provides comprehensive coverage of all functions and features. The Octave Wiki at https://wiki.octave.org/ contains tutorials, examples, and community contributions. Octave Forge at https://octave.sourceforge.io/ hosts additional packages extending Octave's capabilities.&lt;br /&gt;
&lt;br /&gt;
For numerical methods, &amp;quot;Numerical Methods using MATLAB&amp;quot; textbooks often work well with Octave. The MATLAB documentation at https://www.mathworks.com/help/matlab/ can also be helpful as most concepts transfer directly to Octave.&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Version Information ==&lt;br /&gt;
&lt;br /&gt;
This tutorial documents GNU Octave version 8.x or later available on the KENET HPC cluster. This tutorial was last updated on 2026-01-09 and is currently at version 1.0.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=R_studio&amp;diff=1475</id>
		<title>R studio</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=R_studio&amp;diff=1475"/>
				<updated>2026-01-09T20:01:08Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: Created page with &amp;quot;= RStudio Server Tutorial - KENET HPC Cluster =  == Overview == '''RStudio Server''' is a web-based integrated development environment for R, providing a complete R programmin...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= RStudio Server Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''RStudio Server''' is a web-based integrated development environment for R, providing a complete R programming workspace accessible through your browser. It combines a powerful code editor, console, graphics viewer, and package management tools into a single interface, making it ideal for statistical computing and data analysis on the KENET HPC cluster.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' RStudio Server is particularly well-suited for statistical analysis and hypothesis testing, data visualization with ggplot2 and interactive plots, bioinformatics workflows with Bioconductor packages, reproducible research with RMarkdown documents, machine learning with tidymodels and caret, spatial data analysis with sf and terra packages, and collaborative research projects with version control integration.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' RStudio Server is available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using RStudio Server, you should have an active KENET HPC cluster account with access to the Open OnDemand portal. Basic knowledge of R programming will be helpful, though beginners can also use this tutorial to get started. Your data files should be stored in your home directory at &amp;lt;code&amp;gt;/home/username/localscratch&amp;lt;/code&amp;gt;. Familiarity with statistical concepts and data analysis workflows will enhance your experience.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching RStudio Server ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
Begin by logging into Open OnDemand at https://ondemand.vlab.ac.ke using your KENET credentials. Once logged in, click the '''Interactive Apps''' menu in the top navigation bar, then select '''RStudio Server''' from the dropdown list of available applications.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_RStudio_Menu.png|thumb|600px|center|Navigate to Interactive Apps → RStudio Server]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
The job submission form allows you to specify the computational resources needed for your RStudio session. The requirements vary depending on your analysis complexity and dataset size.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; for CPU tasks, &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; for parallel computing&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt; hours for interactive analysis, up to &amp;lt;code&amp;gt;24&amp;lt;/code&amp;gt; for long computations&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores for typical work, more for parallel operations&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16&amp;lt;/code&amp;gt; GB for small datasets, &amp;lt;code&amp;gt;32-64&amp;lt;/code&amp;gt; GB for large data&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your project folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_RStudio_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
'''Tip:''' For genomics or large-scale statistical analyses, request more memory and cores. RStudio can take advantage of parallel processing for many operations when multiple cores are available.&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Wait ===&lt;br /&gt;
After configuring your job parameters, click the '''Launch''' button to submit your job to the cluster scheduler. The job will initially show a &amp;quot;Queued&amp;quot; status while waiting for resources to become available. Once resources are allocated (typically within 30-60 seconds), the status will change to &amp;quot;Running&amp;quot; and a '''Connect to RStudio Server''' button will appear. Click this button to open your RStudio session in a new browser tab.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_RStudio_Running.png|thumb|600px|center|Session card showing &amp;quot;Running&amp;quot; status with Connect button]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Understanding the RStudio Interface ===&lt;br /&gt;
When RStudio opens, you will see a workspace divided into four main panes. The Source pane in the upper left displays your R scripts and RMarkdown documents. The Console pane in the lower left is where R commands are executed and output appears. The Environment/History pane in the upper right shows your workspace variables and command history. The Files/Plots/Packages pane in the lower right provides file navigation, plot viewing, package management, and help documentation.&lt;br /&gt;
&lt;br /&gt;
[[File:RStudio_Interface.png|thumb|600px|center|RStudio Server interface with four main panes]]&lt;br /&gt;
&lt;br /&gt;
=== Your First R Script ===&lt;br /&gt;
To create a new R script, click '''File → New File → R Script''' or press Ctrl+Shift+N. The &amp;lt;code&amp;gt;rstudio/examples/01_hello_cluster.R&amp;lt;/code&amp;gt; file in our GitHub repository provides a simple introduction. Type your R code in the script editor and execute it by placing your cursor on a line and pressing Ctrl+Enter to run that line, or select multiple lines and press Ctrl+Enter to run the selection.&lt;br /&gt;
&lt;br /&gt;
=== Working with the Console ===&lt;br /&gt;
The R Console at the bottom left is an interactive environment where you can type commands directly and see immediate results. This is useful for quick calculations, testing code snippets, or exploring data interactively. The console maintains your R session state, so all variables and loaded packages persist throughout your session.&lt;br /&gt;
&lt;br /&gt;
=== Installing R Packages ===&lt;br /&gt;
R packages extend R's functionality with additional functions and datasets. To install packages, use the Packages pane on the lower right and click '''Install''', or use the console. The proper syntax is shown in the &amp;lt;code&amp;gt;rstudio/examples/02_package_installation.R&amp;lt;/code&amp;gt; file in our GitHub repository. Packages are installed in your personal library, so they persist between sessions.&lt;br /&gt;
&lt;br /&gt;
'''Important:''' Always install packages to your user library, not the system library. RStudio handles this automatically when you use the Packages pane or the install.packages function.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Loading and Exploring Data ===&lt;br /&gt;
&lt;br /&gt;
Loading data in R is straightforward using built-in functions or packages like readr for improved performance. You can read CSV files, Excel spreadsheets, and many other formats. The &amp;lt;code&amp;gt;rstudio/examples/03_loading_data.R&amp;lt;/code&amp;gt; example demonstrates reading data from various sources including your home directory and the faster scratch storage, along with basic data exploration techniques.&lt;br /&gt;
&lt;br /&gt;
After loading data, explore its structure using functions like str, summary, and head. The tidyverse packages provide powerful tools for data manipulation and visualization that integrate well with the RStudio workflow.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: Data Visualization with ggplot2 ===&lt;br /&gt;
&lt;br /&gt;
The ggplot2 package is the standard for creating publication-quality graphics in R. It uses a grammar of graphics approach that makes it easy to create complex, multi-layered plots. See the &amp;lt;code&amp;gt;rstudio/examples/04_ggplot2_visualization.R&amp;lt;/code&amp;gt; example for creating various plot types including scatter plots, line graphs, histograms, and box plots.&lt;br /&gt;
&lt;br /&gt;
Plots appear in the Plots pane in the lower right corner of RStudio. You can zoom, export to various formats, and navigate through your plot history using the arrows in the Plots pane toolbar.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: Statistical Analysis ===&lt;br /&gt;
&lt;br /&gt;
R excels at statistical analysis with comprehensive built-in functions and specialized packages. The &amp;lt;code&amp;gt;rstudio/examples/05_statistical_analysis.R&amp;lt;/code&amp;gt; example demonstrates common statistical tests including t-tests for comparing means, ANOVA for multiple group comparisons, linear regression for modeling relationships, and correlation analysis.&lt;br /&gt;
&lt;br /&gt;
Results are displayed in the console and can be extracted for further use or reporting. The broom package helps convert statistical output into tidy data frames for easier manipulation.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Creating RMarkdown Reports ===&lt;br /&gt;
&lt;br /&gt;
RMarkdown combines R code, output, and narrative text into dynamic documents that update automatically when data or code changes. This is ideal for reproducible research and sharing analyses with collaborators. Create a new RMarkdown document with '''File → New File → R Markdown'''.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;rstudio/examples/06_rmarkdown_template.Rmd&amp;lt;/code&amp;gt; file provides a template showing how to combine text, code chunks, and output. Click the '''Knit''' button to render your document to HTML, PDF, or Word format. The document includes your code, results, and any plots you generate.&lt;br /&gt;
&lt;br /&gt;
=== Task 5: Parallel Computing ===&lt;br /&gt;
&lt;br /&gt;
When working with large datasets or computationally intensive tasks, you can leverage multiple CPU cores for parallel processing. R provides several packages for parallelization including parallel, foreach, and future. The &amp;lt;code&amp;gt;rstudio/examples/07_parallel_computing.R&amp;lt;/code&amp;gt; example shows how to detect available cores and parallelize common operations like bootstrapping, cross-validation, and simulations.&lt;br /&gt;
&lt;br /&gt;
When you request multiple cores in your Open OnDemand job submission, those cores become available for parallel processing within your RStudio session.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Performance Optimization ===&lt;br /&gt;
&lt;br /&gt;
When working with large datasets, use data.table or the tidyverse for efficient data manipulation. Request adequate memory when launching RStudio to avoid running out of RAM during analysis. Store intermediate results to disk using saveRDS and readRDS rather than keeping everything in memory. Use the pryr package to monitor memory usage of objects in your workspace.&lt;br /&gt;
&lt;br /&gt;
For very large datasets that do not fit in memory, consider using database connections with DBI and dbplyr, or chunked processing with the chunked package. The scratch directory at &amp;lt;code&amp;gt;/scratch/username/&amp;lt;/code&amp;gt; provides faster I/O than your home directory for large file operations.&lt;br /&gt;
&lt;br /&gt;
=== Project Organization ===&lt;br /&gt;
&lt;br /&gt;
Use RStudio Projects to organize your work. Create a new project with '''File → New Project''' which sets up a dedicated workspace with its own working directory and settings. Keep your data, scripts, and outputs organized in subdirectories. The &amp;lt;code&amp;gt;rstudio/workflows/01_research_project/&amp;lt;/code&amp;gt; directory in our GitHub repository demonstrates a well-organized project structure.&lt;br /&gt;
&lt;br /&gt;
Use descriptive names for variables and functions. Comment your code liberally to explain what each section does. This helps both collaborators and your future self understand the analysis.&lt;br /&gt;
&lt;br /&gt;
=== Reproducibility ===&lt;br /&gt;
&lt;br /&gt;
Use the renv package to manage project-specific package dependencies, ensuring your analysis works consistently across different systems and over time. Document your R version and package versions at the beginning of scripts or RMarkdown documents using sessionInfo. Save your workspace and history periodically, though for true reproducibility, your scripts should be self-contained and able to recreate your analysis from raw data.&lt;br /&gt;
&lt;br /&gt;
Store random seeds with set.seed before any operation involving randomness to ensure reproducible results in simulations, resampling, or machine learning workflows.&lt;br /&gt;
&lt;br /&gt;
=== Session Management ===&lt;br /&gt;
&lt;br /&gt;
Your RStudio session persists for the duration of your requested walltime. The workspace including all variables, loaded packages, and environment state remains active even if you close the browser tab. You can reconnect by clicking the '''Connect to RStudio Server''' button again.&lt;br /&gt;
&lt;br /&gt;
Before your session ends, save important objects with saveRDS or save, and save your scripts. Consider using File → Save Workspace to preserve your entire environment, though relying on scripts rather than saved workspaces is better for reproducibility.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Exploratory Data Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Load a dataset, perform initial exploration, create visualizations, and generate summary statistics.&lt;br /&gt;
&lt;br /&gt;
Begin by launching RStudio Server with 8 cores and 16 GB memory for a typical dataset. Follow the complete workflow in &amp;lt;code&amp;gt;rstudio/workflows/02_exploratory_analysis.R&amp;lt;/code&amp;gt; from our GitHub repository.&lt;br /&gt;
&lt;br /&gt;
The workflow demonstrates loading data using readr, checking for missing values and data types, creating summary statistics with dplyr, generating exploratory plots with ggplot2 including distributions, correlations, and relationships between variables, identifying outliers and unusual patterns, and documenting findings with inline comments.&lt;br /&gt;
&lt;br /&gt;
This type of exploratory analysis is typically the first step in any data analysis project, helping you understand your data before proceeding to more complex modeling.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Statistical Modeling and Reporting ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Perform regression analysis and create an automated report with RMarkdown.&lt;br /&gt;
&lt;br /&gt;
Launch RStudio and create a new RMarkdown document. Follow the template and workflow shown in &amp;lt;code&amp;gt;rstudio/workflows/03_statistical_modeling.Rmd&amp;lt;/code&amp;gt; which demonstrates loading and preparing data, fitting multiple regression models, comparing model performance with metrics like R-squared and AIC, performing diagnostic checks including residual plots, creating publication-quality tables with knitr and kableExtra, and generating a complete HTML or PDF report.&lt;br /&gt;
&lt;br /&gt;
The RMarkdown document combines narrative explanation, code execution, statistical output, and visualizations into a single reproducible report that can be shared with collaborators or included in publications.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Bioinformatics Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Analyze genomic data using Bioconductor packages.&lt;br /&gt;
&lt;br /&gt;
Launch RStudio on the GPU partition if performing computationally intensive operations. The &amp;lt;code&amp;gt;rstudio/workflows/04_bioinformatics_analysis.R&amp;lt;/code&amp;gt; workflow demonstrates installing and loading Bioconductor packages, reading genomic data formats like FASTQ and BAM files, performing differential expression analysis, creating heatmaps and volcano plots for visualization, and exporting results for further analysis.&lt;br /&gt;
&lt;br /&gt;
Bioconductor provides a comprehensive ecosystem of packages for genomic data analysis. The workflow shows how to integrate multiple packages to create a complete analysis pipeline.&lt;br /&gt;
&lt;br /&gt;
=== Example 4: Machine Learning with Tidymodels ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Build and evaluate machine learning models using the tidymodels framework.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;rstudio/workflows/05_machine_learning.R&amp;lt;/code&amp;gt; example demonstrates splitting data into training and testing sets, preprocessing data with recipes including normalization and feature engineering, specifying and fitting multiple model types such as random forest, gradient boosting, and elastic net, tuning hyperparameters with cross-validation, comparing model performance, and making predictions on new data.&lt;br /&gt;
&lt;br /&gt;
The tidymodels framework provides a unified interface for machine learning in R, making it easier to try different models and compare their performance systematically.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: Session won't start or stays in &amp;quot;Queued&amp;quot; state ===&lt;br /&gt;
&lt;br /&gt;
This typically occurs when no computational resources are available or the queue is full. Try reducing the number of requested cores or memory in your job parameters. Switch to a different partition such as &amp;lt;code&amp;gt;debug&amp;lt;/code&amp;gt; for quick testing with limited resources. Check the cluster status on the dashboard to see current load. If the problem persists after trying these solutions, contact KENET support for assistance.&lt;br /&gt;
&lt;br /&gt;
=== Problem: R session crashes or becomes unresponsive ===&lt;br /&gt;
&lt;br /&gt;
An unresponsive R session usually indicates an out-of-memory condition or an infinite loop in your code. Check memory usage in the Environment pane to see how much memory your objects are consuming. Use rm to remove large objects you no longer need, and call gc to run garbage collection. If the session is completely frozen, you may need to terminate it from the Open OnDemand session card and start a new one with more memory allocated.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Package installation fails ===&lt;br /&gt;
&lt;br /&gt;
Package installation failures can occur due to missing system dependencies or compilation errors. Check the error message carefully for clues. Some packages require system libraries that may not be available on the cluster. Contact KENET support if you need specific system libraries installed. For packages that require compilation, ensure you have the necessary development tools loaded. Installing binary packages is generally faster and avoids compilation issues when available.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Cannot read or write files ===&lt;br /&gt;
&lt;br /&gt;
File access problems usually indicate permission issues or incorrect paths. Check the current working directory with getwd and change it with setwd if needed. Verify file paths are correct using file.exists. Check file permissions with file.info. Remember that you cannot access files in other users' home directories without explicit permission. For large files, use the scratch directory at &amp;lt;code&amp;gt;/scratch/username/&amp;lt;/code&amp;gt; which provides better performance.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Plots not appearing ===&lt;br /&gt;
&lt;br /&gt;
If plots are not showing in the Plots pane, check that you are using the correct graphics device. The default device should work, but you can explicitly call dev.new if needed. If using ggplot2, ensure you are printing the plot object either implicitly by having it as the last line of a code chunk or explicitly with print. For RMarkdown documents, make sure code chunks have the appropriate chunk options set.&lt;br /&gt;
&lt;br /&gt;
=== Problem: RMarkdown won't knit ===&lt;br /&gt;
&lt;br /&gt;
RMarkdown knitting failures are often due to errors in code chunks or missing dependencies. Check that all required packages are installed and loaded. Ensure your code runs without errors in the console before knitting. Check the R Markdown pane for specific error messages. If knitting to PDF, ensure LaTeX is available on the system. HTML output is generally more reliable and does not require additional dependencies.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official RStudio documentation is available at https://docs.posit.co/ide/user/ and provides comprehensive information about all RStudio features. For learning R, the R for Data Science book at https://r4ds.had.co.nz/ is an excellent free resource covering data manipulation, visualization, and modeling. KENET HPC usage guidelines are documented at https://training.kenet.or.ke/index.php/HPC_Usage.&lt;br /&gt;
&lt;br /&gt;
For statistical analysis, the Quick-R website at https://www.statmethods.net/ provides practical examples of common statistical tasks. The Bioconductor project at https://www.bioconductor.org/ offers extensive documentation for genomic data analysis. For machine learning, the tidymodels website at https://www.tidymodels.org/ provides tutorials and reference documentation.&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke/index.php/HPC_Usage, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Feedback ==&lt;br /&gt;
&lt;br /&gt;
If you encounter issues or have suggestions for improving this tutorial, please contact KENET support or submit feedback through the Open OnDemand interface using the feedback button.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Code_server&amp;diff=1474</id>
		<title>Code server</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Code_server&amp;diff=1474"/>
				<updated>2026-01-09T19:57:28Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= VS Code (Web) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''VS Code''' is a powerful, modern code editor that runs in your web browser, providing a full development environment with syntax highlighting, debugging, Git integration, and extensions. It offers the complete VS Code experience without requiring any local installation, making it ideal for cloud-based development on the KENET HPC cluster.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' VS Code is particularly well-suited for Python, R, and Julia development with data analysis workflows, editing configuration files and scripts directly on the cluster, interactive debugging with breakpoints and variable inspection, Git version control for research code management, Jupyter notebook development within the editor, and multi-language project development with a single interface.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' VS Code is available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using VS Code, you should have an active KENET HPC cluster account with access to the Open OnDemand portal. Basic familiarity with a programming language such as Python, R, or shell scripting will be helpful. Your project files should be stored in your home directory at &amp;lt;code&amp;gt;/home/username/localscratch&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching VS Code ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
Begin by logging into Open OnDemand at https://ondemand.vlab.ac.ke using your KENET credentials. Once logged in, click the '''Interactive Apps''' menu in the top navigation bar, then select '''VS Code''' from the dropdown list of available applications.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_VSCode_Menu.png|thumb|600px|center|Navigate to Interactive Apps → VS Code]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
The job submission form allows you to specify the computational resources needed for your VS Code session. For most development work, modest resources are sufficient since you are primarily editing code rather than running intensive computations.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; for general development&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt; hours for development sessions&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;2-4&amp;lt;/code&amp;gt; cores for typical work&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;8&amp;lt;/code&amp;gt; GB is sufficient for most tasks&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your project folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_VSCode_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
'''Tip:''' VS Code itself is lightweight, so you typically do not need large resource allocations unless you plan to run computational tasks from the integrated terminal.&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Wait ===&lt;br /&gt;
After configuring your job parameters, click the '''Launch''' button to submit your job to the cluster scheduler. The job will initially show a &amp;quot;Queued&amp;quot; status while waiting for resources to become available. Once resources are allocated (typically within 30-60 seconds), the status will change to &amp;quot;Running&amp;quot; and a '''Connect to VS Code''' button will appear. Click this button to open your VS Code session in a new browser tab.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_VSCode_Running.png|thumb|600px|center|Session card showing &amp;quot;Running&amp;quot; status with Connect button]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Understanding the VS Code Interface ===&lt;br /&gt;
When VS Code opens, you will see a clean interface divided into several key areas. The Activity Bar on the far left provides access to different views such as Explorer, Search, Source Control, and Extensions. The Side Bar displays the content of the selected view. The Editor area in the center is where you write and edit your code. The Panel at the bottom can show the integrated terminal, problems, output, and debug console.&lt;br /&gt;
&lt;br /&gt;
[[File:VSCode_Interface.png|thumb|600px|center|VS Code web interface on first load]]&lt;br /&gt;
&lt;br /&gt;
=== Opening Files and Folders ===&lt;br /&gt;
To begin working with your files, click '''File -&amp;gt; Open Folder''' from the menu. Navigate to your home directory or project folder at &amp;lt;code&amp;gt;/home/username/localscratch&amp;lt;/code&amp;gt; and click '''OK''' to open the workspace. The Explorer view in the Side Bar will now display your project structure, allowing you to browse and open files with a single click.&lt;br /&gt;
&lt;br /&gt;
=== Creating Your First Python File ===&lt;br /&gt;
To create a new Python file, right-click in the Explorer view and select '''New File''', then name it with a &amp;lt;code&amp;gt;.py&amp;lt;/code&amp;gt; extension. See the &amp;lt;code&amp;gt;examples/01_hello_cluster.py&amp;lt;/code&amp;gt; file in our GitHub repository for a simple example to get started. Type or paste the code into the editor and save with Ctrl+S.&lt;br /&gt;
&lt;br /&gt;
=== Running Code ===&lt;br /&gt;
There are multiple ways to execute your code in VS Code. You can use the integrated terminal by pressing Ctrl+` (backtick) to open it, then type commands like &amp;lt;code&amp;gt;python script.py&amp;lt;/code&amp;gt; to run your code. Alternatively, if you have the Python extension installed, you can right-click in the editor and select &amp;quot;Run Python File in Terminal&amp;quot; for a more streamlined experience.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Installing Extensions ==&lt;br /&gt;
&lt;br /&gt;
Extensions significantly enhance VS Code's capabilities. To browse and install extensions, click the '''Extensions''' icon in the Activity Bar (it looks like four squares with one detached) or press Ctrl+Shift+X.&lt;br /&gt;
&lt;br /&gt;
=== Essential Extensions ===&lt;br /&gt;
&lt;br /&gt;
The '''Python extension by Microsoft''' provides comprehensive Python language support including IntelliSense code completion, linting, debugging, and Jupyter notebook integration. Search for &amp;quot;Python&amp;quot; in the extensions marketplace and click '''Install'''.&lt;br /&gt;
&lt;br /&gt;
The '''Jupyter extension''' enables you to create and run Jupyter notebooks directly within VS Code, combining the power of notebooks with the full editor experience. This is particularly useful for data science workflows.&lt;br /&gt;
&lt;br /&gt;
The '''GitLens extension''' enhances Git capabilities by showing code authorship, commit history inline, and providing powerful repository visualization tools. This helps you understand how your code has evolved over time.&lt;br /&gt;
&lt;br /&gt;
The '''Remote - SSH extension''' allows you to connect to other systems, though this is less relevant when you are already working on the cluster through Open OnDemand.&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;code&amp;gt;extensions/recommended_extensions.md&amp;lt;/code&amp;gt; in our GitHub repository for a complete list of useful extensions for HPC development.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Working with the Integrated Terminal ===&lt;br /&gt;
&lt;br /&gt;
The integrated terminal in VS Code provides full access to the cluster's command line environment. Press Ctrl+` to open it, or go to '''Terminal → New Terminal''' from the menu. The terminal opens in your working directory and has access to all loaded environment modules. See the &amp;lt;code&amp;gt;examples/02_terminal_usage.sh&amp;lt;/code&amp;gt; file for examples of common terminal commands you will use frequently.&lt;br /&gt;
&lt;br /&gt;
You can open multiple terminal instances by clicking the plus icon in the terminal panel. This is useful when you want to run a long computation in one terminal while keeping another available for quick commands. Split terminals are also available by clicking the split icon.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: Git Version Control ===&lt;br /&gt;
&lt;br /&gt;
VS Code provides excellent Git integration for managing your code versions. To initialize a Git repository, open the Source Control view from the Activity Bar (the branch icon) and click '''Initialize Repository'''. This creates a new Git repository in your current workspace folder.&lt;br /&gt;
&lt;br /&gt;
The Source Control view shows all modified files. To commit changes, stage the files you want to include by clicking the plus icon next to each file, enter a commit message in the text box at the top, and click the checkmark to commit. See &amp;lt;code&amp;gt;examples/03_git_workflow.sh&amp;lt;/code&amp;gt; in our GitHub repository for a complete workflow including connecting to remote repositories.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: Python Development and Debugging ===&lt;br /&gt;
&lt;br /&gt;
VS Code offers powerful debugging capabilities for Python code. To debug a script, open your Python file and click in the left margin next to line numbers to set breakpoints (red dots will appear). Press F5 or go to '''Run → Start Debugging''' to begin a debug session. The code will run until it hits a breakpoint, then you can inspect variables, step through code line by line, and evaluate expressions.&lt;br /&gt;
&lt;br /&gt;
The Debug Console allows you to execute Python code in the context of your paused program. The Variables pane shows all local and global variables with their current values. See &amp;lt;code&amp;gt;examples/04_debugging_example.py&amp;lt;/code&amp;gt; for a sample script with common debugging scenarios.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Working with Jupyter Notebooks ===&lt;br /&gt;
&lt;br /&gt;
After installing the Jupyter extension, you can create and run notebooks directly in VS Code. Create a new file with a &amp;lt;code&amp;gt;.ipynb&amp;lt;/code&amp;gt; extension, and VS Code will open it in notebook mode. Click the plus icon to add cells, and use the play button or Shift+Enter to execute cells.&lt;br /&gt;
&lt;br /&gt;
The advantage of using notebooks in VS Code is that you get the full editor features including IntelliSense, debugging, and Git integration while maintaining the interactive cell-based workflow. See &amp;lt;code&amp;gt;examples/05_notebook_in_vscode.ipynb&amp;lt;/code&amp;gt; for an example notebook demonstrating data analysis workflows.&lt;br /&gt;
&lt;br /&gt;
=== Task 5: Multi-file Project Development ===&lt;br /&gt;
&lt;br /&gt;
For larger projects with multiple files, VS Code provides excellent navigation and refactoring tools. Use Ctrl+P to quickly open files by name. Use F12 to jump to function or class definitions across files. Use Shift+F12 to find all references to a function or variable throughout your project.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;projects/data_pipeline/&amp;lt;/code&amp;gt; directory in our GitHub repository demonstrates a multi-file Python project structure with proper organization, imports, and configuration files.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Performance Optimization ===&lt;br /&gt;
&lt;br /&gt;
For optimal performance, request 2-4 cores for typical development work. Close unused editor tabs to keep the interface responsive. Use the search functionality sparingly on large directories, as it can be resource-intensive. Save your work frequently using Ctrl+S, though VS Code does provide auto-save which you can enable in '''File → Auto Save'''.&lt;br /&gt;
&lt;br /&gt;
=== Keyboard Shortcuts ===&lt;br /&gt;
&lt;br /&gt;
Learning keyboard shortcuts significantly improves productivity. Press Ctrl+Shift+P to open the Command Palette, which provides access to all VS Code commands through a searchable interface. Use Ctrl+B to toggle the Side Bar visibility for more editor space. Press Ctrl+` to toggle the terminal. Use Ctrl+/ to comment or uncomment lines of code. Press Alt+Up or Alt+Down to move lines up or down.&lt;br /&gt;
&lt;br /&gt;
=== Session Management ===&lt;br /&gt;
&lt;br /&gt;
VS Code sessions run for the duration of your requested walltime. Your workspace state including open files, editor layout, and terminal sessions persists as long as the session is running. If you close the browser tab, you can reconnect by clicking the '''Connect to VS Code''' button again on the session card. However, once the walltime expires, the session terminates and unsaved work will be lost.&lt;br /&gt;
&lt;br /&gt;
=== Security Best Practices ===&lt;br /&gt;
&lt;br /&gt;
Never commit credentials or API keys to Git repositories. Use a &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file to exclude sensitive configuration files from version control. Keep API keys in environment variables or in configuration files that are explicitly excluded from Git. The &amp;lt;code&amp;gt;examples/06_security_patterns.py&amp;lt;/code&amp;gt; file demonstrates secure ways to handle credentials.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Data Analysis Script Development ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Develop and test a Python script for data processing with proper error handling and logging.&lt;br /&gt;
&lt;br /&gt;
Begin by launching VS Code with 4 cores and a 4-hour walltime. Open your project directory containing your data files. Create a new Python file and follow the structure shown in &amp;lt;code&amp;gt;workflows/01_data_analysis_script.py&amp;lt;/code&amp;gt; from our GitHub repository.&lt;br /&gt;
&lt;br /&gt;
The workflow demonstrates loading data from CSV files, implementing error handling with try-except blocks, adding logging to track execution progress, processing data with pandas, generating visualizations, and exporting results. Use the integrated terminal to test your script with sample data before running it on the full dataset. The debugger helps identify and fix issues quickly when they arise.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Version Controlled Research Project ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Create a research analysis project with Git version control for reproducibility and collaboration.&lt;br /&gt;
&lt;br /&gt;
Launch VS Code and open your project folder. Initialize a Git repository using the Source Control view. Follow the project structure shown in &amp;lt;code&amp;gt;workflows/02_research_project/&amp;lt;/code&amp;gt; which includes a README file documenting the project, Python scripts organized by function, a requirements file listing dependencies, a data directory (excluded from Git), a results directory for outputs, and a proper &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Make regular commits as you develop your analysis. Push changes to a remote repository on GitHub or GitLab for backup and collaboration. The workflow demonstrates how to create meaningful commit messages, work with branches for experimental features, and merge changes back into the main branch.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Machine Learning Development ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Develop and iterate on machine learning models with organized code structure and experiment tracking.&lt;br /&gt;
&lt;br /&gt;
Launch VS Code with the GPU partition if you need GPU acceleration. The &amp;lt;code&amp;gt;workflows/03_ml_development/&amp;lt;/code&amp;gt; directory demonstrates a complete ML project structure including data preprocessing modules, model definition files, training scripts with hyperparameter configuration, evaluation and visualization code, and notebooks for exploration.&lt;br /&gt;
&lt;br /&gt;
Use VS Code's debugging capabilities to step through model training and inspect tensor shapes and values. The integrated terminal allows you to run training jobs while you continue editing code. Use Git to track different model architectures and hyperparameter configurations.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: Extensions won't install ===&lt;br /&gt;
&lt;br /&gt;
Extension installation failures typically occur due to network issues or permissions problems. First, try closing and reopening VS Code. Check that you have write access to your home directory with the command &amp;lt;code&amp;gt;ls -la ~&amp;lt;/code&amp;gt; in the terminal. If the problem persists, some extensions may not be compatible with the web version of VS Code. Consider using alternative extensions with similar functionality.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Terminal not opening or freezing ===&lt;br /&gt;
&lt;br /&gt;
If the integrated terminal fails to open or becomes unresponsive, first try closing the terminal panel and opening a new one with Ctrl+`. If that does not work, check the cluster status to ensure the compute node is responsive. As a last resort, disconnect from the session and reconnect using the '''Connect to VS Code''' button. If problems continue, contact KENET support as there may be an issue with the compute node.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Cannot access files or folders ===&lt;br /&gt;
&lt;br /&gt;
File access problems usually indicate permission issues or incorrect paths. Verify the path by running &amp;lt;code&amp;gt;pwd&amp;lt;/code&amp;gt; in the terminal to see your current directory. Check file permissions with &amp;lt;code&amp;gt;ls -la /path/to/file&amp;lt;/code&amp;gt;. Ensure you are trying to access files within your home directory or areas where you have been granted access. You cannot access files in other users' home directories without explicit permission.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Git authentication failing ===&lt;br /&gt;
&lt;br /&gt;
When pushing to remote repositories, you may encounter authentication failures. GitHub no longer accepts password authentication, so you must use a personal access token or SSH keys. See &amp;lt;code&amp;gt;examples/03_git_workflow.sh&amp;lt;/code&amp;gt; for instructions on setting up SSH keys for Git authentication. Alternatively, use HTTPS with a personal access token stored securely.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Python interpreter not found ===&lt;br /&gt;
&lt;br /&gt;
If the Python extension cannot find the Python interpreter, you need to select it manually. Press Ctrl+Shift+P to open the Command Palette, type &amp;quot;Python: Select Interpreter&amp;quot;, and choose from the available Python installations. The cluster modules you loaded before launching VS Code should be available. If not, you can load modules in the integrated terminal with &amp;lt;code&amp;gt;module load&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official VS Code documentation is available at https://code.visualstudio.com/docs and provides comprehensive information about all features and capabilities. The Python in VS Code guide at https://code.visualstudio.com/docs/python/python-tutorial is particularly useful for data science workflows. KENET HPC usage guidelines are documented at https://training.kenet.or.ke/index.php/HPC_Usage.&lt;br /&gt;
&lt;br /&gt;
For learning VS Code effectively, Microsoft provides interactive tutorials at https://code.visualstudio.com/learn and video courses at https://learn.microsoft.com/en-us/shows/intro-to-vs-code/. The VS Code tips and tricks page at https://code.visualstudio.com/docs/getstarted/tips-and-tricks contains many productivity-enhancing shortcuts and features.&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Feedback ==&lt;br /&gt;
&lt;br /&gt;
If you encounter issues or have suggestions for improving this tutorial, please contact KENET support or submit feedback through the Open OnDemand interface using the feedback button.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Code_server&amp;diff=1473</id>
		<title>Code server</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Code_server&amp;diff=1473"/>
				<updated>2026-01-09T19:42:18Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: Created page with &amp;quot;= VS Code (Web) Tutorial - KENET HPC Cluster =  == Overview == '''VS Code''' is a powerful, modern code editor that runs in your web browser, providing a full development envi...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= VS Code (Web) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''VS Code''' is a powerful, modern code editor that runs in your web browser, providing a full development environment with syntax highlighting, debugging, Git integration, and extensions. It offers the complete VS Code experience without requiring any local installation, making it ideal for cloud-based development on the KENET HPC cluster.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' VS Code is particularly well-suited for Python, R, and Julia development with data analysis workflows, editing configuration files and scripts directly on the cluster, interactive debugging with breakpoints and variable inspection, Git version control for research code management, Jupyter notebook development within the editor, and multi-language project development with a single interface.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' VS Code is available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/KENET-HPC/ood-tutorials&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using VS Code, you should have an active KENET HPC cluster account with access to the Open OnDemand portal. Basic familiarity with a programming language such as Python, R, or shell scripting will be helpful. Your project files should be stored in your home directory at &amp;lt;code&amp;gt;/home/username/&amp;lt;/code&amp;gt; or in the scratch directory at &amp;lt;code&amp;gt;/scratch/username/&amp;lt;/code&amp;gt; for collaborative projects.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching VS Code ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
Begin by logging into Open OnDemand at https://ondemand.vlab.ac.ke using your KENET credentials. Once logged in, click the '''Interactive Apps''' menu in the top navigation bar, then select '''VS Code''' from the dropdown list of available applications.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_VSCode_Menu.png|thumb|600px|center|Navigate to Interactive Apps → VS Code]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
The job submission form allows you to specify the computational resources needed for your VS Code session. For most development work, modest resources are sufficient since you are primarily editing code rather than running intensive computations.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; for general development&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt; hours for development sessions&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;2-4&amp;lt;/code&amp;gt; cores for typical work&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;8&amp;lt;/code&amp;gt; GB is sufficient for most tasks&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your project folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_VSCode_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
'''Tip:''' VS Code itself is lightweight, so you typically do not need large resource allocations unless you plan to run computational tasks from the integrated terminal.&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Wait ===&lt;br /&gt;
After configuring your job parameters, click the '''Launch''' button to submit your job to the cluster scheduler. The job will initially show a &amp;quot;Queued&amp;quot; status while waiting for resources to become available. Once resources are allocated (typically within 30-60 seconds), the status will change to &amp;quot;Running&amp;quot; and a '''Connect to VS Code''' button will appear. Click this button to open your VS Code session in a new browser tab.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_VSCode_Running.png|thumb|600px|center|Session card showing &amp;quot;Running&amp;quot; status with Connect button]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Understanding the VS Code Interface ===&lt;br /&gt;
When VS Code opens, you will see a clean interface divided into several key areas. The Activity Bar on the far left provides access to different views such as Explorer, Search, Source Control, and Extensions. The Side Bar displays the content of the selected view. The Editor area in the center is where you write and edit your code. The Panel at the bottom can show the integrated terminal, problems, output, and debug console.&lt;br /&gt;
&lt;br /&gt;
[[File:VSCode_Interface.png|thumb|600px|center|VS Code web interface on first load]]&lt;br /&gt;
&lt;br /&gt;
=== Opening Files and Folders ===&lt;br /&gt;
To begin working with your files, click '''File → Open Folder''' from the menu. Navigate to your home directory or project folder at &amp;lt;code&amp;gt;/home/username/&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;/scratch/username/project/&amp;lt;/code&amp;gt; and click '''OK''' to open the workspace. The Explorer view in the Side Bar will now display your project structure, allowing you to browse and open files with a single click.&lt;br /&gt;
&lt;br /&gt;
=== Creating Your First Python File ===&lt;br /&gt;
To create a new Python file, right-click in the Explorer view and select '''New File''', then name it with a &amp;lt;code&amp;gt;.py&amp;lt;/code&amp;gt; extension. See the &amp;lt;code&amp;gt;examples/01_hello_cluster.py&amp;lt;/code&amp;gt; file in our GitHub repository for a simple example to get started. Type or paste the code into the editor and save with Ctrl+S.&lt;br /&gt;
&lt;br /&gt;
=== Running Code ===&lt;br /&gt;
There are multiple ways to execute your code in VS Code. You can use the integrated terminal by pressing Ctrl+` (backtick) to open it, then type commands like &amp;lt;code&amp;gt;python script.py&amp;lt;/code&amp;gt; to run your code. Alternatively, if you have the Python extension installed, you can right-click in the editor and select &amp;quot;Run Python File in Terminal&amp;quot; for a more streamlined experience.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Installing Extensions ==&lt;br /&gt;
&lt;br /&gt;
Extensions significantly enhance VS Code's capabilities. To browse and install extensions, click the '''Extensions''' icon in the Activity Bar (it looks like four squares with one detached) or press Ctrl+Shift+X.&lt;br /&gt;
&lt;br /&gt;
=== Essential Extensions ===&lt;br /&gt;
&lt;br /&gt;
The '''Python extension by Microsoft''' provides comprehensive Python language support including IntelliSense code completion, linting, debugging, and Jupyter notebook integration. Search for &amp;quot;Python&amp;quot; in the extensions marketplace and click '''Install'''.&lt;br /&gt;
&lt;br /&gt;
The '''Jupyter extension''' enables you to create and run Jupyter notebooks directly within VS Code, combining the power of notebooks with the full editor experience. This is particularly useful for data science workflows.&lt;br /&gt;
&lt;br /&gt;
The '''GitLens extension''' enhances Git capabilities by showing code authorship, commit history inline, and providing powerful repository visualization tools. This helps you understand how your code has evolved over time.&lt;br /&gt;
&lt;br /&gt;
The '''Remote - SSH extension''' allows you to connect to other systems, though this is less relevant when you are already working on the cluster through Open OnDemand.&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;code&amp;gt;extensions/recommended_extensions.md&amp;lt;/code&amp;gt; in our GitHub repository for a complete list of useful extensions for HPC development.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Working with the Integrated Terminal ===&lt;br /&gt;
&lt;br /&gt;
The integrated terminal in VS Code provides full access to the cluster's command line environment. Press Ctrl+` to open it, or go to '''Terminal → New Terminal''' from the menu. The terminal opens in your working directory and has access to all loaded environment modules. See the &amp;lt;code&amp;gt;examples/02_terminal_usage.sh&amp;lt;/code&amp;gt; file for examples of common terminal commands you will use frequently.&lt;br /&gt;
&lt;br /&gt;
You can open multiple terminal instances by clicking the plus icon in the terminal panel. This is useful when you want to run a long computation in one terminal while keeping another available for quick commands. Split terminals are also available by clicking the split icon.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: Git Version Control ===&lt;br /&gt;
&lt;br /&gt;
VS Code provides excellent Git integration for managing your code versions. To initialize a Git repository, open the Source Control view from the Activity Bar (the branch icon) and click '''Initialize Repository'''. This creates a new Git repository in your current workspace folder.&lt;br /&gt;
&lt;br /&gt;
The Source Control view shows all modified files. To commit changes, stage the files you want to include by clicking the plus icon next to each file, enter a commit message in the text box at the top, and click the checkmark to commit. See &amp;lt;code&amp;gt;examples/03_git_workflow.sh&amp;lt;/code&amp;gt; in our GitHub repository for a complete workflow including connecting to remote repositories.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: Python Development and Debugging ===&lt;br /&gt;
&lt;br /&gt;
VS Code offers powerful debugging capabilities for Python code. To debug a script, open your Python file and click in the left margin next to line numbers to set breakpoints (red dots will appear). Press F5 or go to '''Run → Start Debugging''' to begin a debug session. The code will run until it hits a breakpoint, then you can inspect variables, step through code line by line, and evaluate expressions.&lt;br /&gt;
&lt;br /&gt;
The Debug Console allows you to execute Python code in the context of your paused program. The Variables pane shows all local and global variables with their current values. See &amp;lt;code&amp;gt;examples/04_debugging_example.py&amp;lt;/code&amp;gt; for a sample script with common debugging scenarios.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Working with Jupyter Notebooks ===&lt;br /&gt;
&lt;br /&gt;
After installing the Jupyter extension, you can create and run notebooks directly in VS Code. Create a new file with a &amp;lt;code&amp;gt;.ipynb&amp;lt;/code&amp;gt; extension, and VS Code will open it in notebook mode. Click the plus icon to add cells, and use the play button or Shift+Enter to execute cells.&lt;br /&gt;
&lt;br /&gt;
The advantage of using notebooks in VS Code is that you get the full editor features including IntelliSense, debugging, and Git integration while maintaining the interactive cell-based workflow. See &amp;lt;code&amp;gt;examples/05_notebook_in_vscode.ipynb&amp;lt;/code&amp;gt; for an example notebook demonstrating data analysis workflows.&lt;br /&gt;
&lt;br /&gt;
=== Task 5: Multi-file Project Development ===&lt;br /&gt;
&lt;br /&gt;
For larger projects with multiple files, VS Code provides excellent navigation and refactoring tools. Use Ctrl+P to quickly open files by name. Use F12 to jump to function or class definitions across files. Use Shift+F12 to find all references to a function or variable throughout your project.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;projects/data_pipeline/&amp;lt;/code&amp;gt; directory in our GitHub repository demonstrates a multi-file Python project structure with proper organization, imports, and configuration files.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Performance Optimization ===&lt;br /&gt;
&lt;br /&gt;
For optimal performance, request 2-4 cores for typical development work. Close unused editor tabs to keep the interface responsive. Use the search functionality sparingly on large directories, as it can be resource-intensive. Save your work frequently using Ctrl+S, though VS Code does provide auto-save which you can enable in '''File → Auto Save'''.&lt;br /&gt;
&lt;br /&gt;
=== Keyboard Shortcuts ===&lt;br /&gt;
&lt;br /&gt;
Learning keyboard shortcuts significantly improves productivity. Press Ctrl+Shift+P to open the Command Palette, which provides access to all VS Code commands through a searchable interface. Use Ctrl+B to toggle the Side Bar visibility for more editor space. Press Ctrl+` to toggle the terminal. Use Ctrl+/ to comment or uncomment lines of code. Press Alt+Up or Alt+Down to move lines up or down.&lt;br /&gt;
&lt;br /&gt;
=== Session Management ===&lt;br /&gt;
&lt;br /&gt;
VS Code sessions run for the duration of your requested walltime. Your workspace state including open files, editor layout, and terminal sessions persists as long as the session is running. If you close the browser tab, you can reconnect by clicking the '''Connect to VS Code''' button again on the session card. However, once the walltime expires, the session terminates and unsaved work will be lost.&lt;br /&gt;
&lt;br /&gt;
=== Security Best Practices ===&lt;br /&gt;
&lt;br /&gt;
Never commit credentials or API keys to Git repositories. Use a &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file to exclude sensitive configuration files from version control. Keep API keys in environment variables or in configuration files that are explicitly excluded from Git. The &amp;lt;code&amp;gt;examples/06_security_patterns.py&amp;lt;/code&amp;gt; file demonstrates secure ways to handle credentials.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Data Analysis Script Development ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Develop and test a Python script for data processing with proper error handling and logging.&lt;br /&gt;
&lt;br /&gt;
Begin by launching VS Code with 4 cores and a 4-hour walltime. Open your project directory containing your data files. Create a new Python file and follow the structure shown in &amp;lt;code&amp;gt;workflows/01_data_analysis_script.py&amp;lt;/code&amp;gt; from our GitHub repository.&lt;br /&gt;
&lt;br /&gt;
The workflow demonstrates loading data from CSV files, implementing error handling with try-except blocks, adding logging to track execution progress, processing data with pandas, generating visualizations, and exporting results. Use the integrated terminal to test your script with sample data before running it on the full dataset. The debugger helps identify and fix issues quickly when they arise.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Version Controlled Research Project ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Create a research analysis project with Git version control for reproducibility and collaboration.&lt;br /&gt;
&lt;br /&gt;
Launch VS Code and open your project folder. Initialize a Git repository using the Source Control view. Follow the project structure shown in &amp;lt;code&amp;gt;workflows/02_research_project/&amp;lt;/code&amp;gt; which includes a README file documenting the project, Python scripts organized by function, a requirements file listing dependencies, a data directory (excluded from Git), a results directory for outputs, and a proper &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Make regular commits as you develop your analysis. Push changes to a remote repository on GitHub or GitLab for backup and collaboration. The workflow demonstrates how to create meaningful commit messages, work with branches for experimental features, and merge changes back into the main branch.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Machine Learning Development ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Develop and iterate on machine learning models with organized code structure and experiment tracking.&lt;br /&gt;
&lt;br /&gt;
Launch VS Code with the GPU partition if you need GPU acceleration. The &amp;lt;code&amp;gt;workflows/03_ml_development/&amp;lt;/code&amp;gt; directory demonstrates a complete ML project structure including data preprocessing modules, model definition files, training scripts with hyperparameter configuration, evaluation and visualization code, and notebooks for exploration.&lt;br /&gt;
&lt;br /&gt;
Use VS Code's debugging capabilities to step through model training and inspect tensor shapes and values. The integrated terminal allows you to run training jobs while you continue editing code. Use Git to track different model architectures and hyperparameter configurations.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: Extensions won't install ===&lt;br /&gt;
&lt;br /&gt;
Extension installation failures typically occur due to network issues or permissions problems. First, try closing and reopening VS Code. Check that you have write access to your home directory with the command &amp;lt;code&amp;gt;ls -la ~&amp;lt;/code&amp;gt; in the terminal. If the problem persists, some extensions may not be compatible with the web version of VS Code. Consider using alternative extensions with similar functionality.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Terminal not opening or freezing ===&lt;br /&gt;
&lt;br /&gt;
If the integrated terminal fails to open or becomes unresponsive, first try closing the terminal panel and opening a new one with Ctrl+`. If that does not work, check the cluster status to ensure the compute node is responsive. As a last resort, disconnect from the session and reconnect using the '''Connect to VS Code''' button. If problems continue, contact KENET support as there may be an issue with the compute node.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Cannot access files or folders ===&lt;br /&gt;
&lt;br /&gt;
File access problems usually indicate permission issues or incorrect paths. Verify the path by running &amp;lt;code&amp;gt;pwd&amp;lt;/code&amp;gt; in the terminal to see your current directory. Check file permissions with &amp;lt;code&amp;gt;ls -la /path/to/file&amp;lt;/code&amp;gt;. Ensure you are trying to access files within your home directory or areas where you have been granted access. You cannot access files in other users' home directories without explicit permission.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Git authentication failing ===&lt;br /&gt;
&lt;br /&gt;
When pushing to remote repositories, you may encounter authentication failures. GitHub no longer accepts password authentication, so you must use a personal access token or SSH keys. See &amp;lt;code&amp;gt;examples/03_git_workflow.sh&amp;lt;/code&amp;gt; for instructions on setting up SSH keys for Git authentication. Alternatively, use HTTPS with a personal access token stored securely.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Python interpreter not found ===&lt;br /&gt;
&lt;br /&gt;
If the Python extension cannot find the Python interpreter, you need to select it manually. Press Ctrl+Shift+P to open the Command Palette, type &amp;quot;Python: Select Interpreter&amp;quot;, and choose from the available Python installations. The cluster modules you loaded before launching VS Code should be available. If not, you can load modules in the integrated terminal with &amp;lt;code&amp;gt;module load&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official VS Code documentation is available at https://code.visualstudio.com/docs and provides comprehensive information about all features and capabilities. The Python in VS Code guide at https://code.visualstudio.com/docs/python/python-tutorial is particularly useful for data science workflows. KENET HPC usage guidelines are documented at https://training.kenet.or.ke/index.php/HPC_Usage.&lt;br /&gt;
&lt;br /&gt;
For learning VS Code effectively, Microsoft provides interactive tutorials at https://code.visualstudio.com/learn and video courses at https://learn.microsoft.com/en-us/shows/intro-to-vs-code/. The VS Code tips and tricks page at https://code.visualstudio.com/docs/getstarted/tips-and-tricks contains many productivity-enhancing shortcuts and features.&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/KENET-HPC/ood-tutorials&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Version Information ==&lt;br /&gt;
&lt;br /&gt;
This tutorial documents VS Code version 1.85 or later running through Open OnDemand. The VS Code installation is located at &amp;lt;code&amp;gt;/opt/ohpc/pub/codes/ood/code-server&amp;lt;/code&amp;gt; on the cluster. This tutorial was last updated on 2026-01-09 and is currently at version 1.0.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Feedback ==&lt;br /&gt;
&lt;br /&gt;
If you encounter issues or have suggestions for improving this tutorial, please contact KENET support or submit feedback through the Open OnDemand interface using the feedback button.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=File:JupyterLab_Plotly_Example.png&amp;diff=1472</id>
		<title>File:JupyterLab Plotly Example.png</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=File:JupyterLab_Plotly_Example.png&amp;diff=1472"/>
				<updated>2026-01-09T19:28:05Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1471</id>
		<title>Jupyter</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1471"/>
				<updated>2026-01-09T19:06:28Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= JupyterLab (Web) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''JupyterLab''' is an interactive web-based environment for notebooks, code, and data. It provides an ideal platform for data science, scientific computing, and machine learning workflows, allowing researchers to combine code execution, rich text, visualizations, and interactive outputs in a single document.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' JupyterLab is particularly well-suited for interactive data analysis and visualization, machine learning model development and experimentation, creating reproducible research notebooks, teaching and sharing computational narratives, and real-time data exploration with optional GPU acceleration.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' JupyterLab is available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using JupyterLab, you should have an active KENET HPC cluster account with access to the Open OnDemand portal. Basic knowledge of Python, R, or Julia will be helpful, and you should have your data files stored in your home directory at &amp;lt;code&amp;gt;/home/username/localscratch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching JupyterLab ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
Begin by logging into Open OnDemand at https://ondemand.vlab.ac.ke using your KENET credentials. Once logged in, click the '''Interactive Apps''' menu in the top navigation bar, then select '''JupyterLab''' from the dropdown list of available applications.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Menu.png|thumb|600px|center|Navigate to Interactive Apps → JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
The job submission form allows you to specify the computational resources needed for your JupyterLab session. Fill in the form according to your workload requirements using the table below as a guide.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; (CPU) or &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; (GPU tasks)&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; hours for testing, up to &amp;lt;code&amp;gt;192&amp;lt;/code&amp;gt; for long jobs&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores (adjust based on workload)&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16&amp;lt;/code&amp;gt; GB for data science, &amp;lt;code&amp;gt;32&amp;lt;/code&amp;gt; GB for large datasets&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your project folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
'''Tip:''' For GPU-accelerated deep learning tasks, select the '''gpu''' partition and specify the number of GPUs needed for your work.&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Wait ===&lt;br /&gt;
After configuring your job parameters, click the '''Launch''' button to submit your job to the cluster scheduler. The job will initially show a &amp;quot;Queued&amp;quot; status while waiting for resources to become available. Once resources are allocated (typically within 30-60 seconds), the status will change to &amp;quot;Running&amp;quot; and a '''Connect to JupyterLab''' button will appear. Click this button to open your JupyterLab session in a new browser tab.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Running.png|thumb|600px|center|Session card showing &amp;quot;Running&amp;quot; status with Connect button]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Creating Your First Notebook ===&lt;br /&gt;
When JupyterLab opens, you will see the Launcher interface. To create a new notebook, click '''File → New → Notebook''' from the menu, or simply click the '''Python 3''' tile in the Launcher. You will be prompted to select a kernel, which determines the programming language and environment for your notebook. Choose Python 3, R, or Julia depending on your needs.&lt;br /&gt;
&lt;br /&gt;
[[File:JupyterLab_New_Notebook.png|thumb|600px|center|Creating a new notebook in JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Basic Cell Operations ===&lt;br /&gt;
&lt;br /&gt;
Notebooks consist of cells where you can write and execute code. To see a basic example of creating a simple plot, refer to the &amp;lt;code&amp;gt;01_basic_plotting.py&amp;lt;/code&amp;gt; example in our GitHub repository. Press Shift+Enter to run any cell and see the output immediately below it.&lt;br /&gt;
&lt;br /&gt;
There are three main cell types in JupyterLab. '''Code''' cells contain executable code and are the default type. '''Markdown''' cells contain formatted text, equations, and documentation. '''Raw''' cells contain plain text that is not executed or formatted.&lt;br /&gt;
&lt;br /&gt;
=== Installing Python Packages ===&lt;br /&gt;
&lt;br /&gt;
You can install additional Python packages directly from within a notebook cell using pip. The proper syntax is shown in the &amp;lt;code&amp;gt;00_package_installation.sh&amp;lt;/code&amp;gt; file in our GitHub repository. Always use the &amp;lt;code&amp;gt;--user&amp;lt;/code&amp;gt; flag to install packages in your personal home directory rather than attempting system-wide installation, which will fail due to permissions.&lt;br /&gt;
&lt;br /&gt;
'''Important:''' After installing new packages, you must restart the kernel by selecting Kernel → Restart from the menu for the packages to be recognized.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Loading Data from Cluster Storage ===&lt;br /&gt;
&lt;br /&gt;
Loading data from files stored on the cluster is straightforward using pandas or other data libraries. You can read data from your home directory or from the faster scratch storage. See the example in &amp;lt;code&amp;gt;02_loading_data.py&amp;lt;/code&amp;gt; in our GitHub repository for the complete code showing how to read CSV files from both locations.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: Using GPU for Deep Learning ===&lt;br /&gt;
&lt;br /&gt;
If you launched your session on the GPU partition, you can leverage GPU acceleration for deep learning tasks. TensorFlow and PyTorch will automatically detect and use available GPUs. The &amp;lt;code&amp;gt;03_gpu_tensorflow.py&amp;lt;/code&amp;gt; example demonstrates how to check GPU availability and create a simple neural network model that will automatically utilize GPU resources when available.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: Parallel Processing with Dask ===&lt;br /&gt;
&lt;br /&gt;
For large datasets that don't fit in memory, Dask provides parallel processing capabilities that work seamlessly with pandas syntax. The &amp;lt;code&amp;gt;04_dask_parallel.py&amp;lt;/code&amp;gt; example shows how to read large datasets using Dask and perform grouped aggregations efficiently across multiple cores.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Creating Interactive Visualizations ===&lt;br /&gt;
&lt;br /&gt;
Plotly provides interactive visualizations that work well in JupyterLab, allowing you to zoom, pan, and explore your data dynamically. See &amp;lt;code&amp;gt;05_plotly_interactive.py&amp;lt;/code&amp;gt; for an example of creating an interactive scatter plot with categorical coloring.&lt;br /&gt;
&lt;br /&gt;
[[File:JupyterLab_Plotly_Example.png|thumb|600px|center|Interactive Plotly visualization in JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Performance Optimization ===&lt;br /&gt;
&lt;br /&gt;
When working with computationally intensive tasks, request the GPU partition for deep learning work. For parallel data processing, allocate 4-8 cores to take advantage of multi-core operations. Store large datasets in &amp;lt;code&amp;gt;/scratch/username/&amp;lt;/code&amp;gt; rather than your home directory for significantly faster I/O performance. You can profile cell execution time using the double-percent time magic command at the beginning of a cell. Remember to close notebooks when you are finished to free up memory for other tasks.&lt;br /&gt;
&lt;br /&gt;
=== Session Management ===&lt;br /&gt;
&lt;br /&gt;
Notebooks are automatically saved every 120 seconds, so your work is protected from unexpected disconnections. However, be aware that the kernel continues running even if you close the browser tab. If you encounter memory issues, restart the kernel by selecting Kernel → Restart from the menu. Variables and data persist between cells until you restart the kernel, so you can build up your analysis incrementally across multiple cells.&lt;br /&gt;
&lt;br /&gt;
=== Security Best Practices ===&lt;br /&gt;
&lt;br /&gt;
Never hardcode passwords or API keys directly in your notebooks. Instead, use environment variables which you can access with the os.getenv function. Before sharing notebooks with colleagues, clear any sensitive outputs by selecting Cell → All Output → Clear from the menu. This ensures that confidential data or credentials are not inadvertently shared.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Data Science Pipeline ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' This workflow demonstrates how to load, clean, analyze, and visualize research data in a reproducible manner.&lt;br /&gt;
&lt;br /&gt;
Begin by launching JupyterLab with 8 cores and a 6-hour walltime to ensure adequate resources for your analysis. Create a new notebook named &amp;lt;code&amp;gt;analysis.ipynb&amp;lt;/code&amp;gt; and follow the steps in the &amp;lt;code&amp;gt;workflows/01_data_science_pipeline.py&amp;lt;/code&amp;gt; example from our GitHub repository.&lt;br /&gt;
&lt;br /&gt;
The workflow starts by loading your data, then explores the data structure and summary statistics to understand data types, missing values, and basic distributions. Next, clean the data by handling missing values appropriately and identifying and addressing any outliers. Use seaborn or matplotlib to create visualizations that reveal patterns and relationships in your data. Export your cleaned data for use in subsequent analyses, and download your notebook by right-clicking on it in the file browser and selecting Download.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Machine Learning Experiment ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Train and compare multiple machine learning models to identify the best performing approach for your dataset.&lt;br /&gt;
&lt;br /&gt;
Launch JupyterLab with the GPU partition if you plan to use deep learning models. Follow the complete workflow in &amp;lt;code&amp;gt;workflows/02_ml_experiment.py&amp;lt;/code&amp;gt; which demonstrates how to load data, split it into training and testing sets, train multiple model types, compare their performance, and save the best performing model for later use.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Geospatial Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Process and visualize geographic data using specialized geospatial libraries.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;workflows/03_geospatial_analysis.py&amp;lt;/code&amp;gt; example walks through installing geospatial packages, loading shapefile or GeoJSON data, performing spatial operations such as buffering or intersection, and creating an interactive map using folium. The final map can be exported to HTML for easy sharing and presentation.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Keyboard Shortcuts ==&lt;br /&gt;
&lt;br /&gt;
Mastering keyboard shortcuts will significantly improve your productivity in JupyterLab. Press Shift + Enter to run the current cell and move to the next one. In command mode (press Escape to enter), press B to insert a new cell below the current cell, or A to insert one above. Delete a cell by pressing D twice in quick succession. Convert a cell to Markdown by pressing M, or back to Code by pressing Y. Save your notebook with Ctrl + S. Access the command palette with Ctrl + Shift + C to search for any command. Comment or uncomment code with Ctrl + /. Undo the last cell operation by pressing Z in command mode.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: Session won't start or stays in &amp;quot;Queued&amp;quot; state ===&lt;br /&gt;
&lt;br /&gt;
This typically occurs when no computational resources are available or the queue is full. Try reducing the number of requested cores or memory in your job parameters. Switch to a different partition such as &amp;lt;code&amp;gt;debug&amp;lt;/code&amp;gt; for quick testing with limited resources. Check the cluster status on the dashboard to see current load. If the problem persists after trying these solutions, contact KENET support for assistance.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Kernel dies or becomes unresponsive ===&lt;br /&gt;
&lt;br /&gt;
A dying or unresponsive kernel usually indicates an out-of-memory condition or that your code has entered an infinite loop. Restart the kernel by selecting Kernel → Restart from the menu. Clear all outputs by selecting Edit → Clear All Outputs to free up memory. For testing, reduce the size of your data or use sampling to work with a subset. In your next session, request more memory to accommodate your full dataset.&lt;br /&gt;
&lt;br /&gt;
=== Problem: &amp;quot;Module not found&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
This error appears when a required Python package is not installed in your environment. Refer to the &amp;lt;code&amp;gt;00_package_installation.sh&amp;lt;/code&amp;gt; example in our GitHub repository for the correct installation syntax. After installation, you must restart the kernel for the new package to be recognized.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Can't save notebook ===&lt;br /&gt;
&lt;br /&gt;
Inability to save usually results from exceeding your disk quota or a permissions issue. Check your disk usage from a terminal or notebook cell. Delete unnecessary files or move large files to scratch storage. Verify file permissions to ensure you have write access to the directory.&lt;br /&gt;
&lt;br /&gt;
=== Problem: GPU not detected ===&lt;br /&gt;
&lt;br /&gt;
If your code cannot detect the GPU, first verify that you selected the GPU partition when launching your JupyterLab session. The &amp;lt;code&amp;gt;03_gpu_tensorflow.py&amp;lt;/code&amp;gt; example includes code to check GPU availability. If no GPUs are detected, you will need to end your current session and relaunch with the GPU partition selected.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official JupyterLab documentation is available at https://jupyterlab.readthedocs.io/ and provides comprehensive information about all features. For Jupyter Notebook basics, see https://jupyter-notebook.readthedocs.io/. KENET HPC usage guidelines are documented at https://training.kenet.or.ke/index.php/HPC_Usage.&lt;br /&gt;
&lt;br /&gt;
For learning JupyterLab, DataCamp provides an excellent tutorial at https://www.datacamp.com/tutorial/tutorial-jupyter-notebook, and Real Python offers a comprehensive introduction at https://realpython.com/jupyter-notebook-introduction/.&lt;br /&gt;
&lt;br /&gt;
Key Python libraries for data science include Pandas for data manipulation (https://pandas.pydata.org/), NumPy for numerical computing (https://numpy.org/), Matplotlib for plotting (https://matplotlib.org/), and Scikit-learn for machine learning (https://scikit-learn.org/).&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke/index.php/HPC_Usage, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Feedback ==&lt;br /&gt;
&lt;br /&gt;
If you encounter issues or have suggestions for improving this tutorial, please contact KENET support or submit feedback through the Open OnDemand interface using the feedback button.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1470</id>
		<title>Jupyter</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1470"/>
				<updated>2026-01-09T18:56:28Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= JupyterLab (Web) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''JupyterLab''' is an interactive web-based environment for notebooks, code, and data. It provides an ideal platform for data science, scientific computing, and machine learning workflows, allowing researchers to combine code execution, rich text, visualizations, and interactive outputs in a single document.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' JupyterLab is particularly well-suited for interactive data analysis and visualization, machine learning model development and experimentation, creating reproducible research notebooks, teaching and sharing computational narratives, and real-time data exploration with optional GPU acceleration.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' JupyterLab is available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/Materials-Modelling-Group/training-examples&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using JupyterLab, you should have an active KENET HPC cluster account with access to the Open OnDemand portal. Basic knowledge of Python, R, or Julia will be helpful, and you should have your data files stored in your home directory at &amp;lt;code&amp;gt;/home/username/localscratch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching JupyterLab ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
Begin by logging into Open OnDemand at https://ondemand.vlab.ac.ke using your KENET credentials. Once logged in, click the '''Interactive Apps''' menu in the top navigation bar, then select '''JupyterLab''' from the dropdown list of available applications.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Menu.png|thumb|600px|center|Navigate to Interactive Apps → JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
The job submission form allows you to specify the computational resources needed for your JupyterLab session. Fill in the form according to your workload requirements using the table below as a guide.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; (CPU) or &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; (GPU tasks)&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; hours for testing, up to &amp;lt;code&amp;gt;192&amp;lt;/code&amp;gt; for long jobs&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores (adjust based on workload)&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16&amp;lt;/code&amp;gt; GB for data science, &amp;lt;code&amp;gt;32&amp;lt;/code&amp;gt; GB for large datasets&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your project folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
'''Tip:''' For GPU-accelerated deep learning tasks, select the '''gpu''' partition and specify the number of GPUs needed for your work.&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Wait ===&lt;br /&gt;
After configuring your job parameters, click the '''Launch''' button to submit your job to the cluster scheduler. The job will initially show a &amp;quot;Queued&amp;quot; status while waiting for resources to become available. Once resources are allocated (typically within 30-60 seconds), the status will change to &amp;quot;Running&amp;quot; and a '''Connect to JupyterLab''' button will appear. Click this button to open your JupyterLab session in a new browser tab.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Running.png|thumb|600px|center|Session card showing &amp;quot;Running&amp;quot; status with Connect button]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Creating Your First Notebook ===&lt;br /&gt;
When JupyterLab opens, you will see the Launcher interface. To create a new notebook, click '''File → New → Notebook''' from the menu, or simply click the '''Python 3''' tile in the Launcher. You will be prompted to select a kernel, which determines the programming language and environment for your notebook. Choose Python 3, R, or Julia depending on your needs.&lt;br /&gt;
&lt;br /&gt;
[[File:JupyterLab_New_Notebook.png|thumb|600px|center|Creating a new notebook in JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Basic Cell Operations ===&lt;br /&gt;
&lt;br /&gt;
Notebooks consist of cells where you can write and execute code. To see a basic example of creating a simple plot, refer to the &amp;lt;code&amp;gt;01_basic_plotting.py&amp;lt;/code&amp;gt; example in our GitHub repository. Press Shift+Enter to run any cell and see the output immediately below it.&lt;br /&gt;
&lt;br /&gt;
There are three main cell types in JupyterLab. '''Code''' cells contain executable code and are the default type. '''Markdown''' cells contain formatted text, equations, and documentation. '''Raw''' cells contain plain text that is not executed or formatted.&lt;br /&gt;
&lt;br /&gt;
=== Installing Python Packages ===&lt;br /&gt;
&lt;br /&gt;
You can install additional Python packages directly from within a notebook cell using pip. The proper syntax is shown in the &amp;lt;code&amp;gt;00_package_installation.sh&amp;lt;/code&amp;gt; file in our GitHub repository. Always use the &amp;lt;code&amp;gt;--user&amp;lt;/code&amp;gt; flag to install packages in your personal home directory rather than attempting system-wide installation, which will fail due to permissions.&lt;br /&gt;
&lt;br /&gt;
'''Important:''' After installing new packages, you must restart the kernel by selecting Kernel → Restart from the menu for the packages to be recognized.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Loading Data from Cluster Storage ===&lt;br /&gt;
&lt;br /&gt;
Loading data from files stored on the cluster is straightforward using pandas or other data libraries. You can read data from your home directory or from the faster scratch storage. See the example in &amp;lt;code&amp;gt;02_loading_data.py&amp;lt;/code&amp;gt; in our GitHub repository for the complete code showing how to read CSV files from both locations.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: Using GPU for Deep Learning ===&lt;br /&gt;
&lt;br /&gt;
If you launched your session on the GPU partition, you can leverage GPU acceleration for deep learning tasks. TensorFlow and PyTorch will automatically detect and use available GPUs. The &amp;lt;code&amp;gt;03_gpu_tensorflow.py&amp;lt;/code&amp;gt; example demonstrates how to check GPU availability and create a simple neural network model that will automatically utilize GPU resources when available.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: Parallel Processing with Dask ===&lt;br /&gt;
&lt;br /&gt;
For large datasets that don't fit in memory, Dask provides parallel processing capabilities that work seamlessly with pandas syntax. The &amp;lt;code&amp;gt;04_dask_parallel.py&amp;lt;/code&amp;gt; example shows how to read large datasets using Dask and perform grouped aggregations efficiently across multiple cores.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Creating Interactive Visualizations ===&lt;br /&gt;
&lt;br /&gt;
Plotly provides interactive visualizations that work well in JupyterLab, allowing you to zoom, pan, and explore your data dynamically. See &amp;lt;code&amp;gt;05_plotly_interactive.py&amp;lt;/code&amp;gt; for an example of creating an interactive scatter plot with categorical coloring.&lt;br /&gt;
&lt;br /&gt;
[[File:JupyterLab_Plotly_Example.png|thumb|600px|center|Interactive Plotly visualization in JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Performance Optimization ===&lt;br /&gt;
&lt;br /&gt;
When working with computationally intensive tasks, request the GPU partition for deep learning work. For parallel data processing, allocate 4-8 cores to take advantage of multi-core operations. Store large datasets in &amp;lt;code&amp;gt;/scratch/username/&amp;lt;/code&amp;gt; rather than your home directory for significantly faster I/O performance. You can profile cell execution time using the double-percent time magic command at the beginning of a cell. Remember to close notebooks when you are finished to free up memory for other tasks.&lt;br /&gt;
&lt;br /&gt;
=== Session Management ===&lt;br /&gt;
&lt;br /&gt;
Notebooks are automatically saved every 120 seconds, so your work is protected from unexpected disconnections. However, be aware that the kernel continues running even if you close the browser tab. If you encounter memory issues, restart the kernel by selecting Kernel → Restart from the menu. Variables and data persist between cells until you restart the kernel, so you can build up your analysis incrementally across multiple cells.&lt;br /&gt;
&lt;br /&gt;
=== Security Best Practices ===&lt;br /&gt;
&lt;br /&gt;
Never hardcode passwords or API keys directly in your notebooks. Instead, use environment variables which you can access with the os.getenv function. Before sharing notebooks with colleagues, clear any sensitive outputs by selecting Cell → All Output → Clear from the menu. This ensures that confidential data or credentials are not inadvertently shared.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Data Science Pipeline ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' This workflow demonstrates how to load, clean, analyze, and visualize research data in a reproducible manner.&lt;br /&gt;
&lt;br /&gt;
Begin by launching JupyterLab with 8 cores and a 6-hour walltime to ensure adequate resources for your analysis. Create a new notebook named &amp;lt;code&amp;gt;analysis.ipynb&amp;lt;/code&amp;gt; and follow the steps in the &amp;lt;code&amp;gt;workflows/01_data_science_pipeline.py&amp;lt;/code&amp;gt; example from our GitHub repository.&lt;br /&gt;
&lt;br /&gt;
The workflow starts by loading your data, then explores the data structure and summary statistics to understand data types, missing values, and basic distributions. Next, clean the data by handling missing values appropriately and identifying and addressing any outliers. Use seaborn or matplotlib to create visualizations that reveal patterns and relationships in your data. Export your cleaned data for use in subsequent analyses, and download your notebook by right-clicking on it in the file browser and selecting Download.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Machine Learning Experiment ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Train and compare multiple machine learning models to identify the best performing approach for your dataset.&lt;br /&gt;
&lt;br /&gt;
Launch JupyterLab with the GPU partition if you plan to use deep learning models. Follow the complete workflow in &amp;lt;code&amp;gt;workflows/02_ml_experiment.py&amp;lt;/code&amp;gt; which demonstrates how to load data, split it into training and testing sets, train multiple model types, compare their performance, and save the best performing model for later use.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Geospatial Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Process and visualize geographic data using specialized geospatial libraries.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;workflows/03_geospatial_analysis.py&amp;lt;/code&amp;gt; example walks through installing geospatial packages, loading shapefile or GeoJSON data, performing spatial operations such as buffering or intersection, and creating an interactive map using folium. The final map can be exported to HTML for easy sharing and presentation.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Keyboard Shortcuts ==&lt;br /&gt;
&lt;br /&gt;
Mastering keyboard shortcuts will significantly improve your productivity in JupyterLab. Press Shift + Enter to run the current cell and move to the next one. In command mode (press Escape to enter), press B to insert a new cell below the current cell, or A to insert one above. Delete a cell by pressing D twice in quick succession. Convert a cell to Markdown by pressing M, or back to Code by pressing Y. Save your notebook with Ctrl + S. Access the command palette with Ctrl + Shift + C to search for any command. Comment or uncomment code with Ctrl + /. Undo the last cell operation by pressing Z in command mode.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: Session won't start or stays in &amp;quot;Queued&amp;quot; state ===&lt;br /&gt;
&lt;br /&gt;
This typically occurs when no computational resources are available or the queue is full. Try reducing the number of requested cores or memory in your job parameters. Switch to a different partition such as &amp;lt;code&amp;gt;debug&amp;lt;/code&amp;gt; for quick testing with limited resources. Check the cluster status on the dashboard to see current load. If the problem persists after trying these solutions, contact KENET support for assistance.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Kernel dies or becomes unresponsive ===&lt;br /&gt;
&lt;br /&gt;
A dying or unresponsive kernel usually indicates an out-of-memory condition or that your code has entered an infinite loop. Restart the kernel by selecting Kernel → Restart from the menu. Clear all outputs by selecting Edit → Clear All Outputs to free up memory. For testing, reduce the size of your data or use sampling to work with a subset. In your next session, request more memory to accommodate your full dataset.&lt;br /&gt;
&lt;br /&gt;
=== Problem: &amp;quot;Module not found&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
This error appears when a required Python package is not installed in your environment. Refer to the &amp;lt;code&amp;gt;00_package_installation.sh&amp;lt;/code&amp;gt; example in our GitHub repository for the correct installation syntax. After installation, you must restart the kernel for the new package to be recognized.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Can't save notebook ===&lt;br /&gt;
&lt;br /&gt;
Inability to save usually results from exceeding your disk quota or a permissions issue. Check your disk usage from a terminal or notebook cell. Delete unnecessary files or move large files to scratch storage. Verify file permissions to ensure you have write access to the directory.&lt;br /&gt;
&lt;br /&gt;
=== Problem: GPU not detected ===&lt;br /&gt;
&lt;br /&gt;
If your code cannot detect the GPU, first verify that you selected the GPU partition when launching your JupyterLab session. The &amp;lt;code&amp;gt;03_gpu_tensorflow.py&amp;lt;/code&amp;gt; example includes code to check GPU availability. If no GPUs are detected, you will need to end your current session and relaunch with the GPU partition selected.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official JupyterLab documentation is available at https://jupyterlab.readthedocs.io/ and provides comprehensive information about all features. For Jupyter Notebook basics, see https://jupyter-notebook.readthedocs.io/. KENET HPC usage guidelines are documented at https://training.kenet.or.ke/index.php/HPC_Usage.&lt;br /&gt;
&lt;br /&gt;
For learning JupyterLab, DataCamp provides an excellent tutorial at https://www.datacamp.com/tutorial/tutorial-jupyter-notebook, and Real Python offers a comprehensive introduction at https://realpython.com/jupyter-notebook-introduction/.&lt;br /&gt;
&lt;br /&gt;
Key Python libraries for data science include Pandas for data manipulation (https://pandas.pydata.org/), NumPy for numerical computing (https://numpy.org/), Matplotlib for plotting (https://matplotlib.org/), and Scikit-learn for machine learning (https://scikit-learn.org/).&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke/index.php/HPC_Usage, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Version Information ==&lt;br /&gt;
&lt;br /&gt;
This tutorial documents JupyterLab version 4.x running Python 3.9 or later. The JupyterLab installation is located at &amp;lt;code&amp;gt;/opt/ohpc/pub/codes/ood/jupyterlab&amp;lt;/code&amp;gt; on the cluster. This tutorial was last updated on 2026-01-09 and is currently at version 1.0.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Feedback ==&lt;br /&gt;
&lt;br /&gt;
If you encounter issues or have suggestions for improving this tutorial, please contact KENET support or submit feedback through the Open OnDemand interface using the feedback button.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1469</id>
		<title>Jupyter</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1469"/>
				<updated>2026-01-09T18:28:57Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= JupyterLab (Web) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''JupyterLab''' is an interactive web-based environment for notebooks, code, and data. It provides an ideal platform for data science, scientific computing, and machine learning workflows, allowing researchers to combine code execution, rich text, visualizations, and interactive outputs in a single document.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:''' JupyterLab is particularly well-suited for interactive data analysis and visualization, machine learning model development and experimentation, creating reproducible research notebooks, teaching and sharing computational narratives, and real-time data exploration with optional GPU acceleration.&lt;br /&gt;
&lt;br /&gt;
'''Access:''' JupyterLab is available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
'''Code Examples:''' All code examples for this tutorial are available in our GitHub repository at https://github.com/KENET-HPC/ood-tutorials&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using JupyterLab, you should have an active KENET HPC cluster account with access to the Open OnDemand portal. Basic knowledge of Python, R, or Julia will be helpful, and you should have your data files stored in your home directory at &amp;lt;code&amp;gt;/home/username/&amp;lt;/code&amp;gt; or in the scratch directory at &amp;lt;code&amp;gt;/scratch/username/&amp;lt;/code&amp;gt; for larger datasets.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching JupyterLab ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
Begin by logging into Open OnDemand at https://ondemand.vlab.ac.ke using your KENET credentials. Once logged in, click the '''Interactive Apps''' menu in the top navigation bar, then select '''JupyterLab''' from the dropdown list of available applications.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Menu.png|thumb|600px|center|Navigate to Interactive Apps → JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
The job submission form allows you to specify the computational resources needed for your JupyterLab session. Fill in the form according to your workload requirements using the table below as a guide.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; (CPU) or &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; (GPU tasks)&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; hours for testing, up to &amp;lt;code&amp;gt;192&amp;lt;/code&amp;gt; for long jobs&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores (adjust based on workload)&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16&amp;lt;/code&amp;gt; GB for data science, &amp;lt;code&amp;gt;32&amp;lt;/code&amp;gt; GB for large datasets&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your project folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
'''Tip:''' For GPU-accelerated deep learning tasks, select the '''gpu''' partition and specify the number of GPUs needed for your work.&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Wait ===&lt;br /&gt;
After configuring your job parameters, click the '''Launch''' button to submit your job to the cluster scheduler. The job will initially show a &amp;quot;Queued&amp;quot; status while waiting for resources to become available. Once resources are allocated (typically within 30-60 seconds), the status will change to &amp;quot;Running&amp;quot; and a '''Connect to JupyterLab''' button will appear. Click this button to open your JupyterLab session in a new browser tab.&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Running.png|thumb|600px|center|Session card showing &amp;quot;Running&amp;quot; status with Connect button]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Creating Your First Notebook ===&lt;br /&gt;
When JupyterLab opens, you will see the Launcher interface. To create a new notebook, click '''File → New → Notebook''' from the menu, or simply click the '''Python 3''' tile in the Launcher. You will be prompted to select a kernel, which determines the programming language and environment for your notebook. Choose Python 3, R, or Julia depending on your needs.&lt;br /&gt;
&lt;br /&gt;
[[File:JupyterLab_New_Notebook.png|thumb|600px|center|Creating a new notebook in JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Basic Cell Operations ===&lt;br /&gt;
&lt;br /&gt;
Notebooks consist of cells where you can write and execute code. To see a basic example of creating a simple plot, refer to the &amp;lt;code&amp;gt;01_basic_plotting.py&amp;lt;/code&amp;gt; example in our GitHub repository. Press Shift+Enter to run any cell and see the output immediately below it.&lt;br /&gt;
&lt;br /&gt;
There are three main cell types in JupyterLab. '''Code''' cells contain executable code and are the default type. '''Markdown''' cells contain formatted text, equations, and documentation. '''Raw''' cells contain plain text that is not executed or formatted.&lt;br /&gt;
&lt;br /&gt;
=== Installing Python Packages ===&lt;br /&gt;
&lt;br /&gt;
You can install additional Python packages directly from within a notebook cell using pip. The proper syntax is shown in the &amp;lt;code&amp;gt;00_package_installation.sh&amp;lt;/code&amp;gt; file in our GitHub repository. Always use the &amp;lt;code&amp;gt;--user&amp;lt;/code&amp;gt; flag to install packages in your personal home directory rather than attempting system-wide installation, which will fail due to permissions.&lt;br /&gt;
&lt;br /&gt;
'''Important:''' After installing new packages, you must restart the kernel by selecting Kernel → Restart from the menu for the packages to be recognized.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Loading Data from Cluster Storage ===&lt;br /&gt;
&lt;br /&gt;
Loading data from files stored on the cluster is straightforward using pandas or other data libraries. You can read data from your home directory or from the faster scratch storage. See the example in &amp;lt;code&amp;gt;02_loading_data.py&amp;lt;/code&amp;gt; in our GitHub repository for the complete code showing how to read CSV files from both locations.&lt;br /&gt;
&lt;br /&gt;
=== Task 2: Using GPU for Deep Learning ===&lt;br /&gt;
&lt;br /&gt;
If you launched your session on the GPU partition, you can leverage GPU acceleration for deep learning tasks. TensorFlow and PyTorch will automatically detect and use available GPUs. The &amp;lt;code&amp;gt;03_gpu_tensorflow.py&amp;lt;/code&amp;gt; example demonstrates how to check GPU availability and create a simple neural network model that will automatically utilize GPU resources when available.&lt;br /&gt;
&lt;br /&gt;
=== Task 3: Parallel Processing with Dask ===&lt;br /&gt;
&lt;br /&gt;
For large datasets that don't fit in memory, Dask provides parallel processing capabilities that work seamlessly with pandas syntax. The &amp;lt;code&amp;gt;04_dask_parallel.py&amp;lt;/code&amp;gt; example shows how to read large datasets using Dask and perform grouped aggregations efficiently across multiple cores.&lt;br /&gt;
&lt;br /&gt;
=== Task 4: Creating Interactive Visualizations ===&lt;br /&gt;
&lt;br /&gt;
Plotly provides interactive visualizations that work well in JupyterLab, allowing you to zoom, pan, and explore your data dynamically. See &amp;lt;code&amp;gt;05_plotly_interactive.py&amp;lt;/code&amp;gt; for an example of creating an interactive scatter plot with categorical coloring.&lt;br /&gt;
&lt;br /&gt;
[[File:JupyterLab_Plotly_Example.png|thumb|600px|center|Interactive Plotly visualization in JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Tips &amp;amp; Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Performance Optimization ===&lt;br /&gt;
&lt;br /&gt;
When working with computationally intensive tasks, request the GPU partition for deep learning work. For parallel data processing, allocate 4-8 cores to take advantage of multi-core operations. Store large datasets in &amp;lt;code&amp;gt;/scratch/username/&amp;lt;/code&amp;gt; rather than your home directory for significantly faster I/O performance. You can profile cell execution time using the double-percent time magic command at the beginning of a cell. Remember to close notebooks when you are finished to free up memory for other tasks.&lt;br /&gt;
&lt;br /&gt;
=== Session Management ===&lt;br /&gt;
&lt;br /&gt;
Notebooks are automatically saved every 120 seconds, so your work is protected from unexpected disconnections. However, be aware that the kernel continues running even if you close the browser tab. If you encounter memory issues, restart the kernel by selecting Kernel → Restart from the menu. Variables and data persist between cells until you restart the kernel, so you can build up your analysis incrementally across multiple cells.&lt;br /&gt;
&lt;br /&gt;
=== Security Best Practices ===&lt;br /&gt;
&lt;br /&gt;
Never hardcode passwords or API keys directly in your notebooks. Instead, use environment variables which you can access with the os.getenv function. Before sharing notebooks with colleagues, clear any sensitive outputs by selecting Cell → All Output → Clear from the menu. This ensures that confidential data or credentials are not inadvertently shared.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Example Workflows ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Data Science Pipeline ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' This workflow demonstrates how to load, clean, analyze, and visualize research data in a reproducible manner.&lt;br /&gt;
&lt;br /&gt;
Begin by launching JupyterLab with 8 cores and a 6-hour walltime to ensure adequate resources for your analysis. Create a new notebook named &amp;lt;code&amp;gt;analysis.ipynb&amp;lt;/code&amp;gt; and follow the steps in the &amp;lt;code&amp;gt;workflows/01_data_science_pipeline.py&amp;lt;/code&amp;gt; example from our GitHub repository.&lt;br /&gt;
&lt;br /&gt;
The workflow starts by loading your data, then explores the data structure and summary statistics to understand data types, missing values, and basic distributions. Next, clean the data by handling missing values appropriately and identifying and addressing any outliers. Use seaborn or matplotlib to create visualizations that reveal patterns and relationships in your data. Export your cleaned data for use in subsequent analyses, and download your notebook by right-clicking on it in the file browser and selecting Download.&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Machine Learning Experiment ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Train and compare multiple machine learning models to identify the best performing approach for your dataset.&lt;br /&gt;
&lt;br /&gt;
Launch JupyterLab with the GPU partition if you plan to use deep learning models. Follow the complete workflow in &amp;lt;code&amp;gt;workflows/02_ml_experiment.py&amp;lt;/code&amp;gt; which demonstrates how to load data, split it into training and testing sets, train multiple model types, compare their performance, and save the best performing model for later use.&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Geospatial Analysis ===&lt;br /&gt;
&lt;br /&gt;
'''Objective:''' Process and visualize geographic data using specialized geospatial libraries.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;workflows/03_geospatial_analysis.py&amp;lt;/code&amp;gt; example walks through installing geospatial packages, loading shapefile or GeoJSON data, performing spatial operations such as buffering or intersection, and creating an interactive map using folium. The final map can be exported to HTML for easy sharing and presentation.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Keyboard Shortcuts ==&lt;br /&gt;
&lt;br /&gt;
Mastering keyboard shortcuts will significantly improve your productivity in JupyterLab. Press Shift + Enter to run the current cell and move to the next one. In command mode (press Escape to enter), press B to insert a new cell below the current cell, or A to insert one above. Delete a cell by pressing D twice in quick succession. Convert a cell to Markdown by pressing M, or back to Code by pressing Y. Save your notebook with Ctrl + S. Access the command palette with Ctrl + Shift + C to search for any command. Comment or uncomment code with Ctrl + /. Undo the last cell operation by pressing Z in command mode.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problem: Session won't start or stays in &amp;quot;Queued&amp;quot; state ===&lt;br /&gt;
&lt;br /&gt;
This typically occurs when no computational resources are available or the queue is full. Try reducing the number of requested cores or memory in your job parameters. Switch to a different partition such as &amp;lt;code&amp;gt;debug&amp;lt;/code&amp;gt; for quick testing with limited resources. Check the cluster status on the dashboard to see current load. If the problem persists after trying these solutions, contact KENET support for assistance.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Kernel dies or becomes unresponsive ===&lt;br /&gt;
&lt;br /&gt;
A dying or unresponsive kernel usually indicates an out-of-memory condition or that your code has entered an infinite loop. Restart the kernel by selecting Kernel → Restart from the menu. Clear all outputs by selecting Edit → Clear All Outputs to free up memory. For testing, reduce the size of your data or use sampling to work with a subset. In your next session, request more memory to accommodate your full dataset.&lt;br /&gt;
&lt;br /&gt;
=== Problem: &amp;quot;Module not found&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
This error appears when a required Python package is not installed in your environment. Refer to the &amp;lt;code&amp;gt;00_package_installation.sh&amp;lt;/code&amp;gt; example in our GitHub repository for the correct installation syntax. After installation, you must restart the kernel for the new package to be recognized.&lt;br /&gt;
&lt;br /&gt;
=== Problem: Can't save notebook ===&lt;br /&gt;
&lt;br /&gt;
Inability to save usually results from exceeding your disk quota or a permissions issue. Check your disk usage from a terminal or notebook cell. Delete unnecessary files or move large files to scratch storage. Verify file permissions to ensure you have write access to the directory.&lt;br /&gt;
&lt;br /&gt;
=== Problem: GPU not detected ===&lt;br /&gt;
&lt;br /&gt;
If your code cannot detect the GPU, first verify that you selected the GPU partition when launching your JupyterLab session. The &amp;lt;code&amp;gt;03_gpu_tensorflow.py&amp;lt;/code&amp;gt; example includes code to check GPU availability. If no GPUs are detected, you will need to end your current session and relaunch with the GPU partition selected.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Additional Resources ==&lt;br /&gt;
&lt;br /&gt;
The official JupyterLab documentation is available at https://jupyterlab.readthedocs.io/ and provides comprehensive information about all features. For Jupyter Notebook basics, see https://jupyter-notebook.readthedocs.io/. KENET HPC usage guidelines are documented at https://training.kenet.or.ke/index.php/HPC_Usage.&lt;br /&gt;
&lt;br /&gt;
For learning JupyterLab, DataCamp provides an excellent tutorial at https://www.datacamp.com/tutorial/tutorial-jupyter-notebook, and Real Python offers a comprehensive introduction at https://realpython.com/jupyter-notebook-introduction/.&lt;br /&gt;
&lt;br /&gt;
Key Python libraries for data science include Pandas for data manipulation (https://pandas.pydata.org/), NumPy for numerical computing (https://numpy.org/), Matplotlib for plotting (https://matplotlib.org/), and Scikit-learn for machine learning (https://scikit-learn.org/).&lt;br /&gt;
&lt;br /&gt;
'''Code Examples Repository:''' All code examples referenced in this tutorial are available at https://github.com/KENET-HPC/ood-tutorials&lt;br /&gt;
&lt;br /&gt;
For support, contact KENET at support@kenet.or.ke, consult the documentation at https://training.kenet.or.ke, or access the Open OnDemand portal at https://ondemand.vlab.ac.ke.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Version Information ==&lt;br /&gt;
&lt;br /&gt;
This tutorial documents JupyterLab version 4.x running Python 3.9 or later. The JupyterLab installation is located at &amp;lt;code&amp;gt;/opt/ohpc/pub/codes/ood/jupyterlab&amp;lt;/code&amp;gt; on the cluster. This tutorial was last updated on 2026-01-09 and is currently at version 1.0.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Feedback ==&lt;br /&gt;
&lt;br /&gt;
If you encounter issues or have suggestions for improving this tutorial, please contact KENET support or submit feedback through the Open OnDemand interface using the feedback button.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Back to:''' [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1468</id>
		<title>Jupyter</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1468"/>
				<updated>2026-01-09T08:27:08Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= JupyterLab (Web) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''JupyterLab''' is an interactive web-based environment for notebooks, code, and data, ideal for data science, scientific computing, and machine learning workflows.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:'''&lt;br /&gt;
* Interactive data analysis and visualization&lt;br /&gt;
* Machine learning model development and experimentation&lt;br /&gt;
* Creating reproducible research notebooks&lt;br /&gt;
* Teaching and sharing computational narratives&lt;br /&gt;
* Real-time data exploration with GPU acceleration&lt;br /&gt;
&lt;br /&gt;
'''Access:''' Available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using JupyterLab, ensure you have:&lt;br /&gt;
* Active KENET HPC cluster account&lt;br /&gt;
* Access to Open OnDemand portal&lt;br /&gt;
* Basic knowledge of Python, R, or Julia&lt;br /&gt;
* Data files stored in &amp;lt;code&amp;gt;/home/username/localscratch&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching JupyterLab ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
# Log into Open OnDemand: https://ondemand.vlab.ac.ke&lt;br /&gt;
# Click '''Interactive Apps''' in the top navigation menu&lt;br /&gt;
# Select '''JupyterLab''' from the dropdown list&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Menu.png|thumb|600px|center|Navigate to Interactive Apps → JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
Fill in the job submission form with your requirements:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; (CPU) or &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; (GPU tasks)&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; hours for testing, up to &amp;lt;code&amp;gt;192&amp;lt;/code&amp;gt; for long jobs&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores (adjust based on workload)&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16&amp;lt;/code&amp;gt; GB for data science, &amp;lt;code&amp;gt;32&amp;lt;/code&amp;gt; GB for large datasets&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your project folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For GPU-accelerated deep learning, select the '''gpu''' partition and specify number of GPUs needed.}}&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Wait ===&lt;br /&gt;
# Click '''Launch''' button&lt;br /&gt;
# Wait for job to start (Status: &amp;quot;Queued&amp;quot; → &amp;quot;Running&amp;quot;)&lt;br /&gt;
# Click '''Connect to JupyterLab''' button when available (typically 30-60 seconds)&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Running.png|thumb|600px|center|Session card showing &amp;quot;Running&amp;quot; status with Connect button]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Creating Your First Notebook ===&lt;br /&gt;
# Click '''File → New → Notebook''' or click the '''Python 3''' tile in the Launcher&lt;br /&gt;
# Select kernel: Python 3, R, or Julia (if available)&lt;br /&gt;
# Start writing code in cells&lt;br /&gt;
&lt;br /&gt;
[[File:JupyterLab_New_Notebook.png|thumb|600px|center|Creating a new notebook in JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Basic Cell Operations ===&lt;br /&gt;
&lt;br /&gt;
Notebooks consist of cells where you can write and execute code. Here is a simple example to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code python&amp;gt;&lt;br /&gt;
 # Code cell - Press Shift+Enter to run&lt;br /&gt;
 import pandas as pd&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 &lt;br /&gt;
 # Create sample data&lt;br /&gt;
 data = pd.DataFrame({&lt;br /&gt;
     'x': range(10),&lt;br /&gt;
     'y': [i**2 for i in range(10)]&lt;br /&gt;
 })&lt;br /&gt;
 &lt;br /&gt;
 # Plot&lt;br /&gt;
 plt.plot(data['x'], data['y'])&lt;br /&gt;
 plt.title('Sample Plot on KENET HPC')&lt;br /&gt;
 plt.show()&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are three main cell types in JupyterLab. '''Code''' cells contain executable code and are the default type. '''Markdown''' cells contain formatted text, equations, and documentation. '''Raw''' cells contain plain text that is not executed or formatted.&lt;br /&gt;
=== Installing Python Packages ===&lt;br /&gt;
&lt;br /&gt;
You can install additional Python packages directly from within a notebook cell. Always use the &amp;lt;code&amp;gt;--user&amp;lt;/code&amp;gt; flag to install packages in your personal home directory rather than system-wide:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 # In a notebook cell&lt;br /&gt;
 !pip install --user seaborn scikit-learn&lt;br /&gt;
 # or alternatively&lt;br /&gt;
 %pip install --user packagename&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Important:''' Always use the &amp;lt;code&amp;gt;--user&amp;lt;/code&amp;gt; flag to install packages in your home directory, not system-wide. System directories are read-only and attempts to install there will fail.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Loading Data from Cluster Storage ===&lt;br /&gt;
&lt;br /&gt;
Loading data from files stored on the cluster is straightforward using pandas or other data libraries. You can read data from your home directory or from the faster scratch storage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=KENET_Open_OnDemand&amp;diff=1467</id>
		<title>KENET Open OnDemand</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=KENET_Open_OnDemand&amp;diff=1467"/>
				<updated>2026-01-09T08:26:03Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''KENET Provides Accessible HPC using Open Ondemand''' &lt;br /&gt;
This document will assist you to learn how to access and use the Open Ondemand  facility provided by KENET.&lt;br /&gt;
Access is provided using a set of dedicated interfaces for each tool, blending web browser or remote desktop approaches to make it convenient to use the cluster. Below is a list of available Open Ondemand applications.&lt;br /&gt;
&lt;br /&gt;
* [[code server|VS Code (Web) ]]&lt;br /&gt;
* [[jupyter| JupyterLab (web) ]]&lt;br /&gt;
* [[mlflow| mlflow (Web) ]]&lt;br /&gt;
* [[tensorboard | Tensorboard (Web)]]&lt;br /&gt;
* [[R studio | R Studio (Web)]]&lt;br /&gt;
* [[pspp| PSPP (In JupyterLab Web) ]]&lt;br /&gt;
* [[octave| Octave (Remote Desktop)]]&lt;br /&gt;
* [[ qgis | QGIS (Remote Desktop)]]&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1466</id>
		<title>Jupyter</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1466"/>
				<updated>2026-01-09T08:15:21Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= JupyterLab (Web) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''JupyterLab''' is an interactive web-based environment for notebooks, code, and data, ideal for data science, scientific computing, and machine learning workflows.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:'''&lt;br /&gt;
* Interactive data analysis and visualization&lt;br /&gt;
* Machine learning model development and experimentation&lt;br /&gt;
* Creating reproducible research notebooks&lt;br /&gt;
* Teaching and sharing computational narratives&lt;br /&gt;
* Real-time data exploration with GPU acceleration&lt;br /&gt;
&lt;br /&gt;
'''Access:''' Available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using JupyterLab, ensure you have:&lt;br /&gt;
* Active KENET HPC cluster account&lt;br /&gt;
* Access to Open OnDemand portal&lt;br /&gt;
* Basic knowledge of Python, R, or Julia&lt;br /&gt;
* Data files stored in &amp;lt;code&amp;gt;/home/username/localscratch&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching JupyterLab ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
# Log into Open OnDemand: https://ondemand.vlab.ac.ke&lt;br /&gt;
# Click '''Interactive Apps''' in the top navigation menu&lt;br /&gt;
# Select '''JupyterLab''' from the dropdown list&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Menu.png|thumb|600px|center|Navigate to Interactive Apps → JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
Fill in the job submission form with your requirements:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; (CPU) or &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; (GPU tasks)&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; hours for testing, up to &amp;lt;code&amp;gt;192&amp;lt;/code&amp;gt; for long jobs&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores (adjust based on workload)&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16&amp;lt;/code&amp;gt; GB for data science, &amp;lt;code&amp;gt;32&amp;lt;/code&amp;gt; GB for large datasets&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your project folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For GPU-accelerated deep learning, select the '''gpu''' partition and specify number of GPUs needed.}}&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Wait ===&lt;br /&gt;
# Click '''Launch''' button&lt;br /&gt;
# Wait for job to start (Status: &amp;quot;Queued&amp;quot; → &amp;quot;Running&amp;quot;)&lt;br /&gt;
# Click '''Connect to JupyterLab''' button when available (typically 30-60 seconds)&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Running.png|thumb|600px|center|Session card showing &amp;quot;Running&amp;quot; status with Connect button]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Creating Your First Notebook ===&lt;br /&gt;
# Click '''File → New → Notebook''' or click the '''Python 3''' tile in the Launcher&lt;br /&gt;
# Select kernel: Python 3, R, or Julia (if available)&lt;br /&gt;
# Start writing code in cells&lt;br /&gt;
&lt;br /&gt;
[[File:JupyterLab_New_Notebook.png|thumb|600px|center|Creating a new notebook in JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Basic Cell Operations ===&lt;br /&gt;
&lt;br /&gt;
Notebooks consist of cells where you can write and execute code. Here is a simple example to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code python&amp;gt;&lt;br /&gt;
 # Code cell - Press Shift+Enter to run&lt;br /&gt;
 import pandas as pd&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 &lt;br /&gt;
 # Create sample data&lt;br /&gt;
 data = pd.DataFrame({&lt;br /&gt;
     'x': range(10),&lt;br /&gt;
     'y': [i**2 for i in range(10)]&lt;br /&gt;
 })&lt;br /&gt;
 &lt;br /&gt;
 # Plot&lt;br /&gt;
 plt.plot(data['x'], data['y'])&lt;br /&gt;
 plt.title('Sample Plot on KENET HPC')&lt;br /&gt;
 plt.show()&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are three main cell types in JupyterLab. '''Code''' cells contain executable code and are the default type. '''Markdown''' cells contain formatted text, equations, and documentation. '''Raw''' cells contain plain text that is not executed or formatted.&lt;br /&gt;
=== Installing Python Packages ===&lt;br /&gt;
&lt;br /&gt;
You can install additional Python packages directly from within a notebook cell. Always use the &amp;lt;code&amp;gt;--user&amp;lt;/code&amp;gt; flag to install packages in your personal home directory rather than system-wide:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 # In a notebook cell&lt;br /&gt;
 !pip install --user seaborn scikit-learn&lt;br /&gt;
 # or alternatively&lt;br /&gt;
 %pip install --user packagename&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Important:''' Always use the &amp;lt;code&amp;gt;--user&amp;lt;/code&amp;gt; flag to install packages in your home directory, not system-wide. System directories are read-only and attempts to install there will fail.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Common Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Task 1: Loading Data from Cluster Storage ===&lt;br /&gt;
&lt;br /&gt;
Loading data from files stored on the cluster is straightforward using pandas or other data libraries. You can read data from your home directory or from the faster scratch storage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1465</id>
		<title>Jupyter</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1465"/>
				<updated>2026-01-09T08:12:20Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= JupyterLab (Web) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''JupyterLab''' is an interactive web-based environment for notebooks, code, and data, ideal for data science, scientific computing, and machine learning workflows.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:'''&lt;br /&gt;
* Interactive data analysis and visualization&lt;br /&gt;
* Machine learning model development and experimentation&lt;br /&gt;
* Creating reproducible research notebooks&lt;br /&gt;
* Teaching and sharing computational narratives&lt;br /&gt;
* Real-time data exploration with GPU acceleration&lt;br /&gt;
&lt;br /&gt;
'''Access:''' Available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using JupyterLab, ensure you have:&lt;br /&gt;
* Active KENET HPC cluster account&lt;br /&gt;
* Access to Open OnDemand portal&lt;br /&gt;
* Basic knowledge of Python, R, or Julia&lt;br /&gt;
* Data files stored in &amp;lt;code&amp;gt;/home/username/localscratch&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching JupyterLab ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
# Log into Open OnDemand: https://ondemand.vlab.ac.ke&lt;br /&gt;
# Click '''Interactive Apps''' in the top navigation menu&lt;br /&gt;
# Select '''JupyterLab''' from the dropdown list&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Menu.png|thumb|600px|center|Navigate to Interactive Apps → JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
Fill in the job submission form with your requirements:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; (CPU) or &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; (GPU tasks)&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; hours for testing, up to &amp;lt;code&amp;gt;192&amp;lt;/code&amp;gt; for long jobs&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores (adjust based on workload)&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16&amp;lt;/code&amp;gt; GB for data science, &amp;lt;code&amp;gt;32&amp;lt;/code&amp;gt; GB for large datasets&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your project folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For GPU-accelerated deep learning, select the '''gpu''' partition and specify number of GPUs needed.}}&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Wait ===&lt;br /&gt;
# Click '''Launch''' button&lt;br /&gt;
# Wait for job to start (Status: &amp;quot;Queued&amp;quot; → &amp;quot;Running&amp;quot;)&lt;br /&gt;
# Click '''Connect to JupyterLab''' button when available (typically 30-60 seconds)&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Running.png|thumb|600px|center|Session card showing &amp;quot;Running&amp;quot; status with Connect button]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Creating Your First Notebook ===&lt;br /&gt;
# Click '''File → New → Notebook''' or click the '''Python 3''' tile in the Launcher&lt;br /&gt;
# Select kernel: Python 3, R, or Julia (if available)&lt;br /&gt;
# Start writing code in cells&lt;br /&gt;
&lt;br /&gt;
[[File:JupyterLab_New_Notebook.png|thumb|600px|center|Creating a new notebook in JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Basic Cell Operations ===&lt;br /&gt;
&lt;br /&gt;
Notebooks consist of cells where you can write and execute code. Here is a simple example to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code python&amp;gt;&lt;br /&gt;
 # Code cell - Press Shift+Enter to run&lt;br /&gt;
 import pandas as pd&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 &lt;br /&gt;
 # Create sample data&lt;br /&gt;
 data = pd.DataFrame({&lt;br /&gt;
     'x': range(10),&lt;br /&gt;
     'y': [i**2 for i in range(10)]&lt;br /&gt;
 })&lt;br /&gt;
 &lt;br /&gt;
 # Plot&lt;br /&gt;
 plt.plot(data['x'], data['y'])&lt;br /&gt;
 plt.title('Sample Plot on KENET HPC')&lt;br /&gt;
 plt.show()&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are three main cell types in JupyterLab. '''Code''' cells contain executable code and are the default type. '''Markdown''' cells contain formatted text, equations, and documentation. '''Raw''' cells contain plain text that is not executed or formatted.&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=File:JupyterLab_New_Notebook.png&amp;diff=1464</id>
		<title>File:JupyterLab New Notebook.png</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=File:JupyterLab_New_Notebook.png&amp;diff=1464"/>
				<updated>2026-01-09T08:00:56Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=File:OOD_JupyterLab_Running.png&amp;diff=1463</id>
		<title>File:OOD JupyterLab Running.png</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=File:OOD_JupyterLab_Running.png&amp;diff=1463"/>
				<updated>2026-01-09T07:59:17Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=File:OOD_JupyterLab_Form.png&amp;diff=1462</id>
		<title>File:OOD JupyterLab Form.png</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=File:OOD_JupyterLab_Form.png&amp;diff=1462"/>
				<updated>2026-01-09T07:57:32Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=File:OOD_JupyterLab_Menu.png&amp;diff=1461</id>
		<title>File:OOD JupyterLab Menu.png</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=File:OOD_JupyterLab_Menu.png&amp;diff=1461"/>
				<updated>2026-01-09T07:53:11Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1460</id>
		<title>Jupyter</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1460"/>
				<updated>2026-01-09T07:39:45Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= JupyterLab (Web) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''JupyterLab''' is an interactive web-based environment for notebooks, code, and data, ideal for data science, scientific computing, and machine learning workflows.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:'''&lt;br /&gt;
* Interactive data analysis and visualization&lt;br /&gt;
* Machine learning model development and experimentation&lt;br /&gt;
* Creating reproducible research notebooks&lt;br /&gt;
* Teaching and sharing computational narratives&lt;br /&gt;
* Real-time data exploration with GPU acceleration&lt;br /&gt;
&lt;br /&gt;
'''Access:''' Available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using JupyterLab, ensure you have:&lt;br /&gt;
* Active KENET HPC cluster account&lt;br /&gt;
* Access to Open OnDemand portal&lt;br /&gt;
* Basic knowledge of Python, R, or Julia&lt;br /&gt;
* Data files stored in &amp;lt;code&amp;gt;/home/username/localscratch&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching JupyterLab ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
# Log into Open OnDemand: https://ondemand.vlab.ac.ke&lt;br /&gt;
# Click '''Interactive Apps''' in the top navigation menu&lt;br /&gt;
# Select '''JupyterLab''' from the dropdown list&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Menu.png|thumb|600px|center|Navigate to Interactive Apps → JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
Fill in the job submission form with your requirements:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; (CPU) or &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; (GPU tasks)&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; hours for testing, up to &amp;lt;code&amp;gt;192&amp;lt;/code&amp;gt; for long jobs&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores (adjust based on workload)&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16&amp;lt;/code&amp;gt; GB for data science, &amp;lt;code&amp;gt;32&amp;lt;/code&amp;gt; GB for large datasets&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your project folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For GPU-accelerated deep learning, select the '''gpu''' partition and specify number of GPUs needed.}}&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Wait ===&lt;br /&gt;
# Click '''Launch''' button&lt;br /&gt;
# Wait for job to start (Status: &amp;quot;Queued&amp;quot; → &amp;quot;Running&amp;quot;)&lt;br /&gt;
# Click '''Connect to JupyterLab''' button when available (typically 30-60 seconds)&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Running.png|thumb|600px|center|Session card showing &amp;quot;Running&amp;quot; status with Connect button]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Creating Your First Notebook ===&lt;br /&gt;
# Click '''File → New → Notebook''' or click the '''Python 3''' tile in the Launcher&lt;br /&gt;
# Select kernel: Python 3, R, or Julia (if available)&lt;br /&gt;
# Start writing code in cells&lt;br /&gt;
&lt;br /&gt;
[[File:JupyterLab_New_Notebook.png|thumb|600px|center|Creating a new notebook in JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Basic Cell Operations ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Code cell - Press Shift+Enter to run&lt;br /&gt;
import pandas as pd&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
# Create sample data&lt;br /&gt;
data = pd.DataFrame({&lt;br /&gt;
    'x': range(10),&lt;br /&gt;
    'y': [i**2 for i in range(10)]&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
# Plot&lt;br /&gt;
plt.plot(data['x'], data['y'])&lt;br /&gt;
plt.title('Sample Plot on KENET HPC')&lt;br /&gt;
plt.show()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1459</id>
		<title>Jupyter</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Jupyter&amp;diff=1459"/>
				<updated>2026-01-09T07:35:22Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: Created page with &amp;quot;= JupyterLab (Web) Tutorial - KENET HPC Cluster =  == Overview == '''JupyterLab''' is an interactive web-based environment for notebooks, code, and data, ideal for data scienc...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= JupyterLab (Web) Tutorial - KENET HPC Cluster =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
'''JupyterLab''' is an interactive web-based environment for notebooks, code, and data, ideal for data science, scientific computing, and machine learning workflows.&lt;br /&gt;
&lt;br /&gt;
'''Use Cases:'''&lt;br /&gt;
* Interactive data analysis and visualization&lt;br /&gt;
* Machine learning model development and experimentation&lt;br /&gt;
* Creating reproducible research notebooks&lt;br /&gt;
* Teaching and sharing computational narratives&lt;br /&gt;
* Real-time data exploration with GPU acceleration&lt;br /&gt;
&lt;br /&gt;
'''Access:''' Available through the KENET Open OnDemand web portal at https://ondemand.vlab.ac.ke&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before using JupyterLab, ensure you have:&lt;br /&gt;
* Active KENET HPC cluster account&lt;br /&gt;
* Access to Open OnDemand portal&lt;br /&gt;
* Basic knowledge of Python, R, or Julia&lt;br /&gt;
* Data files stored in &amp;lt;code&amp;gt;/home/username/localscratch&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Launching JupyterLab ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Access Interactive Apps ===&lt;br /&gt;
# Log into Open OnDemand: https://ondemand.vlab.ac.ke&lt;br /&gt;
# Click '''Interactive Apps''' in the top navigation menu&lt;br /&gt;
# Select '''JupyterLab''' from the dropdown list&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Menu.png|thumb|600px|center|Navigate to Interactive Apps → JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Configure Job Parameters ===&lt;br /&gt;
Fill in the job submission form with your requirements:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description !! Recommended Value&lt;br /&gt;
|-&lt;br /&gt;
| '''Partition''' || Queue for job execution || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; (CPU) or &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; (GPU tasks)&lt;br /&gt;
|-&lt;br /&gt;
| '''Walltime''' || Maximum runtime in hours || &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; hours for testing, up to &amp;lt;code&amp;gt;192&amp;lt;/code&amp;gt; for long jobs&lt;br /&gt;
|-&lt;br /&gt;
| '''CPU Cores''' || Number of processor cores || &amp;lt;code&amp;gt;4-8&amp;lt;/code&amp;gt; cores (adjust based on workload)&lt;br /&gt;
|-&lt;br /&gt;
| '''Memory''' || RAM allocation || &amp;lt;code&amp;gt;16&amp;lt;/code&amp;gt; GB for data science, &amp;lt;code&amp;gt;32&amp;lt;/code&amp;gt; GB for large datasets&lt;br /&gt;
|-&lt;br /&gt;
| '''Working Directory''' || Starting directory || &amp;lt;code&amp;gt;/home/username&amp;lt;/code&amp;gt; or your project folder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Form.png|thumb|600px|center|Job configuration form with recommended settings]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For GPU-accelerated deep learning, select the '''gpu''' partition and specify number of GPUs needed.}}&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Submit and Wait ===&lt;br /&gt;
# Click '''Launch''' button&lt;br /&gt;
# Wait for job to start (Status: &amp;quot;Queued&amp;quot; → &amp;quot;Running&amp;quot;)&lt;br /&gt;
# Click '''Connect to JupyterLab''' button when available (typically 30-60 seconds)&lt;br /&gt;
&lt;br /&gt;
[[File:OOD_JupyterLab_Running.png|thumb|600px|center|Session card showing &amp;quot;Running&amp;quot; status with Connect button]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
=== Creating Your First Notebook ===&lt;br /&gt;
# Click '''File → New → Notebook''' or click the '''Python 3''' tile in the Launcher&lt;br /&gt;
# Select kernel: Python 3, R, or Julia (if available)&lt;br /&gt;
# Start writing code in cells&lt;br /&gt;
&lt;br /&gt;
[[File:JupyterLab_New_Notebook.png|thumb|600px|center|Creating a new notebook in JupyterLab]]&lt;br /&gt;
&lt;br /&gt;
=== Basic Cell Operations ===&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=KENET_Open_OnDemand&amp;diff=1458</id>
		<title>KENET Open OnDemand</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=KENET_Open_OnDemand&amp;diff=1458"/>
				<updated>2026-01-09T07:24:41Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''KENET Provides Accessible HPC using Open Ondemand''' &lt;br /&gt;
This document will assist you to learn how to access and use the Open Ondemand  facility provided by KENET.&lt;br /&gt;
Access is provided using a set of dedicated interfaces for each tool, blending web browser or remote desktop approaches to make it convenient to use the cluster. Below is a list of available Open Ondemand applications.&lt;br /&gt;
&lt;br /&gt;
* [[code server|VS Code (Web) ]]&lt;br /&gt;
* [[jupyter| JupyterLab (web) ]]&lt;br /&gt;
* [[mlflow| mlflow (Web) ]]&lt;br /&gt;
* [[tensorboard | Tensorboard (Web)]]&lt;br /&gt;
* [[R studio | R Studio (Web)]]&lt;br /&gt;
* [[pspp| PSPP (In JupyterLab Web) ]]&lt;br /&gt;
* [[octave| Octave (Remote Desktop)]]&lt;br /&gt;
* [[ qgis | QGIS (Remote Desktop)]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=KENET_Open_OnDemand&amp;diff=1457</id>
		<title>KENET Open OnDemand</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=KENET_Open_OnDemand&amp;diff=1457"/>
				<updated>2026-01-09T07:21:52Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''KENET Provides Accessible HPC using Open Ondemand''' &lt;br /&gt;
This document will assist you to learn how to access and use the Open Ondemand  facility provided by KENET.&lt;br /&gt;
Access is provided using a set of dedicated interfaces for each tool, blending web browser or remote desktop approaches to make it convenient to use the cluster. Below is a list of available Open Ondemand applications.&lt;br /&gt;
&lt;br /&gt;
* [[code server|VS Code (Web) ]]&lt;br /&gt;
* [[jupyter| JupyterLab (web) ]]&lt;br /&gt;
* [[mlflow| mlflow (Web) ]]&lt;br /&gt;
* [[tensorboard | Tensorboard (Web)]]&lt;br /&gt;
* [[pspp| PSPP (In JupyterLab Web) ]]&lt;br /&gt;
* [[octave| Octave (Remote Desktop)]]&lt;br /&gt;
* [[ qgis | QGIS (Remote Desktop)]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=HPC_Usage&amp;diff=1456</id>
		<title>HPC Usage</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=HPC_Usage&amp;diff=1456"/>
				<updated>2026-01-08T19:31:14Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Welcome to the KENET HPC usage Wiki'''&lt;br /&gt;
&lt;br /&gt;
KENET, as part of its mission to advance education and research, provides a set of advanced computing facilities to researchers at member institutions, as well as facilitating access to world class facilities for computing around the world. &lt;br /&gt;
This document will assist you to learn how to access and use the HPC facility provided by KENET. &lt;br /&gt;
&lt;br /&gt;
* [[About|About]]&lt;br /&gt;
* [[Requesting For Access|Requesting For Access]]&lt;br /&gt;
* [[Remote Login|Remote Login]]&lt;br /&gt;
* [[ Slurm| Slurm]]&lt;br /&gt;
* [[Basic Usage: CPU Based Resources With Slurm|Basic usage: CPU Based Resources With Slurm]]&lt;br /&gt;
* [[Basic Usage: GPU Based Resources With Slurm|Basic usage: GPU Based Resources With Slurm]]&lt;br /&gt;
* [[Intermediate Usage: PyTorch and Tensorflow|Intermediate usage: PyTorch and Tensorflow  With Conda, Custom packages with pip ]]&lt;br /&gt;
* [[Module system|Intermediate usage: Module System And Available Codes]]&lt;br /&gt;
* [[Debuging and Interactive Slurm Jobs|Intermediate usage: Interactive Slurm Jobs, Testing and Iteration, Interactive ssh access to compute nodes]]&lt;br /&gt;
* [[Advanced Usage|Advanced Usage]]&lt;br /&gt;
* [[How to Get Help|How to Get Help]]&lt;br /&gt;
* [[Thematic Examples|Thematic Examples]]&lt;br /&gt;
* [[GPU Cloud VMs| GPU Cloud VMs]]&lt;br /&gt;
* [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=HPC_Usage&amp;diff=1455</id>
		<title>HPC Usage</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=HPC_Usage&amp;diff=1455"/>
				<updated>2026-01-08T19:28:21Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Welcome to the KENET HPC usage Wiki'''&lt;br /&gt;
&lt;br /&gt;
KENET, as part of its mission to advance education and research, provides a set of advanced computing facilities to researchers at member institutions, as well as facilitating access to world class facilities for computing around the world. &lt;br /&gt;
This document will assist you to learn how to access and use the HPC facility provided by KENET. &lt;br /&gt;
&lt;br /&gt;
* [[About|About]]&lt;br /&gt;
* [[Requesting For Access|Requesting For Access]]&lt;br /&gt;
* [[Remote Login|Remote Login]]&lt;br /&gt;
* [[ Slurm| Slurm]]&lt;br /&gt;
* [[Basic Usage: CPU Based Resources With Slurm|Basic usage: CPU Based Resources With Slurm]]&lt;br /&gt;
* [[Basic Usage: GPU Based Resources With Slurm|Basic usage: GPU Based Resources With Slurm]]&lt;br /&gt;
* [[Intermediate Usage: PyTorch and Tensorflow|Intermediate usage: PyTorch and Tensorflow  With Conda ]]&lt;br /&gt;
* [[Module system|Intermediate usage: Module System And Available Codes]]&lt;br /&gt;
* [[Debuging and Interactive Slurm Jobs|Intermediate usage: Interactive Slurm Jobs, Testing and Iteration]]&lt;br /&gt;
* [[Advanced Usage|Advanced Usage]]&lt;br /&gt;
* [[How to Get Help|How to Get Help]]&lt;br /&gt;
* [[Thematic Examples|Thematic Examples]]&lt;br /&gt;
* [[GPU Cloud VMs| GPU Cloud VMs]]&lt;br /&gt;
* [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=KENET_Open_OnDemand&amp;diff=1454</id>
		<title>KENET Open OnDemand</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=KENET_Open_OnDemand&amp;diff=1454"/>
				<updated>2026-01-08T19:27:23Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''KENET Provides Accessible HPC using Open Ondemand''' &lt;br /&gt;
This document will assist you to learn how to access and use the Open Ondemand  facility provided by KENET.&lt;br /&gt;
Access is provided using a set of dedicated interfaces for each tool, blending web browser or remote desktop approaches to make it convenient to use the cluster. Below is a list of available Open Ondemand applications.&lt;br /&gt;
&lt;br /&gt;
* [[code server|VS Code ]]&lt;br /&gt;
* [[jupyter| JupyterLab (web) ]]&lt;br /&gt;
* [[mlflow| mlflow (Web) ]]&lt;br /&gt;
* [[octave| Octave (Remote Desktop)]]&lt;br /&gt;
* [[ qgis | QGIS (Remote Desktop)]]&lt;br /&gt;
* [[tensorboard | Tensorboard (Web)]]&lt;br /&gt;
* [[pspp| PSPP (In JupyterLab Web) ]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=KENET_Open_OnDemand&amp;diff=1453</id>
		<title>KENET Open OnDemand</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=KENET_Open_OnDemand&amp;diff=1453"/>
				<updated>2026-01-08T19:25:45Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: Created page with &amp;quot;'''KENET Provides Accessible HPC using Open Ondemand''' This document will assist you to learn how to access and use the Open Ondemand  facility provided by KENET.  * code s...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''KENET Provides Accessible HPC using Open Ondemand'''&lt;br /&gt;
This document will assist you to learn how to access and use the Open Ondemand  facility provided by KENET.&lt;br /&gt;
&lt;br /&gt;
* [[code server|VS Code ]]&lt;br /&gt;
* [[jupyter| JupyterLab (web) ]]&lt;br /&gt;
* [[mlflow| mlflow (Web) ]]&lt;br /&gt;
* [[octave| Octave (Remote Desktop)]]&lt;br /&gt;
* [[ qgis | QGIS (Remote Desktop)]]&lt;br /&gt;
* [[tensorboard | Tensorboard (Web)]]&lt;br /&gt;
* [[pspp| PSPP (In JupyterLab Web) ]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=HPC_Usage&amp;diff=1452</id>
		<title>HPC Usage</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=HPC_Usage&amp;diff=1452"/>
				<updated>2026-01-08T19:19:31Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Welcome to the KENET HPC usage Wiki'''&lt;br /&gt;
&lt;br /&gt;
KENET, as part of its mission to advance education and research, provides a set of advanced computing facilities to researchers at member institutions, as well as facilitating access to world class facilities for computing around the world. &lt;br /&gt;
This document will assist you to learn how to access and use the HPC facility provided by KENET. &lt;br /&gt;
&lt;br /&gt;
* [[About|About]]&lt;br /&gt;
* [[Requesting For Access|Requesting For Access]]&lt;br /&gt;
* [[Remote Login|Remote Login]]&lt;br /&gt;
* [[ Slurm| Slurm]]&lt;br /&gt;
* [[Basic Usage: CPU Based Resources With Slurm|Basic usage: CPU Based Resources With Slurm]]&lt;br /&gt;
* [[Basic Usage: GPU Based Resources With Slurm|Basic usage: GPU Based Resources With Slurm]]&lt;br /&gt;
* [[Intermediate Usage: PyTorch and Tensorflow|Intermediate usage: PyTorch and Tensorflow  With Conda ]]&lt;br /&gt;
* [[Module system| Module System And Available Codes]]&lt;br /&gt;
* [[Debuging and Interactive Slurm Jobs| Interactive Slurm Jobs, Testing and Iteration]]&lt;br /&gt;
* [[Advanced Usage|Advanced Usage]]&lt;br /&gt;
* [[How to Get Help|How to Get Help]]&lt;br /&gt;
* [[Thematic Examples|Thematic Examples]]&lt;br /&gt;
* [[GPU Cloud VMs| GPU Cloud VMs]]&lt;br /&gt;
* [[KENET Open OnDemand | Easy HPC access with KENET Open OnDemand]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1418</id>
		<title>Thematic Examples</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1418"/>
				<updated>2025-10-03T07:48:41Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===== Thematic Examples From Computer Science, Engineering and Computational Modeling and Material Science =====&lt;br /&gt;
We will work through examples based on the following codes:&lt;br /&gt;
# Quantum Espresso  (CMMS)&lt;br /&gt;
# PyTorch  (CS)&lt;br /&gt;
# FluidX3D  (Engineering)&lt;br /&gt;
== CMMS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
=== Quantum Espresso Tutorial ===&lt;br /&gt;
[[File:Quantum_ESPRESSO_logo.jpg|250px]]&lt;br /&gt;
==== Computing The Bandstructure of Silicon ====&lt;br /&gt;
In this tutorial, we will calculate the band structure of bulk Silicon. &lt;br /&gt;
Silicon is a semi-conductor with a small gap. The calculation will proceed through three broad steps, starting from the&lt;br /&gt;
self consistent calculation, the non-self consistent calculation, the bands calculation, and finally the post processing. &lt;br /&gt;
The files required for this exercise can be retreived as follows: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
 $ ls &lt;br /&gt;
 si.band.david.in  si.nscf.david.in  si.plotbands.in  si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We can visualize the structure using tools like VESTA or [http://www.xcrysden.org/ Xcrysden], using the input file that specifies the structure '''si.scf.david.in '''. This can be done on your computer once you install Xcrysden and copy the input to your device as such: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ xcrysden --pwi si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Which gives us this structure visualization:&lt;br /&gt;
 &lt;br /&gt;
[[File:Si-2x2x2.png]]&lt;br /&gt;
&lt;br /&gt;
Showing the typical diamond like tetrahedral structure. &lt;br /&gt;
We now call '''Quantum Espresso''' and run the three steps, this can be performed in one job for simple short calculations, for longer calculations the three steps can be separated into three jobs. Let us create the appropriate submission scripts. This is a simple seof calculations, but we have split it into multiple jobs for the sake of generality.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.scf.david.in &amp;gt; scf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 1scf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 1scf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this has run, we will have some generated outputs, including wavefunctions and the text  file '''scf.out'''. &lt;br /&gt;
Next we prepare the submission script for the  '''nscf''' step, &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_nscf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.nscf.david.in &amp;gt; nscf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 2nscf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 2nscf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this nscf step is done, we now compute the band structure, create the submission script for the '''bands''' calculation:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_bands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1 bands.x -in si.bands.in  &amp;gt; si.bands.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We have the bulk of the computational work done, we now are left with a post processing steps to obtain results, we now use the&lt;br /&gt;
'''plotbands''' executable for this step: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_ppbands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
plotband.x  &amp;lt; si.plotband.in&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will produce some new  visualization data and a postscript plot, '''si_bands.ps''' which should yield an image like this: &lt;br /&gt;
&lt;br /&gt;
[[File:Si_bandstruture.png| 600px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/PaseL5awEl1fcDBwZkDVzpIOb Watch Band Structure Demo] ===&lt;br /&gt;
&lt;br /&gt;
== CS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== Conda Usage on the cluster ====&lt;br /&gt;
[[File:Conda_logo.svg.png|250px]]&lt;br /&gt;
&lt;br /&gt;
Conda is a python based package manager and (python) environment management tool, used to install and manage multiple versions of software packages and tools. Its typical for it to be installed in a single user's account, and active from the moment a user logs in, however, being that this facility  is a cluster, we have opted to provide it to users using our HPC Module system, this should reduce redundancy in the core packages, saving every user from having a local installation in their account. Conda users will have access to all centrally installed packages. &lt;br /&gt;
===== How to activate Conda and View environments =====&lt;br /&gt;
Conda is available in the global list of modules, which can be listed via the '''module avail''' command, meaning until you load the module, the '''conda''' command is not available.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module avail&lt;br /&gt;
  --------------------------- /usr/share/modulefiles --------------------&lt;br /&gt;
   mpi/openmpi-x86_64&lt;br /&gt;
  -------------------- /opt/ohpc/pub/modulefiles --------------------&lt;br /&gt;
  applications/gpu/gromacs/2024.4 ...&lt;br /&gt;
  ... &lt;br /&gt;
  '''applications/gpu/python/conda-25.1.1-python-3.9.21'''&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Let us go a head and load the right module:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We now have the conda command available on the terminal. Let us list the conda environments available by default: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda env list&lt;br /&gt;
 base                 * /opt/ohpc/pub/conda/instdir&lt;br /&gt;
 python-3.9.21          /opt/ohpc/pub/conda/instdir/envs/python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And we can load the '''python-3.9.21''' conda environment, this environment provides a set of key '''ML/AI''' python frameworks, namely '''PyTorch''' and '''Tensorflow'''. &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda activate python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Tools like Pytorch, TensorFlow and others are available in this environment.&lt;br /&gt;
&lt;br /&gt;
[[File:Pytorch_logo.png|100px]] [[File:TensorFlow_logo.svg.png|100px]]  &lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/lJBIZE6tNnTQh9Hu77YXPoNSJ  Watch Conda Demo] === &lt;br /&gt;
&lt;br /&gt;
==== Object Detection Tutorial (YOLO) ====&lt;br /&gt;
We will take a look at a simple object detection exercise with '''YOLO'''. &lt;br /&gt;
Let us get the files needed for the exercise:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now we have to  '''install''' yolo, and use it to run a simple object detection exercise using the code in the file '''objdet.py'''. &lt;br /&gt;
Place the following in a simple text file  'det.job':&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
 conda activate python-3.9.21&lt;br /&gt;
 pip install ultralytics&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples/&lt;br /&gt;
 python3  objdet.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
It should produce two images on the disk, the original and the annotated, showing the object detection: &lt;br /&gt;
&lt;br /&gt;
[[File:bus.jpg|250px]] &lt;br /&gt;
[[File:busan.jpg|250px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/q9cddRGzGNCL3h8tofb66bOCq Watch YOLO Demo] ===&lt;br /&gt;
&lt;br /&gt;
== Engineering Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== FluidX3D Tutorial ====&lt;br /&gt;
[[File:FluidX3d_logo.png|150px]]&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will compute the airflow around a Fan using and implementation of Lattice Boltzmann CDF in [https://github.com/ProjectPhysX/FluidX3D/tree/master FluidX3D]. The geometry to be used will be similar to &lt;br /&gt;
this Fan: [https://www.thingiverse.com/thing:6113/files SOLID BOTTOM]&lt;br /&gt;
&lt;br /&gt;
[[File:FAN_Solid_Bottom_display_large.png|400px]] &lt;br /&gt;
&lt;br /&gt;
FluidX3D is a C++ code with support for GPU acceleration, and requires that we write some code to setup the calculation. Let us retreive the code and data for the calculation: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir cfd&lt;br /&gt;
 $ cd cfd&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ git clone https://github.com/ProjectPhysX/FluidX3D.git&lt;br /&gt;
 $ cp training-examples/{setup.cpp,defines.hpp} FluidX3D/src&lt;br /&gt;
 $ mkdir stl &lt;br /&gt;
 $ wget https://cdn.thingiverse.com/assets/1d/89/dd/cb/fd/FAN_Solid_Bottom.stl?ofn=RkFOX1NvbGlkX0JvdHRvbS5zdGw= -O stl/Fan.stl&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once we have the files, we can load the right modules, and compile the example, place the following in a simple file: &lt;br /&gt;
'''cfd.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load devel/nvidia-hpc/24.11&lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/ &lt;br /&gt;
 cd FluidX3D&lt;br /&gt;
 ./make.sh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And submit it to slurm via  '''cfd.job''', and let it run. &lt;br /&gt;
This will generate the outputs in  '''./bin/export''', this was specified in the '''setup.cpp''' code instructions. We can now convert these snapshots into a video file using FFMPEG especially compiled with GPU support on the cluster, however, only open codecs like libopenh264 are enabled in this ffmpeg module. Place the following in a simple file named '''encode.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/ffmpeg/git &lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/FluidX3D/bin&lt;br /&gt;
 ffmpeg -y -hwaccel cuda  -framerate 60 -pattern_type glob -i &amp;quot;export/image-*.png&amp;quot; -c:v libopenh264   -pix_fmt yuv420p -b:v 24M &amp;quot;video.mp4&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Submit the job via slurm &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ sbatch encode.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once complete, it will produce the following video inside the '''FluidX3D/bin''' directory: &lt;br /&gt;
&lt;br /&gt;
[[File:output_fluid.gif|530px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/s6eVYpg1PkaCgj4aYwQNymLcN Watch CFD Demo] ===&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=HPC_Usage&amp;diff=1417</id>
		<title>HPC Usage</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=HPC_Usage&amp;diff=1417"/>
				<updated>2025-08-12T14:47:20Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Welcome to the KENET HPC usage Wiki'''&lt;br /&gt;
&lt;br /&gt;
KENET, as part of its mission to advance education and research, provides a set of advanced computing facilities to researchers at member institutions, as well as facilitating access to world class facilities for computing around the world. &lt;br /&gt;
This document will assist you to learn how to access and use the HPC facility provided by KENET. &lt;br /&gt;
&lt;br /&gt;
* [[About|About]]&lt;br /&gt;
* [[Requesting For Access|Requesting For Access]]&lt;br /&gt;
* [[Remote Login|Remote Login]]&lt;br /&gt;
* [[ Slurm| Slurm]]&lt;br /&gt;
* [[Basic Usage: CPU Based Resources With Slurm|Basic usage: CPU Based Resources With Slurm]]&lt;br /&gt;
* [[Basic Usage: GPU Based Resources With Slurm|Basic usage: GPU Based Resources With Slurm]]&lt;br /&gt;
* [[Intermediate Usage: PyTorch and Tensorflow|Intermediate usage: PyTorch and Tensorflow  With Conda ]]&lt;br /&gt;
* [[Module system| Module System And Available Codes]]&lt;br /&gt;
* [[Debuging and Interactive Slurm Jobs| Interactive Slurm Jobs, Testing and Iteration]]&lt;br /&gt;
* [[Advanced Usage|Advanced Usage]]&lt;br /&gt;
* [[How to Get Help|How to Get Help]]&lt;br /&gt;
* [[Thematic Examples|Thematic Examples]]&lt;br /&gt;
* [[GPU Cloud VMs| GPU Cloud VMs]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=HPC_Usage&amp;diff=1416</id>
		<title>HPC Usage</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=HPC_Usage&amp;diff=1416"/>
				<updated>2025-08-12T14:46:59Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Welcome to the KENET HPC usage Wiki'''&lt;br /&gt;
&lt;br /&gt;
KENET, as part of its mission to advance education and research, provides a set of advanced computing facilities to researchers at member institutions, as well as facilitating access to world class facilities for computing around the world. &lt;br /&gt;
This document will assist you to learn how to access and use the HPC facility provided by KENET. &lt;br /&gt;
&lt;br /&gt;
* [[About|About]]&lt;br /&gt;
* [[Requesting For Access|Requesting For Access]]&lt;br /&gt;
* [[Remote Login|Remote Login]]&lt;br /&gt;
* [[ Slurm| Slurm]]&lt;br /&gt;
* [[Basic Usage: CPU Based Resources With Slurm|Basic usage: CPU Based Resources With Slurm]]&lt;br /&gt;
* [[Basic Usage: GPU Based Resources With Slurm|Basic usage: GPU Based Resources With Slurm]]&lt;br /&gt;
* [[Intermediate Usage: PyTorch and Tensorflow With Conda|Intermediate usage: PyTorch and Tensorflow ]]&lt;br /&gt;
* [[Module system| Module System And Available Codes]]&lt;br /&gt;
* [[Debuging and Interactive Slurm Jobs| Interactive Slurm Jobs, Testing and Iteration]]&lt;br /&gt;
* [[Advanced Usage|Advanced Usage]]&lt;br /&gt;
* [[How to Get Help|How to Get Help]]&lt;br /&gt;
* [[Thematic Examples|Thematic Examples]]&lt;br /&gt;
* [[GPU Cloud VMs| GPU Cloud VMs]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1415</id>
		<title>Thematic Examples</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1415"/>
				<updated>2025-05-12T20:14:59Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===== Thematic Examples From Computer Science, Engineering and Computational Modeling and Material Science =====&lt;br /&gt;
We will work through examples based on the following codes:&lt;br /&gt;
# Quantum Espresso  (CMMS)&lt;br /&gt;
# PyTorch  (CS)&lt;br /&gt;
# FluidX3D  (Engineering)&lt;br /&gt;
== CMMS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
=== Quantum Espresso Tutorial ===&lt;br /&gt;
[[File:Quantum_ESPRESSO_logo.jpg|250px]]&lt;br /&gt;
==== Computing The Bandstructure of Silicon ====&lt;br /&gt;
In this tutorial, we will calculate the band structure of bulk Silicon. &lt;br /&gt;
Silicon is a semi-conductor with a small gap. The calculation will proceed through three broad steps, starting from the&lt;br /&gt;
self consistent calculation, the non-self consistent calculation, the bands calculation, and finally the post processing. &lt;br /&gt;
The files required for this exercise can be retreived as follows: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
 $ ls &lt;br /&gt;
 si.band.david.in  si.nscf.david.in  si.plotbands.in  si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We can visualize the structure using tools like VESTA or [http://www.xcrysden.org/ Xcrysden], using the input file that specifies the structure '''si.scf.david.in '''. This can be done on your computer once you install Xcrysden and copy the input to your device as such: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ xcrysden --pwi si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Which gives us this structure visualization:&lt;br /&gt;
 &lt;br /&gt;
[[File:Si-2x2x2.png]]&lt;br /&gt;
&lt;br /&gt;
Showing the typical diamond like tetrahedral structure. &lt;br /&gt;
We now call '''Quantum Espresso''' and run the three steps, this can be performed in one job for simple short calculations, for longer calculations the three steps can be separated into three jobs. Let us create the appropriate submission scripts. This is a simple seof calculations, but we have split it into multiple jobs for the sake of generality.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.scf.david.in &amp;gt; scf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 1scf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 1scf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this has run, we will have some generated outputs, including wavefunctions and the text  file '''scf.out'''. &lt;br /&gt;
Next we prepare the submission script for the  '''nscf''' step, &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_nscf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.nscf.david.in &amp;gt; nscf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 2nscf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 2nscf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this nscf step is done, we now compute the band structure, create the submission script for the '''bands''' calculation:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_bands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1 bands.x -in si.bands.in  &amp;gt; si.bands.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We have the bulk of the computational work done, we now are left with a post processing steps to obtain results, we now use the&lt;br /&gt;
'''plotbands''' executable for this step: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_ppbands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
plotband.x  &amp;lt; si.plotband.in&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will produce some new  visualization data and a postscript plot, '''si_bands.ps''' which should yield an image like this: &lt;br /&gt;
&lt;br /&gt;
[[File:Si_bandstruture.png| 600px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/PaseL5awEl1fcDBwZkDVzpIOb Watch Band Structure Demo] ===&lt;br /&gt;
&lt;br /&gt;
== CS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== Conda Usage on the cluster ====&lt;br /&gt;
[[File:Conda_logo.svg.png|250px]]&lt;br /&gt;
&lt;br /&gt;
Conda is a python based package manager and (python) environment management tool, used to install and manage multiple versions of software packages and tools. Its typical for it to be installed in a single user's account, and active from the moment a user logs in, however, being that this facility  is a cluster, we have opted to provide it to users using our HPC Module system, this should reduce redundancy in the core packages, saving every user from having a local installation in their account. Conda users will have access to all centrally installed packages. &lt;br /&gt;
===== How to activate Conda and View environments =====&lt;br /&gt;
Conda is available in the global list of modules, which can be listed via the '''module avail''' command, meaning until you load the module, the '''conda''' command is not available.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module avail&lt;br /&gt;
  --------------------------- /usr/share/modulefiles --------------------&lt;br /&gt;
   mpi/openmpi-x86_64&lt;br /&gt;
  -------------------- /opt/ohpc/pub/modulefiles --------------------&lt;br /&gt;
  applications/gpu/gromacs/2024.4 ...&lt;br /&gt;
  ... &lt;br /&gt;
  '''applications/gpu/python/conda-25.1.1-python-3.9.21'''&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Let us go a head and load the right module:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We now have the conda command available on the terminal. Let us list the conda environments available by default: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda env list&lt;br /&gt;
 base                 * /opt/ohpc/pub/conda/instdir&lt;br /&gt;
 python-3.9.21          /opt/ohpc/pub/conda/instdir/envs/python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And we can load the '''python-3.9.21''' conda environment, this environment provides a set of key '''ML/AI''' python frameworks, namely '''PyTorch''' and '''Tensorflow'''. &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda activate python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Tools like Pytorch, TensorFlow and others are available in this environment.&lt;br /&gt;
&lt;br /&gt;
[[File:Pytorch_logo.png|100px]] [[File:TensorFlow_logo.svg.png|100px]]  &lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/lJBIZE6tNnTQh9Hu77YXPoNSJ  Watch Conda Demo] === &lt;br /&gt;
&lt;br /&gt;
==== Object Detection Tutorial (YOLO) ====&lt;br /&gt;
We will take a look at a simple object detection exercise with '''YOLO'''. &lt;br /&gt;
Let us get the files needed for the exercise:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now we have to  '''install''' yolo, and use it to run a simple object detection exercise using the code in the file '''objdet.py'''. &lt;br /&gt;
Place the following in a simple text file  'det.job':&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
 conda activate python-3.9.21&lt;br /&gt;
 pip install ultralytics&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples/&lt;br /&gt;
 python3  objdet.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
It should produce two images on the disk, the original and the annotated, showing the object detection: &lt;br /&gt;
&lt;br /&gt;
[[File:bus.jpg|250px]] &lt;br /&gt;
[[File:busan.jpg|250px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/q9cddRGzGNCL3h8tofb66bOCq Watch YOLO Demo] ===&lt;br /&gt;
&lt;br /&gt;
== Engineering Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== FluidX3D Tutorial ====&lt;br /&gt;
[[File:FluidX3d_logo.png|150px]]&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will compute the airflow around a Fan using and implementation of Lattice Boltzmann CDF in [https://github.com/ProjectPhysX/FluidX3D/tree/master FluidX3D]. The geometry to be used will be similar to &lt;br /&gt;
this Fan: [https://www.thingiverse.com/thing:6113/files SOLID BOTTOM]&lt;br /&gt;
&lt;br /&gt;
[[File:FAN_Solid_Bottom_display_large.png|400px]] &lt;br /&gt;
&lt;br /&gt;
FluidX3D is a C++ code with support for GPU acceleration, and requires that we write some code to setup the calculation. Let us retreive the code and data for the calculation: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir cfd&lt;br /&gt;
 $ cd cfd&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ https://github.com/ProjectPhysX/FluidX3D.git&lt;br /&gt;
 $ cp training-examples/{setup.cpp,defines.hpp} FluidX3D/src&lt;br /&gt;
 $ mkdir stl &lt;br /&gt;
 $ wget https://cdn.thingiverse.com/assets/1d/89/dd/cb/fd/FAN_Solid_Bottom.stl?ofn=RkFOX1NvbGlkX0JvdHRvbS5zdGw= -O stl/Fan.stl&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once we have the files, we can load the right modules, and compile the example, place the following in a simple file: &lt;br /&gt;
'''cfd.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load devel/nvidia-hpc/24.11&lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/ &lt;br /&gt;
 cd FluidX3D&lt;br /&gt;
 ./make.sh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And submit it to slurm via  '''cfd.job''', and let it run. &lt;br /&gt;
This will generate the outputs in  '''./bin/export''', this was specified in the '''setup.cpp''' code instructions. We can now convert these snapshots into a video file using FFMPEG especially compiled with GPU support on the cluster, however, only open codecs like libopenh264 are enabled in this ffmpeg module. Place the following in a simple file named '''encode.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/ffmpeg/git &lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/FluidX3D/bin&lt;br /&gt;
 ffmpeg -y -hwaccel cuda  -framerate 60 -pattern_type glob -i &amp;quot;export/image-*.png&amp;quot; -c:v libopenh264   -pix_fmt yuv420p -b:v 24M &amp;quot;video.mp4&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Submit the job via slurm &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ sbatch encode.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once complete, it will produce the following video inside the '''FluidX3D/bin''' directory: &lt;br /&gt;
&lt;br /&gt;
[[File:output_fluid.gif|530px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/s6eVYpg1PkaCgj4aYwQNymLcN Watch CFD Demo] ===&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1414</id>
		<title>Thematic Examples</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1414"/>
				<updated>2025-05-12T20:14:41Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===== Thematic Examples From Computer Science, Engineering and Computational Modeling and Material Science =====&lt;br /&gt;
We will work through examples based on the following codes:&lt;br /&gt;
# Quantum Espresso  (CMMS)&lt;br /&gt;
# PyTorch  (CS)&lt;br /&gt;
# FluidX3D  (Engineering)&lt;br /&gt;
== CMMS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
=== Quantum Espresso Tutorial ===&lt;br /&gt;
[[File:Quantum_ESPRESSO_logo.jpg|250px]]&lt;br /&gt;
==== Computing The Bandstructure of Silicon ====&lt;br /&gt;
In this tutorial, we will calculate the band structure of bulk Silicon. &lt;br /&gt;
Silicon is a semi-conductor with a small gap. The calculation will proceed through three broad steps, starting from the&lt;br /&gt;
self consistent calculation, the non-self consistent calculation, the bands calculation, and finally the post processing. &lt;br /&gt;
The files required for this exercise can be retreived as follows: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
 $ ls &lt;br /&gt;
 si.band.david.in  si.nscf.david.in  si.plotbands.in  si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We can visualize the structure using tools like VESTA or [http://www.xcrysden.org/ Xcrysden], using the input file that specifies the structure '''si.scf.david.in '''. This can be done on your computer once you install Xcrysden and copy the input to your device as such: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ xcrysden --pwi si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Which gives us this structure visualization:&lt;br /&gt;
 &lt;br /&gt;
[[File:Si-2x2x2.png]]&lt;br /&gt;
&lt;br /&gt;
Showing the typical diamond like tetrahedral structure. &lt;br /&gt;
We now call '''Quantum Espresso''' and run the three steps, this can be performed in one job for simple short calculations, for longer calculations the three steps can be separated into three jobs. Let us create the appropriate submission scripts. This is a simple seof calculations, but we have split it into multiple jobs for the sake of generality.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.scf.david.in &amp;gt; scf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 1scf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 1scf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this has run, we will have some generated outputs, including wavefunctions and the text  file '''scf.out'''. &lt;br /&gt;
Next we prepare the submission script for the  '''nscf''' step, &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_nscf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.nscf.david.in &amp;gt; nscf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 2nscf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 2nscf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this nscf step is done, we now compute the band structure, create the submission script for the '''bands''' calculation:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_bands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1 bands.x -in si.bands.in  &amp;gt; si.bands.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We have the bulk of the computational work done, we now are left with a post processing steps to obtain results, we now use the&lt;br /&gt;
'''plotbands''' executable for this step: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_ppbands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
plotband.x  &amp;lt; si.plotband.in&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will produce some new  visualization data and a postscript plot, '''si_bands.ps''' which should yield an image like this: &lt;br /&gt;
&lt;br /&gt;
[[File:Si_bandstruture.png| 600px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/PaseL5awEl1fcDBwZkDVzpIOb Watch Band Structure Demo] ===&lt;br /&gt;
&lt;br /&gt;
== CS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== Conda Usage on the cluster ====&lt;br /&gt;
[[File:Conda_logo.svg.png|250px]]&lt;br /&gt;
&lt;br /&gt;
Conda is a python based package manager and (python) environment management tool, used to install and manage multiple versions of software packages and tools. Its typical for it to be installed in a single user's account, and active from the moment a user logs in, however, being that this facility  is a cluster, we have opted to provide it to users using our HPC Module system, this should reduce redundancy in the core packages, saving every user from having a local installation in their account. Conda users will have access to all centrally installed packages. &lt;br /&gt;
===== How to activate Conda and View environments =====&lt;br /&gt;
Conda is available in the global list of modules, which can be listed via the '''module avail''' command, meaning until you load the module, the '''conda''' command is not available.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module avail&lt;br /&gt;
  --------------------------- /usr/share/modulefiles --------------------&lt;br /&gt;
   mpi/openmpi-x86_64&lt;br /&gt;
  -------------------- /opt/ohpc/pub/modulefiles --------------------&lt;br /&gt;
  applications/gpu/gromacs/2024.4 ...&lt;br /&gt;
  ... &lt;br /&gt;
  '''applications/gpu/python/conda-25.1.1-python-3.9.21'''&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Let us go a head and load the right module:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We now have the conda command available on the terminal. Let us list the conda environments available by default: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda env list&lt;br /&gt;
 base                 * /opt/ohpc/pub/conda/instdir&lt;br /&gt;
 python-3.9.21          /opt/ohpc/pub/conda/instdir/envs/python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And we can load the '''python-3.9.21''' conda environment, this environment provides a set of key '''ML/AI''' python frameworks, namely '''PyTorch''' and '''Tensorflow'''. &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda activate python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Tools like Pytorch, TensorFlow and others are available in this environment.&lt;br /&gt;
&lt;br /&gt;
[[File:Pytorch_logo.png|100px]] [[File:TensorFlow_logo.svg.png|100px]]  &lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/lJBIZE6tNnTQh9Hu77YXPoNSJ  Watch Conda Demo] === &lt;br /&gt;
&lt;br /&gt;
==== Object Detection Tutorial (YOLO) ====&lt;br /&gt;
We will take a look at a simple object detection exercise with '''YOLO'''. &lt;br /&gt;
Let us get the files needed for the exercise:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now we have to  '''install''' yolo, and use it to run a simple object detection exercise using the code in the file '''objdet.py'''. &lt;br /&gt;
Place the following in a simple text file  'det.job':&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
 conda activate python-3.9.21&lt;br /&gt;
 pip install ultralytics&lt;br /&gt;
&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples/&lt;br /&gt;
 python3  objdet.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
It should produce two images on the disk, the original and the annotated, showing the object detection: &lt;br /&gt;
&lt;br /&gt;
[[File:bus.jpg|250px]] &lt;br /&gt;
[[File:busan.jpg|250px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/q9cddRGzGNCL3h8tofb66bOCq Watch YOLO Demo] ===&lt;br /&gt;
&lt;br /&gt;
== Engineering Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== FluidX3D Tutorial ====&lt;br /&gt;
[[File:FluidX3d_logo.png|150px]]&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will compute the airflow around a Fan using and implementation of Lattice Boltzmann CDF in [https://github.com/ProjectPhysX/FluidX3D/tree/master FluidX3D]. The geometry to be used will be similar to &lt;br /&gt;
this Fan: [https://www.thingiverse.com/thing:6113/files SOLID BOTTOM]&lt;br /&gt;
&lt;br /&gt;
[[File:FAN_Solid_Bottom_display_large.png|400px]] &lt;br /&gt;
&lt;br /&gt;
FluidX3D is a C++ code with support for GPU acceleration, and requires that we write some code to setup the calculation. Let us retreive the code and data for the calculation: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir cfd&lt;br /&gt;
 $ cd cfd&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ https://github.com/ProjectPhysX/FluidX3D.git&lt;br /&gt;
 $ cp training-examples/{setup.cpp,defines.hpp} FluidX3D/src&lt;br /&gt;
 $ mkdir stl &lt;br /&gt;
 $ wget https://cdn.thingiverse.com/assets/1d/89/dd/cb/fd/FAN_Solid_Bottom.stl?ofn=RkFOX1NvbGlkX0JvdHRvbS5zdGw= -O stl/Fan.stl&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once we have the files, we can load the right modules, and compile the example, place the following in a simple file: &lt;br /&gt;
'''cfd.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load devel/nvidia-hpc/24.11&lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/ &lt;br /&gt;
 cd FluidX3D&lt;br /&gt;
 ./make.sh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And submit it to slurm via  '''cfd.job''', and let it run. &lt;br /&gt;
This will generate the outputs in  '''./bin/export''', this was specified in the '''setup.cpp''' code instructions. We can now convert these snapshots into a video file using FFMPEG especially compiled with GPU support on the cluster, however, only open codecs like libopenh264 are enabled in this ffmpeg module. Place the following in a simple file named '''encode.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/ffmpeg/git &lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/FluidX3D/bin&lt;br /&gt;
 ffmpeg -y -hwaccel cuda  -framerate 60 -pattern_type glob -i &amp;quot;export/image-*.png&amp;quot; -c:v libopenh264   -pix_fmt yuv420p -b:v 24M &amp;quot;video.mp4&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Submit the job via slurm &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ sbatch encode.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once complete, it will produce the following video inside the '''FluidX3D/bin''' directory: &lt;br /&gt;
&lt;br /&gt;
[[File:output_fluid.gif|530px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/s6eVYpg1PkaCgj4aYwQNymLcN Watch CFD Demo] ===&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Basic_Usage:_CPU_Based_Resources_With_Slurm&amp;diff=1413</id>
		<title>Basic Usage: CPU Based Resources With Slurm</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Basic_Usage:_CPU_Based_Resources_With_Slurm&amp;diff=1413"/>
				<updated>2025-05-12T19:43:57Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Slurm_logo.svg.png|150px]]&lt;br /&gt;
&lt;br /&gt;
== Simple  commands with SLURM ==&lt;br /&gt;
You can obtain information on the Slurm  &amp;quot;Partitions&amp;quot; that accept jobs using the sinfo command&lt;br /&gt;
&amp;lt;code  bash&amp;gt;&lt;br /&gt;
    $ sinfo&lt;br /&gt;
    PARTITION AVAIL  TIMELIMIT  NODES  STATE NODELIST&lt;br /&gt;
    test         up       1:00      1   idle gnt-usiu-gpu-00.kenet.or.ke&lt;br /&gt;
    gpu1         up 1-00:00:00      1   idle gnt-usiu-gpu-00.kenet.or.ke&lt;br /&gt;
    normal*      up 1-00:00:00      1   idle gnt-usiu-gpu-00.kenet.or.ke&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The test partition is reserved for testing, with a very short time limit. The normal partition is to be used for CPU only jobs, &lt;br /&gt;
and the gpu1 queue is reserved for GPU jobs. Both production partitions have a time limit of 24 hours at a time for individual&lt;br /&gt;
jobs. &lt;br /&gt;
&lt;br /&gt;
== Showing The Queue ==&lt;br /&gt;
The squeue slurm command will list all submitted jobs, and will give you an indication of how busy the cluster is, as well as the status of all running or waiting jobs. Jobs that are complete will exit the queue and will not be in this list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
    $ squeue &lt;br /&gt;
    JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)&lt;br /&gt;
     63    normal     gpu1   jotuya  R       0:03      1 gnt-usiu-gpu-00.kenet.or.ke&lt;br /&gt;
    $&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Quantum_ESPRESSO_logo.jpg|250px]]&lt;br /&gt;
&lt;br /&gt;
== Submitting Your first Job ==&lt;br /&gt;
==== Create a submission script For Quantum Espresso ====&lt;br /&gt;
You require a submission script, which is a plain text file with all the instructions for the command you intend to run.&lt;br /&gt;
Retrieve the example files in your scratch directory from this [https://github.com/Materials-Modelling-Group/training-examples github repository ]&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  cd ~/localscratch/&lt;br /&gt;
  git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
  cd  training-examples&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and in this directory we will place the following text content in a file:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 &lt;br /&gt;
 #SBATCH -J testjob               # Job name&lt;br /&gt;
 #SBATCH -o job.%j.out         # Name of stdout output file (%j expands to jobId)&lt;br /&gt;
 #SBATCH -e %j.err             # Name of std err&lt;br /&gt;
 #SBATCH --partition=normal    # Queue&lt;br /&gt;
 #SBATCH --nodes=1             # Total number of nodes requested&lt;br /&gt;
 #SBATCH --cpus-per-task=1     # &lt;br /&gt;
 #SBATCH --time=00:03:00        # Run time (hh:mm:ss) - 1.5 hours&lt;br /&gt;
   &lt;br /&gt;
 # Launch MPI-based executable&lt;br /&gt;
 module load applications/qespresso/7.3.1 &lt;br /&gt;
  &lt;br /&gt;
 cd $HOME/localscratch/training-examples &lt;br /&gt;
 mpirun -np 4  pw.x &amp;lt;al.scf.david.in &amp;gt; output.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Put this in a file called *test.slurm*&lt;br /&gt;
&lt;br /&gt;
==== Submitting the Job to the Queue ====&lt;br /&gt;
The slurm sbatch command provides the means to submit batch jobs to the queue:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
    $ sbatch  test.slurm &lt;br /&gt;
    Submitted batch job 64&lt;br /&gt;
    $&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will run the named program on four 4 cores, note that the parallelism is built into the program, if the program itself is not parallelised, running on multiple cores will not provide any benefit.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [https://asciinema.org/a/uN4JgasyfUJlKlkgiBSUBtkmN  Watch Demo] ==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next:&lt;br /&gt;
[[Basic_Usage:_GPU_Based_Resources_With_Slurm| Basic_Usage:_GPU_Based_Resources_With_Slurm]]&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Basic_Usage:_CPU_Based_Resources_With_Slurm&amp;diff=1412</id>
		<title>Basic Usage: CPU Based Resources With Slurm</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Basic_Usage:_CPU_Based_Resources_With_Slurm&amp;diff=1412"/>
				<updated>2025-05-12T19:43:33Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Slurm_logo.svg.png|150px]]&lt;br /&gt;
&lt;br /&gt;
== Simple  commands with SLURM ==&lt;br /&gt;
You can obtain information on the Slurm  &amp;quot;Partitions&amp;quot; that accept jobs using the sinfo command&lt;br /&gt;
&amp;lt;code  bash&amp;gt;&lt;br /&gt;
    $ sinfo&lt;br /&gt;
    PARTITION AVAIL  TIMELIMIT  NODES  STATE NODELIST&lt;br /&gt;
    test         up       1:00      1   idle gnt-usiu-gpu-00.kenet.or.ke&lt;br /&gt;
    gpu1         up 1-00:00:00      1   idle gnt-usiu-gpu-00.kenet.or.ke&lt;br /&gt;
    normal*      up 1-00:00:00      1   idle gnt-usiu-gpu-00.kenet.or.ke&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The test partition is reserved for testing, with a very short time limit. The normal partition is to be used for CPU only jobs, &lt;br /&gt;
and the gpu1 queue is reserved for GPU jobs. Both production partitions have a time limit of 24 hours at a time for individual&lt;br /&gt;
jobs. &lt;br /&gt;
&lt;br /&gt;
== Showing The Queue ==&lt;br /&gt;
The squeue slurm command will list all submitted jobs, and will give you an indication of how busy the cluster is, as well as the status of all running or waiting jobs. Jobs that are complete will exit the queue and will not be in this list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
    $ squeue &lt;br /&gt;
    JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)&lt;br /&gt;
     63    normal     gpu1   jotuya  R       0:03      1 gnt-usiu-gpu-00.kenet.or.ke&lt;br /&gt;
    $&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Quantum_ESPRESSO_logo.jpg|250px]]&lt;br /&gt;
&lt;br /&gt;
== Submitting Your first Job ==&lt;br /&gt;
==== Create a submission script For Quantum Espresso ====&lt;br /&gt;
You require a submission script, which is a plain text file with all the instructions for the command you intend to run.&lt;br /&gt;
Retreive the example files in your scratch directory from this [https://github.com/Materials-Modelling-Group/training-examples | github repository ]&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
  cd ~/localscratch/&lt;br /&gt;
  git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
  cd  training-examples&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and in this directory we will place the following text content in a file:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 &lt;br /&gt;
 #SBATCH -J testjob               # Job name&lt;br /&gt;
 #SBATCH -o job.%j.out         # Name of stdout output file (%j expands to jobId)&lt;br /&gt;
 #SBATCH -e %j.err             # Name of std err&lt;br /&gt;
 #SBATCH --partition=normal    # Queue&lt;br /&gt;
 #SBATCH --nodes=1             # Total number of nodes requested&lt;br /&gt;
 #SBATCH --cpus-per-task=1     # &lt;br /&gt;
 #SBATCH --time=00:03:00        # Run time (hh:mm:ss) - 1.5 hours&lt;br /&gt;
   &lt;br /&gt;
 # Launch MPI-based executable&lt;br /&gt;
 module load applications/qespresso/7.3.1 &lt;br /&gt;
  &lt;br /&gt;
 cd $HOME/localscratch/training-examples &lt;br /&gt;
 mpirun -np 4  pw.x &amp;lt;al.scf.david.in &amp;gt; output.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Put this in a file called *test.slurm*&lt;br /&gt;
&lt;br /&gt;
==== Submitting the Job to the Queue ====&lt;br /&gt;
The slurm sbatch command provides the means to submit batch jobs to the queue:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
    $ sbatch  test.slurm &lt;br /&gt;
    Submitted batch job 64&lt;br /&gt;
    $&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will run the named program on four 4 cores, note that the parallelism is built into the program, if the program itself is not parallelised, running on multiple cores will not provide any benefit.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [https://asciinema.org/a/uN4JgasyfUJlKlkgiBSUBtkmN  Watch Demo] ==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next:&lt;br /&gt;
[[Basic_Usage:_GPU_Based_Resources_With_Slurm| Basic_Usage:_GPU_Based_Resources_With_Slurm]]&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1411</id>
		<title>Thematic Examples</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1411"/>
				<updated>2025-05-12T19:20:20Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===== Thematic Examples From Computer Science, Engineering and Computational Modeling and Material Science =====&lt;br /&gt;
We will work through examples based on the following codes:&lt;br /&gt;
# Quantum Espresso  (CMMS)&lt;br /&gt;
# PyTorch  (CS)&lt;br /&gt;
# FluidX3D  (Engineering)&lt;br /&gt;
== CMMS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
=== Quantum Espresso Tutorial ===&lt;br /&gt;
[[File:Quantum_ESPRESSO_logo.jpg|250px]]&lt;br /&gt;
==== Computing The Bandstructure of Silicon ====&lt;br /&gt;
In this tutorial, we will calculate the band structure of bulk Silicon. &lt;br /&gt;
Silicon is a semi-conductor with a small gap. The calculation will proceed through three broad steps, starting from the&lt;br /&gt;
self consistent calculation, the non-self consistent calculation, the bands calculation, and finally the post processing. &lt;br /&gt;
The files required for this exercise can be retreived as follows: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
 $ ls &lt;br /&gt;
 si.band.david.in  si.nscf.david.in  si.plotbands.in  si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We can visualize the structure using tools like VESTA or [http://www.xcrysden.org/ Xcrysden], using the input file that specifies the structure '''si.scf.david.in '''. This can be done on your computer once you install Xcrysden and copy the input to your device as such: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ xcrysden --pwi si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Which gives us this structure visualization:&lt;br /&gt;
 &lt;br /&gt;
[[File:Si-2x2x2.png]]&lt;br /&gt;
&lt;br /&gt;
Showing the typical diamond like tetrahedral structure. &lt;br /&gt;
We now call '''Quantum Espresso''' and run the three steps, this can be performed in one job for simple short calculations, for longer calculations the three steps can be separated into three jobs. Let us create the appropriate submission scripts. This is a simple seof calculations, but we have split it into multiple jobs for the sake of generality.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.scf.david.in &amp;gt; scf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 1scf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 1scf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this has run, we will have some generated outputs, including wavefunctions and the text  file '''scf.out'''. &lt;br /&gt;
Next we prepare the submission script for the  '''nscf''' step, &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_nscf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.nscf.david.in &amp;gt; nscf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 2nscf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 2nscf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this nscf step is done, we now compute the band structure, create the submission script for the '''bands''' calculation:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_bands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1 bands.x -in si.bands.in  &amp;gt; si.bands.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We have the bulk of the computational work done, we now are left with a post processing steps to obtain results, we now use the&lt;br /&gt;
'''plotbands''' executable for this step: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_ppbands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
plotband.x  &amp;lt; si.plotband.in&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will produce some new  visualization data and a postscript plot, '''si_bands.ps''' which should yield an image like this: &lt;br /&gt;
&lt;br /&gt;
[[File:Si_bandstruture.png| 600px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/PaseL5awEl1fcDBwZkDVzpIOb Watch Band Structure Demo] ===&lt;br /&gt;
&lt;br /&gt;
== CS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== Conda Usage on the cluster ====&lt;br /&gt;
[[File:Conda_logo.svg.png|250px]]&lt;br /&gt;
&lt;br /&gt;
Conda is a python based package manager and (python) environment management tool, used to install and manage multiple versions of software packages and tools. Its typical for it to be installed in a single user's account, and active from the moment a user logs in, however, being that this facility  is a cluster, we have opted to provide it to users using our HPC Module system, this should reduce redundancy in the core packages, saving every user from having a local installation in their account. Conda users will have access to all centrally installed packages. &lt;br /&gt;
===== How to activate Conda and View environments =====&lt;br /&gt;
Conda is available in the global list of modules, which can be listed via the '''module avail''' command, meaning until you load the module, the '''conda''' command is not available.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module avail&lt;br /&gt;
  --------------------------- /usr/share/modulefiles --------------------&lt;br /&gt;
   mpi/openmpi-x86_64&lt;br /&gt;
  -------------------- /opt/ohpc/pub/modulefiles --------------------&lt;br /&gt;
  applications/gpu/gromacs/2024.4 ...&lt;br /&gt;
  ... &lt;br /&gt;
  '''applications/gpu/python/conda-25.1.1-python-3.9.21'''&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Let us go a head and load the right module:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We now have the conda command available on the terminal. Let us list the conda environments available by default: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda env list&lt;br /&gt;
 base                 * /opt/ohpc/pub/conda/instdir&lt;br /&gt;
 python-3.9.21          /opt/ohpc/pub/conda/instdir/envs/python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And we can load the '''python-3.9.21''' conda environment, this environment provides a set of key '''ML/AI''' python frameworks, namely '''PyTorch''' and '''Tensorflow'''. &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda activate python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Tools like Pytorch, TensorFlow and others are available in this environment.&lt;br /&gt;
&lt;br /&gt;
[[File:Pytorch_logo.png|100px]] [[File:TensorFlow_logo.svg.png|100px]]  &lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/lJBIZE6tNnTQh9Hu77YXPoNSJ  Watch Conda Demo] === &lt;br /&gt;
&lt;br /&gt;
==== Object Detection Tutorial (YOLO) ====&lt;br /&gt;
We will take a look at a simple object detection exercise with '''YOLO'''. &lt;br /&gt;
Let us get the files needed for the exercise:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now we have to  '''install''' yolo, and use it to run a simple object detection exercise using the code in the file '''objdet.py'''. &lt;br /&gt;
Place the following in a simple text file  'det.job':&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
 conda activate python-3.9.21&lt;br /&gt;
 pip install ultralytics&lt;br /&gt;
&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples/&lt;br /&gt;
 python3  objdet.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
It should produce two images on the disk, the original and the annotated, showing the object detection: &lt;br /&gt;
&lt;br /&gt;
[[File:bus.jpg|250px]] &lt;br /&gt;
[[File:busan.jpg|250px]]&lt;br /&gt;
&lt;br /&gt;
== Engineering Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== FluidX3D Tutorial ====&lt;br /&gt;
[[File:FluidX3d_logo.png|150px]]&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will compute the airflow around a Fan using and implementation of Lattice Boltzmann CDF in [https://github.com/ProjectPhysX/FluidX3D/tree/master FluidX3D]. The geometry to be used will be similar to &lt;br /&gt;
this Fan: [https://www.thingiverse.com/thing:6113/files SOLID BOTTOM]&lt;br /&gt;
&lt;br /&gt;
[[File:FAN_Solid_Bottom_display_large.png|400px]] &lt;br /&gt;
&lt;br /&gt;
FluidX3D is a C++ code with support for GPU acceleration, and requires that we write some code to setup the calculation. Let us retreive the code and data for the calculation: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir cfd&lt;br /&gt;
 $ cd cfd&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ https://github.com/ProjectPhysX/FluidX3D.git&lt;br /&gt;
 $ cp training-examples/{setup.cpp,defines.hpp} FluidX3D/src&lt;br /&gt;
 $ mkdir stl &lt;br /&gt;
 $ wget https://cdn.thingiverse.com/assets/1d/89/dd/cb/fd/FAN_Solid_Bottom.stl?ofn=RkFOX1NvbGlkX0JvdHRvbS5zdGw= -O stl/Fan.stl&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once we have the files, we can load the right modules, and compile the example, place the following in a simple file: &lt;br /&gt;
'''cfd.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load devel/nvidia-hpc/24.11&lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/ &lt;br /&gt;
 cd FluidX3D&lt;br /&gt;
 ./make.sh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And submit it to slurm via  '''cfd.job''', and let it run. &lt;br /&gt;
This will generate the outputs in  '''./bin/export''', this was specified in the '''setup.cpp''' code instructions. We can now convert these snapshots into a video file using FFMPEG especially compiled with GPU support on the cluster, however, only open codecs like libopenh264 are enabled in this ffmpeg module. Place the following in a simple file named '''encode.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/ffmpeg/git &lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/FluidX3D/bin&lt;br /&gt;
 ffmpeg -y -hwaccel cuda  -framerate 60 -pattern_type glob -i &amp;quot;export/image-*.png&amp;quot; -c:v libopenh264   -pix_fmt yuv420p -b:v 24M &amp;quot;video.mp4&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Submit the job via slurm &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ sbatch encode.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once complete, it will produce the following video inside the '''FluidX3D/bin''' directory: &lt;br /&gt;
&lt;br /&gt;
[[File:output_fluid.gif|530px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/s6eVYpg1PkaCgj4aYwQNymLcN Watch CFD Demo] ===&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1410</id>
		<title>Thematic Examples</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1410"/>
				<updated>2025-05-12T18:11:43Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===== Thematic Examples From Computer Science, Engineering and Computational Modeling and Material Science =====&lt;br /&gt;
We will work through examples based on the following codes:&lt;br /&gt;
# Quantum Espresso  (CMMS)&lt;br /&gt;
# PyTorch  (CS)&lt;br /&gt;
# FluidX3D  (Engineering)&lt;br /&gt;
== CMMS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
=== Quantum Espresso Tutorial ===&lt;br /&gt;
[[File:Quantum_ESPRESSO_logo.jpg|250px]]&lt;br /&gt;
==== Computing The Bandstructure of Silicon ====&lt;br /&gt;
In this tutorial, we will calculate the band structure of bulk Silicon. &lt;br /&gt;
Silicon is a semi-conductor with a small gap. The calculation will proceed through three broad steps, starting from the&lt;br /&gt;
self consistent calculation, the non-self consistent calculation, the bands calculation, and finally the post processing. &lt;br /&gt;
The files required for this exercise can be retreived as follows: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
 $ ls &lt;br /&gt;
 si.band.david.in  si.nscf.david.in  si.plotbands.in  si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We can visualize the structure using tools like VESTA or [http://www.xcrysden.org/ Xcrysden], using the input file that specifies the structure '''si.scf.david.in '''. This can be done on your computer once you install Xcrysden and copy the input to your device as such: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ xcrysden --pwi si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Which gives us this structure visualization:&lt;br /&gt;
 &lt;br /&gt;
[[File:Si-2x2x2.png]]&lt;br /&gt;
&lt;br /&gt;
Showing the typical diamond like tetrahedral structure. &lt;br /&gt;
We now call '''Quantum Espresso''' and run the three steps, this can be performed in one job for simple short calculations, for longer calculations the three steps can be separated into three jobs. Let us create the appropriate submission scripts. This is a simple seof calculations, but we have split it into multiple jobs for the sake of generality.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.scf.david.in &amp;gt; scf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 1scf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 1scf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this has run, we will have some generated outputs, including wavefunctions and the text  file '''scf.out'''. &lt;br /&gt;
Next we prepare the submission script for the  '''nscf''' step, &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_nscf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.nscf.david.in &amp;gt; nscf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 2nscf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 2nscf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this nscf step is done, we now compute the band structure, create the submission script for the '''bands''' calculation:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_bands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1 bands.x -in si.bands.in  &amp;gt; si.bands.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We have the bulk of the computational work done, we now are left with a post processing steps to obtain results, we now use the&lt;br /&gt;
'''plotbands''' executable for this step: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_ppbands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
plotband.x  &amp;lt; si.plotband.in&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will produce some new  visualization data and a postscript plot, '''si_bands.ps''' which should yield an image like this: &lt;br /&gt;
&lt;br /&gt;
[[File:Si_bandstruture.png| 600px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/PaseL5awEl1fcDBwZkDVzpIOb Watch Band Structure Demo] ===&lt;br /&gt;
&lt;br /&gt;
== CS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== Conda Usage on the cluster ====&lt;br /&gt;
[[File:Conda_logo.svg.png|250px]]&lt;br /&gt;
&lt;br /&gt;
Conda is a python based package manager and (python) environment management tool, used to install and manage multiple versions of software packages and tools. Its typical for it to be installed in a single user's account, and active from the moment a user logs in, however, being that this facility  is a cluster, we have opted to provide it to users using our HPC Module system, this should reduce redundancy in the core packages, saving every user from having a local installation in their account. Conda users will have access to all centrally installed packages. &lt;br /&gt;
===== How to activate Conda and View environments =====&lt;br /&gt;
Conda is available in the global list of modules, which can be listed via the '''module avail''' command, meaning until you load the module, the '''conda''' command is not available.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module avail&lt;br /&gt;
  --------------------------- /usr/share/modulefiles --------------------&lt;br /&gt;
   mpi/openmpi-x86_64&lt;br /&gt;
  -------------------- /opt/ohpc/pub/modulefiles --------------------&lt;br /&gt;
  applications/gpu/gromacs/2024.4 ...&lt;br /&gt;
  ... &lt;br /&gt;
  '''applications/gpu/python/conda-25.1.1-python-3.9.21'''&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Let us go a head and load the right module:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We now have the conda command available on the terminal. Let us list the conda environments available by default: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda env list&lt;br /&gt;
 base                 * /opt/ohpc/pub/conda/instdir&lt;br /&gt;
 python-3.9.21          /opt/ohpc/pub/conda/instdir/envs/python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And we can load the '''python-3.9.21''' conda environment, this environment provides a set of key '''ML/AI''' python frameworks, namely '''PyTorch''' and '''Tensorflow'''. &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda activate python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Tools like Pytorch, TensorFlow and others are available in this environment.&lt;br /&gt;
&lt;br /&gt;
[[File:Pytorch_logo.png|100px]] [[File:TensorFlow_logo.svg.png|100px]]  &lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/lJBIZE6tNnTQh9Hu77YXPoNSJ  Watch Conda Demo] === &lt;br /&gt;
&lt;br /&gt;
==== Object Detection Tutorial (YOLO) ====&lt;br /&gt;
We will take a look at a simple object detection exercise with '''YOLO'''. &lt;br /&gt;
Let us get the files needed for the exercise:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now we have to  '''install''' yolo, and use it to run a simple object detection exercise using the code in the file '''objdet.py'''. &lt;br /&gt;
Place the following in a simple text file  'det.job':&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
 conda activate python-3.9.21&lt;br /&gt;
 pip install ultralytics&lt;br /&gt;
&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples/&lt;br /&gt;
 python3  objdet.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
It should produce two images on the disk, the original and the annotated, showing the object detection: &lt;br /&gt;
&lt;br /&gt;
[[File:bus.jpg|250px]] &lt;br /&gt;
[[File:busan.jpg|250px]]&lt;br /&gt;
&lt;br /&gt;
==== Code Generation Tutorial (Mistral) ====&lt;br /&gt;
&lt;br /&gt;
== Engineering Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== FluidX3D Tutorial ====&lt;br /&gt;
[[File:FluidX3d_logo.png|150px]]&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will compute the airflow around a Fan using and implementation of Lattice Boltzmann CDF in [https://github.com/ProjectPhysX/FluidX3D/tree/master FluidX3D]. The geometry to be used will be similar to &lt;br /&gt;
this Fan: [https://www.thingiverse.com/thing:6113/files SOLID BOTTOM]&lt;br /&gt;
&lt;br /&gt;
[[File:FAN_Solid_Bottom_display_large.png|400px]] &lt;br /&gt;
&lt;br /&gt;
FluidX3D is a C++ code with support for GPU acceleration, and requires that we write some code to setup the calculation. Let us retreive the code and data for the calculation: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir cfd&lt;br /&gt;
 $ cd cfd&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ https://github.com/ProjectPhysX/FluidX3D.git&lt;br /&gt;
 $ cp training-examples/{setup.cpp,defines.hpp} FluidX3D/src&lt;br /&gt;
 $ mkdir stl &lt;br /&gt;
 $ wget https://cdn.thingiverse.com/assets/1d/89/dd/cb/fd/FAN_Solid_Bottom.stl?ofn=RkFOX1NvbGlkX0JvdHRvbS5zdGw= -O stl/Fan.stl&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once we have the files, we can load the right modules, and compile the example, place the following in a simple file: &lt;br /&gt;
'''cfd.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load devel/nvidia-hpc/24.11&lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/ &lt;br /&gt;
 cd FluidX3D&lt;br /&gt;
 ./make.sh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And submit it to slurm via  '''cfd.job''', and let it run. &lt;br /&gt;
This will generate the outputs in  '''./bin/export''', this was specified in the '''setup.cpp''' code instructions. We can now convert these snapshots into a video file using FFMPEG especially compiled with GPU support on the cluster, however, only open codecs like libopenh264 are enabled in this ffmpeg module. Place the following in a simple file named '''encode.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/ffmpeg/git &lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/FluidX3D/bin&lt;br /&gt;
 ffmpeg -y -hwaccel cuda  -framerate 60 -pattern_type glob -i &amp;quot;export/image-*.png&amp;quot; -c:v libopenh264   -pix_fmt yuv420p -b:v 24M &amp;quot;video.mp4&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Submit the job via slurm &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ sbatch encode.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once complete, it will produce the following video inside the '''FluidX3D/bin''' directory: &lt;br /&gt;
&lt;br /&gt;
[[File:output_fluid.gif|530px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/s6eVYpg1PkaCgj4aYwQNymLcN Watch CFD Demo] ===&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1409</id>
		<title>Thematic Examples</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1409"/>
				<updated>2025-05-12T18:11:07Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===== Thematic Examples From Computer Science, Engineering and Computational Modeling and Material Science =====&lt;br /&gt;
We will work through examples based on the following codes:&lt;br /&gt;
# Quantum Espresso  (CMMS)&lt;br /&gt;
# PyTorch  (CS)&lt;br /&gt;
# FluidX3D  (Engineering)&lt;br /&gt;
== CMMS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
=== Quantum Espresso Tutorial ===&lt;br /&gt;
[[File:Quantum_ESPRESSO_logo.jpg|250px]]&lt;br /&gt;
==== Computing The Bandstructure of Silicon ====&lt;br /&gt;
In this tutorial, we will calculate the band structure of bulk Silicon. &lt;br /&gt;
Silicon is a semi-conductor with a small gap. The calculation will proceed through three broad steps, starting from the&lt;br /&gt;
self consistent calculation, the non-self consistent calculation, the bands calculation, and finally the post processing. &lt;br /&gt;
The files required for this exercise can be retreived as follows: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
 $ ls &lt;br /&gt;
 si.band.david.in  si.nscf.david.in  si.plotbands.in  si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We can visualize the structure using tools like VESTA or [http://www.xcrysden.org/ Xcrysden], using the input file that specifies the structure '''si.scf.david.in '''. This can be done on your computer once you install Xcrysden and copy the input to your device as such: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ xcrysden --pwi si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Which gives us this structure visualization:&lt;br /&gt;
 &lt;br /&gt;
[[File:Si-2x2x2.png]]&lt;br /&gt;
&lt;br /&gt;
Showing the typical diamond like tetrahedral structure. &lt;br /&gt;
We now call '''Quantum Espresso''' and run the three steps, this can be performed in one job for simple short calculations, for longer calculations the three steps can be separated into three jobs. Let us create the appropriate submission scripts. This is a simple seof calculations, but we have split it into multiple jobs for the sake of generality.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.scf.david.in &amp;gt; scf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 1scf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 1scf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this has run, we will have some generated outputs, including wavefunctions and the text  file '''scf.out'''. &lt;br /&gt;
Next we prepare the submission script for the  '''nscf''' step, &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_nscf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.nscf.david.in &amp;gt; nscf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 2nscf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 2nscf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this nscf step is done, we now compute the band structure, create the submission script for the '''bands''' calculation:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_bands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1 bands.x -in si.bands.in  &amp;gt; si.bands.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We have the bulk of the computational work done, we now are left with a post processing steps to obtain results, we now use the&lt;br /&gt;
'''plotbands''' executable for this step: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_ppbands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
plotband.x  &amp;lt; si.plotband.in&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will produce some new  visualization data and a postscript plot, '''si_bands.ps''' which should yield an image like this: &lt;br /&gt;
&lt;br /&gt;
[[File:Si_bandstruture.png| 600px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/PaseL5awEl1fcDBwZkDVzpIOb Watch Band Structure Demo] ===&lt;br /&gt;
&lt;br /&gt;
== CS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== Conda Usage on the cluster ====&lt;br /&gt;
[[File:Conda_logo.svg.png|250px]]&lt;br /&gt;
&lt;br /&gt;
Conda is a python based package manager and (python) environment management tool, used to install and manage multiple versions of software packages and tools. Its typical for it to be installed in a single user's account, and active from the moment a user logs in, however, being that this facility  is a cluster, we have opted to provide it to users using our HPC Module system, this should reduce redundancy in the core packages, saving every user from having a local installation in their account. Conda users will have access to all centrally installed packages. &lt;br /&gt;
===== How to activate Conda and View environments =====&lt;br /&gt;
Conda is available in the global list of modules, which can be listed via the '''module avail''' command, meaning until you load the module, the '''conda''' command is not available.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module avail&lt;br /&gt;
  --------------------------- /usr/share/modulefiles --------------------&lt;br /&gt;
   mpi/openmpi-x86_64&lt;br /&gt;
  -------------------- /opt/ohpc/pub/modulefiles --------------------&lt;br /&gt;
  applications/gpu/gromacs/2024.4 ...&lt;br /&gt;
  ... &lt;br /&gt;
  '''applications/gpu/python/conda-25.1.1-python-3.9.21'''&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Let us go a head and load the right module:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We now have the conda command available on the terminal. Let us list the conda environments available by default: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda env list&lt;br /&gt;
 base                 * /opt/ohpc/pub/conda/instdir&lt;br /&gt;
 python-3.9.21          /opt/ohpc/pub/conda/instdir/envs/python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And we can load the '''python-3.9.21''' conda environment, this environment provides a set of key '''ML/AI''' python frameworks, namely '''PyTorch''' and '''Tensorflow'''. &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda activate python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Tools like Pytorch, TensorFlow and others are available in this environment.&lt;br /&gt;
&lt;br /&gt;
[[File:Pytorch_logo.png|100px]] [[File:TensorFlow_logo.svg.png|100px]]  &lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/lJBIZE6tNnTQh9Hu77YXPoNSJ  Watch Conda Demo] === &lt;br /&gt;
&lt;br /&gt;
==== Object Detection Tutorial (YOLO) ====&lt;br /&gt;
We will take a look at a simple object detection exercise with '''YOLO'''. &lt;br /&gt;
Let us get the files needed for the exercise:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now we have to  '''install''' yolo, and use it to run a simple object detection exercise using the code in the file '''objdet.py'''. &lt;br /&gt;
Place the following in a simple text file  'det.job':&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
 conda activate python-3.9.21&lt;br /&gt;
 pip install ultralytics&lt;br /&gt;
&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples/&lt;br /&gt;
 python3  objdet.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
It should produce two images on the disk, the original and the annotated, showing the object detection: &lt;br /&gt;
[[File:bus.jpg|150px]] &lt;br /&gt;
[[File:busan.jpg|150px]]&lt;br /&gt;
&lt;br /&gt;
==== Code Generation Tutorial (Mistral) ====&lt;br /&gt;
&lt;br /&gt;
== Engineering Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== FluidX3D Tutorial ====&lt;br /&gt;
[[File:FluidX3d_logo.png|150px]]&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will compute the airflow around a Fan using and implementation of Lattice Boltzmann CDF in [https://github.com/ProjectPhysX/FluidX3D/tree/master FluidX3D]. The geometry to be used will be similar to &lt;br /&gt;
this Fan: [https://www.thingiverse.com/thing:6113/files SOLID BOTTOM]&lt;br /&gt;
&lt;br /&gt;
[[File:FAN_Solid_Bottom_display_large.png|400px]] &lt;br /&gt;
&lt;br /&gt;
FluidX3D is a C++ code with support for GPU acceleration, and requires that we write some code to setup the calculation. Let us retreive the code and data for the calculation: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir cfd&lt;br /&gt;
 $ cd cfd&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ https://github.com/ProjectPhysX/FluidX3D.git&lt;br /&gt;
 $ cp training-examples/{setup.cpp,defines.hpp} FluidX3D/src&lt;br /&gt;
 $ mkdir stl &lt;br /&gt;
 $ wget https://cdn.thingiverse.com/assets/1d/89/dd/cb/fd/FAN_Solid_Bottom.stl?ofn=RkFOX1NvbGlkX0JvdHRvbS5zdGw= -O stl/Fan.stl&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once we have the files, we can load the right modules, and compile the example, place the following in a simple file: &lt;br /&gt;
'''cfd.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load devel/nvidia-hpc/24.11&lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/ &lt;br /&gt;
 cd FluidX3D&lt;br /&gt;
 ./make.sh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And submit it to slurm via  '''cfd.job''', and let it run. &lt;br /&gt;
This will generate the outputs in  '''./bin/export''', this was specified in the '''setup.cpp''' code instructions. We can now convert these snapshots into a video file using FFMPEG especially compiled with GPU support on the cluster, however, only open codecs like libopenh264 are enabled in this ffmpeg module. Place the following in a simple file named '''encode.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/ffmpeg/git &lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/FluidX3D/bin&lt;br /&gt;
 ffmpeg -y -hwaccel cuda  -framerate 60 -pattern_type glob -i &amp;quot;export/image-*.png&amp;quot; -c:v libopenh264   -pix_fmt yuv420p -b:v 24M &amp;quot;video.mp4&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Submit the job via slurm &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ sbatch encode.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once complete, it will produce the following video inside the '''FluidX3D/bin''' directory: &lt;br /&gt;
&lt;br /&gt;
[[File:output_fluid.gif|530px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/s6eVYpg1PkaCgj4aYwQNymLcN Watch CFD Demo] ===&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1408</id>
		<title>Thematic Examples</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1408"/>
				<updated>2025-05-12T18:10:11Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===== Thematic Examples From Computer Science, Engineering and Computational Modeling and Material Science =====&lt;br /&gt;
We will work through examples based on the following codes:&lt;br /&gt;
# Quantum Espresso  (CMMS)&lt;br /&gt;
# PyTorch  (CS)&lt;br /&gt;
# FluidX3D  (Engineering)&lt;br /&gt;
== CMMS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
=== Quantum Espresso Tutorial ===&lt;br /&gt;
[[File:Quantum_ESPRESSO_logo.jpg|250px]]&lt;br /&gt;
==== Computing The Bandstructure of Silicon ====&lt;br /&gt;
In this tutorial, we will calculate the band structure of bulk Silicon. &lt;br /&gt;
Silicon is a semi-conductor with a small gap. The calculation will proceed through three broad steps, starting from the&lt;br /&gt;
self consistent calculation, the non-self consistent calculation, the bands calculation, and finally the post processing. &lt;br /&gt;
The files required for this exercise can be retreived as follows: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
 $ ls &lt;br /&gt;
 si.band.david.in  si.nscf.david.in  si.plotbands.in  si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We can visualize the structure using tools like VESTA or [http://www.xcrysden.org/ Xcrysden], using the input file that specifies the structure '''si.scf.david.in '''. This can be done on your computer once you install Xcrysden and copy the input to your device as such: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ xcrysden --pwi si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Which gives us this structure visualization:&lt;br /&gt;
 &lt;br /&gt;
[[File:Si-2x2x2.png]]&lt;br /&gt;
&lt;br /&gt;
Showing the typical diamond like tetrahedral structure. &lt;br /&gt;
We now call '''Quantum Espresso''' and run the three steps, this can be performed in one job for simple short calculations, for longer calculations the three steps can be separated into three jobs. Let us create the appropriate submission scripts. This is a simple seof calculations, but we have split it into multiple jobs for the sake of generality.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.scf.david.in &amp;gt; scf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 1scf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 1scf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this has run, we will have some generated outputs, including wavefunctions and the text  file '''scf.out'''. &lt;br /&gt;
Next we prepare the submission script for the  '''nscf''' step, &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_nscf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.nscf.david.in &amp;gt; nscf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 2nscf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 2nscf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this nscf step is done, we now compute the band structure, create the submission script for the '''bands''' calculation:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_bands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1 bands.x -in si.bands.in  &amp;gt; si.bands.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We have the bulk of the computational work done, we now are left with a post processing steps to obtain results, we now use the&lt;br /&gt;
'''plotbands''' executable for this step: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_ppbands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
plotband.x  &amp;lt; si.plotband.in&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will produce some new  visualization data and a postscript plot, '''si_bands.ps''' which should yield an image like this: &lt;br /&gt;
&lt;br /&gt;
[[File:Si_bandstruture.png| 600px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/PaseL5awEl1fcDBwZkDVzpIOb Watch Band Structure Demo] ===&lt;br /&gt;
&lt;br /&gt;
== CS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== Conda Usage on the cluster ====&lt;br /&gt;
[[File:Conda_logo.svg.png|250px]]&lt;br /&gt;
&lt;br /&gt;
Conda is a python based package manager and (python) environment management tool, used to install and manage multiple versions of software packages and tools. Its typical for it to be installed in a single user's account, and active from the moment a user logs in, however, being that this facility  is a cluster, we have opted to provide it to users using our HPC Module system, this should reduce redundancy in the core packages, saving every user from having a local installation in their account. Conda users will have access to all centrally installed packages. &lt;br /&gt;
===== How to activate Conda and View environments =====&lt;br /&gt;
Conda is available in the global list of modules, which can be listed via the '''module avail''' command, meaning until you load the module, the '''conda''' command is not available.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module avail&lt;br /&gt;
  --------------------------- /usr/share/modulefiles --------------------&lt;br /&gt;
   mpi/openmpi-x86_64&lt;br /&gt;
  -------------------- /opt/ohpc/pub/modulefiles --------------------&lt;br /&gt;
  applications/gpu/gromacs/2024.4 ...&lt;br /&gt;
  ... &lt;br /&gt;
  '''applications/gpu/python/conda-25.1.1-python-3.9.21'''&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Let us go a head and load the right module:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We now have the conda command available on the terminal. Let us list the conda environments available by default: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda env list&lt;br /&gt;
 base                 * /opt/ohpc/pub/conda/instdir&lt;br /&gt;
 python-3.9.21          /opt/ohpc/pub/conda/instdir/envs/python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And we can load the '''python-3.9.21''' conda environment, this environment provides a set of key '''ML/AI''' python frameworks, namely '''PyTorch''' and '''Tensorflow'''. &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda activate python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Tools like Pytorch, TensorFlow and others are available in this environment.&lt;br /&gt;
&lt;br /&gt;
[[File:Pytorch_logo.png|100px]]&lt;br /&gt;
&lt;br /&gt;
[[File:TensorFlow_logo.svg.png|100px]]  &lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/lJBIZE6tNnTQh9Hu77YXPoNSJ  Watch Conda Demo] === &lt;br /&gt;
&lt;br /&gt;
==== Object Detection Tutorial (YOLO) ====&lt;br /&gt;
We will take a look at a simple object detection exercise with '''YOLO'''. &lt;br /&gt;
Let us get the files needed for the exercise:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now we have to  '''install''' yolo, and use it to run a simple object detection exercise using the code in the file '''objdet.py'''. &lt;br /&gt;
Place the following in a simple text file  'det.job':&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
 conda activate python-3.9.21&lt;br /&gt;
 pip install ultralytics&lt;br /&gt;
&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples/&lt;br /&gt;
 python3  objdet.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
It should produce two images on the disk, the original and the annotated, showing the object detection: &lt;br /&gt;
[[File:bus.jpg|150px]][[File:busan.jpg|150px]]&lt;br /&gt;
&lt;br /&gt;
==== Code Generation Tutorial (Mistral) ====&lt;br /&gt;
&lt;br /&gt;
== Engineering Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== FluidX3D Tutorial ====&lt;br /&gt;
[[File:FluidX3d_logo.png|150px]]&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will compute the airflow around a Fan using and implementation of Lattice Boltzmann CDF in [https://github.com/ProjectPhysX/FluidX3D/tree/master FluidX3D]. The geometry to be used will be similar to &lt;br /&gt;
this Fan: [https://www.thingiverse.com/thing:6113/files SOLID BOTTOM]&lt;br /&gt;
&lt;br /&gt;
[[File:FAN_Solid_Bottom_display_large.png|400px]] &lt;br /&gt;
&lt;br /&gt;
FluidX3D is a C++ code with support for GPU acceleration, and requires that we write some code to setup the calculation. Let us retreive the code and data for the calculation: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir cfd&lt;br /&gt;
 $ cd cfd&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ https://github.com/ProjectPhysX/FluidX3D.git&lt;br /&gt;
 $ cp training-examples/{setup.cpp,defines.hpp} FluidX3D/src&lt;br /&gt;
 $ mkdir stl &lt;br /&gt;
 $ wget https://cdn.thingiverse.com/assets/1d/89/dd/cb/fd/FAN_Solid_Bottom.stl?ofn=RkFOX1NvbGlkX0JvdHRvbS5zdGw= -O stl/Fan.stl&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once we have the files, we can load the right modules, and compile the example, place the following in a simple file: &lt;br /&gt;
'''cfd.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load devel/nvidia-hpc/24.11&lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/ &lt;br /&gt;
 cd FluidX3D&lt;br /&gt;
 ./make.sh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And submit it to slurm via  '''cfd.job''', and let it run. &lt;br /&gt;
This will generate the outputs in  '''./bin/export''', this was specified in the '''setup.cpp''' code instructions. We can now convert these snapshots into a video file using FFMPEG especially compiled with GPU support on the cluster, however, only open codecs like libopenh264 are enabled in this ffmpeg module. Place the following in a simple file named '''encode.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/ffmpeg/git &lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/FluidX3D/bin&lt;br /&gt;
 ffmpeg -y -hwaccel cuda  -framerate 60 -pattern_type glob -i &amp;quot;export/image-*.png&amp;quot; -c:v libopenh264   -pix_fmt yuv420p -b:v 24M &amp;quot;video.mp4&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Submit the job via slurm &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ sbatch encode.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once complete, it will produce the following video inside the '''FluidX3D/bin''' directory: &lt;br /&gt;
&lt;br /&gt;
[[File:output_fluid.gif|530px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/s6eVYpg1PkaCgj4aYwQNymLcN Watch CFD Demo] ===&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1407</id>
		<title>Thematic Examples</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=Thematic_Examples&amp;diff=1407"/>
				<updated>2025-05-12T18:09:48Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===== Thematic Examples From Computer Science, Engineering and Computational Modeling and Material Science =====&lt;br /&gt;
We will work through examples based on the following codes:&lt;br /&gt;
# Quantum Espresso  (CMMS)&lt;br /&gt;
# PyTorch  (CS)&lt;br /&gt;
# FluidX3D  (Engineering)&lt;br /&gt;
== CMMS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
=== Quantum Espresso Tutorial ===&lt;br /&gt;
[[File:Quantum_ESPRESSO_logo.jpg|250px]]&lt;br /&gt;
==== Computing The Bandstructure of Silicon ====&lt;br /&gt;
In this tutorial, we will calculate the band structure of bulk Silicon. &lt;br /&gt;
Silicon is a semi-conductor with a small gap. The calculation will proceed through three broad steps, starting from the&lt;br /&gt;
self consistent calculation, the non-self consistent calculation, the bands calculation, and finally the post processing. &lt;br /&gt;
The files required for this exercise can be retreived as follows: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
 $ ls &lt;br /&gt;
 si.band.david.in  si.nscf.david.in  si.plotbands.in  si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We can visualize the structure using tools like VESTA or [http://www.xcrysden.org/ Xcrysden], using the input file that specifies the structure '''si.scf.david.in '''. This can be done on your computer once you install Xcrysden and copy the input to your device as such: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ xcrysden --pwi si.scf.david.in &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Which gives us this structure visualization:&lt;br /&gt;
 &lt;br /&gt;
[[File:Si-2x2x2.png]]&lt;br /&gt;
&lt;br /&gt;
Showing the typical diamond like tetrahedral structure. &lt;br /&gt;
We now call '''Quantum Espresso''' and run the three steps, this can be performed in one job for simple short calculations, for longer calculations the three steps can be separated into three jobs. Let us create the appropriate submission scripts. This is a simple seof calculations, but we have split it into multiple jobs for the sake of generality.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.scf.david.in &amp;gt; scf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 1scf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 1scf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this has run, we will have some generated outputs, including wavefunctions and the text  file '''scf.out'''. &lt;br /&gt;
Next we prepare the submission script for the  '''nscf''' step, &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_nscf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1  pw.x -in si.nscf.david.in &amp;gt; nscf.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
put this in a file named 2nscf.job  and we submit the same:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ sbatch 2nscf.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once this nscf step is done, we now compute the band structure, create the submission script for the '''bands''' calculation:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_bands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
 mpirun -np 1 bands.x -in si.bands.in  &amp;gt; si.bands.out&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We have the bulk of the computational work done, we now are left with a post processing steps to obtain results, we now use the&lt;br /&gt;
'''plotbands''' executable for this step: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_ppbands_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/qespresso/7.3.1 &lt;br /&gt;
 &lt;br /&gt;
 ##Set environment variables for QE&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples &lt;br /&gt;
 &lt;br /&gt;
 ##Run QE with GPU support&lt;br /&gt;
plotband.x  &amp;lt; si.plotband.in&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will produce some new  visualization data and a postscript plot, '''si_bands.ps''' which should yield an image like this: &lt;br /&gt;
&lt;br /&gt;
[[File:Si_bandstruture.png| 600px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/PaseL5awEl1fcDBwZkDVzpIOb Watch Band Structure Demo] ===&lt;br /&gt;
&lt;br /&gt;
== CS Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== Conda Usage on the cluster ====&lt;br /&gt;
[[File:Conda_logo.svg.png|250px]]&lt;br /&gt;
&lt;br /&gt;
Conda is a python based package manager and (python) environment management tool, used to install and manage multiple versions of software packages and tools. Its typical for it to be installed in a single user's account, and active from the moment a user logs in, however, being that this facility  is a cluster, we have opted to provide it to users using our HPC Module system, this should reduce redundancy in the core packages, saving every user from having a local installation in their account. Conda users will have access to all centrally installed packages. &lt;br /&gt;
===== How to activate Conda and View environments =====&lt;br /&gt;
Conda is available in the global list of modules, which can be listed via the '''module avail''' command, meaning until you load the module, the '''conda''' command is not available.&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module avail&lt;br /&gt;
  --------------------------- /usr/share/modulefiles --------------------&lt;br /&gt;
   mpi/openmpi-x86_64&lt;br /&gt;
  -------------------- /opt/ohpc/pub/modulefiles --------------------&lt;br /&gt;
  applications/gpu/gromacs/2024.4 ...&lt;br /&gt;
  ... &lt;br /&gt;
  '''applications/gpu/python/conda-25.1.1-python-3.9.21'''&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Let us go a head and load the right module:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We now have the conda command available on the terminal. Let us list the conda environments available by default: &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda env list&lt;br /&gt;
 base                 * /opt/ohpc/pub/conda/instdir&lt;br /&gt;
 python-3.9.21          /opt/ohpc/pub/conda/instdir/envs/python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And we can load the '''python-3.9.21''' conda environment, this environment provides a set of key '''ML/AI''' python frameworks, namely '''PyTorch''' and '''Tensorflow'''. &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ conda activate python-3.9.21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Tools like Pytorch, TensorFlow and others are available in this environment.&lt;br /&gt;
&lt;br /&gt;
[[File:Pytorch_logo.png|100px]]&lt;br /&gt;
[[File:TensorFlow_logo.svg.png|100px]]  &lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/lJBIZE6tNnTQh9Hu77YXPoNSJ  Watch Conda Demo] === &lt;br /&gt;
&lt;br /&gt;
==== Object Detection Tutorial (YOLO) ====&lt;br /&gt;
We will take a look at a simple object detection exercise with '''YOLO'''. &lt;br /&gt;
Let us get the files needed for the exercise:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir examples&lt;br /&gt;
 $ cd examples/&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ cd training-examples/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now we have to  '''install''' yolo, and use it to run a simple object detection exercise using the code in the file '''objdet.py'''. &lt;br /&gt;
Place the following in a simple text file  'det.job':&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/python/conda-25.1.1-python-3.9.21&lt;br /&gt;
 conda activate python-3.9.21&lt;br /&gt;
 pip install ultralytics&lt;br /&gt;
&lt;br /&gt;
 cd $HOME/localscratch/examples/training-examples/&lt;br /&gt;
 python3  objdet.py&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
It should produce two images on the disk, the original and the annotated, showing the object detection: &lt;br /&gt;
[[File:bus.jpg|150px]][[File:busan.jpg|150px]]&lt;br /&gt;
&lt;br /&gt;
==== Code Generation Tutorial (Mistral) ====&lt;br /&gt;
&lt;br /&gt;
== Engineering Thematic Area ==&lt;br /&gt;
&lt;br /&gt;
==== FluidX3D Tutorial ====&lt;br /&gt;
[[File:FluidX3d_logo.png|150px]]&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will compute the airflow around a Fan using and implementation of Lattice Boltzmann CDF in [https://github.com/ProjectPhysX/FluidX3D/tree/master FluidX3D]. The geometry to be used will be similar to &lt;br /&gt;
this Fan: [https://www.thingiverse.com/thing:6113/files SOLID BOTTOM]&lt;br /&gt;
&lt;br /&gt;
[[File:FAN_Solid_Bottom_display_large.png|400px]] &lt;br /&gt;
&lt;br /&gt;
FluidX3D is a C++ code with support for GPU acceleration, and requires that we write some code to setup the calculation. Let us retreive the code and data for the calculation: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ cd ~/localscratch/&lt;br /&gt;
 $ mkdir cfd&lt;br /&gt;
 $ cd cfd&lt;br /&gt;
 $ git clone https://github.com/Materials-Modelling-Group/training-examples.git&lt;br /&gt;
 $ https://github.com/ProjectPhysX/FluidX3D.git&lt;br /&gt;
 $ cp training-examples/{setup.cpp,defines.hpp} FluidX3D/src&lt;br /&gt;
 $ mkdir stl &lt;br /&gt;
 $ wget https://cdn.thingiverse.com/assets/1d/89/dd/cb/fd/FAN_Solid_Bottom.stl?ofn=RkFOX1NvbGlkX0JvdHRvbS5zdGw= -O stl/Fan.stl&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once we have the files, we can load the right modules, and compile the example, place the following in a simple file: &lt;br /&gt;
'''cfd.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load devel/nvidia-hpc/24.11&lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/ &lt;br /&gt;
 cd FluidX3D&lt;br /&gt;
 ./make.sh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And submit it to slurm via  '''cfd.job''', and let it run. &lt;br /&gt;
This will generate the outputs in  '''./bin/export''', this was specified in the '''setup.cpp''' code instructions. We can now convert these snapshots into a video file using FFMPEG especially compiled with GPU support on the cluster, however, only open codecs like libopenh264 are enabled in this ffmpeg module. Place the following in a simple file named '''encode.job'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --job-name=si_scf_normal&lt;br /&gt;
 #SBATCH --partition=gpu1&lt;br /&gt;
 #SBATCH --gpus=1&lt;br /&gt;
 #SBATCH --ntasks-per-node=1&lt;br /&gt;
 #SBATCH --time=00:10:00&lt;br /&gt;
 #SBATCH --output=si_scf_%j.out &lt;br /&gt;
 #SBATCH --error=si_scf_%j.err&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 ##Load necessary modules&lt;br /&gt;
 module load applications/gpu/ffmpeg/git &lt;br /&gt;
 &lt;br /&gt;
 cd $HOME/localscratch/cfd/FluidX3D/bin&lt;br /&gt;
 ffmpeg -y -hwaccel cuda  -framerate 60 -pattern_type glob -i &amp;quot;export/image-*.png&amp;quot; -c:v libopenh264   -pix_fmt yuv420p -b:v 24M &amp;quot;video.mp4&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Submit the job via slurm &lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
 $ sbatch encode.job&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once complete, it will produce the following video inside the '''FluidX3D/bin''' directory: &lt;br /&gt;
&lt;br /&gt;
[[File:output_fluid.gif|530px]]&lt;br /&gt;
&lt;br /&gt;
=== [https://asciinema.org/a/s6eVYpg1PkaCgj4aYwQNymLcN Watch CFD Demo] ===&lt;br /&gt;
&lt;br /&gt;
Up:&lt;br /&gt;
[[ HPC_Usage| HPC_Usage]]&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=File:Busan.jpg&amp;diff=1406</id>
		<title>File:Busan.jpg</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=File:Busan.jpg&amp;diff=1406"/>
				<updated>2025-05-12T18:07:51Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	<entry>
		<id>http://training.kenet.or.ke/index.php?title=File:Bus.jpg&amp;diff=1405</id>
		<title>File:Bus.jpg</title>
		<link rel="alternate" type="text/html" href="http://training.kenet.or.ke/index.php?title=File:Bus.jpg&amp;diff=1405"/>
				<updated>2025-05-12T18:07:24Z</updated>
		
		<summary type="html">&lt;p&gt;Atambo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Atambo</name></author>	</entry>

	</feed>