Skip to content

Incorrect Type for devices Parameter in benchmark_utilization Function #136697

@SamuelMLDev

Description

@SamuelMLDev

🐛 Describe the bug

Title

Incorrect devices Parameter Type in benchmark_utilization Function Causes Profiling Errors

🐛 Describe the bug

Passing the devices parameter as a string (e.g., "cuda") instead of a list (e.g., ["cuda"]) in the benchmark_utilization function leads to unexpected behavior and errors during profiling.

Comment

A clear and concise description of what the bug is.

# Sample code to reproduce the problem
import torch
from torch.profiler import ProfilerActivity

def f(a):
    return a.sum()

a = torch.rand(2**20, device="cuda")
utilization, mm_conv_utilization = benchmark_utilization(
    f,
    a,
    "tmp",
    trace_file_name="tmp_chrome_trace",
    devices="cuda"  # Incorrect type
)


### Versions

wget https://raw.githubusercontent.com/pytorch/pytorch/main/torch/utils/collect_env.py


cc @robieta @chaekit @aaronenyeshi @guotuofeng @guyang3532 @dzhulgakov @davidberard98 @briancoutinho @sraikund16 @sanrise

Metadata

Metadata

Assignees

No one assigned

    Labels

    oncall: profilerprofiler-related issues (cpu, gpu, kineto)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions