Why is $ProcessorCount different than the selected number of cores in PBS? By using ParallelTable and submitting my Mathematica code to a cluster, I noticed that it was enhancing the speed even when I selected a single core in a single node, comparing to the use of standard Table. Verifying the number of cores using $ProcessorCount, I got 16.

For selecting the number of cores I have submitted a bash file in terminal (already logged in SSH) using

qsub -I run_inter.sh


The file "run_inter.sh" contains

#!/bin/sh
#PBS -l walltime=10:00:00

#PBS -q par32
#PBS -l nodes=1:ppn=1


where "par32" is a machine with 32GB of RAM.

Is there any reason for Mathematica to ignore the specification of core number and use 16 anyway?

-

Your PBS specifications do not get sent to Mathematica. PBS doesn't control Mathematica. Your job is being run on a machine with 16 cores and Mathematica sees this, hence the result of $ProcessorCount. To limit Mathematica to a single core, add the following lines to your script SetSystemOptions["MKLThreads" -> 1] SetSystemOptions["ParallelOptions" -> "ParallelThreadNumber" -> 1]  This will not affect the result of $ProcessorCount
Thank you. So, the option nodes= :ppn=  is useless when using Mathematica? How can I choose the number of nodes in the cluster? – fcpenha Sep 24 '13 at 23:11
Its a two step process, #PBS -l nodes=1:ppn=1 tells your cluster that you intend to use one core and SetSystemOptions["MKLThreads" -> 1] SetSystemOptions["ParallelOptions" -> "ParallelThreadNumber" -> 1] ensures that you really do only use one core – WalkingRandomly Sep 25 '13 at 0:11
But, for example, that machine has nodes with 16 cores each. If I want to use 20 cores (10 for each node), I should use #PBS -l nodes=2:ppn=10 plus what? LaunchKernels[20] ? – fcpenha Sep 25 '13 at 1:46