AiiDA
AiiDA (https://www.aiida.net/) can be used in a number of different ways with PC2 HPC systems:
Running AiiDA on a different system, such as a local computer, and submitting calculations to PC2 HPC systems.
Running calculations, as well as AiiDA itself, on PC2 HPC systems.
Because these two situations need different setup steps, we will describe them independently below. We recommend the first possibility, i.e., running AiiDA on a local system and submitting calculations to PC2 HPC system because a local setup gives you more configuration freedom and also the possibility to, at the same time, submit also to other HPC systems. However, if you donÄt have a suitable local computer we include here also a guide for the second possibility of running AiIDA completely on PC2 HPC systems. If you are unsure what the best way for you is, please contact us at pc2-support@uni-paderborn.de.
Â
The two setups have individual advantages and disadvantages:
 | Running AiiDA on a local system and submitting to PC2 | Running AiiDA on PC2 |
---|---|---|
AiiDA can run permanently | Yes | Yes |
Possible trouble from network issues | Yes, in the connection between your local computer and the HPC system | No, because AiiDA is running very close to the HPC system |
PostgreSQL database can be used | Yes, but you need to set it up and maintain it on your local system | Yes |
RabbitMQ can be used | Yes, but you need to set it up and maintain it on your local system | discouraged due to the shared nature of HPC systems, please contact pc2-support@uni-paderborn.de if you need it. |
Jupyter Notebooks can be used | Yes | Yes, via JupyterHub |
Â
Running AiiDA on a Local System and Submitting Calculations to PC2 HPC Systems
This setup assumes that you are running AiiDA on a local computer or server outside of PC2. For the setup of AiIDA on the local computer follow the detailed guide https://aiida.readthedocs.io/projects/aiida-core/en/stable/installation/index.html. In case of questions or problems or questions please don't hesitate to contact us via pc2-support@uni-paderborn.de.
Create a Computer
To be able to submit calculations to a PC2 HPC system, create a computer in AiIDA by running the following on your local system where AiiDA is running:
verdi computer setup --label Noctua2 --description "Noctua2 Slurm" --scheduler core.slurm --hostname n2login1 --transport core.ssh --work-dir "[work dir]" --mpirun-command srun --shebang '#!/bin/bash' --mpiprocs-per-machine 128 --default-memory-per-machine 240000000 --not-use-double-quotes --prepend-text "" --append-text ""
Replace:
[work dir]
with a path to a directory on the parallel file system that AiiDA is going to use as a temporary working directory for your jobs, e.g.,/scratch/hpc-prf-[project abbreviation]/{username}/AiiDA/scratch
.{username}
is automatically replaced by AiiDA with your user name.
Configure the Computer
For access via ssh the computer needs to be configured by running:
verdi -p [AiiDA profile name] computer configure core.ssh Noctua2
with the following settings:
User name: [user name]
Port number: 22
Look for keys [Y/n]: n
SSH key file []: [path to your ssh private key]
Connection timeout in s [60]: 60
Allow ssh agent [Y/n]: Y
SSH proxy jump []: [user name]@fe.noctua2.pc2.uni-paderborn.de
SSH proxy command []:
Compress file transfers [Y/n]: Y
GSS auth [False]:
GSS kex [False]:
GSS deleg_creds [False]:
GSS host [n2login1]:
Load system host keys [Y/n]: Y
Key policy (RejectPolicy, WarningPolicy, AutoAddPolicy) [RejectPolicy]: WarningPolicy
Use login shell when executing command [Y/n]:
Connection cooldown time (s) [30.0]:
Replace:
[path to your ssh private key]
: with the path to your SSH key that is enabled for login to PC2 cluster systems. Please note that the ssh-agent is required so that password-protected ssh-keys work with AiiDA. Password-protected ssh-keys are required for PC2 HPC systems. See also our guide on SSH keys.[user name]
: your PC2 user name
Testing the Computer
Run verdi computer test Noctua2
to test the configuration. In case of questions or problems or questions please don't hesitate to contact us via pc2-support@uni-paderborn.de.
Create a Code
The next steps show with the example of Quantum Espresso pw.x how you can use the existing software on PC2 HPC systems with AiiDA. In this example we use Quantum Espresso from the module chem/QuantumESPRESSO/7.3-foss-2023a
.
Run AiiDA Quantum Espresso plugins:
pip install aiida-quantumespresso verdi plugin list aiida.calculations aiida-pseudo install sssp #for the example below
Run
verdi code create core.code.installed
and enterTest the code:
Running a Calculation
Import an atomic structure
List structures and their IDs:
Run the verdi shell (
verdi shell
) with
The last lines specify the properties of the compute job in terms of partition, time limit, and resources. More options can be found at https://aiida.readthedocs.io/projects/aiida-core/en/stable/topics/calculations/usage.html#options. The meaning is as follows:
builder.metadata.options.max_wallclock_second: time limit of the job in seconds
builder.metadata.options.queue_name: name of the partition, e.g., normal, largemem,…
builder.metadata.options.withmpi: should the job be run with MPI
builder.metadata.options.resources
num_machines: sbatch option -N/--nodes=
num_mpiprocs_per_machine: sbatch option --ntasks-per-node=
num_cores_per_mpiproc: sbatch option -c/--cpus-per-task=
builder.metadata.options.account: the name of your compute project, required if you are a member of multiple compute projects
builder.metadata.options.qos: in case you want to use special QoS like devel or express
builder.metadata.options.max_memory_kb: maximal memory per node in case you want to overwrite the default values of memory per node
Run the job with AiiDA
If you run AiIDA locally with RabbitMQ:
If you run AiiDA locally without RabbitMQ:
Â
You can monitor your jobs with
verdi process list -a
Running AiiDA on PC2 Systems
We describe here the setup of AiiDA on PC2 HPC systems with Sqlite and PostgresSQL but without RabbitMQ. RabbitMQ is problematic on HPC systems because care must be taken about access control (see https://www.rabbitmq.com/docs/access-control). Please contact pc2-support@uni-paderborn.de if you need RabbitMQ.
Â
To run AiiDA on PC2 systems, there are three options:
Run AiiDA on one of the login nodes, i.e., n2login[1-6]
Run AiiDA on the PC2 Jupyter Hub
Run AiiDA in a long-running compute job (at most 21 days)
Basic Setup of AiiDA
Load a suitable Python module, e.g.,
Create a Python virtual environment and activate it
We recommend placing Python virtual environments in the PC2 groups directories, i.e.,
/pc2/groups/hpc-prf-[your project abbreviation]
install AiiDA
If you want to use AiIDA in the PC2 Jupyter Hub, you need to also register the virtual environment as a Jupyter Hub kernel:
Note that you can later use
to load the AiiDA Jupyter notebook extension so that you can for example use verdi as
Database Setup
As a database backend, you can either use SQLite or PostgreSQL
Setup for SQLite
Create an AiiDA profile
As the directory of the backend, you can choose a directory on the parallel file system.
Setup for PostgreSQL
Set up a PostgreSQL database
Load PostgreSQL module
Copy sample configuration
Change the settings in the config
postgresql.conf:
port = : choose some random port (>1024, <65536)
listen_addresses = 'localhost'
unix_socket_directories = '/tmp'
unix_socket_permissions = 0700
Create and initialize the data directory. The data directory should be on the parallel file system:
Try to start PostgreSQL:
(while PostgreSQL is running) Create database:
(while PostgreSQL is running) Configure PostgreSQL for AiiDA by running
psql -p [port number]
(while PostgreSQL is running) Test database connection:
Create an AiiDA profile
PostgreSQL engine [postgresql_psycopg2]:
PostgreSQL hostname [localhost]:
PostgreSQL port [5432]: [port number]
PostgreSQL username: aiida
PostgreSQL password: [passwort for user aiida chosen above]
PostgreSQL database name: aiida
File repository URI: A directory on the parallel file system. it needs to start with file:// , i.e.,
file:///scratch/hpc-prf-[project abbreviation]/...
Note that the PostgreSQL database needs to be running for AiiDA to work:
When running AiiDA on one of the login nodes: Run the PostgreSQL database in a tmux or screen session on the same login node
When running AiiDA on the PC2 Jupyter Hub: Run PostgreSQL database in a tmux or screen session in the console in Jupyter Lab instance
When running AiiDA in a long-running compute job: Start PostgreSQL database in the job before AiiDA in the background, i.e.,
Create a Computer
To be able to submit calculations to a PC2 HPC system, create a computer in AiIDA by running the following on your local system where AiiDA is running:
Replace:
[work dir]
with a path to a directory on the parallel file system that AiiDA is going to use as a temporary working directory for your jobs, e.g.,/scratch/hpc-prf-[project abbreviation]/{username}/AiiDA/scratch
.{username}
is automatically replaced by AiiDA with your user name.
Configure the Computer
Configure the computer for your AiIDA profile by running:
verdi -p [AiiDA profile name] computer configure core.local Noctua2
Use login shell when executing command [Y/n]: n
Connection cooldown time (s) [0.0]:
Testing the Computer
Run verdi computer test Noctua2
to test the configuration. In case of questions or problems or questions please don't hesitate to contact us via pc2-support@uni-paderborn.de.
Then you can follow the steps to create code and run a calculation above.
Â