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

Plotting error measures during groundstate searches #105

Closed
Gertian opened this issue Dec 13, 2023 · 4 comments
Closed

Plotting error measures during groundstate searches #105

Gertian opened this issue Dec 13, 2023 · 4 comments

Comments

@Gertian
Copy link
Collaborator

Gertian commented Dec 13, 2023

When performing groundstate searches requiring many iterations it is desirable to have some notion of convergence speed to estimate runtime on clusters and better help planning.

I used to have an implementation of this using UnicodePlots.jl which can run in any terminal.

I was thinking about re-implementing this and was wondering how such functionality would fit most elegantly within the current framework. I suspect the finalize function can be used for this ? Alternatively it might be implemented as a verbosity setting.

@lkdvos
Copy link
Member

lkdvos commented Dec 14, 2023

I recently changed the logging within the algorithms to allow for something similar, but haven't gotten around to playing with it some more. They now attach some variables to the log messages, that you could access through a custom logger. This would then be able to be handled with something like a unicode plot, or a progress meter, etc. I'd recommend having a look at LoggingExtras for more information.
Of course the finaliser should also allow for this, but I felt like the logging approach was better suited

@Gertian
Copy link
Collaborator Author

Gertian commented Dec 28, 2023

This sounds like a better approach indeed.
I looked into the finalize thing and this was slightly problematic because the function can only take input from the current state of the GS search

@maartenvd
Copy link
Collaborator

maartenvd commented Dec 28, 2023 via email

@Gertian
Copy link
Collaborator Author

Gertian commented Apr 17, 2024

@maartenvd and @lkdvos

As maarten suggested I ended up fixing this using finalize. In particular we now have :

function finalize_saver(x, f, g, numiter) #x = state, f = costfun(x), g  = gradient(f(x)), numiter = iteration
    @info "I'm also updating the $(status_file) file"
    normgrad = sqrt(GrassmannMPS.inner(x,g,g))                
    open("status_file", "a") do file
        write(file, "sinval = $sinval, iter = $numiter, f = $f \t normgrad = $normgrad > $( sinval*extra_accuracy )\n")
    end
    return x,f,g
end

and then I use external software to read and plot the status_file.

If it's up to me this thread can be closed 👍

@lkdvos lkdvos closed this as completed Apr 17, 2024
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

No branches or pull requests

3 participants