4  Check mamba environment and copy data to HPC

Author

Gabriel Ortega-Solís

5 Note

This tutorial assumes that you successfully configured VSCode and have already created a Mamba environment on the HPC cluster. If VSCode is properly working, you can just open a terminal manually and click on the run button in every code cell, and the code will be sent to your currently active terminal. If VSCode is not configured yet, you can copy and paste the code snippets in this tutorial into a terminal. Probably you’ll need Ctrl+Shift+V to paste in the terminal.

Please remember to replace USERNAME with your actual username and skirit.metacentrum.cz with the appropriate login node for your cluster.

The variable $USER is automatically replaced with your actual username on the HPC cluster when you run the code. However, you can also replace it with your username everywhere in the code if you prefer.

6 Goal

Prepare a scheduler script with suitable resources and submit a reproducible batch job with qsub.

7 Connect to the login node through SSH

Open a terminal on your personal computer and connect to the HPC cluster’s login node using SSH. For example:

Replace USERNAME with your actual username and skirit.metacentrum.cz with the appropriate login node for your cluster.

8 Test your Mamba environment

A preconfigured Mamba environment will allow you to control the software available. Otherwise, your job could fail because the server doesn’t offer you the right software (or versions) your script requires. Check the previous chapter if you haven’t created a mamba environment yet. Here you must be aware that I am using the “easy” mode and I am not moving the mamba environment to /scratch, but just loading it from its original location. Advanced users interested in long running jobs should consider moving their mamba environment to /scratch. This will speed up the loading of the environment and ensure network instability won’t affect your job.

module add mambaforge
mamba activate /storage/brno2/home/$USER/mamba/envs/geostats

After activating your chosen mamba environment, check if the software you need is already available. For example, if you need R you can run:

which R
which Rscript

Both lines should point to an R or Rscript executable inside your Mamba environment.

Now create your working directory if it doesn’t exist and move to it:

mkdir -p /storage/brno2/home/$USER/HPC-VSCode-Mamba_SciSeminar/
cd /storage/brno2/home/$USER/HPC-VSCode-Mamba_SciSeminar/

Deactivate the Mamba environment and exit the login node momentarily to copy the working data to the compute node in the next section.:

mamba deactivate
exit

9 Copy data to the HPC cluster

Now that the working folder exists on the HPC cluster, use scp on your personal computer to copy your dataset to it. For example:

scp Data/COP90.tif [email protected]:/storage/brno2/home/USERNAME/HPC-VSCode-Mamba_SciSeminar/
scp Data/South.gpkg [email protected]:/storage/brno2/home/USERNAME/HPC-VSCode-Mamba_SciSeminar/

10 Connect to the login node again through SSH

Repeat the previous SSH command to connect to the login node again:

Replace USERNAME with your actual username and skirit.metacentrum.cz with the appropriate login node for your cluster.

Now you can move to your working directory and check that the files were copied successfully:

cd /storage/brno2/home/$USER/HPC-VSCode-Mamba_SciSeminar/
ls -lh