gomp-discuss
[Top][All Lists]
Advanced

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

Re: [Gomp-discuss] Number of CPU's


From: Steven Bosscher
Subject: Re: [Gomp-discuss] Number of CPU's
Date: 17 Feb 2003 10:58:52 +0100

Op ma 17-02-2003, om 10:43 schreef Lars Segerlund:
> 
>    I am fairly sure that POSIX doesn't provide a way to determine the 
> number of physical CPU's in the system, this has to be done in a system 
> dependent manner.

Well, like I said: You can get the number of configured and online CPUs
with:

     long N_CPUs_configured = sysconf (_SC_NPROCESSORS_CONF);
     long N_CPUs_online = sysconf (_SC_NPROCESSORS_ONLN);

This works on Solaris, HPUX and Linux, I'm not sure if it's POSIX but if
it isn't then it's sort-of the de facto standard.

Greetz
Steven






reply via email to

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