pcvs.helpers.resource_tracker module

Module for resource tracking.

class pcvs.helpers.resource_tracker.ResourceTracker(dims_values)[source]

Bases: object

A resource tracker that track resources usage of tests.

The resources ‘used’ by tests are:
  • the number of jobs use to run make for build job.

  • the number of nodes, processes (mpi) & threads (omp)

    that the runtime of the test use.

A resource is represented as a list of int, eaches representing a number of resources at it’s level. It is usually a list of two elements representing: [nb_nodes, nb_threads_per_node]. note: there can be any number of elements.

The resource tracker, considering a resource, representing the available hardware, will handle allocation of resource representing the job allocation.

The main purpose of this class is to have a smart way to handle parallel tests execution that have any resources requirements while tracking overall usage of a cluster to avoid surcharging the cluster scheduler (like slurm).

Initialize a resources allocator.

alloc(allocation)[source]

Make an allocation in the resources allocator.

Return type:

int

alloc_tracking_counter: int = 1
do_alloc(allocation, alloc_tracking_id)[source]

Inner allocation function.

Return type:

bool

free(alloc_tracking_id)[source]

Free an allocation.

Return type:

None