-
Notifications
You must be signed in to change notification settings - Fork 23
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
How to use with PackageCompiler? #84
Comments
I failed to make my own custom images before, though TBH I timeboxed the task to 15 minutes and didn't try that hard. If someone can post an ELI5 level set of instructions, I will be glad to include them in the Snail documentation. |
To be able to do it we need to find a way for packagecompiler to load the module, but it might require also running a few functions. I have no idea, though. Is there a way we can run a couple of functions simulating what julia-snail does during a session? |
Alternatively, it might be the case that most of the start-up time for snail is actually some dependency such as CSTParser, is this possible? |
It's definitely dependencies, but the JIT compiler probably needs to have seen Snail functions to optimize them. A great start is to look through |
It might help doing this if JuliaSnail.jl was more like a module that we install normally. I understand that now it's loaded by Anyways, if dependencies such as CSTParser are mostly responsible for the start-up time, then just having that compiled might be enough and easier to accomplish. I would be very happy to reduce the start-up time, I tend to restart the shell often because I never learned to work otherwise. |
Now I see JuliaSnail.jl contains multiple sub-modules. If it's not easy to make the whole of JuliaSnail into an installable module, we might try just taking this CST sub-module, make it a separate installable "JuliaSnailCST.jl", and we package-compile that. You even have this |
Making any part of Snail installable through normal Julia packaging channels introduces headaches. Version compatibility checks, extra steps to cut releases, extra installation steps for users, undoubtedly more support questions, and generally more work for me. So I'm not very interested in doing that. Is making an installable module really a prerequisite for |
I certainly don't mean to turn it hard to install. First step is just figuring out a way to do it, that's just one idea... I don't know enough about the PackageCompiler or JuliaSnail inner workings to be sure of what's needed. I'm not sure installing the package is a required thing to do, but my hunch is it would make it much easier. If compiling this CST sub-module is really the heart of the matter, I think it's a good idea to try that out. Then if it works we can look for a way to make it easier. I'll try to investigate that and get back to you. |
@gcv I did it! I got JuliaSnail.jl installed in my default Julia environment and used PackageCompile to create a sysimage along with Makie. Now I can start a new Julia session and see my first plot very quickly. What a bliss! I would love to help others do the same thing. I believe it is possible to have the automatic and simple initialization of JuliaSnail.jl, similar to using I created a fork that contains some modifications I had to do. First of all, I needed to add a couple of dependencies, and the package wasn't installable as well because there was no name or uuid. I've also removed the 'with_dir_env` function just to see if we can make things work without it, but I haven't tested the plugins yet. https://github.com/nlw0/julia-snail/tree/nic/pkg-structure |
Can you explain what you did in detail? |
Here's a tentative guide: Make the project compatible with PkgThe project structure right now is not recognized by Pkg: Some modifications are necessary for that to work. Either checkout the branch https://github.com/nlw0/julia-snail/tree/nic/installable-package, or do the following:
After these modifications it should now be possible to either:
At this point, if you install it, you can remove the "-L" from the Julia call at Create a sysimageOnce the package can be found via Pkg, it can be easily added to a sysimage by following the usual PackageCompile instructions. You can add more packages as well. Here's one way to do it. Create the script
Run Once the precompile statements file is created, you can call julia again and run
Notice this is different from the After a few minutes your sysimage file should be created, and calling Julia with |
That's a great guide. Thanks for writing it up. I'm now thinking about adding a "wizard" to Snail that would automate a bunch of steps for users building custom images. You added GLMakie and ImageView, for example, and other users might want to add other things. It sounds like we can't make an image based purely on the current state of the Julia REPL, and PackageCompiler has a hard requirement for anything bundled into an image to be a Julia "package"? It's surprising and annoying, but I guess we'll live with that. Do you know why all those explicit dependencies have to be added (Printf, REPL, Sockets, etc.)? They're built into Julia itself. |
Happy to help! i've been using julia-snail for a while now, looking for ways to contribute. I think the only module you can really consider built-in in Julia is Base, everything else are just like other modules. Pkg is a little fussy with the dependencies, etc, but this is supposed to help! Same for PackageCompiler, I think when you start trying to do things around the way it works there will be some nasty surprises. It would be nice to have some easier way to create a sysimage, but on the other hand people tend to want lots of customization, like setting up emacs! Maybe as we come up with a good procedure and documentation first, we will naturally reach a point we can offer a simple script for the basics. |
I can't get past this error: PackageCompiler.create_sysimage(["JuliaSnail"], sysimage_path="img1.so", precompile_statements_file="precompile_statements.jl") Note that
There's no precompiling output for JuliaSnail and PackageCompiler because I had run this before. I made a |
(Updating this to keep track of comments on the Julia Discourse.)
I'll have to give this another go. |
Hi @gcv , apologies I didn't come back to this earlier. I'm upgrading to Julia 1.8.3 now. I was dreading a bit trying to do the process again, but I'm happy to say that following my (already forgotten) guide I was able to pull it off. I'd love to help more people be able to do it, and continue to make the process easier, because it's still such a big deal to make sure we have a good time-to-first-plot, especially for users of "alternative" IDEs. Theoretically, the tools should be already there. It seems there might still be some detail involving either the installation/availability of JuliaSnail, or some relationship between package availability and PackageCompiler. I notice you just
Anyways, I would suggest trying out actually installing it with |
@nlw0: Cool, thanks for following up. I’ll try to find time in the next few weeks to pick this up again. I agree that TTFP is pretty essential. I think I already mentioned that I’d love for Snail to provide “make an image out of my current project” feature. |
@nlw0: Have you had a chance to try the latest Julia 1.9.0 prereleases? They seem to have made major improvements on the time-to-first-plot problem. If this problem will simply go away in the short to medium term, I'd rather not invest time into PackageCompiler integration. |
The advantage to PackageCompiler is that it solves |
It would be great to add JuliaSnail.jl to a sysimage created with PackageCompiler. I'm not sure how to do it, though, as the module is just
include
d, as far as I know, andPackageCompiler.create_sysimage
expects a list with module names. Does anybody have any tips?The text was updated successfully, but these errors were encountered: