# Understanding why I am seeing precompilation on github actions. Cache partial miss

**URL:** <https://discourse.julialang.org/t/understanding-why-i-am-seeing-precompilation-on-github-actions-cache-partial-miss/138390>\
**Category:** General Usage\
**Created:** [July 21, 2026, 8:03am UTC](https://discourse.julialang.org/t/understanding-why-i-am-seeing-precompilation-on-github-actions-cache-partial-miss/138390 "2026-07-21T08:03:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [July 21, 2026, 8:03am UTC](https://discourse.julialang.org/t/understanding-why-i-am-seeing-precompilation-on-github-actions-cache-partial-miss/138390/1 "2026-07-21T08:03:41Z")

</div>

I am seeing this message in my github actions logs:

```julia-auto
  julia scripts/julia_dev_tooling/format.jl
  shell: /usr/bin/bash -e {0}
  env:
    JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
  Activating project at `~/work/biohaus/biohaus/scripts/julia_dev_tooling`
Precompiling project...
    863.3 ms ✓ Glob
   1097.5 ms ✓ Preferences
    510.4 ms ✓ PrecompileTools
  25113.2 ms ✓ CommonMark
    918.3 ms ✓ CommonMark → CommonMarkMarkdownExt
  32835.5 ms ✓ JuliaSyntax
  46553.2 ms ✓ JuliaFormatter
  7 dependencies successfully precompiled in 79 seconds. 10 already precompiled.
[ Info: <messages from my script>

```

[full logs](https://gist.github.com/oxinabox/63f6976d4d401be9db9ad5c12073c97b)

So I am seeing

> 7 dependencies successfully precompiled in 79 seconds. 10 already precompiled.

So it is at least partially hitting my cache since 10 were already precompiled.  
Why is it not fully hitting it? Why are 7 being precompiled?  
I can’t see any messages further up about new versions being installed,  
and I shouldn’t since i have a manifest checked in, and i haven’t touched my dependencies at all in this PR.

I am using the standard `julia-actions/cache` action.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [July 21, 2026, 10:14am UTC](https://discourse.julialang.org/t/understanding-why-i-am-seeing-precompilation-on-github-actions-cache-partial-miss/138390/2 "2026-07-21T10:14:46Z")

</div>

> [@oxinabox](#):
>
> Why is it not fully hitting it? Why are 7 being precompiled?

Setting the environment variable

```julia-auto
JULIA_DEBUG=loading

```

will tell you why existing cache can’t be hit.

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [July 22, 2026, 3:08am UTC](https://discourse.julialang.org/t/understanding-why-i-am-seeing-precompilation-on-github-actions-cache-partial-miss/138390/3 "2026-07-22T03:08:31Z")

</div>

Thanks.  
I had a feeling i had used something like this before.

Now to wait til I see it reoccur

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [July 28, 2026, 5:43am UTC](https://discourse.julialang.org/t/understanding-why-i-am-seeing-precompilation-on-github-actions-cache-partial-miss/138390/4 "2026-07-28T05:43:26Z")

</div>

Ok.  
I am seeing a few causes.  
But by far the majority are

```julia-auto
Debug: Rejecting cache file /home/runner/.julia/compiled/v1.11/CommonSolve/zEcGf_aN5US.ji for Base.PkgId(nothing, ""):
  Reasons = "Unable to find compatible target in cached code image.\nTarget 0 (znver3): Rejecting this target due to use of runtime-disabled features\n"
  Image Targets =
   1-element Vector{Base.ImageTarget}:
    znver3; flags=0; features_en=(sse3, pclmul, ssse3, fma, cx16, sse4.1, sse4.2, movbe, popcnt, aes, xsave, avx, f16c, fsgsbase, bmi, avx2, bmi2, adx, clflushopt, clwb, sha, shstk, vaes, vpclmulqdq, rdpid, sahf, lzcnt, sse4a, prfchw, xsavec, xsaves, clzero)
  Current Targets =
   1-element Vector{Base.ImageTarget}:
    sapphirerapids; flags=0; features_en=(sse3, pclmul, ssse3, fma, cx16, sse4.1, sse4.2, movbe, popcnt, aes, xsave, avx, f16c, fsgsbase, bmi, avx2, bmi2, avx512f, avx512dq, adx, avx512ifma, clflushopt, clwb, avx512cd, sha, avx512bw, avx512vl, avx512vbmi, waitpkg, avx512vbmi2, shstk, gfni, vaes, vpclmulqdq, avx512vnni, avx512bitalg, avx512vpopcntdq, rdpid, cldemote, movdiri, movdir64b, serialize, tsxldtrk, amx-bf16, avx512fp16, amx-tile, amx-int8, sahf, lzcnt, prfchw, xsavec, xsaves, avxvnni, avx512bf16)
@ Base loading.jl:3818

```

so this says the we are running on a different CPU architecture to what was running for the one that is in the cache.  
We are on a `sapphirerapids` which is a Intel Xeon 4  
the cache was saved on a `znver3` which is AMD Zen 3

Probably what is going on is that GitHub Actions is running on whatever machines are available from a big pool on Azure.  
And it doesn’t care about the microarchitecture.

The `znver3` has a few features that the `saphirerapids` does not.  
`clzero, sse4a`  
(the `saphirerapids` has a ton of features `znver3` doesn’t have)

I believe if we always run julia as `julia -C x86-64-v3` (or long `julia --cpu-target x86-64-v3`) that should tell it to only use features that are present in both of these types of machines.

Not sure how to do that in general however.  
Because i can’t pass arguments like `--cpu-target` to julia-buildpkg, or julia-runtests.  
I can pass it for things where i trigger julia manually in my workflow.  
Which does include the linting, but does not include the tests.

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [July 28, 2026, 7:00am UTC](https://discourse.julialang.org/t/understanding-why-i-am-seeing-precompilation-on-github-actions-cache-partial-miss/138390/5 "2026-07-28T07:00:41Z")

</div>

> Not sure how to do that in general however.

Answer from @vchuravy 🙂  
set the `JULIA_CPU_TARGET` environent variable

---

<div class="post-metadata">

**Author:** ![Krastanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/krastanov/32/6817_2.png) [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Post date:** [July 29, 2026, 2:31am UTC](https://discourse.julialang.org/t/understanding-why-i-am-seeing-precompilation-on-github-actions-cache-partial-miss/138390/6 "2026-07-29T02:31:17Z")

</div>

What did you set it to in order to cover most gh action runners?

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [July 29, 2026, 3:14am UTC](https://discourse.julialang.org/t/understanding-why-i-am-seeing-precompilation-on-github-actions-cache-partial-miss/138390/7 "2026-07-29T03:14:08Z")

</div>

right now to `x86-64-v3`  
I will give it a few weeks and see if that both

1. prevents the compilation cache misses and
2. doesn’t break things.

If it does break things, I will drop down to `x86-64-v2`, then down to `x86-64` then `generic`.  
I suspect `x86-64-v3` will be good enough though.

If this does prove to work i will start making noise telling everyone to do this.  
And start thinking about how we can make sure it always is set (or otherwise achieved) for all julia use on github actions.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [July 29, 2026, 6:58am UTC](https://discourse.julialang.org/t/understanding-why-i-am-seeing-precompilation-on-github-actions-cache-partial-miss/138390/8 "2026-07-29T06:58:04Z")

</div>

What’s nice about `JULIA_CPU_TARGET` is that you can have multiple targets at the same time, you don’t have to pick the lowest common denominator.

My recommendation is to

1. take inspiration from the value used in the official builds of Julia

> <https://github.com/JuliaCI/julia-buildkite/blob/3c69f608e41915eedf18766682d3bc23db8744b6/utilities/build_envs.sh#L28-L37>

1. get the values of `Sys.CPU_NAME` for the machines you want to target (that’s also printed in the output of `InteractiveUtils.versioninfo()`), and use them.

As a concrete example, if the targets for the x86-64 GitHub-hosted Actions runners are `znver3` and `saphirerapids` you can do

```sh
JULIA_CPU_TARGET='generic;sandybridge,-xsaveopt,clone_all;znver3,-rdrnd,base(1);saphirerapids,-rdrnd,base(1)'

```

`generic` is the very minimum common denominator, and ensures the cache will be always reusable no matter what specific machines you get for a given architecture, but then you also have specialised native code for all the desired microarchitectures, not just one.

Just be careful that `JULIA_CPU_TARGETS` has to be set differently for different architectures (for example x86-64 vs x86 vs aarch64), in GitHub Actions you may want to dispatch in on the [`runner.arch`](https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#runner-context) value (but if you use a 32-bit of Julia on a 64-bit machine that won’t be enough).

---

<div class="post-metadata">

**Author:** ![ianshmean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ianshmean/32/216042_2.png) [@ianshmean](https://discourse.julialang.org/u/ianshmean)\
**Post date:** [July 29, 2026, 8:12pm UTC](https://discourse.julialang.org/t/understanding-why-i-am-seeing-precompilation-on-github-actions-cache-partial-miss/138390/9 "2026-07-29T20:12:12Z")

</div>

On 1.13+ you can also set `JULIA_CPU_TARGET=sysimage` to retain the coverage that the sysimage has

> **[JULIA\_CPU\_TARGET - Environment Variables · The Julia Language](https://docs.julialang.org/en/v1.14-dev/manual/environment-variables/#JULIA_CPU_TARGET)**
>
> Julia can be configured with a number of environment variables, set either in the usual way for each operating system, or in a portable way from within Julia. Supposing that you want to set the environment variable JULIA\_EDITOR to vim, you can type...

---

<div class="post-metadata">

**Author:** ![Wen-Wei\_Tseng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wen-wei_tseng/32/28839_2.png) [@Wen-Wei\_Tseng](https://discourse.julialang.org/u/Wen-Wei_Tseng)\
**Post date:** [July 30, 2026, 6:43am UTC](https://discourse.julialang.org/t/understanding-why-i-am-seeing-precompilation-on-github-actions-cache-partial-miss/138390/10 "2026-07-30T06:43:06Z")

</div>

Based on [docker-stacks/images/minimal-notebook/setup-scripts/setup-julia-packages.bash at main · jupyter/docker-stacks · GitHub](https://github.com/jupyter/docker-stacks/blob/main/images/minimal-notebook/setup-scripts/setup-julia-packages.bash), FYI

```yaml
    # https://github.com/jupyter/docker-stacks/blob/main/images/minimal-notebook/setup-scripts/setup-julia-packages.bash
    - name: Set Julia CPU target (x64)
      if: runner.arch == 'X64'
      run: echo 'JULIA_CPU_TARGET=generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1);x86-64-v4,-rdrnd,base(1)' >> $GITHUB_ENV
    - name: Set Julia CPU target (ARM64)
      if: runner.arch == 'ARM64'
      run: echo 'JULIA_CPU_TARGET=generic;cortex-a57;thunderx2t99;carmel,clone_all;apple-m1,base(3);neoverse-512tvb,base(3)' >> $GITHUB_ENV

```
