autoconf
[Top][All Lists]
Advanced

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

Re: number of processors


From: Philip Willoughby
Subject: Re: number of processors
Date: Tue, 27 Aug 2002 22:22:56 +0100 (BST)

Today, Eric Siegerman wrote:

>Rather:
>    if (nprocs == -1)          /* Value unavailable */
>      exit(EXIT_ERROR);
>    else if (nprocs == 0)
>      nprocs = 1;
>
>>   printf ("%ld\n",nprocs);
>>   exit (EXIT_SUCCESS);
>> }
>
>Then if it exits with an error, proceed to your other tests.

Yes...

A more useful variant of my original code (I tidied it up a bit after
posting) can be got from http://csgsoft.doc.ic.ac.uk/numcpus

Also IMO the best way to test on linux is to add one to the number of the
last processor (they are numbered sequentially from 0).

Regards,

Philip Willoughby

Systems Programmer, Department of Computing, Imperial College, London, UK
-- 
echo address@hidden | tr "bizndfohces" "pwgd9ociaku"





reply via email to

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