Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ITensors] Fix ITensorsPackageCompilerExt precompile issue #1549

Closed

Conversation

kmp5VT
Copy link
Collaborator

@kmp5VT kmp5VT commented Oct 18, 2024

Description

Fixing the issue #1548 .
The issue is related to the precomile_itensor.jl file's dependency on VectorInterface. During precompile, ITensorsVectorIntefaceExt is not being added which throws an error due to a missing function.

@@ -1,4 +1,5 @@
using ITensors.ITensorMPS: MPO, OpSum, dmrg, random_mps, siteinds
include("$(@__DIR__)/../ITensorsVectorInterfaceExt/ITensorsVectorInterfaceExt.jl")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look like a good idea to do. Does it work if you load VectorInterface.jl to trigger the extension to load, i.e. add the line:

using VectorInterface: VectorInterface

It seems weird that we would have to do that though.

Copy link
Member

@mtfishman mtfishman Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see in #1548 (comment) you said you already tried that and it didn't work.

The confusing part to me, and maybe what is causing problems here for some reason, is that VectorInterface.jl is a dependency of KrylovKit.jl, and KrylovKit.jl is a dependency of ITensors.jl, so ITensorsVectorInterfaceExt should get loaded automatically. So there is something strange happening with the order that the packages/extensions get loaded, I suspect it is a bug in Julia and/or Pkg.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something you could try is adding VectorInterface.jl as a dependency of ITensors.jl directly and see if that forces ITensorsVectorInterfaceExt to get loaded. It's implicitly a dependency anyway, as I described, so it shouldn't be a problem adding it as a dependency, though it seems like a bug that we would have to do that.

One reason I made ITensorsVectorInterfaceExt is because when we move ITensors.ITensorMPS to ITensorMPS.jl, KrylovKit.jl and VectorInterface.jl will no longer be dependencies of ITensors.jl, so that extension was anticipating that code reorganization. But if it is causing problems that we can't circumvent right now we could move ITensorsVectorInterfaceExt into ITensors.jl and turn VectorInterface.jl into a dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants