# Using multiple cores but the speed doesn't increase

**URL:** <https://discourse.julialang.org/t/using-multiple-cores-but-the-speed-doesnt-increase/109066>\
**Category:** General Usage\
**Created:** [January 21, 2024, 5:32am UTC](https://discourse.julialang.org/t/using-multiple-cores-but-the-speed-doesnt-increase/109066 "2024-01-21T05:32:48Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/224680_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [February 5, 2024, 10:33am UTC](https://discourse.julialang.org/t/using-multiple-cores-but-the-speed-doesnt-increase/109066/21 "2024-02-05T10:33:53Z")

</div>

> [@soldin](#):
>
> I just wanna know if there is a way to engage all the cores without making the above-mentioned modifications?
> 
> Something like julia --t or julia --p?

The simplest way is [multithreading](https://docs.julialang.org/en/v1/manual/multi-threading/): start Julia with multiple threads

```bash
julia -t auto

```

and then put `@threads` in front of the `for` loops you want to parallelize, assuming they have no race conditions (i.e. no threads competing to write at the same memory location). If you suspect race conditions, you will need to use [distributed](https://docs.julialang.org/en/v1/manual/distributed-computing/) computing instead, which is also fairly easy to setup.

Even then, it might be that the code is not sped up by multiple threads, in which case you need to optimise it first before parallelizing.

---

<div class="post-metadata">

**Author:** ![soldin](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@soldin](https://discourse.julialang.org/u/soldin)\
**Post date:** [February 6, 2024, 6:03pm UTC](https://discourse.julialang.org/t/using-multiple-cores-but-the-speed-doesnt-increase/109066/22 "2024-02-06T18:03:16Z")

</div>

Thanks a lot.

[Previous page](https://discourse.julialang.org/t/using-multiple-cores-but-the-speed-doesnt-increase/109066.md?page=1)
