-
Notifications
You must be signed in to change notification settings - Fork 478
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
ATTENTION: Ziglings currently only works manually with the new build system of Zig since 0.11.0-dev.2157 #202
Comments
@chrboesch
Zig version: 0.11.0-dev.2157+f56f3c582 Thanks in advance for your help |
I'm getting this error with |
No Zig build since parallel builds was merged can work with the current (version number details)The downloadable version is Therefore, if your version tag doesn't lie before Note that you can (probably) do many (most?) examples by hand, if you manually invoke |
@aitoehigie Yes, this is also related to the new build system. |
First of all, all tasks can be called manually by their number. The automatic version will also come back, I'm already working on the solution. |
The idea for a sustainable solution is to use the arguments in the build to select whether to compile all tasks one by one, and then re-run the build system one step at a time. In principal it works. I tested yesterday. |
not sure to understand @chrboesch ; Isn't it already the case? |
@sterchelen No. If you start the build system without paramter, all exercises are packed into an array and then a list of steps is build from it. So far this list was processed one after the other and now it is processed in parallel. This leads to several problems: 1. the order is no longer correct, 2. the build process aborts because too many errors also occur once due to parallel processing. Therefore my thought, the build process does NOT create a list of steps but calls itself recursively and passes one step at a time as a parameter. |
@chrboesch Would it be an option to make each exercise's step depend on the previous one's step? (I.e. using |
@rohlem The dependencies are already set the same way. I hadn't seen that directly because I just haven't had time to look at it closely yet. The question is, why doesn't the compiler stop and abort after the first error? Instead, he keeps running and producing errors until he runs into one himself. Maybe something has changed in the dependency syntax and the problem can be solved by adjusting it. |
As far as I can see, there is no way to continue with the build system in the old way because the dependencies do not work with parallel threads. Each exercise is put in the pipe and compiled independently of the other exercises. It would need semaphores that exchange information between threads. This is possible to program, but would probably destroy the entire mechanism. I will continue with the experimentation. |
I started a local branch to improve, simplify and fix For ensuring that my branch does not change the behavior of There are two quick fixes: 1. Use an old version of
|
|
Unfortunately https://github.com/ziglang/zig/blob/6f13a725a/lib/build_runner.zig does not work. However I managed to get the new build runner work with a simple patch: diff --git a/lib/build_runner.zig b/lib/build_runner.zig
index bfc6ab7..e195b32 100644
--- a/lib/build_runner.zig
+++ b/lib/build_runner.zig
@@ -355,7 +355,7 @@ fn runStepNames(
} else {
try step_stack.ensureUnusedCapacity(gpa, step_names.len);
for (0..step_names.len) |i| {
- const step_name = step_names[step_names.len - i - 1];
+ const step_name = step_names[i];
const s = b.top_level_steps.get(step_name) orelse {
std.debug.print("no step named '{s}'. Access the help menu with 'zig build -h'\n", .{step_name});
process.exit(1);
@@ -410,12 +410,12 @@ fn runStepNames(
// check whether it should run any dependants.
const steps_slice = step_stack.keys();
for (0..steps_slice.len) |i| {
- const step = steps_slice[steps_slice.len - i - 1];
+ const step = steps_slice[i];
wait_group.start();
- thread_pool.spawn(workerMakeOneStep, .{
+ @call(.auto, workerMakeOneStep, .{
&wait_group, &thread_pool, b, step, &step_prog, run,
- }) catch @panic("OOM");
+ });
}
}
assert(run.memory_blocked_steps.items.len == 0);
@@ -846,9 +846,9 @@ fn workerMakeOneStep(
// Successful completion of a step, so we queue up its dependants as well.
for (s.dependants.items) |dep| {
wg.start();
- thread_pool.spawn(workerMakeOneStep, .{
+ @call(.auto, workerMakeOneStep, .{
wg, thread_pool, b, dep, prog_node, run,
- }) catch @panic("OOM");
+ });
}
}
@@ -872,9 +872,9 @@ fn workerMakeOneStep(
remaining -= dep.max_rss;
wg.start();
- thread_pool.spawn(workerMakeOneStep, .{
+ @call(.auto, workerMakeOneStep, .{
wg, thread_pool, b, dep, prog_node, run,
- }) catch @panic("OOM");
+ });
} else {
run.memory_blocked_steps.items[i] = dep;
i += 1; In my local repository, I have saved this patch in In order to use it: $ ZIG_BUILD_RUNNER=lib/build_runner.zig zig build |
Did you try it with our original build system before we made changes because of the update? https://github.com/ratfactor/ziglings/commits/main/build.zig |
No. |
@perillo Sorry, I'll summarise again briefly. Before the update of the Zig Build system with parallel processing, Ziglings ran as follows: After the update of the zig build system, all exercises run in parallel, so that a simple |
@chrboesch This is the same behavior when using the latest commit of What I did not test is the commit before the one you mentioned. I tested 0d154fe now, but it fails since the code try to use |
Ok, I understand. The problem with |
Well, I'll summarise: With @perillo's patch of Build_Runner we can run 'Ziglings' as usual thanks to @SuperAuguste's build extension. ziglang/zig@25b8318 What we need for this is The latter is a bit of a challenge because it breaks the native feeling of'zig build'. I would like to know what @ratfactor thinks about this. |
Yeah, I agree that it breaks the native feeling. The I really appreciate the attempt to make this work like before, but we've got to figure out how to make it less awkward. I'm half tempted to suggest my original shell script, which was so simple: 971ab7f#diff-e98d7fec1a7ab427eac77bee3049921b81f13a2b9df3b6de0f326c0dd91350d1 But the advantage of the Zig build system is that it's cross-platform and...you are guaranteed to already have it. Is there some other way to trick the build script into just running one exercise at a time? Some sort of hack like writing to a text file when an exercise is completed? |
I would like to clarify that using a custom build runner is a temporary solution; it can be used by person reviewing #212 to test that my changes does not break the behavior of |
Does that mean you think it's a general bug in the |
I finally managed to fix the bug in For testing the old behavior I used Zig 0.10.1 and ziglings commit f534355. Should I mark this issue as closed, in the next commit I will push in #212? |
@perillo submitted a PR with an extension for |
The new parallel build support in Zig broke the exercise chain, so that each esercise check is no longer strictly serialized. 1. Add the Dexno option, in order to isolate the chain starting from a named exercise from the normal chain, thus simplify the code. The current code have an additional issue: it added 4 x n steps, making reading the help message or the list of steps very hard. Add only the `install`, `uninstall`, `zigling`, `test` and `start` steps. The last three steps match the old steps `n`, `n_test` and `n_start`. The default step is zigling (note the singular form). The `install` step override the builtin install step, showing a custom description and matches the old `n_install` step. The uninstall step was added for consistency, so that the description is consistent. Setup a new chain starting at `zig build -Dexno=n start` so that it is stricly serialized. The behavior should be the same as the old one. 2. Handle the code for all the exercises separately. Add only the `ziglings step`, making it the default step, in addition to the install and uninstall steps. Setup a new chain starting at the first exercise, to that it is strictly serialized. The behavior should be the same as the old one. The current code has a know issue: the messages from the ZiglingStep and the ones from the compiler compilation progress are interleaved, but each message is written atomically, due to the use of `std.debug.getStderrMutex()`. Update the README.md file. Closes ratfactor#202
IMHO, the solution was to reimplement the ziglings script in Zig and running it with |
The new parallel build support in Zig broke the exercise chain, so that each esercise check is no longer strictly serialized. 1. Add the Dexno option, in order to isolate the chain starting from a named exercise from the normal chain, thus simplify the code. The current code have an additional issue: it added 4 x n steps, making reading the help message or the list of steps very hard. Add only the `install`, `uninstall`, `zigling`, `test` and `start` steps. The last three steps match the old steps `n`, `n_test` and `n_start`. The default step is zigling (note the singular form). The `install` step override the builtin install step, showing a custom description and matches the old `n_install` step. The uninstall step was added for consistency, so that the description is consistent. Setup a new chain starting at `zig build -Dexno=n start` so that it is stricly serialized. The behavior should be the same as the old one. 2. Handle the code for all the exercises separately. Add only the `ziglings step`, making it the default step, in addition to the install and uninstall steps. Setup a new chain starting at the first exercise, to that it is strictly serialized. The behavior should be the same as the old one. The current code has a know issue: the messages from the ZiglingStep and the ones from the compiler compilation progress are interleaved, but each message is written atomically, due to the use of `std.debug.getStderrMutex()`. Update the README.md file. Closes ratfactor#202
The new parallel build support in Zig broke the exercise chain, so that each esercise check is no longer strictly serialized. 1. Add the Dexno option, in order to isolate the chain starting from a named exercise from the normal chain, thus simplify the code. The current code have an additional issue: it added 4 x n steps, making reading the help message or the list of steps very hard. Add only the `install`, `uninstall`, `zigling`, `test` and `start` steps. The last three steps match the old steps `n`, `n_test` and `n_start`. The default step is zigling (note the singular form). The `install` step override the builtin install step, showing a custom description and matches the old `n_install` step. The uninstall step was added for consistency, so that the description is consistent. Setup a new chain starting at `zig build -Dexno=n start` so that it is stricly serialized. The behavior should be the same as the old one. 2. Handle the code for all the exercises separately. Add only the `ziglings step`, making it the default step, in addition to the install and uninstall steps. Setup a new chain starting at the first exercise, to that it is strictly serialized. The behavior should be the same as the old one. The current code has a know issue: the messages from the ZiglingStep and the ones from the compiler compilation progress are interleaved, but each message is written atomically, due to the use of `std.debug.getStderrMutex()`. Update the README.md file. Closes ratfactor#202
The new parallel build support in Zig broke the exercise chain, so that each esercise check is no longer strictly serialized. 1. Add the Dexno option, in order to isolate the chain starting from a named exercise from the normal chain, thus simplify the code. The current code have an additional issue: it added 4 x n steps, making reading the help message or the list of steps very hard. Add only the `install`, `uninstall`, `zigling`, `test` and `start` steps. The last three steps match the old steps `n`, `n_test` and `n_start`. The default step is zigling (note the singular form). The `install` step override the builtin install step, showing a custom description and matches the old `n_install` step. The uninstall step was added for consistency, so that the description is consistent. Setup a new chain starting at `zig build -Dexno=n start` so that it is stricly serialized. The behavior should be the same as the old one. 2. Handle the code for all the exercises separately. Add only the `ziglings step`, making it the default step, in addition to the install and uninstall steps. Setup a new chain starting at the first exercise, to that it is strictly serialized. The behavior should be the same as the old one. The current code has a know issue: the messages from the ZiglingStep and the ones from the compiler compilation progress are interleaved, but each message is written atomically, due to the use of `std.debug.getStderrMutex()`. Update the README.md file. Closes ratfactor#202
Zigling is currently not executable with the new Zig build system. The parallel processing of the individual processes no longer allows a sequence as before. Therefore Ziglings must be rebuilt. This will take some time and we ask for your understanding.
ziglang/zig#14647
The text was updated successfully, but these errors were encountered: