Am 13.07.2012 um 09:44 schrieb William Hay:

> On 13 July 2012 07:37, Joseph A. Farran <[email protected]> wrote:
>> Hi.
>> 
>> I am trying to set OMP_NUM_THREADS to the number of slots in my .sge_request 
>> with
>> 
>>     -v OMP_NUM_THREADS=$NSLOTS
>> But GE is not setting the variable to the value of $NSLOTS.    It does a 
>> literal set of "$NSLOTS".
>> 
>> Can this be done with .sge_request  to set OMP_NUM_THREADS with say 8 if 
>> $NSLOTS is equal to 8?
> 
> No that gets set when the job is submitted and $NSLOTS isn't set until
> runtime(because you can request a
> PE range).   You could put instructions to do this in shell
> initialization scripts and/or set ENV/BASH_ENV
> scripts via .sge_request to point to a shell fragment that does this.

Besides using the "starter_method" we discussed last week, it's also possible 
to use a job prolog to change the value in the environment file:

$ cat prolog.sh
#!/bin/sh
sed -i "/^OMP_NUM_THREADS/d;\$aOMP_NUM_THREADS=$NSLOTS" 
$SGE_JOB_SPOOL_DIR/environment

$ qconf -sq all.q
...
prolog                sgeadmin@/usr/sge/cluster/prolog.sh

$ cat job.sh
#!/bin/sh
echo $OMP_NUM_THREADS

$ qsub -q all.q -pe openmpi 4 job.sh
Your job 4489 ("job.sh") has been submitted

$ cat job.sh.o4489
4

-- Reuti

> William
> _______________________________________________
> users mailing list
> [email protected]
> https://gridengine.org/mailman/listinfo/users


_______________________________________________
users mailing list
[email protected]
https://gridengine.org/mailman/listinfo/users

Reply via email to