-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Parallelize precompiles generation #47983
Parallelize precompiles generation #47983
Conversation
Seems like a good thing to do, but it could make the precompilation process harder to debug. It might be good to be able to fallback to the current serial approach for debugging purposes. I guess putting optional waits on the Also I think the progress printing needs figuring out. It's currently a bit chaotic and hard to interpret. |
contrib/generate_precompile.jl
Outdated
end | ||
|
||
# Collect statements from running the script | ||
mktempdir() do prec_path | ||
@async mktempdir() do prec_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should have errormonitor
on them so that their failure is loud
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, should be loud now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vchuravy errormonitor
causes CI to fail for some reason. Is the current approach with fetch(step1) == :ok || throw("Step 1 of collecting precompiles failed.")
sufficient?
Not sure, where the current CI problem comes from. I cannot reproduce it locally. |
Try rebasing? |
The REPL precomp generation script includes intentionally throwing errors. Perhaps that's why errormonitor etc was surfacing errors that were previously ignored? |
Perhaps, but I'm unable to confirm locally. |
Besides |
Looks great.
|
Looking great. Disabling the cursor is best with a try-finally because it can be annoying to lose it if the build process fails |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
I realized the 4 we're reporting as failures are just comments being skipped, so (I hope you don't mind) I pushed a fix for that |
c7c05da
to
a1ee9af
Compare
It seems like |
We could flush the strean for every statement printed maybe. |
I actually think I might be wrong, and we're already flushing. Investigating.. |
Actually, they are populated during the process. I've already tried a very naive approach and it seems to work. |
Nice. I've been trying an approach that doesn't re-read and unique the statements each loop, though it's not working yet |
I propose to leave the asynchronous reading to a different PR because it adds one more level of complexity (and space for possible dead-locks). |
Sounds good to me |
This seems to work without re-reading the total file each time IanButterworth@5ee671a?w=1 |
Nice, but I'm slightly worried about Moreover, we should wait until |
Builds are passing, but win 32 tests are reporting failure without an obvious reason. Updating from master just to check |
readline will never do that (if reading from a proper stream/pipe), but readavailable will often do that |
Wow, I didn't mean to merge this. I tried to merge it locally using |
Wasn't even a squash merge. That seems to easy to do accidentally..! |
I think it asked me and since I thought it was local I thought whatever. The last step said "submit" which in hind sight probably should have made me more alert... |
It seems possible if someone flushes (that is a correct think to do). The following MWE t = tempname()
w = open(t, "w")
r = open(t, "r")
tr = @async begin
for i = 1:30
sleep(0.1)
line = readline(r)
line == "" && continue
println(line)
end
end
print(w, "a+")
flush(w)
sleep(0.3)
print(w, "b\n")
close(w)
wait(tr) prints only
but it is not a full line. |
A file is not a stream/pipe (unless it was created with mkfifo) |
This PR parallelizes
generate_precompile.jl
. It saves half a minute building Julia, and, thanks to usingChannel
, the order of the precompiles should be still fully deterministic.PR
Master
The next optimization would be to read
precompile_file
on the fly, that would save several seconds extra.