Specifying hardware

You may want to specify some constraints on the hardware your task will execute on. For example, if you specifically need a high amount of RAM, or if you need a GPU. You can do this simply by adding constraints in the hardware_constraints field of your task. Below are examples of how to do this, either with Tasq or with the SDK.

Note that not all constraints are public, meaning that some may not be available to you. To have access to them, please contact us at qlab@qarnot-computing.com.

Each constraint comes with a set of values that it can take. Here's the list of all the types of hardware constraint:

With Tasq

When you create a task, simply tick the use hardware constraints button in step 5 as shown below.

With a SDK

You can specify a hardware constraint by setting the hardware_constraints attribute of your task. Each constraint determines a single aspect, for example the minimum number of CPU core or the maximum quantity of RAM.

To get a list of available hardware constraints to you and their possible values, simply execute:

import qarnot

conn = qarnot.Connection(client_token='<<< MY_SECRET_TOKEN >>')
for hwc in conn.all_hardware_constraints():
    print(hwc.to_json())

Here's a possible result:

{'discriminator': 'MinimumRamHardwareConstraint', 'minimumMemoryMB': 32000.0}
{'discriminator': 'MinimumRamHardwareConstraint', 'minimumMemoryMB': 128000.0}
{'discriminator': 'SpecificHardwareConstraint', '_specificationKey': '32c-128g-amd-tr2990wx-ssd'}
{'discriminator': 'SpecificHardwareConstraint', '_specificationKey': '28c-128g-intel-dual-xeon2680v4-ssd'}
{'discriminator': 'SpecificHardwareConstraint', '_specificationKey': '96c-512g-amd-epyc9654-ssd'}
{'discriminator': 'MinimumCoreHardwareConstraint', 'coreCount': 8}
{'discriminator': 'MinimumCoreHardwareConstraint', 'coreCount': 16}
{'discriminator': 'MinimumCoreHardwareConstraint', 'coreCount': 32}

In this case, lines 4 to 6 indicate that the minimum number of cores can be set to either 8, 16 or 32.

Now, to send a task with hardware constraints, you only need to set the task.hardware_constraints list.

The general syntax to create a hardware_constraint of a given type (i.e. discriminator) is qarnot.hardware_constraint.<disciminator>(<value>). Depending on the type of constraint <value> is coreCount, minimumMemoryMB, or nothing in the case of the GpuHardware constraint.

Below is a simple example to create a task that will run on a server with at least 16 cores.

import qarnot

conn = qarnot.Connection(client_token='<<< MY_SECRET_TOKEN >>>')
task = conn.create_task("Hardware constraints", "docker-batch", 1)
task.constants["DOCKER_CMD"] = 'lscpu'

task.hardware_constraints = [
    qarnot.hardware_constraint.SpecificHardware("28c-128g-intel-dual-xeon2680v4-ssd")
]
#task.hardware_constraints = [
#    qarnot.hardware_constraint.MinimumCoreHardware(16)
#]

task.submit()