How to fix CPU frequency while executing OpenMP code?

How to fix CPU frequency while executing OpenMP code?

by Arjun Lenan Sandhya -
Number of replies: 2

I read from the NHR documentation that OpenMP is not slurm-aware and srun is not used for purely OpenMP code. If so, how can we fix the cpu frequency while executing the script? The relevant code in the job script I am using is given below:

export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
export OMP_PLACES=cores
export OMP_PROC_BIND=close
echo "Running benchmark for $SLURM_CPUS_PER_TASK threads"
./stream $SLURM_CPUS_PER_TASK



In reply to Arjun Lenan Sandhya

Re: How to fix CPU frequency while executing OpenMP code?

by Georg Hager -

The comment about OpenMP not being SLURM aware pertains to the fact that the number of threads is not set automagically just because you told SLURM that you want so-and-so-many threads. However, it's all very simple: Just allocate one node (-N 1) and then, in your script, set the number of threads and the affinity as usual and start your binary with srun as a wrapper:

$ OMP_NUM_THREADS=8 OMP_PLACES=cores OMP_PROC_BIND=close srun --cpu-freq=...whatever... ./a.out