Skip to content

Instantly share code, notes, and snippets.

@vishnuexe
Last active December 20, 2024 10:09
Show Gist options
  • Select an option

  • Save vishnuexe/b381536a2a1903f81bd5569e816d4eb0 to your computer and use it in GitHub Desktop.

Select an option

Save vishnuexe/b381536a2a1903f81bd5569e816d4eb0 to your computer and use it in GitHub Desktop.

create def file

Bootstrap: docker
From: <give docker image path>  example: nvcr.io/nvidia/pytorch:24.11-py3

%post
    <required packages to be installed or commands to be exectued for preparation of the main program>
    apt-get -y update
    apt-get install -y python-pip
    pip install diffusers==0.30.2
    huggingface-cli login --token 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 --add-to-git-credential

create sif file from def: singularity build --fakeroot test.sif tutorial-1.def

create mpi file:

#!/bin/bash
#SBATCH --job-name=myjob # create a short name for your job
#SBATCH --nodes=1 # node count
#SBATCH --ntasks=1 # total number of tasks across all nodes
#SBATCH --cpus-per-task=4 # cpu-cores per task (>1 if multi-threaded tasks)
#SBATCH --mem-per-cpu=4G # memory per cpu-core (4G per cpu-core is default)
#SBATCH --time=00:05:00 # total run time limit (HH:MM:SS)
#SBATCH --gres=gpu:1 # number of gpus per node
nvidia-smi

Slrum template for singularity run:

#!/bin/bash
#SBATCH --job-name=cv # create a short name for your job
#SBATCH --nodes=1 # node count
#SBATCH --ntasks=1 # total number of tasks across all nodes
#SBATCH --cpus-per-task=4 # cpu-cores per task (>1 if multi-threaded tasks)
#SBATCH --mem-per-cpu=4G # memory per cpu-core (4G per cpu-core is default)
#SBATCH --time=23:59:00 # total run time limit (HH:MM:SS)
#SBATCH --mail-type=begin #send mail when job begins
#SBATCH --mail-type=end
#SBATCH --mail-user=142204003@smail.iitpkd.ac.in
#SBATCH --gres=gpu:1 # number of gpus per node
#SBATCH --partition=gpu02
srun singularity exec --nv inpaint.sif python FLUX-Controlnet-Inpainting/main.py

For interactive session on gpu run this while you are in master/cpu node:

srun --partition=gpu01 --nodes=1 --time=00:30:00 --pty /bin/bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment