help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Read the number of cpus on Linux


From: Francesco Potortì
Subject: Read the number of cpus on Linux
Date: Tue, 20 Jul 2010 10:37:17 +0200

When using parcellfun, I want to know the number of processors
beforehand.

This is the simplest way I have come up with on Linux:

pid = fopen("/proc/cpuinfo");
cpus = length(strfind(char(fread(pid)'),"processor"));
fclose(pid);

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]