Page 1 of 1

Can an APL function discover how many cores are avail?

PostPosted: October 6th, 2010, 1:14 am
by Richard.Hill
Can an APL function discover how many cores are available in the users computer?

Re: Can an APL function discover how many cores are avail?

PostPosted: October 6th, 2010, 12:50 pm
by brent hildebrand
Richard.Hill wrote:Can an APL function discover how many cores are available in the users computer?
on Win32, this is found in the GetSystemInfo API call.
Code: Select all
      ⎕wcall 'W_Ini' 'GetSystemInfo'
(>SYSTEM_INFO) LIB Kernel32
The APL ADF for GetSystemInfo using the SYSTEM_INFO structure which is defined as follows in the ADF file:
Code: Select all
      ⎕wcall 'W_Ini' '[type]SYSTEM_INFO'
{W wProcessorArchitecture, W wReserved, D dwPageSize, P lpMinimumApplicationAddresss, P lpMaximumApplicationAddress, D dwActiveProcessorMask, D dwNumberOfProcessors, D dwProcessorType,  D dwAllocationGranularity, W wProcessorLevel, W wProcessorRevision}

The 7th element is the number of processors. So, to get this information via APL try the following:[code] (6+⎕io)⊃⎕wcall 'GetSystemInfo' â

PostPosted: October 6th, 2010, 10:09 pm
by aplus
I ran this code on a cheap entry level Acer Netbook with an Intel Atom N450 Processor (1.66 GHz, 512KB Cache) and was surprised to see 2 as the number of cores. In Control Panel/System it reports only 1 core.

PostPosted: October 6th, 2010, 10:47 pm
by brent hildebrand
aplus wrote:I ran this code on a cheap entry level Acer Netbook with an Intel Atom N450 Processor (1.66 GHz, 512KB Cache) and was surprised to see 2 as the number of cores. In Control Panel/System it reports only 1 core.
While true, the Atom N450 has a single core, it is also hyperthreaded, and thus I believe that GetSystemInfo will then report 2 processors. I know this is true on my Pentium computer with hyperthreading. My pentium-M no hyperthreading reports a 1 processor. Core-2 Duo reports 2. It would be interesting to see what a Core-I7 with 4 cores reports...

PostPosted: October 6th, 2010, 11:40 pm
by brent hildebrand
The other thing to check in the results of GetSystemInfo is the ActiveProcessorMask. [code] ⎕wcall 'GetSystemInfo' â

PostPosted: October 7th, 2010, 1:06 am
by Richard.Hill
Brent, Thank you...
Core 2 Quad Q9505 reports 4

PostPosted: October 7th, 2010, 8:57 am
by brent hildebrand
Richard.Hill wrote:Brent, Thank you...
Core 2 Quad Q9505 reports 4
Richard, on your computer, does this[code](5+⎕io)⊃⎕wcall 'GetSystemInfo' â

PostPosted: October 7th, 2010, 9:34 am
by Adam Kertesz
My i7-740QM is reporting 8 cores, the same as my CPU Meter gadget shows.

PostPosted: October 7th, 2010, 10:54 am
by brent hildebrand
Adam Kertesz wrote:My i7-740QM is reporting 8 cores, the same as my CPU Meter gadget shows.
Adam, does your ActiveProcessorMask report 255? [code](5+⎕io)⊃⎕wcall 'GetSystemInfo' â

PostPosted: October 7th, 2010, 4:51 pm
by Adam Kertesz
Yes.
(Don't forget: my APL is still version 6.4
the SYSVER is
76.3.01 Sep 8 2006 15:15:41 Win/32)

APLNextSupervisor v0.9.25.x Will Be Released Shortly

PostPosted: December 14th, 2010, 2:12 am
by joe_blaze
The next version of the APLNextSupervisor will implement the 'NProcessors' property which will report the number of physical and virtual processors which are available on the workstation on which the APLNextSupervisor has been installed.

See the attached pdf-format document for some details.

APL+Win subscribers will be notified of the availability of the next version of the APLNextSupervisor and will be able to download the installer and try the new property themselves.