CTest: Resource allocation does not combine instances to reach requested slot totals
The current behavior of the resource allocation logic does not allow multiple array items from a resource type to be combined to satisfy the needs of a single resource group. Consider the following:
set_property(TEST someTest PROPERTY RESOURCE_GROUPS gpus:4)
With a resource spec file defined like so:
{
"local": [
{
"gpus" : [
{
"id": "0",
"slots": 2
},
{
"id": "1",
"slots": 2
}
]
}
]
}
The ctest
scheduler sees that the test's resource group requires 4 slots of gpus
. The resource spec file provides 4 slots, but they are split across two elements of the gpus
resource type array. The scheduler refuses to merge slots from different array elements and the test fails to run with the current scheduler logic. However, the Environment Variables section of the ctest(1)
manual includes the following example for the CTEST_RESOURCE_GROUP_<num>_<resource-type>
environment variable:
CTEST_RESOURCE_GROUP_0_GPUS=id:0,slots:2
CTEST_RESOURCE_GROUP_1_GPUS=id:2,slots:2
CTEST_RESOURCE_GROUP_2_GPUS=id:1,slots:4;id:3,slots:1 <-- Not possible to get this
CTEST_RESOURCE_GROUP_2_CRYPTO_CHIPS=id:card0,slots:2
The line highlighted can't actually be generated with the current scheduler behavior. It is merging slots from multiple array elements and assigning them to a single group. Either the example is incorrect, or the scheduler logic is restricted in a way that wasn't expected.