Re: [hwloc-users] Bind current thread to a specific cpu

2011-08-18 Thread PULVERAIL Sébastien
I use logical ids, so I do this :

 

hwloc_obj_t cpu = hwloc_get_obj_by_type(topology,
HWLOC_OBJ_PU, i);

int err = hwloc_set_cpubind(topology, cpu->cpuset,
HWLOC_CPUBIND_THREAD);

 

Is it correct ?

--

Seb

 

De : hwloc-users-boun...@open-mpi.org
[mailto:hwloc-users-boun...@open-mpi.org] De la part de Brice Goglin
Envoyé : jeudi 18 août 2011 10:25
À : Hardware locality user list
Objet : Re: [hwloc-users] Bind current thread to a specific cpu

 

Are you talking about logical ids (the one given by hwloc) or physical/OS
ids (the one given by the OS and possibly in strange order) ? You should
avoid using physical ids, but...

If logical, you can hwloc_get_obj_by_type() to get the corresponding object,
then use its ->cpuset.

If physical, you just need a cpuset that contains the bit corresponding to
this id. You can use hwloc_bitmap_only(set, ) to reset a (previously
allocated) cpuset to nothing but this id.

Brice



Le 18/08/2011 10:10, PULVERAIL Sébastien a écrit : 

Hi,

 

I’m looking for a function that allows to bind the current thread to a
specific cpu given by its id.

 

I found the function hwloc_set_thread_cpubind to bind a thread to a cpuset.

I also found the function hwloc_bitmap_singlify to keep only one index in
the cpuset.

But I didn’t found anything to only keep the cpu I need in my cpuset…


Is it possible ? 

 

--

Seb

 

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

 



Re: [hwloc-users] Bind current thread to a specific cpu

2011-08-18 Thread Brice Goglin
Are you talking about logical ids (the one given by hwloc) or
physical/OS ids (the one given by the OS and possibly in strange order)
? You should avoid using physical ids, but...

If logical, you can hwloc_get_obj_by_type() to get the corresponding
object, then use its ->cpuset.

If physical, you just need a cpuset that contains the bit corresponding
to this id. You can use hwloc_bitmap_only(set, ) to reset a
(previously allocated) cpuset to nothing but this id.

Brice



Le 18/08/2011 10:10, PULVERAIL Sébastien a écrit :
>
> Hi,
>
>  
>
> I'm looking for a function that allows to bind the current thread to a
> specific cpu given by its id.
>
>  
>
> I found the function hwloc_set_thread_cpubind to bind a thread to a
> cpuset.
>
> I also found the function hwloc_bitmap_singlify to keep only one index
> in the cpuset.
>
> But I didn't found anything to only keep the cpu I need in my cpuset...
>
>
> Is it possible ?
>
>  
>
> Best regards
>
> _
>
>  
>
> *Sébastien Pulvérail*| Sogeti High Tech
>
> Phone +33 (0) 5 34 46 92 98 | Mobile +33 (0) 6 84 44 73 26
>
> sebastien.pulver...@sogeti.com 
>
>  
>
> 3 Chemin de Laporte | Bât. AEROPARK | 31300 Toulouse | France
>
> www.sogeti.com / www.sogeti-hightech.fr
>
>  
>
> logo_signature_email_Sogeti High Tech
>
> _
>
> P/Please consider the environment before printing !/
>
>  
>
>
> ___
> hwloc-users mailing list
> hwloc-us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users