Setting number of threads using OpenMP

We can set either in the code or through environment variable. If we use environtment variable, we simply type

$ setenv OMP_NUM_THREADS 6

where 6 is the number of cpus we want to use.


failed to poll for a spawned proc

I am having problem running an openmpi program. It kept on giving me this error:

[opto023:31621] pls:tm: failed to poll for a spawned proc, return status = 17002
[opto023:31621] [0,0,0] ORTE_ERROR_LOG: In errno in file ../../../../../orte/mca/rmgr/urm/rmgr_urm.c at line 462
[opto023:31621] mpirun: spawn failed with errno=-11

I after I searched in the net, it might be due to OpenMPI and Torque problem.
check this forum.

The problem is solved by submitting the job using -S option

$qsub -S /bin/sh paralleljob.pbs