def METHOD_NAME(resp, warn_msg, check_compute=False):
    from pynvml.smi import nvidia_smi
    def query(*args, **kwargs):
        return resp
    def getInstance():
        nvsmi = Mock()
        nvsmi.DeviceQuery = Mock(side_effect=query)
        return nvsmi
    nvidia_smi.getInstance = Mock(side_effect=getInstance)
    gpu_info = GpuInfo()
    if check_compute:
        with pytest.warns(UserWarning, match=warn_msg):
            gpu_info.compute()
    # with Engine
    engine = Engine(lambda engine, batch: 0.0)
    engine.state = State(metrics={})
    with pytest.warns(UserWarning, match=warn_msg):
        gpu_info.completed(engine, name="gpu info")