-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
RFC: Pass custom snoopfile and arbitrary julia flags to compile_incremental #187
Conversation
…ncremental to run_julia. Allow custom snoopfile to be used with compile_incremental
So |
For the other point, we should make it possible to pass a blacklist of packages! |
Concerning 1), I'd like to come up with the convention to have a |
From the available flags, we should only pass these through: "check-bounds"
#"code-coverage"
# "compile"
#"compiled-modules"
# "cpu-target"
"depwarn"
"handle-signals"
# "history-file"
# "machine-file"
"math-mode"
"optimize"
# "output-bc"
# "output-ji"
# "output-jitbc"
# "output-o"
# "output-unoptbc"
# "project"
# "startup-file"
"sysimage"
"sysimage-native-code" # not sure actually
#"trace-compile"
#"track-allocation"
"warn-overwrite"
"inline" All others will yield undefined behaviour, if I'm not mistaken! |
Thanks for the feedback! I like the idea of putting a snoopfile in packages. Would the idea be to check for a snoopfile in the package, use it if it exists, and fall back to runtests.jl if it doesn't? I also like the package blacklist idea! Is it enough just to basically do what I've done in this PR but replace the hardcoded removal of I'm sorry, I don't think I understand your comments on setting the cpu-target. My initial understanding was that your recommendation would be to run Using either
when launching julia, as expected. I've seen the same behaviour using a julia installation built from source (recent master branch of julia) with the setting JULIA_CPU_TARGET=x86_64 in Make.user. So it's worked for me. Having said all that, it could be that what I've done is bad for reasons I don't understand and I've just been lucky. I also understand that adding this option makes it easy for users to pass a bad value for the cpu_target. |
Yup! And maybe also check for a snoop require - but that could be an additional step ;)
Yes, that sounds sufficient!
Ah that's weird...My assumption was, that it propagates the system image cpu_target from the generic binary... But I just checked on windows with the generic binaries, and my But I guess it's pretty fragile to mix |
Great. I'll make a new PR with those changes. Should be able to close this one. I'll also get rid of passing through arbitrary keyword arguments and just include the ones that make sense that are mentioned above. Re the CPU target flag: A full understanding of the implications of mixing instructions for different architectures in one system image is over my head. However, from reading the docs on specifying multiple system image targets I would have thought mixing things would be fine as long as valid instructions for the current cpu can be found at runtime. Having said that I agree that it's cleaner to just pass the current system image with the right cpu_target into compile_incremental. |
Hi,
Thanks for all the recent work on PackageCompiler! I've made a couple changes to compile_incremental that make it a bit more general and make it work smoothly for my use case. I think they could be useful to the general community so I've put them in a small PR. Of course feel free to ignore if you don't think these changes fit with the direction PackageCompiler is headed. This PR makes three changes:
Allow the user to pass their own "snoopfile" to
compile_incremental
. I think it makes sense to use a package's tests as the default thing to run to generate a precompile file but I don't understand why the option to use one's own snoopfile isn't there. I know I can just callsnoop
to generate a precompile file from my own snoopfile and then pass it tocompile_incremental
but then I lose the convenience of having one call tocompile_incremental
that callssnoop_packages
and then the compilation itself all in one go.Allow arbitrary keyword arguments to be passed to
compile_incremental
that just get passed straight through torun_julia
. This allows the user pass any julia command line flags to run_julia. My main use case for this has been to compile with--cpu-target=x86-64
so I can generate a system image that works across a cluster with heterogeneous hardware. I could just add acpu_target
keyword argument tocompile_incremental
but it seems convenient to allow passing whatever flags one might like, such as changing the bounds checking setting or the math-mode for example.This last change is a hack but a useful hack I think. I've found that if the
Distributed
standard lib is initialized in the precompile file then compilation crashes with aTask cannot be serialized
error. In practice this has meant that I haven't been able to compile any packages that depend onDistributed
. However, packages that use functionality fromDistributed
can still be compiled. I had been making this work manually. For example, to compile JSON.jl I would runcompile_incremental(:JSON)
, which crashed when it ran julia with-output-o
. I would then take a look at.../PackageCompiler/packages/incremental_precompile.jl
, which in this example has the following lines:I would then manually edit the file to remove the references to
Distributed
from the section shown and then runcompile_incremental(nothing,".../PackageCompiler/packages/incremental_precompile.jl")
. This PR automates the removal of the references toDistributed
by changing line 47 of snooping.jl toThis is of course a total hack but I imagine it could make a lot more packages compile-able right now.