Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
en:centro:servizos:hpc [2016/05/23 12:42] – fernando.guillen | en:centro:servizos:hpc [2022/06/30 11:46] – fernando.guillen | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== High Performance Computing (HPC) ====== | + | ====== High Performance Computing (HPC) cluster ctcomp3 |
+ | [[ https:// | ||
+ | ===== Description | ||
- | ===== Quick usage instructions ===== | + | The computing part of the cluster is made up of: |
- | ---------------- | + | * 9 servers for general computing. |
- | A summary of the steps necessary to get a job done: | + | * 1 "fat node" for memory-intensive jobs. |
+ | * 4 servers for GPU computing. | ||
+ | |||
+ | Users only have direct access to the login node, which has more limited features and should not be used for computing. \\ | ||
+ | All nodes are interconnected by a 10Gb network. \\ | ||
+ | There is distributed storage accessible from all nodes with 220 TB of capacity connected by a dual 25Gb fibre network. \\ | ||
- | - [[ es: | + | \\ |
- | - [[ es: | + | ^ Name ^ Model ^ Processor |
- | - [[ es: | + | | hpc-login2 |
+ | | hpc-node[1-2] | ||
+ | | hpc-node[3-9] | ||
+ | | | ||
+ | | < | ||
+ | | | ||
+ | | hpc-gpu3 | Dell R7525 | 2 x AMD EPYC 7543 @2,80 GHz (32c) | 256 GB | ||
+ | | | ||
+ | * Now ctgpgpu8. It will be integrated | ||
+ | ===== Accessing the system ===== | ||
+ | To access the cluster, access must be requested in advance via [[https:// | ||
+ | The access is done through an SSH connection to the login node: | ||
+ | <code bash> | ||
+ | ssh < | ||
+ | </ | ||
+ | ===== Storage, directories and filesystems | ||
+ | <note warning> None of the file systems in the cluster are backed up!!!</ | ||
+ | The HOME of the users in the cluster is on the file share system, so it is accessible from all nodes in the cluster. Path defined in the environment variable %%$HOME%%. \\ | ||
+ | Each node has a local 1TB scratch partition, which is deleted at the end of each job. It can be accessed through the %%$LOCAL_SCRATCH%% environment variable in the scripts. \\ | ||
+ | For data to be shared by groups of users, you must request the creation of a folder in the shared storage that will only be accessible by members of the group.\\ | ||
+ | ^ Directory | ||
+ | | Home | %%$HOME%% | ||
+ | | local Scratch | ||
+ | | Group folder | ||
+ | %%* storage is shared %% | ||
+ | === WARNING === | ||
+ | The file share system performs poorly when working with many small files. To improve performance in such scenarios, create a file system in an image file and mount it to work directly on it. The procedure is as follows: | ||
+ | * Create the image file at your home folder: | ||
+ | <code bash> | ||
+ | ## truncate image.name -s SIZE_IN_BYTES | ||
+ | truncate example.ext4 -s 20G | ||
+ | </ | ||
+ | * Create a filesystem in the image file: | ||
+ | <code bash> | ||
+ | ## mkfs.ext4 -T small -m 0 image.name | ||
+ | ## -T small optimized options for small files | ||
+ | ## -m 0 Do not reserve capacity for root user | ||
+ | mkfs.ext4 -T small -m 0 example.ext4 | ||
+ | </ | ||
+ | * Mount the image (using SUDO) with the script | ||
+ | <code bash> | ||
+ | ## By default it is mounted at / | ||
+ | sudo mount_image.py example.ext4 | ||
+ | </ | ||
+ | * To unmount the image use the script // | ||
- | ===== Introduction ===== | + | The mount script has this options: |
- | ------------- | + | < |
- | High Performance Computing | + | --mount-point path <-- (optional) This option creates subdirectories under / |
+ | --rw <-- (optional) By default it is mounted readonly, | ||
+ | </ | ||
+ | <note warning> Do not mount the image file readwrite from more than one node!!!</ | ||
- | A queue management system is a program that plans how and when jobs will execute using the available computational resources. | + | The unmounting script has this options: |
+ | < | ||
+ | --mount-point | ||
+ | </ | ||
+ | ===== Transference of files and data ===== | ||
+ | === SCP === | ||
+ | From your local machine to the cluster: | ||
+ | <code bash> | ||
+ | scp filename < | ||
+ | </ | ||
+ | From the cluster to your local machine: | ||
+ | <code bash> | ||
+ | scp filename < | ||
+ | </ | ||
+ | [[https:// | ||
+ | === SFTP === | ||
+ | To transfer several files or to navigate through the filesystem. | ||
+ | <code bash> | ||
+ | < | ||
+ | sftp> | ||
+ | sftp> ls | ||
+ | sftp> cd < | ||
+ | sftp> put < | ||
+ | sftp> get < | ||
+ | sftp> quit | ||
+ | </ | ||
+ | [[https:// | ||
+ | === RSYNC === | ||
+ | [[ https:// | ||
+ | === SSHFS === | ||
+ | Requires local installation of the sshfs package.\\ | ||
+ | Allows for example to mount the user's local home in hpc-login2: | ||
+ | <code bash> | ||
+ | ## Mount | ||
+ | sshfs < | ||
+ | ## Unmount | ||
+ | fusermount -u < | ||
+ | </ | ||
+ | [[https:// | ||
- | The way these systems work is: | + | ===== Available Software ===== |
- | - The user requests some resources to the queue manager for a computational task. This task is a set of instructions written in a script. | + | Todos los nodos tienen el software básico que se instala por defecto con AlmaLinux 8.4, particularmente: |
- | - The queue manager assigns the request to one of its queues. | + | * GCC 8.5.0 |
- | - When the requested resources are available and depending on the priorities established by the system, the queue manager executes the task and stores the output. | + | * Python 3.6.8 |
+ | * Perl 5.26.3 | ||
- | It is important to note that the request and the execution of a given task are independent actions that are not resolved atomically. In fact it is usual that the execution of the task has to wait in one of the queues until the requested resources are available. Also, interactive use is impossible. | + | Para usar cualquier otro software no instalado en el sistema u otra versión del mismo hay tres opciones: |
+ | - Usar Modules con los módulos que ya están instalados (o solicitar la instalación de un nuevo módulo si no está disponible) | ||
+ | - Usar un contenedor (uDocker o Apptainer/ | ||
+ | - Usar Conda | ||
+ | Un módulo es la solución más sencilla para usar software sin modificaciones o dependencias difíciles de satisfacer.\\ | ||
+ | Un contenedor es ideal cuando las dependencias son complicadas y/o el software está muy personalizado. También es la mejor solución si lo que se busca es reproducibilidad, facilidad para su distribución y trabajo en equipo.\\ | ||
+ | Conda es la mejor solución si lo que se necesita es la última versión de una librería o programa o paquetes no disponibles de otra forma.\\ | ||
- | ==== Hardware description ==== | ||
- | Ctcomp2 is a heterogeneous cluster, composed of 8 HP Proliant BL685c G7, 5 Dell PowerEdge M910 and 5 Dell PowerEdge M620 nodes. | + | ==== Uso de modules/ |
- | * Each HP Proliant node has 4 AMD Opteron 6262 HE (16 cores) processors and 256 GB RAM(except node1 and the master with 128GB). | + | [[ https:// |
- | * Each Dell PowerEdge M910 node has 2 Intel Xeon L7555 (8 cores, 16 threads) processors and 64 GB RAM. | + | <code bash> |
- | * Each Dell PowerEdge M620 node has 2 Intel Xeon E5-2650L (8 cores, 16 threads) processors and 64 GB RAM. | + | # Ver los módulos disponibles: |
- | * Connection with the cluster is made at 1Gb but nodes are connected between them by several 10 GbE networks. | + | module avail |
+ | # Cargar un módulo: | ||
+ | module < | ||
+ | # Descargar un módulo: | ||
+ | module unload < | ||
+ | # Ver módulos cargados en tu entorno: | ||
+ | module list | ||
+ | # Puede usarse ml como abreviatura del comando module: | ||
+ | ml avail | ||
+ | # Para obtener información sobre un módulo: | ||
+ | ml spider < | ||
+ | </ | ||
- | ==== Software description ==== | ||
- | The job management is done by the queue manager PBS/TORQUE. To improve energetic efficiency an on demand power on and off system called CLUES has been implemented. | ||
- | * [[http://docs.adaptivecomputing.com/maui/index.php|MAUI 3.3.1]] | + | ==== Ejecución de contenedores de software ==== |
- | * [[http:// | + | === uDocker ==== |
- | * [[http:// | + | [[ https://indigo-dc.gitbook.io/udocker/user_manual |
+ | uDocker está instalado como un módulo, así que es necesario cargarlo en el entorno: | ||
+ | <code bash> | ||
+ | ml uDocker | ||
+ | </code> | ||
- | ===== User queues ===== | + | === Apptainer/ |
- | ------------- | + | [[ https:// |
+ | Apptainer/ | ||
- | There are four user and eight system queues. The user queues are //routing// queues that set, depending on the number of computational numbers requested, the system queue in which each job is going to be executed. Users can't send their jobs directly to the system queues, jobs have to be submitted to the user queues. | ||
- | Independently of the type of queue used for job submissions, | + | ==== CONDA ==== |
- | Therefore for jobs in which both memory and execution time are critical it is recommended to modify the number of process requested (even though not all of them get used during the execution) to guarantee that the job needs are fulfilled. The system queue also determines the maximum number of jobs per user and their priority. Users are allowed to specify the job execution time because a precise estimation of execution times allows the queue management system to use resources efficiently without disturbing established priorities. Anyway it is advisable to set an execution time long enough as to guarantee the correct execution of the job and avoid its cancellation. | + | [[ https://docs.conda.io/ |
- | __To execute jobs that don't adjust to queue parameters get in touch with the IT department.__ | + | Miniconda es la versíon mínima de Anaconda y solo incluye el gestor de entornos conda, Python y unos pocos paquetes necesarios. A partir de ahí cada usuario solo descarga e instala los paquetes que necesita. |
+ | <code bash> | ||
+ | # Obtener miniconda | ||
+ | wget https:// | ||
+ | # Instalarlo | ||
+ | sh Miniconda3-py39_4.11.0-Linux-x86_64.sh | ||
+ | </ | ||
- | User queues are '' | + | ===== Uso de SLURM ===== |
- | | + | El gestor de colas en el cluster es [[ https:// |
- | | + | <note tip>El término CPU identifica a un core físico de un socket. El hyperthreading está desactivado, por lo que cada nodo tiene disponibles tantas CPU como (nº sockets) * (nº cores físico por socket) tenga.</ |
- | < | + | == Recursos disponibles == |
- | ct$ qsub -q short script.sh | + | <code bash> |
+ | hpc-login2 ~]$ sinfo -e -o " | ||
+ | # Hay un alias para este comando: | ||
+ | hpc-login2 ~]$ ver_recursos | ||
+ | NODELIST | ||
+ | hpc-fat1 | ||
+ | hpc-gpu[1-2] | ||
+ | hpc-gpu3 | ||
+ | hpc-gpu4 | ||
+ | hpc-node[1-2] | ||
+ | hpc-node[3-9] | ||
+ | |||
+ | # Para ver el uso actual de los recursos: (CPUS (Allocated/ | ||
+ | hpc-login2 ~]$ sinfo -N -r -O NodeList, | ||
+ | # Hay un alias para este comando: | ||
+ | hpc-login2 ~]$ ver_uso | ||
+ | NODELIST | ||
+ | hpc-fat1 | ||
+ | hpc-gpu3 | ||
+ | hpc-gpu4 | ||
+ | hpc-node1 | ||
+ | hpc-node2 | ||
+ | hpc-node3 | ||
+ | hpc-node4 | ||
+ | hpc-node5 | ||
+ | hpc-node6 | ||
+ | hpc-node7 | ||
+ | hpc-node8 | ||
+ | hpc-node9 | ||
</ | </ | ||
- | * '' | + | ==== Nodos ==== |
- | < | + | Un nodo es la unidad de computación de SLURM, y se corresponde con un servidor físico. |
- | ct$ qsub -q bigmem script.sh | + | <code bash> |
+ | # Mostrar la información de un nodo: | ||
+ | hpc-login2 ~]$ scontrol show node hpc-node1 | ||
+ | NodeName=hpc-node1 Arch=x86_64 CoresPerSocket=18 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | RealMemory=187645 AllocMem=0 FreeMem=166801 Sockets=2 Boards=1 | ||
+ | State=IDLE ThreadsPerCore=1 TmpDisk=0 Weight=1 Owner=N/A MCS_label=N/ | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
</ | </ | ||
- | * '' | + | ==== Particiones ==== |
- | < | + | Las particiones en SLURM son grupos lógicos de nodos. En el cluster hay una única partición a la que pertenecen todos los nodos, por lo que no es necesario especificarla |
- | ct$ qsub -q interactive | + | < |
+ | # Mostrar la información de las particiones: | ||
+ | hpc-login2 ~]$ sinfo | ||
+ | defaultPartition* | ||
+ | # Cuando se incorporen al cluster ctgpgpu7 y 8 apareceran como los nodos hpc-gpu1 y 2 respectivamente. | ||
</ | </ | ||
+ | ==== Trabajos ==== | ||
+ | Los trabajos en SLURM son asignaciones de recursos a un usuario durante un tiempo determinado. Los trabajos se identifican por un número correlativo o JOBID. \\ | ||
+ | Un trabajo (JOB) consiste en uno o más pasos (STEPS), cada uno consistente en una o más tareas (TASKS) que usan una o más CPU. Hay un STEP por cada programa que se ejecute de forma secuencial en un JOB y hay un TASK por cada programa que se ejecute en paralelo. Por lo tanto en el caso más simple como por ejemplo lanzar un trabajo consistente en ejecutar el comando hostname el JOB tiene un único STEP y una única TASK. | ||
- | The system queues are '' | + | ==== Sistema de colas (QOS) ==== |
- | | + | La cola a la que se envíe cada trabajo define la prioridad,los límites |
- | * '' | + | <code bash> |
- | | + | # Mostrar las colas |
- | | + | hpc-login2 ~]$ sacctmgr show qos |
- | | + | # Hay un alias que muestra solo la información más relevante: |
- | | + | hpc-login2 ~]$ ver_colas |
- | | + | Name |
- | | + | ---------- ---------- --------------- ----------- --------------------------- ----------- ------------- --------- ----------- |
+ | | ||
+ | interactive | ||
+ | urgent | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | # Priority: es la prioridad relativa de cada cola. \\ | ||
+ | # DenyonLimit: | ||
+ | # UsageFactor: | ||
+ | # MaxTRES: límites por cada trabajo \\ | ||
+ | # MaxWall: tiempo máximo que puede estar el trabajo en ejecución \\ | ||
+ | # MaxTRESPU: límites globales por usuario \\ | ||
+ | # MaxJobsPU: Número máximo de trabajos que un usuario puede tener en ejecución. \\ | ||
+ | # MaxSubmitPU: | ||
+ | |||
+ | ==== Envío de un trabajo al sistema de colas ==== | ||
+ | == Especificación de recursos == | ||
+ | Por defecto, si se envía un trabajo sin especificar nada el sistema lo envia a la QOS por defecto (regular) y le asigna un nodo, una CPU y toda la memoria disponible. El límite de tiempo para la ejecución del trabajo es el de la cola (4 días y 4 horas). | ||
+ | Esto es muy ineficiente, | ||
+ | | ||
+ | | ||
+ | | ||
- | The following table summarizes the characteristics of the user and system queues; | + | A mayores puede ser interesante añadir los siguientes parámetros: |
+ | | -J | ||
+ | | -q | ||
+ | | -o | ||
+ | | | ||
+ | | -C | ||
+ | | | %%--exclusive%% | ||
+ | | -w | %%--nodelist%% | ||
- | ^ Queue ^ Limits | + | == Cómo se asignan los recursos == |
- | | ::: ^ Processes | + | Por defecto el método de asignación entre nodos es la asignación en bloque |
- | | '' | + | |
- | | '' | + | == Calculo de la prioridad == |
- | | '' | + | Cuando se envía un trabajo al sistema de colas, lo primero que ocurre es que se comprueba si los recursos solicitados entran dentro de los límites fijados en la cola correspondiente. Si supera alguno se cancela el envío. \\ |
- | | '' | + | Si hay recursos disponibles el trabajo se ejecuta directamente, |
- | | '' | + | El fairshare es un cálculo dinámico que hace SLURM para cada usuario y es la diferencia entre los recursos asignados y los recursos consumidos a lo largo de los últimos 14 días. |
- | | '' | + | <code bash> |
- | | '' | + | hpc-login2 ~]$ sshare |
- | | '' | + | User RawShares |
- | | '' | + | ---------- ---------- ----------- ----------- ----------- |
- | | '' | + | 1.000000 |
- | | '' | + | |
- | | '' | + | user_name |
+ | </ | ||
+ | # RawShares: es la cantidad de recursos en términos absolutos asignada al usuario. Es igual para todos los usuarios.\\ | ||
+ | # NormShares: Es la cantidad anterior normalizada a los recursos asignados en total.\\ | ||
+ | # RawUsage: Es la cantidad de segundos/ | ||
+ | # NormUsage: Cantidad anterior normalizada al total de segundos/ | ||
+ | # FairShare: El factor FairShare entre 0 y 1. Cuanto mayor uso del cluster, más se aproximará a 0 y menor será la prioridad.\\ | ||
+ | |||
+ | == Envío de trabajos == | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | 1. SALLOC \\ | ||
+ | Sirve para obtener de forma inmediata una asignación de recursos (nodos). En cuanto se obtiene se ejecuta el comando especificado o una shell en su defecto. | ||
+ | <code bash> | ||
+ | # Obtener 5 nodos y lanzar un trabajo. | ||
+ | hpc-login2 ~]$ salloc -N5 myprogram | ||
+ | # Obtener acceso interactivo a un nodo (Pulsar Ctrl+D para terminar el acceso): | ||
+ | hpc-login2 ~]$ salloc -N1 | ||
+ | </ | ||
+ | 2. SRUN \\ | ||
+ | Sirve para lanzar un trabajo paralelo ( es preferible a usar mpirun ). Es interactivo y bloqueante. | ||
+ | <code bash> | ||
+ | # Lanzar un hostname en 2 nodos | ||
+ | hpc-login2 ~]$ srun -N2 hostname | ||
+ | hpc-node1 | ||
+ | hpc-node2 | ||
+ | </ | ||
+ | 3. SBATCH \\ | ||
+ | Sirve para enviar un script al sistema de colas. Es de procesamiento por lotes y no bloqueante. | ||
+ | <code bash> | ||
+ | # Crear el script: | ||
+ | hpc-login2 ~]$ vim trabajo_ejemplo.sh | ||
+ | # | ||
+ | #SBATCH --job-name=prueba | ||
+ | #SBATCH --nodes=1 | ||
+ | #SBATCH --ntasks=1 | ||
+ | #SBATCH --cpus-per-task=1 | ||
+ | # | ||
+ | #SBATCH --time=00: | ||
+ | #SBATCH --qos=urgent | ||
+ | #SBATCH --output=prueba_%j.log | ||
+ | |||
+ | echo "Hello World!" | ||
+ | |||
+ | hpc-login2 ~]$ sbatch trabajo_ejemplo.sh | ||
+ | </ | ||
+ | |||
+ | ==== Uso de los nodos con GPU ==== | ||
+ | Para solicitar específicamente una asignación de GPUs para un trabajo hay que añadir a sbatch o srun las opciones: | ||
+ | | %%--gres%% | ||
+ | | | ||
+ | También existen las opciones %% --gpus-per-socket, | ||
+ | Ejemplos: | ||
+ | <code bash> | ||
+ | ## Ver la lista de nodos y gpus: | ||
+ | hpc-login2 ~]$ ver_recursos | ||
+ | ## Solicitar | ||
+ | --gpus=2 | ||
+ | ## Solicitar una A100 de 40G en un nodo y una A100 de 80G en otro, añadir: | ||
+ | --gres=gpu: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Monitorización de los trabajos ==== | ||
+ | <code bash> | ||
+ | ## Listado de todos los trabajos en la cola | ||
+ | hpc-login2 ~]$ squeue | ||
+ | ## Listado de los trabajos de un usuario | ||
+ | hpc-login2 ~]$ squeue -u < | ||
+ | ## Cancelar un trabajo: | ||
+ | hpc-login2 ~]$ scancel < | ||
+ | ## Lista de trabajos recientes | ||
+ | hpc-login2 ~]$ sacct -b | ||
+ | ## Información histórica detallada de un trabajo: | ||
+ | hpc-login2 ~]$ sacct -l -j < | ||
+ | ## Información de debug de un trabajo para troubleshooting: | ||
+ | hpc-login2 ~]$ scontrol show jobid -dd < | ||
+ | ## Ver el uso de recursos de un trabajo en ejecución: | ||
+ | hpc-login2 ~]$ sstat < | ||
+ | </ | ||
+ | ==== Controlar la salida de los trabajos ==== | ||
+ | == Códigos de salida == | ||
+ | Por defecto estos son los códigos de salida de los comandos: | ||
+ | ^ SLURM command | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | |||
+ | == STDIN, STDOUT y STDERR == | ||
+ | **SRUN: | ||
+ | Por defecto stdout y stderr se redirigen de todos los TASKS a el stdout y stderr de srun, y stdin se redirecciona desde el stdin de srun a todas las TASKS. Esto se puede cambiar con: | ||
+ | | %%-i, --input=< | ||
+ | | %%-o, --output=< | ||
+ | | %%-e, --error=< | ||
+ | Y las opciones son: | ||
+ | * //all//: opción por defecto. | ||
+ | * //none//: No se redirecciona nada. | ||
+ | * //taskid//: Solo se redirecciona desde y/o al TASK id especificado. | ||
+ | * // | ||
+ | * //filename pattern//: Igual que filename pero con un fichero definido por un [[ https:// | ||
+ | |||
+ | **SBATCH: | ||
+ | Por defecto "/ | ||
+ | | %%-i, --input=< | ||
+ | | %%-o, --output=< | ||
+ | | %%-e, --error=< | ||
+ | La referencia de filename_pattern está [[ https:// | ||
+ | |||
+ | ==== Envío de correos ==== | ||
+ | Se pueden configurar los JOBS para que envíen correos en determinadas circunstancias usando estos dos parámetros (**SON NECESARIOS AMBOS**): | ||
+ | | | ||
+ | | | ||
+ | |||
+ | |||
+ | |||
+ | ==== Estados de los trabajos en el sistema de colas ==== | ||
+ | <code bash> | ||
+ | hpc-login2 ~]# squeue -l | ||
+ | JOBID PARTITION | ||
+ | 6547 defaultPa | ||
+ | </ | ||
+ | Estados (STATE) más comunes de un trabajo: | ||
+ | * R RUNNING Job currently has an allocation. | ||
+ | * CD COMPLETED Job has terminated all processes on all nodes with an exit code of zero. | ||
+ | * F FAILED Job terminated with non-zero exit code or other failure condition. | ||
+ | * PD PENDING Job is awaiting resource allocation. | ||
+ | |||
+ | [[ https:// | ||
+ | Si un trabajo no está en ejecución aparecerá una razón debajo de REASON:[[ https:// | ||
- | * Processes: Maximum number of processes by job in this queue. | ||
- | * Nodes: Maximum numbers of nodes in which the job will be executed. | ||
- | * Memory: Maximum virtual memory concurrently used by all the job processes. | ||
- | * Jobs/user: Maximum number of jobs per user regardless of their state. | ||
- | * Maximum time (hours): Maximum real time during which the job can be in the execution state. | ||
- | * Priority: Priority of the execution queue related to the other queues. A higher value means more priority. Please note that lacking other criteria, any job sent with qsub will by default be executed in np1 using its limits. |