On 09/ 3/10 07:00 PM, John H Palmieri wrote:
On Sep 3, 10:47 am, Simon King<simon.k...@nuigalway.ie>  wrote:

I'd like to restrict @parallel(ncpus=...), where "..." is something
like 1/2 (or 1/3?) of the available CPUs. But how can I determine
this number?

From sage (or python):

   sage: import multiprocessing
   sage: multiprocessing.cpu_count()

returns a number claiming to be the number of cpus.

I don't have an answer to your other question.

--
John

Be aware, that for hyperthreaded machines, the number of CPUs may exceed the number of cores.


drkir...@hawk:~/sage-4.5.3.alpha2$ ./sage
----------------------------------------------------------------------
| Sage Version 4.5.3.alpha2, Release Date: 2010-08-23                |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
**********************************************************************
*                                                                    *
* Warning: this is a prerelease version, and it may be unstable.     *
*                                                                    *
**********************************************************************
sage: import multiprocessing
sage: multiprocessing.cpu_count()
8
sage:


This machine only has 4 cores, but uses Intel's Hyperthreading technology to give 2 threads per core.

In the case of t2.math, there are 8 threads per core.

So using half the CPUs, might in fact use almost all the computer's resources.

I'm not sure how to find the number of cores in Sage. I think it would be quite difficult to do without interrogating to find out what CPU the machine has, and using the data sheet to find out if that has multiple threads per core, and if so how many.

Dave

Dave

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to