Client is very opinionated about actual GPU memory
I start up a client that has a T4 GPU (g4dn.xlarge aws instance) and I told the dashboard it has 16GB ,but when I launch the client it is very opinionated: Well actually I am saying the GPU has 16384 MB when it really has only 15360 MB. Perhaps this could be handled a bit more gracefully, since even Nvidia is selling these GPU as 16GB
/var/tmp/cloud/startup/start.sh
Error processing config ['/var/tmp/cloud/startup/../startup/fed_client.json', '/var/tmp/cloud/startup/../local/resources.json.default']: ConfigError: Error processing '/var/tmp/cloud/startup/../startup/fed_client.json' in element '{"id": "resource_manager", "path": "nvflare.app_common.resource_managers.gpu_resource_manager.GPUResourceManager", "args": {"num_of_gpus": 1, "mem_per_gpu_in_GiB": 16}}': path: 'components.#1', exception: 'ValueError: Memory per GPU specified (16384) exceeds available GPU memory: 15360.'
ConfigError: ConfigError: Error processing '/var/tmp/cloud/startup/../startup/fed_client.json' in element '{"id": "resource_manager", "path": "nvflare.app_common.resource_managers.gpu_resource_manager.GPUResourceManager", "args": {"num_of_gpus": 1, "mem_per_gpu_in_GiB": 16}}': path: 'components.#1', exception: 'ValueError: Memory per GPU specified (16384) exceeds available GPU memory: 15360.'
2024-05-06 05:10:50,439 - MPM - INFO - MPM: Good Bye!
Hi @dirkpetersen thanks for the issue!
Our default implementation of GPUResourceManager is this: https://github.com/NVIDIA/NVFlare/blob/main/nvflare/app_common/resource_managers/gpu_resource_manager.py#L43
So in your case you can specify 15 instead of 16.
This implementation is opinionated that only takes in memory in GB and it will multiply it by 1024 https://github.com/NVIDIA/NVFlare/blob/main/nvflare/app_common/resource_managers/gpu_resource_manager.py#L72
But you can refer to the code and write your own ResourceManager that is design for your specific needs.
After the dashboard generates the provision kits, you can go inside and edit each client site's "resource.json" file, for example:
{
"format_version": 2,
"client": {
"retry_timeout": 30,
"compression": "Gzip"
},
"components": [
{
"id": "resource_manager",
"path": "path_to_your_code.MyGPUResourceManager",
"args": {
"num_of_gpus": 0,
"mem_per_gpu_in_GiB": 0
}
},
{
"id": "resource_consumer",
"path": "nvflare.app_common.resource_consumers.gpu_resource_consumer.GPUResourceConsumer",
"args": {}
}
]
}
Thank you, I did make this adjustment and it is explained in the documentation. I just submitted this to help improving usability of nvflare as most user would run into this issue at first
Got it, thanks for sharing your experience!
Reopening because the same usability problem persists in NVFlare 2.9.0 with a Dashboard-generated client kit on an existing Ubuntu cloud VM.
Configured capacity: 1 GPU, 16 GiB per GPU. The client detects 15,360 MiB (15 GiB) and fails during initialization:
ValueError: Memory per GPU specified (16384) exceeds available GPU memory for GPU ID 0: 15360.
The GPU model has not been confirmed; the evidence here is the configured and detected memory values. Manually changing the setting to 15 GiB remains a workaround, but users still have to discover this discrepancy after startup fails.
Proposed change
Treat mem_per_gpu_in_GiB as the administrator's maximum memory budget, and calculate each managed GPU's effective capacity at client startup:
effective capacity = min(configured GiB, detected total MiB / 1024)
When the configured capacity exceeds the detected total, start successfully and emit one warning per affected GPU, for example:
GPU 0: configured capacity 16 GiB exceeds detected total memory 15 GiB (15360 MiB).
Limiting schedulable capacity to 15 GiB.
The effective value must be used for reporting, scheduling, reservation, and release, preserving fractional GiB and each GPU's individual capacity. A job requesting 16 GiB must still fail the resource check on a 15 GiB client. This uses detected total memory; the existing free-memory check when consuming resources remains in place.
Apply this by default to existing startup kits after upgrading NVFlare, without a new setting, schema migration, or kit regeneration. Preserve explicit lower budgets, GPU selection, GPU-count validation, detection failures, and ignore_host=True behavior.
I am preparing a scoped implementation with tests for the 16/15 GiB reproduction, fractional and mixed GPU capacities, selected GPU IDs, warnings, and reservation/release accounting, plus resource-management and Dashboard documentation. This runtime change is separate from the dashboard deployment-guide improvements tracked in #5516.
For usability, I think this makes sense. We just have to make sure that the identically named field in a job’s requirements must remain the requested amount. A 16 GiB job must continue to fail on a 15 GiB GPU.