Open MPI logo

Hardware Locality Users' Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Users mailing list

Subject: Re: [hwloc-users] How do I access CPUModel info string
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2012-10-25 18:03:54


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, &size, 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