# Julia CPU Target

**URL:** https://discourse.julialang.org/t/julia-cpu-target/101291
**Category:** General Usage
**Created:** [July 7, 2023, 5:31am UTC](https://discourse.julialang.org/t/julia-cpu-target/101291 "2023-07-07T05:31:11Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)
#### Post date: [July 7, 2023, 5:31am UTC](https://discourse.julialang.org/t/julia-cpu-target/101291/1 "2023-07-07T05:31:12Z")

</div>

Damn stupid question - is there a methodology for choosing the -C CPU Target fields for a given CPU type?  
I can see that you can use CPUID.jl but for more in depth choices such as th many avx related flags is there a scriptable way to figure out what the processor you are running on has available? I mean that you can run a quick utility then launch Julia with the appropriate -C flags.

Is this question better answered in LLVM land?

---

<div class="post-metadata">

### Author: ![lmtzx9h4qqnt](https://avatars.discourse-cdn.com/v4/letter/l/74df32/32.png) [@lmtzx9h4qqnt](https://discourse.julialang.org/u/lmtzx9h4qqnt)
#### Post date: [October 13, 2023, 6:18pm UTC](https://discourse.julialang.org/t/julia-cpu-target/101291/2 "2023-10-13T18:18:24Z")

</div>

`julia -e 'println(Sys.CPU_NAME)'`?

---

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [October 13, 2023, 6:27pm UTC](https://discourse.julialang.org/t/julia-cpu-target/101291/3 "2023-10-13T18:27:36Z")

</div>

> [@johnh](#):
>
> I mean that you can run a quick utility then launch Julia with the appropriate -C flags.

I believe you don’t need that, since Julia chooses appropriate. Julia will compile, _your code_, for your type of CPU (for JLLs, already compiled code from e.g. C, then it will not but -C would neither change that code). If you were to compile to distribute that code, it might not work for older/other CPUs, why if you use PackageCompiler.jl it would by default be more, i.e. very conservative, compile for rather old CPUs.
