Skip to content

Commit

Permalink
tests/restrict: check that we reorder properly when needed
Browse files Browse the repository at this point in the history
Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Oct 12, 2018
1 parent a0cf079 commit 03ac9b2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/hwloc/hwloc_topology_restrict.c
Expand Up @@ -251,6 +251,28 @@ int main(void)

hwloc_topology_destroy(topology);

/* check that restricting PUs maintains ordering of normal children */
printf("restricting so that PUs get reordered\n");
hwloc_topology_init(&topology);
hwloc_topology_set_synthetic(topology, "node:1 core:2 pu:2(index=0,2,1,3)");
hwloc_topology_load(topology);
hwloc_bitmap_zero(cpuset);
hwloc_bitmap_set_range(cpuset, 1, 2);
err = hwloc_topology_restrict(topology, cpuset, 0);
assert(!err);
hwloc_topology_destroy(topology);

/* check that restricting NUMA nodes maintains ordering of normal children in remove-memless case */
printf("restricting by nodeset so that remaining non-memless PUs get reordered\n");
hwloc_topology_init(&topology);
hwloc_topology_set_synthetic(topology, "pack:2 l3:2 numa:1 pu:1(indexes=0,2,1,3)");
hwloc_topology_load(topology);
hwloc_bitmap_zero(cpuset);
hwloc_bitmap_set_range(cpuset, 1, 2);
err = hwloc_topology_restrict(topology, cpuset, HWLOC_RESTRICT_FLAG_BYNODESET|HWLOC_RESTRICT_FLAG_REMOVE_MEMLESS);
assert(!err);
hwloc_topology_destroy(topology);

hwloc_bitmap_free(cpuset);

return 0;
Expand Down

0 comments on commit 03ac9b2

Please sign in to comment.