Can an APL function discover how many cores are avail?

General discussions related to APLNext's APLNextSupervisor product.

Can an APL function discover how many cores are avail?

Postby Richard.Hill » October 6th, 2010, 1:14 am

Can an APL function discover how many cores are available in the users computer?
Richard Hill
Richard.Hill
 
Posts: 82
Joined: March 8th, 2007, 12:51 am
Location: Melbourne, Vic, Australia

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

Postby brent hildebrand » October 6th, 2010, 12:50 pm

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' â
brent hildebrand
 
Posts: 481
Joined: February 12th, 2007, 5:53 pm
Location: Loma Linda, CA

Postby aplus » October 6th, 2010, 10:09 pm

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.
aplus
 
Posts: 163
Joined: April 16th, 2007, 2:21 pm
Location: Allentown, PA

Postby brent hildebrand » October 6th, 2010, 10:47 pm

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...
brent hildebrand
 
Posts: 481
Joined: February 12th, 2007, 5:53 pm
Location: Loma Linda, CA

Postby brent hildebrand » October 6th, 2010, 11:40 pm

The other thing to check in the results of GetSystemInfo is the ActiveProcessorMask. [code] ⎕wcall 'GetSystemInfo' â
brent hildebrand
 
Posts: 481
Joined: February 12th, 2007, 5:53 pm
Location: Loma Linda, CA

Postby Richard.Hill » October 7th, 2010, 1:06 am

Brent, Thank you...
Core 2 Quad Q9505 reports 4
Richard Hill
Richard.Hill
 
Posts: 82
Joined: March 8th, 2007, 12:51 am
Location: Melbourne, Vic, Australia

Postby brent hildebrand » October 7th, 2010, 8:57 am

Richard.Hill wrote:Brent, Thank you...
Core 2 Quad Q9505 reports 4
Richard, on your computer, does this[code](5+⎕io)⊃⎕wcall 'GetSystemInfo' â
brent hildebrand
 
Posts: 481
Joined: February 12th, 2007, 5:53 pm
Location: Loma Linda, CA

Postby Adam Kertesz » October 7th, 2010, 9:34 am

My i7-740QM is reporting 8 cores, the same as my CPU Meter gadget shows.
Adam Kertesz
 
Posts: 29
Joined: February 20th, 2007, 10:37 pm
Location: Miami Beach, FL

Postby brent hildebrand » October 7th, 2010, 10:54 am

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' â
brent hildebrand
 
Posts: 481
Joined: February 12th, 2007, 5:53 pm
Location: Loma Linda, CA

Postby Adam Kertesz » October 7th, 2010, 4:51 pm

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)
Adam Kertesz
 
Posts: 29
Joined: February 20th, 2007, 10:37 pm
Location: Miami Beach, FL

APLNextSupervisor v0.9.25.x Will Be Released Shortly

Postby joe_blaze » December 14th, 2010, 2:12 am

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.
Attachments
APLNextSupervisor_NProcessors_Property.pdf
(297.81 KiB) Downloaded 130 times
joe_blaze
 
Posts: 384
Joined: February 11th, 2007, 3:09 am
Location: Box 361 Brielle, NJ 08730-0361


Return to APLNextSupervisor

Who is online

Users browsing this forum: No registered users and 1 guest

cron