Saving workspace in JLD

I have a number of saved *.jld files from Julia 0.6.4 but had to switch to Julia 1.2 recently. With JLD package @load seems work fine, but there is a problem with @save(“workspace.jld”). It complains about current module not defined. How can I make it work?

ps. i understand that simple save command still works, but listing 100+ variables by names and then reading them in the same fashion seems a bit annoying, unless i missing something here.

Hi,

This looks like either a bug or removed feature in the JLD package. Have you considered reorganizing your variables into data structures, e.g. NamedTuple?

params = (
       a = 5,
       b = [1,2,3],
       c = "Test"
       )
using JLD2 # NamedTuple requires JLD2
@save "workspace.jld" params
@load "workspace.jld"
@show params.b
1 Like

This is a neat utility. I had thought of trying to use it to load my own modules more quickly, but unfortunately it takes about the same time (7 as opposed to 10 seconds). Still, it is quite handy when I am not in a hurry to run something.

For quick application, though, I had tried looking at various methods of precompilation which have been proposed but I couldn’t follow them. I wonder, is there any other way to easily save a workspace and (later) load it (including functions, etc.) quickly?

1 Like