Re: [hwloc-users] How do I access CPUModel info string

2012-11-18 Thread Brice Goglin
Le 26/10/2012 09:39, Brice Goglin a écrit :
> Le 26/10/2012 05:22, Robin Scher a écrit :
>> I would love to get this by my next release, say in the next 3-6
>> months. Is that something that would be possible? Is there anything I
>> can do to help?
>
> We'll have a v1.6 release before the end of the year, and hopefully a
> first release candidate by mid-november for SC12.
> It'll include the Darwin code (just committed) and the x86 code
> (Samuel committed it). But I need to finish reworking the core
> components before the x86 code becomes available to non-FreeBSD
> backends. Hopefully, I'll have something ready by next week.

By the way, in case you missed it, with hwloc 1.6rc1 (released last
week), you should get CPUModel attributes on all x86 machines, as well
as Mac OS X on all architectures. Obviously this includes Windows/x86 (I
only tested on 32bits).

I will likely release 1.6rc2 tomorrow or tuesday, and the final 1.6 will
arrive by the end of the month if nobody complains.

Brice



Re: [hwloc-users] How do I access CPUModel info string

2012-10-29 Thread Samuel Thibault
Olivier Cessenat, le Sat 27 Oct 2012 19:10:55 +0200, a écrit :
> Just in case, I also provide the output of sysctl hw:

Thanks. There is indeed no package information (hw.packages), that's why
hwloc does not include any socket object.

Brice wrote:
> One way to solve this problem (which may also occur on old Linux 
> distribs) would be to store the CPU model in the machine object. But 
> we'll have to make sure all processors in the machine are indeed of the 
> same model. On MacOSX, it looks like sysctl reports a single socket 
> description anyway, so no problem. 

So we have to resort to that, now commited.

Samuel


Re: [hwloc-users] How do I access CPUModel info string

2012-10-27 Thread Brice Goglin
Can you send your lstopo output?
preferably with latest trunk tarball

http://www.open-mpi.org/software/hwloc/nightly/trunk/hwloc-1.6a1r4928.tar.gz

One way to solve this problem (which may also occur on old Linux
distribs) would be to store the CPU model in the machine object. But
we'll have to make sure all processors in the machine are indeed of the
same model. On MacOSX, it looks like sysctl reports a single socket
description anyway, so no problem.

Brice




