[ITensorsPackageCompilerExt] Superseding indictment of ITensorsPackageCompilerExt #1550
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR supersedes #1549 as a fix for #1548 (see also https://itensor.discourse.group/t/itensorspackagecompilerext-precompilation-failure-julia-v1-11/2070).
Closes #1548 and closes #1549 (@kmp5VT).
I noticed that
ITensorsPackageCompilerExt
was erroneously including and running the compilation script when it is loaded, so that it was actually running ITensor code (such as DMRG) when it was being loaded, while that script should only be run if a user wants to compile ITensor code into a system image.I don't know why that workflow was ok in Julia 1.10 and below but causes problems during precompilation in Julia 1.11. My only guess is that in Julia 1.11 there was a change to the ordering of when package extension code gets loaded and/or precompiled. Anyway, I'm not sure it is worth investigating since a more sane workflow seems to work without any problems.
I also added a somewhat crude test that checks that
ITensors.compile
gets overloaded whenITensorsPackageCompilerExt
gets loaded. This test would have caught the original issue since the test file would have failed when trying to loadITensorsPackageCompilerExt
in the first place.