[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Read the number of cpus on Linux
From: |
Andy Buckle |
Subject: |
Re: Read the number of cpus on Linux |
Date: |
Tue, 20 Jul 2010 11:04:11 +0100 |
On Tue, Jul 20, 2010 at 9:37 AM, Francesco Potortì <address@hidden> wrote:
> 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);
On windows
>[status output]=system("echo %number_of_processors%");
>nop=str2num(output)
nop = 2
--
/* andy buckle */