5.27. Keras¶
On this system, you can utilize a GPU-accelerated deep learning environment using Keras by pulling and running optimized TensorFlow container images (which include Keras) provided by NVIDIA NGC (NVIDIA GPU Cloud) using Singularity.
Container Image Example (NGC) |
Execution Queue |
|---|---|
|
A_002
A_001
CA_001
DA_002
|
Attention
Please pull container images on the frontend node in advance.
Please also download necessary datasets on the frontend node in advance.
For container pulling procedures and detailed options, please also refer to the How to Use Singularity page.
5.27.1. Preparing Container Image (Frontend Node)¶
Pull the TensorFlow container image (which includes Keras) from the NVIDIA NGC registry on the frontend node to create a Singularity image file ( .sif ).
Please execute the pull within your home directory. After creating the image, clean the cache to prevent consuming your home directory quota (see How to Use Singularity for details).
Pull TensorFlow container image from NGC (e.g., 24.09-tf2-py3)
$ singularity pull tensorflow_24.09-tf2-py3.sif docker://nvcr.io/nvidia/tensorflow:24.09-tf2-py3
For available tags (versions), please refer to NVIDIA NGC Catalog (TensorFlow).
5.27.2. Job Script Format¶
Job script format for executing on Accelerator Server using GPUs.
Specifying the --nv option allows the container to access NVIDIA GPUs.
#!/bin/sh
#PBS -l select=1[:ncpus=number of CPUs][:ngpus=number of GPUs][:mem=amount of memory]
#PBS -q CA_001
#PBS -N jobname
cd $PBS_O_WORKDIR
singularity exec --nv <image_file.sif> python input_file > output_file 2> error_file
5.27.3. Example¶
Example of running cifar100.py on the shared GPU queue (CA_001) using 2 CPU cores, 2 GPUs, and 64GB memory.
#!/bin/sh
#PBS -l select=1:ncpus=2:ngpus=2:mem=64gb
#PBS -q CA_001
#PBS -N Keras_job
cd $PBS_O_WORKDIR
singularity exec --nv tensorflow_24.09-tf2-py3.sif python cifar100.py > cifar100.out 2> cifar100.err