#!/bin/bash -l # saved as numpy_dot.qsub # Request some cores #$ -pe omp 4 # Set the job name #$ -N sample_numpy_dot # Get an email when it's done #$ -m e # Load a Python module - this will work with any of them. module load python3/3.8.6 # NSLOTS will be automatically set to 4 when the script is run on a # compute node because 4 cores were requested. # Set the Numpy-related environment variables before calling Python. # Just set OMP_NUM_THREADS. The underlying threaded library will use # this variable to determine the number of cores to use. export OMP_NUM_THREADS=$NSLOTS # Run the script, print the elapsed time # Submit with different numbers of cores and you'll # see different runtimes. time python numpy_dot.py 500000 100