Repository navigation
Examples: add isolated parallel execution cookbook program (#12) - #315
guillermomolina merged 3 commits into
Conversation
guillermomolina
left a comment
There was a problem hiding this comment.
Thanks for the contribution — this is well scoped and matches the public isolated-parallel model. CI is green and the example looks good overall.
I only have two small polish requests before merging:
-
Please add the final newline to
protos/examples/concurrency/parallel-execution.protos. -
Please tweak the
parallelReducecomment so it reflects the stronger Protos contract: determinism comes from the canonical logical reduction tree, not from requiring the reducer to be associative/commutative.
Suggested wording:
parallelReduce uses one canonical logical reduction tree, so scheduling does not choose the parenthesization. Do not assume sequential left-fold semantics.
Thanks — nice first contribution!
|
Addressed both polish requests in c1ee86c: added the final newline and updated the parallelReduce comment to describe the canonical logical reduction tree without implying an associativity/commutativity requirement. Ready for another look. |
|
Thanks! The requested changes look good. The new CI failure is unrelated to your contribution. The PR is currently based on an older Could you please update/rebase Once the new CI run is green, this should be ready to merge. Thanks! |
guillermomolina
left a comment
There was a problem hiding this comment.
Thanks — the requested polish changes are in, the branch has been updated onto current main, and the new CI run is green. Approved for merge.
Closes #12
Summary
Adds a standalone cookbook program
protos/examples/concurrency/parallel-execution.protosteaching the public isolated-parallel (P) model, and lists it inprotos/examples/README.md.The example demonstrates:
closure.parallel(...)(the projected closure has no lexical edge back to the caller, so data is passed as arguments rather than captured);Futurewithvalue();parallelMapandparallelFilterpreserve source order,parallelFindIndexselects the lowest logical matching index (nullwhen nothing matches),parallelReduceuses the canonical reduction tree (nullfor an empty source), andparallelSortis stable;parallel(...)returns.The new source carries the exact APL Part 5 notice. Existing parallel/concurrency tests remain green.
Validation
mvn -q -DskipTests package(JDK 22.0.2 + Maven 3.9.9): PASS.java -jar target/protos-0.2.344-SNAPSHOT.jar protos/examples/concurrency/parallel-execution.protos: exit 0, clean stderr, deterministic output:42/[9, 1, 16, 1, 25, 81, 4, 36]/[4, 2, 6]/2/null/31/null/[1, 1, 2, 3, 4, 5, 6, 9]mvn test -Dtest=ProtosCliLearningMaterialsTest: 50/50 pass (the suite auto-discovers every print-dependent example, including the new one, and runs it through the standalone CLI without stderr).mvn test -Dtest=ProtosParallelExecutionTest: 7/7 pass.scripts/source_style_guard.py --base upstream/main --head HEAD: PASS.git diff --check: clean.ProtosCliTestcase (testSubcommandRunsBundledProtosToolThroughCommonBootstrap) fails on this machine both with and without this change: the Truffle runtime25.3.4.1version check requires JDK 25, and this machine runs JDK 22. The failure reproduces on a cleanupstream/maincheckout and does not touch the changed files.AI assistance: this contribution was authored with the help of an AI coding agent (implementation, tests and PR description); the audit, execution, and validation evidence above were performed and recorded by the agent.