LocalRunner and RPCRunner

Hi there,

I’m a newbie to TVM and I’m trying to get started with the tuning tutorial for x86 and NVIDIA GPU. My question is about the Runners. It seems like the LocalRunner itself does not distinguish the backend that the tuning is done for, but the tuning by itself should be specific to hardware (CPU/GPU/ASIC). Am I missing anything here?

    runner=autotvm.LocalRunner(number=1, repeat=10,
                               min_repeat_ms=0,
                               enable_cpu_cache_flush=True),

If we want to expose the hardware features to the tuning module, should I use the RPCRunner and specify the “device” like below?

    runner=autotvm.RPCRunner(
        "1080ti",  # change the device key to your key
        "0.0.0.0",
        9190,
        number=20,
        repeat=3,
        timeout=4,
        min_repeat_ms=150,

Thanks!

The hardware related information is specified in “target”. In your case, the target should be cuda -model=1080ti. The builder will build the model based on the target, and runner is only in charge of running the built model, so it doesn’t have to take the hardware information. Accordingly, the device key in RPC runner is just a label and can be arbitrarily specified.

Thanks for the explanation! I’m looking at the LocalBuilder function in both the CPU and GPU tutorials, but neither of them takes any arguments related to the target. How does the builder know about the target?

tuning_option = { “log_filename”: log_file, “tuner”: “xgb”, “n_trial”: 2000, “early_stopping”: 600, “measure_option”: autotvm.measure_option( builder=autotvm.LocalBuilder(timeout=10), runner=autotvm.LocalRunner(number=20, repeat=3, timeout=4, min_repeat_ms=150), ), }

tuning_option = { ‘log_filename’: log_file, ‘tuner’: ‘random’, ‘early_stopping’: None,

'measure_option': autotvm.measure_option(
    builder=autotvm.LocalBuilder(),
    runner=autotvm.LocalRunner(number=1, repeat=10,
                               min_repeat_ms=0,
                               enable_cpu_cache_flush=True),
),

}

It uses the target specified in MeasureInput. See L428 in