Le 27/10/2012 11:37, Olivier Cessenat a écrit :
> Hello,
>
> Robin Scher indicated how to get the info on a Mac.
>
> At least on mine (OSX 10.4) with darwin 8.11.1
> where
> $ sysctl -a machdep.cpu.brand_string
> machdep.cpu.brand_string: Intel(R) Core(TM)2 CPU T7400  @
> 2.16GHz
> I unfortunately have no socket:
> *** The number of sockets is unknown
> [ from Third example: Print the number of sockets. of
> http://www.open-mpi.org/projects/hwloc/doc/v1.5.1/
> ]
> I see objects type 1,2,4 and 6 only.
>
> So, will there be another (non socket hwloc object based) way to get
> CPUModel or will it find sockets as on Linux ?
>
> Thanks.
>
> Olivier Cessenat.
>
>
> Le jeudi 25 octobre 2012 à 23:42 +0200, Brice Goglin a écrit :
>> Hello,
>>
>> Assuming you found the socket hwloc object whose name you want, do
>> hwloc_obj_get_info_by_name(obj, "CPUModel");
>> you'll get const char * pointing to what you want.
>>
>> However, this info is only available on Linux and Solaris for now. If
>> you have any idea of to discover such info on other OS, please let us
>> know.
>>
>> Brice
>>
>>
>>
>> Le 25/10/2012 23:39, Robin Scher a écrit : 
>>> Is there a way to get this string (e.g. "Intel(R) Core(TM) i7 CPU M
>>> 620 @ 2.67GHz") consistently on Windows, Linux, OS-X and Solaris?
>>>
>>> Thanks,
>>> -robin
>>>
>>> -- 
>>> Robin Scher Uberware
>>> ro...@uberware.net
>>> +1 (213) 448-0443 
>>>
>>>
>>>
>>>
>>> ___
>>> hwloc-users mailing list
>>> hwloc-us...@open-mpi.org
>>> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users
>> ___
>> hwloc-users mailing list
>> hwloc-us...@open-mpi.org
>> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users
> ___
> hwloc-users mailing list
> hwloc-us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users



Re: [hwloc-users] How do I access CPUModel info string

2012-10-27 Thread Olivier Cessenat
Hello,

Robin Scher indicated how to get the info on a Mac.

At least on mine (OSX 10.4) with darwin 8.11.1
where
$ sysctl -a machdep.cpu.brand_string
machdep.cpu.brand_string: Intel(R) Core(TM)2 CPU T7400  @
2.16GHz
I unfortunately have no socket:
*** The number of sockets is unknown
[ from Third example: Print the number of sockets. of
http://www.open-mpi.org/projects/hwloc/doc/v1.5.1/
]
I see objects type 1,2,4 and 6 only.

So, will there be another (non socket hwloc object based) way to get
CPUModel or will it find sockets as on Linux ?

Thanks.

Olivier Cessenat.


Le jeudi 25 octobre 2012 à 23:42 +0200, Brice Goglin a écrit :
> Hello,
> 
> Assuming you found the socket hwloc object whose name you want, do
> hwloc_obj_get_info_by_name(obj, "CPUModel");
> you'll get const char * pointing to what you want.
> 
> However, this info is only available on Linux and Solaris for now. If
> you have any idea of to discover such info on other OS, please let us
> know.
> 
> Brice
> 
> 
> 
> Le 25/10/2012 23:39, Robin Scher a écrit : 
> > Is there a way to get this string (e.g. "Intel(R) Core(TM) i7 CPU M
> > 620 @ 2.67GHz") consistently on Windows, Linux, OS-X and Solaris?
> > 
> > Thanks,
> > -robin
> > 
> > -- 
> > Robin Scher Uberware
> > ro...@uberware.net
> > +1 (213) 448-0443 
> > 
> > 
> > 
> > 
> > ___
> > hwloc-users mailing list
> > hwloc-us...@open-mpi.org
> > http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users
> 
> ___
> hwloc-users mailing list
> hwloc-us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users



Re: [hwloc-users] How do I access CPUModel info string

2012-10-26 Thread Brice Goglin
Le 26/10/2012 05:22, Robin Scher a écrit :
> I would love to get this by my next release, say in the next 3-6
> months. Is that something that would be possible? Is there anything I
> can do to help?

We'll have a v1.6 release before the end of the year, and hopefully a
first release candidate by mid-november for SC12.
It'll include the Darwin code (just committed) and the x86 code (Samuel
committed it). But I need to finish reworking the core components before
the x86 code becomes available to non-FreeBSD backends. Hopefully, I'll
have something ready by next week.

Thanks for all your help anyway
Brice



Re: [hwloc-users] How do I access CPUModel info string

2012-10-26 Thread Robin Scher


On 10/25/2012 3:06 PM, Samuel Thibault wrote:

Robin Scher, le Thu 25 Oct 2012 23:57:38 +0200, a écrit :

Do you think those could be added to hwloc?

Yes: we already use cpuid for the x86 backend. That will only work on
x86 hosts of course.


Windows being x86 only for the time being, I'm OK with that.

I would love to get this by my next release, say in the next 3-6 months. 
Is that something that would be possible? Is there anything I can do to 
help?


Thanks,
-robin

--
*Robin Scher* Uberware
ro...@uberware.net
+1 (213) 448-0443




Re: [hwloc-users] How do I access CPUModel info string

2012-10-25 Thread Samuel Thibault
Robin Scher, le Thu 25 Oct 2012 23:57:38 +0200, a écrit :
> ; eax = 0x8002 --> eax, ebx, ecx, edx: get processor name string
> (part 1)
> mov eax,0x8002
> cpuid

Oh, this is indeed *exactly* the model name string. I only knew about
the vendor_id string.

> I don't know if that would work on Win64, though.

It should: cpuid is not a privileged instruction.

> Do you think those could be added to hwloc?

Yes: we already use cpuid for the x86 backend. That will only work on
x86 hosts of course.

Brice, that actually brings another piece to the plugin engine: on
Windows ideally we should still get the topology from the OS, but take
the cpu string from the x86 backend...

Samuel


Re: [hwloc-users] How do I access CPUModel info string

2012-10-25 Thread Brice Goglin
Le 25/10/2012 23:57, Robin Scher a écrit :
> On OS-X, you can get this string from the sysctlbyname() call:
>
> const char *name = "machdep.cpu.brand_string";
> char buffer[ 64 ];
> size_t size = 64;
> if( !sysctlbyname( name, buffer, , NULL, 0 ) )
> memcpy( cpu_model, buffer, 12 * sizeof( int ) );

Thanks.

> if That doesn't work, you can get it from calling system_profiler and
> parsing the output.

I'd rather not do that from inside the hwloc library :)

> On Widows (32 bit), the only way I've found is to actually use the
> cpuid assembly call:

Good to know, that's likely similar to the Linux code I cited in my
other mail.
I'll see if I can put that in some sort of common code.

> I don't know if that would work on Win64, though. Do you think those
> could be added to hwloc?

If we can make this work without too much pain, sure.

Brice



Re: [hwloc-users] How do I access CPUModel info string

2012-10-25 Thread Brice Goglin
Le 25/10/2012 23:42, Samuel Thibault a écrit :
> Robin Scher, le Thu 25 Oct 2012 23:39:46 +0200, a écrit :
>> Is there a way to get this string (e.g. "Intel(R) Core(TM) i7 CPU M 620 @
>> 2.67GHz") consistently on Windows, Linux, OS-X and Solaris?
> Currently, no.
>
> hwloc itself does not have a table of such strings, and each OS has its
> own table.
>

Actually there's no table on Linux/x86. It uses cpuid to fill the model
name in the vast majority of cases [1]. We could use that to get
consistent names on non-Linux non-Solaris OS, and in the x86 backend.

Brice

[1] http://lxr.free-electrons.com/source/arch/x86/kernel/cpu/common.c#L389


Re: [hwloc-users] How do I access CPUModel info string

2012-10-25 Thread Robin Scher

On OS-X, you can get this string from the sysctlbyname() call:

const char *name = "machdep.cpu.brand_string";
char buffer[ 64 ];
size_t size = 64;
if( !sysctlbyname( name, buffer, , NULL, 0 ) )
memcpy( cpu_model, buffer, 12 * sizeof( int ) );

if That doesn't work, you can get it from calling system_profiler and 
parsing the output.


On Widows (32 bit), the only way I've found is to actually use the cpuid 
assembly call:


int ints[ 12 ];

// Use assembly to detect CPUID information...
_asm
{
; we must push/pop the registers <> writes to, as the
; optimiser doesn't know about <>, and so doesn't expect
; these registers to change.
push eax
push ebx
push ecx
push edx

; eax = 0x8002 --> eax, ebx, ecx, edx: get processor name 
string (part 1)

mov eax,0x8002
cpuid
mov ints[  0 * TYPE int ], eax
mov ints[  1 * TYPE int ], ebx
mov ints[  2 * TYPE int ], ecx
mov ints[  3 * TYPE int ], edx

; eax = 0x8003 --> eax, ebx, ecx, edx: get processor name 
string (part 2)

mov eax,0x8003
cpuid
mov ints[  4 * TYPE int ], eax
mov ints[  5 * TYPE int ], ebx
mov ints[  6 * TYPE int ], ecx
mov ints[  7 * TYPE int ], edx

; eax = 0x8004 --> eax, ebx, ecx, edx: get processor name 
string (part 3)

mov eax,0x8004
cpuid
mov ints[  8 * TYPE int ], eax
mov ints[  9 * TYPE int ], ebx
mov ints[ 10 * TYPE int ], ecx
mov ints[ 11 * TYPE int ], edx

pop edx
pop ecx
pop ebx
pop eax
}
::memcpy( cpu_model, ints, 12 * sizeof( int ) );

I don't know if that would work on Win64, though. Do you think those 
could be added to hwloc?


Thanks
-robin


On 10/25/2012 2:42 PM, Brice Goglin wrote:

Hello,

Assuming you found the socket hwloc object whose name you want, do
hwloc_obj_get_info_by_name(obj, "CPUModel");
you'll get const char * pointing to what you want.

However, this info is only available on Linux and Solaris for now. If 
you have any idea of to discover such info on other OS, please let us 
know.


Brice



Le 25/10/2012 23:39, Robin Scher a écrit :
Is there a way to get this string (e.g. "Intel(R) Core(TM) i7 CPU M 
620 @ 2.67GHz") consistently on Windows, Linux, OS-X and Solaris?


Thanks,
-robin

--
*Robin Scher* Uberware
ro...@uberware.net
+1 (213) 448-0443




___
hwloc-users mailing list
hwloc-us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users




___
hwloc-users mailing list
hwloc-us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users


--
*Robin Scher* Uberware
ro...@uberware.net
+1 (213) 448-0443




Re: [hwloc-users] How do I access CPUModel info string

2012-10-25 Thread Samuel Thibault
Robin Scher, le Thu 25 Oct 2012 23:39:46 +0200, a écrit :
> Is there a way to get this string (e.g. "Intel(R) Core(TM) i7 CPU M 620 @
> 2.67GHz") consistently on Windows, Linux, OS-X and Solaris?

Currently, no.

hwloc itself does not have a table of such strings, and each OS has its
own table.

Samuel