What is local mode?

How severe does this issue affect your experience of using Ray?

  • Low: It annoys or frustrates me for a moment.

Hi! Recently I have been looking at the source code of Ray, and the options_.is_local_mode confuse me. Specifically, it’s CoreWorker::SubmitTask method in src/ray/core_worker/core_worker.cc

if (options_.is_local_mode) {
    returned_refs = ExecuteTaskLocalMode(task_spec);
  } else {
    returned_refs = task_manager_->AddPendingTask(
        task_spec.CallerAddress(), task_spec, CurrentCallSite(), max_retries);
    io_service_.post(
        [this, task_spec]() {
          RAY_UNUSED(direct_task_submitter_->SubmitTask(task_spec));
        },
        "CoreWorker.SubmitTask");
  }

I originally thought that is local mode means the task should run in the local node. But when I ran a remote function in my PC, it’s still not in local mode. FYI, I use ray.init() and @ray.remote(num_gpus=0.1, max_calls=1) to run my function in Ray.

Local mode is actually an option that you, as the user, can set. It will run things in series instead of in parallel.

From set_mode function in worker.py:

The mode LOCAL_MODE should be used if this Worker is a driver and if
you want to run the driver in a manner equivalent to serial Python for
debugging purposes. It will not send remote function calls to the
scheduler and will instead execute them in a blocking fashion.

This gets passed to core_worker.cc through _raylet.pyx.

Anyway, the option is deprecated, so I would not recommend using it.

2 Likes

@HuangLianghong And good for debugging too on the local host.

1 Like