[GE users] Setting OMP_NUM_THREADS automatically

Reuti reuti at staff.uni-marburg.de
Fri Jul 25 12:51:54 BST 2008


Hi,

Am 25.07.2008 um 13:37 schrieb Chris Rudge:

> Is it possible to have SGE set the number of threads for OpenMP jobs
> automatically. If a job uses a whole node (4 processors in our case)
> then we don't need to worry as the number of threads defaults to the
> number of processors.
>
> I'm looking at encouraging users to use, say,
> 	qsub -pe openmp 2-4 .....
>
> to submit their jobs which would allow an openmp job to run on 3
> processors if the cluster is full except for one node which had a  
> single
> serial job on it.
>
> Ideally I'd like to make this transparent to the user - i.e. in the PE
> startup script. However, if I set the environment variable in the PE
> startup script the users job starts in a different shell so doesn't
> inherit the variable.
>
> Can I do anything better than simply instructing all users that they
> should ensure that their job scripts include something like
> 	setenv OMP_NUM_THREADS $NSLOTS

you could setup a custom starter_method like:

#!/bin/sh
export OMP_NUM_THREADS=$NSLOTS
exec "$@"

and set it in the queue definition just:

starter_method /usr/sge/cluster/startup.sh

-- Reuti



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at gridengine.sunsource.net
For additional commands, e-mail: users-help at gridengine.sunsource.net




More information about the gridengine-users mailing list