The python3 -m julia.sysimage sys_py.so builds the image.
But when applying this image to the file, I do not observe any acceleration. Most likely this is due to the fact that my library is not in the image. How to fix it?
For example my main Julia file main.jl.
using DifferentialEquations
a = solve(
ODEProblem((x, p, t) -> 4.0, 1.0, (0.50 - 0.50, 0.50)),
BS3(),
abstol = 1e-8,
)(
0.50,
)
println(a)
Which performs by the julia main.jl in 12.5 s.
I create an image for him with the help of Julia herself:
using PackageCompiler
create_sysimage(
["DifferentialEquations"],
sysimage_path = "sysimage.so",
precompile_execution_file = "main.jl",
)
In this case, execution through the julia --sysimage sysimage.so command occurs in 1.5 s. That is, the image works.
If I write in PyJulia and run it, then it performs all the same 12.5 s.
from julia import Main as jl
jl.eval("using DifferentialEquations")
result = jl.eval("""
a = solve(
ODEProblem((x, p, t) -> 4.0, 1.0, (0.50 - 0.50, 0.50)),
BS3(),
abstol = 1e-8,
)(
0.50,
)
"""
)
print(result)
If I generate an image with a PyJulia with the help of the python3 -m julia.sysimage sys.so command, then all this is torn and does not help. The code is executed in 12.5 s. My code:
from julia.api import LibJulia
api = LibJulia.load()
api.sysimage = "sys_py.so"
api.init_julia()
from julia import Main as jl
jl.eval("using DifferentialEquations")
result = jl.eval("""
a = solve(
ODEProblem((x, p, t) -> 4.0, 1.0, (0.50 - 0.50, 0.50)),
BS3(),
abstol = 1e-8,
)(
0.50,
)
"""
)
print(result)
I want to quickly import the DifferentialEquations library. How can I achieve this with PyJulia?