Re: [hwloc-users] Question about hwloc_bitmap_singlify

2018-08-28 Thread Brice Goglin
Hello

If you bind a thread to a newset that contains 4 PUs (4 bits), the
operating system scheduler is free to run that thread on any of these
PUs. It means it may run on it on one PU, then migrate it to the other
PU, then migrate it back, etc. If these PUs do not share all caches, you
will see a performance drop because the data you put in the cache when
running on PU1 has to be stored/migrated in the cache on another PU when
the thread is migrated by the OS scheduler. If the PU share all caches,
the performance drop is much lower, but still exists because migrating
tasks between PU takes a bit of time.

If you call hwloc_bitmap_signlify(newset) before binding, you basically
say "I want to run on any of these 4 PUs, I am actually going to run on
a specific one". Singlify takes your set of PUs in the bitmap and keeps
a single one. Your original binding is respected (you run inside the
original binding), but you don't use all of them.

HOWEVER if you bind multiple threads to the same identical newset, you
don't want to singlify because all of them would run on the SAME PU. You
can either bind without singlify() so that the OS scheduler spreads your
threads on different PUs among newset. Or you want to manually split
newset into multiple subset (hwloc_distrib can do that).

I'll try to improve the doc.

Brice



Le 29/08/2018 à 06:26, Junchao Zhang a écrit :
> Hi,   
>   On cpu binding, hwloc manual says "It is often useful to call
> hwloc_bitmap_singlify() first so that a single CPU remains in the set.
> This way, the process will not even migrate between different CPUs
> inside the given set" . I don't understand it. If I do not do
> hwloc_bitmap_singlify, what will happen? Suppose a process's old cpu
> binding is oldset, and I want to bind it to newset. What should I do
> to use hwloc_bitmap_singlify?
>   Thank you.
> --Junchao Zhang
>
>
> ___
> hwloc-users mailing list
> hwloc-users@lists.open-mpi.org
> https://lists.open-mpi.org/mailman/listinfo/hwloc-users

___
hwloc-users mailing list
hwloc-users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/hwloc-users

[hwloc-users] Question about hwloc_bitmap_singlify

2018-08-28 Thread Junchao Zhang
Hi,
  On cpu binding, hwloc manual says "It is often useful to call
hwloc_bitmap_singlify() first so that a single CPU remains in the set. This
way, the process will not even migrate between different CPUs inside the
given set" . I don't understand it. If I do not do hwloc_bitmap_singlify,
what will happen? Suppose a process's old cpu binding is oldset, and I want
to bind it to newset. What should I do to use hwloc_bitmap_singlify?
  Thank you.
--Junchao Zhang
___
hwloc-users mailing list
hwloc-users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/hwloc-users

Re: [hwloc-users] How to combine bitmaps on MPI ranks?

2018-08-28 Thread Brice Goglin
This question was addressed offline while the mailing lists were offline.

We had things like hwloc_bitmap_set_ith_ulong() and
hwloc_bitmap_from_ith_ulong() for packing/unpacking but they weren't
very convenient unless you know multiple ulongs are actually needed to
store the bitmap.

We added new functions to ease things
(hwloc_bitmap_nr/from/to_ulongs()). They will be in the upcoming hwloc 2.1.

Brice



Le 23/08/2018 à 04:57, Junchao Zhang a écrit :
> Hello,
>   Suppose I call hwloc on two MPI ranks and get a bitmap on each.  On
> rank 0, I want to bitwise OR the two. How to do that?  I did not find
> bitmap APIs to pack/unpack bitmaps to/from ulongs for MPI send/recv
> purpose. 
>   Thank you.
> --Junchao Zhang
>
>
> ___
> hwloc-users mailing list
> hwloc-users@lists.open-mpi.org
> https://lists.open-mpi.org/mailman/listinfo/hwloc-users

___
hwloc-users mailing list
hwloc-users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/hwloc-users

[hwloc-users] How to combine bitmaps on MPI ranks?

2018-08-28 Thread Junchao Zhang
Hello,
  Suppose I call hwloc on two MPI ranks and get a bitmap on each.  On rank
0, I want to bitwise OR the two. How to do that?  I did not find bitmap
APIs to pack/unpack bitmaps to/from ulongs for MPI send/recv purpose.
  Thank you.
--Junchao Zhang
___
hwloc-users mailing list
hwloc-users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/hwloc-users