-
Notifications
You must be signed in to change notification settings - Fork 145
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
Precompilation can lead to Dual tag ordering problems #714
Comments
Is there a way to detect from inside the package if we're currently pre-compiling it? If so, maybe the tag counter could be initialized at typemin(Int) instead of 0? |
Although I'm not sure I understand why the counter restarts at zero, shouldn't it be the same state as it was at the end of precompilation? https://www.oxinabox.net/2023/06/16/top-level-code-in-julia.html |
|
…iated Tag's count
Hi, I found an issue when working with precompilation and nested derivatives.
The tag count system is setup such that the inner derivative receives a tag with a higher
tagcount
than the outer derivative. When precompiling, it can happen that only the outer derivative is precompiled, for example because of runtime dispatch that depends on the value of some parameters. When running the code later, the atomic counter for tags starts from 0 again, which can cause the inner derivative to be given a tag with a lower count. This leads to aCannot determine ordering of Dual tags
error.Here is a reproduction example: https://github.com/Technici4n/FDPrecompilationIssue.
Precompilation should succeed, and running the test should fail with the following output:
(I encountered this issue was encountered in the context of https://github.com/mfherbst/AiidaDFTK.jl but the setup is more complicated than in this minimal reproduction example. AiidaDFTK precompiles a stress computation (outer derivative) using the LDA functional (does not require a nested derivative). I encountered the issue when running a stress computation through AiidaDFTK using a PBE functional (which requires a nested gradient). You can think of
α
from the reproduction example as the parameter that selects the functional, LDA asα = 0
, PBE asα = 1
.)The text was updated successfully, but these errors were encountered: