Re: [fpc-pascal] detect CPU cores

2014-09-12 Thread Dmitry Boyarintsev
Please disregard my previous statement abour renaming register names. I was completely wrong. The problem most likely was with a wrong asm mode. Try to specify the asm mode explicitly by adding {$ASMMODE INTEL} at the begging of the unit. You might try an alternative version here: http://pastebin.

Re: [fpc-pascal] detect CPU cores

2014-09-12 Thread Xiangrong Fang
2014-09-13 0:28 GMT+08:00 Dmitry Boyarintsev : > You're compiling for x64, You need to replace "eax" and "edx" with "rax" > and "rdx", since e?x are available for i386 only. > > My situation is, I program and test on Ubuntu x64 on a i3-M390. Then compile it to Windows 32bit on a VirtualBox on this

Re: [fpc-pascal] detect CPU cores

2014-09-12 Thread Sven Barth
On 12.09.2014 22:13, Marco van de Voort wrote: In our previous episode, Sven Barth said: Considering that the implementation is currently "Result := 1" for any target that is no surprise ;) I've now implemented GetCPUCount for all Windows targets. .. updating... For the BSD's I'd use sys

Re: [fpc-pascal] detect CPU cores

2014-09-12 Thread Marco van de Voort
In our previous episode, Sven Barth said: > > Considering that the implementation is currently "Result := 1" for any > > target that is no surprise ;) > > I've now implemented GetCPUCount for all Windows targets. .. updating... > For the BSD's > I'd use sysctl, which would mean that I'd need t

Re: [fpc-pascal] detect CPU cores

2014-09-12 Thread Sven Barth
On 12.09.2014 20:20, Sven Barth wrote: Am 12.09.2014 17:31 schrieb "Marco van de Voort" mailto:mar...@stack.nl>>: > > In our previous episode, Sven Barth said: > > FPC 2.7.1 has TThread.ProcessorCount (it's a class property, so no instance > > needed) or System.CpuCount (ProcessorCount uses t

Re: [fpc-pascal] detect CPU cores

2014-09-12 Thread Sven Barth
Am 12.09.2014 17:31 schrieb "Marco van de Voort" : > > In our previous episode, Sven Barth said: > > FPC 2.7.1 has TThread.ProcessorCount (it's a class property, so no instance > > needed) or System.CpuCount (ProcessorCount uses this). It's not yet > > implemented though for any system :/ > > I ran

Re: [fpc-pascal] detect CPU cores

2014-09-12 Thread Dmitry Boyarintsev
You're compiling for x64, You need to replace "eax" and "edx" with "rax" and "rdx", since e?x are available for i386 only. thanks, Dmitry On Fri, Sep 12, 2014 at 11:15 AM, Xiangrong Fang wrote: > I found this code on the net: > > > http://code.google.com/p/fpos/source/browse/kernel/cpuid.pas?

Re: [fpc-pascal] detect CPU cores

2014-09-12 Thread Marco van de Voort
In our previous episode, Sven Barth said: > FPC 2.7.1 has TThread.ProcessorCount (it's a class property, so no instance > needed) or System.CpuCount (ProcessorCount uses this). It's not yet > implemented though for any system :/ I ran it to test if it made a difference between cores and hyperthrea

Re: [fpc-pascal] detect CPU cores

2014-09-12 Thread Tomas Hajny
On Fri, September 12, 2014 17:15, Xiangrong Fang wrote: > I found this code on the net: > > http://code.google.com/p/fpos/source/browse/kernel/cpuid.pas?r=c387b381d7a05f9328693cdcf59b0b4f633294e4 > > It's part of the "FreePascal Operationg System" project. I suppose it is > compatible with FreePasc

Re: [fpc-pascal] detect CPU cores

2014-09-12 Thread Sven Barth
Am 12.09.2014 16:08 schrieb "Xiangrong Fang" : > > Hi All, > > Is there a platform independent (specifically Windows and Linux) way to detect cores and hyper-threads of the CPU? I am writing a calculation intensive app and would like to fully utilize SMP capability of the CPU. FPC 2.7.1 has TThrea

Re: [fpc-pascal] detect CPU cores

2014-09-12 Thread Xiangrong Fang
I found this code on the net: http://code.google.com/p/fpos/source/browse/kernel/cpuid.pas?r=c387b381d7a05f9328693cdcf59b0b4f633294e4 It's part of the "FreePascal Operationg System" project. I suppose it is compatible with FreePascal of course. But while compiled, I got lots of errors, such as:

Re: [fpc-pascal] detect CPU cores

2014-09-12 Thread Dmitry Boyarintsev
If you're talking bout x88_64, i386 platforms, you should be able to do it using CPUID instruction http://en.wikipedia.org/wiki/CPUID thanks, Dmitry On Fri, Sep 12, 2014 at 10:07 AM, Xiangrong Fang wrote: > Hi All, > > Is there a platform independent (specifically Windows and Linux) way to > d

[fpc-pascal] detect CPU cores

2014-09-12 Thread Xiangrong Fang
Hi All, Is there a platform independent (specifically Windows and Linux) way to detect cores and hyper-threads of the CPU? I am writing a calculation intensive app and would like to fully utilize SMP capability of the CPU. Thanks! Xiangrong ___ fpc-pasc