# CPU Targets for Precompilation

**URL:** <https://itensor.discourse.group/t/cpu-targets-for-precompilation/2258>\
**Category:** ITensor Julia Questions\
**Created:** [February 20, 2025, 9:22pm UTC](https://itensor.discourse.group/t/cpu-targets-for-precompilation/2258 "2025-02-20T21:22:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vik](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/vik/32/50_2.png) [@vik](https://itensor.discourse.group/u/vik)\
**Post date:** [February 20, 2025, 9:22pm UTC](https://itensor.discourse.group/t/cpu-targets-for-precompilation/2258/1 "2025-02-20T21:22:08Z")

</div>

Is there a way to pass CPU targets to `ITensor.compile()`, as can be done with the `cpu_target` argument to `PackageCompiler.create_sysimage()`? (relevant source: [PackageCompiler.jl-`create_sysimage`](https://julialang.github.io/PackageCompiler.jl/stable/refs.html#PackageCompiler.create_sysimage))

I encountered an error similar to [Question for use ITensor compile() in shell](https://itensor.discourse.group/t/question-for-use-itensor-compile-in-shell/357) when running my code on a cluster, since the architecture of some nodes is `casecadelake` and `icelake` for others (the sysimage was compiled on a node with `icelake` architecture). I was hoping to be able to change the target, as mentioned in [this Julia doc](https://docs.julialang.org/en/v1/devdocs/sysimg/#Specifying-multiple-system-image-targets).

Alternatively, if I could determine where the source code of the `ITensors.compile` function is, I would be happy to add this as an additional argument and push it back, if that might be of broader use.

---

<div class="post-metadata">

**Author:** ![mtfishman](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/mtfishman/32/11_2.png) [@mtfishman](https://itensor.discourse.group/u/mtfishman)\
**Post date:** [February 20, 2025, 9:28pm UTC](https://itensor.discourse.group/t/cpu-targets-for-precompilation/2258/2 "2025-02-20T21:28:20Z")

</div>

That sounds reasonable, though honestly I’m starting to regret that we defined `ITensor.compile` at all, it is just a simple wrapper around `PackageCompiler.create_sysimage` that calls a script that runs DMRG, it is easy enough to just call `PackageCompiler.create_sysimage` directly and get all of the customizability you need from that.

---

<div class="post-metadata">

**Author:** ![vik](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/vik/32/50_2.png) [@vik](https://itensor.discourse.group/u/vik)\
**Post date:** [February 20, 2025, 9:52pm UTC](https://itensor.discourse.group/t/cpu-targets-for-precompilation/2258/3 "2025-02-20T21:52:11Z")

</div>

Thank you! I suspected as much, but I am grateful for the confirmation nonetheless. Would you happen to know the filename of the script? I can look for it either on GitHub or my local ITensor installation. Thanks!

---

<div class="post-metadata">

**Author:** ![mtfishman](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/mtfishman/32/11_2.png) [@mtfishman](https://itensor.discourse.group/u/mtfishman)\
**Post date:** [February 20, 2025, 9:58pm UTC](https://itensor.discourse.group/t/cpu-targets-for-precompilation/2258/4 "2025-02-20T21:58:00Z")

</div>

The implementation is here: [ITensorMPS.jl/ext/ITensorMPSPackageCompilerExt at v0.3.7 · ITensor/ITensorMPS.jl · GitHub](https://github.com/ITensor/ITensorMPS.jl/tree/v0.3.7/ext/ITensorMPSPackageCompilerExt).

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/d3072b13e047cd06df7f3981547c0917d940dfa4.png) [@system](https://itensor.discourse.group/u/system)\
**Post date:** [March 2, 2025, 9:58pm UTC](https://itensor.discourse.group/t/cpu-targets-for-precompilation/2258/5 "2025-03-02T21:58:24Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
