[torqueusers] How to get number of allocated CPUs within job script?

Norbert Paschedag noe at physik.unizh.ch
Thu Apr 6 07:17:15 MDT 2006



On Wed, 5 Apr 2006, Lennart Karlsson wrote:

> We run Torque and Moab on a 64 processor Altix system, i.e.
> one node containing 64 processors.
>
> Within a job script you want to know how many processors was
> allocated to the job by Moab.
>
> If you are lucky, you can count the number of lines in the file
> $PBS_NODEFILE, but not always, e.g. when you use the ncpus
> specification in your qsub command.
>
> It seems clumsy to run "showres" to fetch this information... Is
> there a better way?
>
> Perhaps a new $PBS_ variable is needed? (Does Torque know the number
> of processors? It does not disclose that information in the
> 'qstat -f' output.)
>
> On an Altix, the job might be able to ask questions about the size
> of the surrounding cpuset. But the cpuset-2.0 implementation is not
> yet implemented in Torque, as far as I know.
>

There was a patch for torque floating around on this list (I think)
that would add additional environment variables $NCPUS (similar to what 
PBSpro is doing on SMPs) and $PBS_NCPUS. Worked fine on our cluster.

If you're interested I can send you my version of the patch.

Regards,
   Norbert



More information about the torqueusers mailing list