# What is local mode?

**URL:** <https://discuss.ray.io/t/what-is-local-mode/10893>\
**Category:** Ray Core\
**Created:** [June 3, 2023, 7:29am UTC](https://discuss.ray.io/t/what-is-local-mode/10893 "2023-06-03T07:29:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HuangLianghong](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/huanglianghong/32/3545_2.png) [@HuangLianghong](https://discuss.ray.io/u/HuangLianghong)\
**Post date:** [June 3, 2023, 7:29am UTC](https://discuss.ray.io/t/what-is-local-mode/10893/1 "2023-06-03T07:29:01Z")

</div>

**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`

```auto
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.

---

<div class="post-metadata">

**Author:** ![vitsai](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/vitsai/32/4195_2.png) [@vitsai](https://discuss.ray.io/u/vitsai)\
**Post date:** [June 9, 2023, 5:30pm UTC](https://discuss.ray.io/t/what-is-local-mode/10893/2 "2023-06-09T17:30:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jules\_Damji](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/jules_damji/32/4058_2.png) [@Jules\_Damji](https://discuss.ray.io/u/Jules_Damji)\
**Post date:** [June 9, 2023, 5:32pm UTC](https://discuss.ray.io/t/what-is-local-mode/10893/3 "2023-06-09T17:32:41Z")

</div>

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