Skip to content

update getGpuUsage() to only refresh metrics for one gpu #22

Description

@smedegaard

WorkerThread.getGpuUsage() updates the metrics of all available GPUs. That's redundant since one worker thread is assigned to one GPU.

Pass the array list holding the relevnat GPU id.

Blocked by #21

    public String getGpuUsage() {
        StringBuffer gpuUsage = new StringBuffer();
        if (gpuId >= 0) {
            try {
                configManager.systemInfo.updateAcceleratorMetrics();  // <--- pass [gpuid] here
                Accelerator accelerator =
                        this.configManager.systemInfo.getAccelerators().get(gpuId);
                return accelerator.utilizationToString();
            } catch (Exception e) {
                gpuUsage.append("failed to obtained gpu usage");
                logger.error("Exception Raised : " + e.toString());
            }
        } else {
            gpuUsage.append("N/A");
        }

        return gpuUsage.toString();
    }

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions