0

I am running some computational calculations using my DFT software. To do so I need a job script that assigns the client node to my job.

My job file is here

#!/bin/sh
#SBATCH -J test
#SBATCH -p 52core
#SBATCH -N 1
#SBATCH -n 16
#SBATCH -o %x.o%j
#SBATCH -e %x.e%j
#export I_MPI_PMI_LIBRARY=/usr/lib64/libpmi.so #Do not change here!!
##### Notjing to worry about above part===============
export OMP_NUM_THREADS=1

# Use , as list seperator
IFS=','
# Convert string to array
hcpus=($SLURM_JOB_CPUS_PER_NODE)
unset IFS

declare -a conv

# Expand compressed slurm array
for cpu in ${hcpus[@]}; do
     if [[ $cpu =~ (.*)\((.*)x\) ]]; then
    # found compressed value
    value=${BASH_REMATCH[1]}
    factor=${BASH_REMATCH[2]}
    for j in $(seq 1 $factor); do
        conv=( ${conv[*]} $value )
    done
     else
    conv=( ${conv[*]} $cpu )
     fi
done

# Build .machines file
rm -f .machines

nhost=0

echo ${conv[@]};

IFS=','
for node in $SLURM_NODELIST
do 
    declare -i cpuspernode=${conv[$nhost]};
    for ((i=0; i<${cpuspernode}; i++))  
    do
    echo 1:$node >> .machines
    done
    let nhost+=1
done 

echo 'granularity:1' >>.machines
echo 'extrafine:1' >>.machines

# .machines file complete

# Run your caclulation
run_lapw -p

This job file uses the bc on the client nodes and my client nodes are not having bc. There is no chance that I can install bc on the client nodes.

Is it possible to modify this script such that It uses the head node for bc and then assign the client node to my job file?

Basically it creates the .machine files. one .machine file for each core of the node and one .machines file which have the below format

1:node11
1:node11
1:node11
1:node11
1:node11
1:node11
1:node11
1:node11
1:node11
1:node11
1:node11
1:node11
1:node11
1:node11
1:node11
1:node11
granularity:1
extrafine:1
Gilles Gouaillardet
  • 8,193
  • 11
  • 24
  • 30
astha
  • 593
  • 5
  • 15
  • if you want to have each slot to display its name, simply run `srun hostname` then a bit of scripting to prepend `1:` to each line, and then append the footer. note you might want to simply copy `bc` into your `$HOME` directory or rebuilt it so it can be used on the compute nodes. – Gilles Gouaillardet Nov 15 '20 at 09:40
  • Sure, we can do that but again this .machine file is to be created automatic. I do not have any control on it. The program does it autometically – astha Nov 15 '20 at 10:15
  • that's why you should invoke `srun` (and postprocess it with trivial shell commands) in your job script. – Gilles Gouaillardet Nov 15 '20 at 10:46

0 Answers0