From: Olivier Dion <olivier.dion@polymtl.ca>
To: Olivier Dion via <gwl-devel@gnu.org>
Cc: Olivier Dion <olivier.dion@polymtl.ca>
Subject: [PATCH 1/2] gwl/workflows: Execute independent processes in parallel
Date: Tue, 14 Jun 2022 15:53:36 -0400 [thread overview]
Message-ID: <20220614195337.30570-1-olivier.dion@polymtl.ca> (raw)
In-Reply-To: <87edzxuyis.fsf@laura>
Processes in the same list can be executed in parallel with `par-map'. The
results are then appended to the accumulator.
---
gwl/workflows.scm | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/gwl/workflows.scm b/gwl/workflows.scm
index 03b29e0..74a1c74 100644
--- a/gwl/workflows.scm
+++ b/gwl/workflows.scm
@@ -43,6 +43,7 @@
#:use-module (ice-9 match)
#:use-module (ice-9 format)
+ #:use-module (ice-9 threads)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9 gnu)
#:use-module (srfi srfi-11)
@@ -447,13 +448,12 @@ can be used in a fold over a WORKFLOW's processes."
(lambda (item acc)
(match item
((? list?)
- (fold (lambda (process res)
- (cons (proc process) res))
- acc
- ;; By reversing the order of the processes
- ;; in STEP we keep the output order the same
- ;; as the order of the sequential function.
- (reverse item)))
+ (append
+ ;; By reversing the order of the processes
+ ;; in STEP we keep the output order the same
+ ;; as the order of the sequential function.
+ (par-map (cut proc <>) (reverse item))
+ acc))
(_ (cons (proc item) acc)))))
(define* (workflow-prepare workflow engine
--
2.36.1
next prev parent reply other threads:[~2022-06-14 19:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-10 0:56 auto-connect fails to parallelize independent processes Olivier Dion via
2022-06-10 13:13 ` Ricardo Wurmus
2022-06-13 20:02 ` Olivier Dion via
2022-06-14 19:04 ` Olivier Dion via
2022-06-14 19:53 ` Olivier Dion [this message]
2022-06-14 19:53 ` [PATCH 2/2] gwl/ui: Protect format to currnt-error-port with mutex Olivier Dion
2022-06-15 23:28 ` Ricardo Wurmus
2022-06-15 23:27 ` [PATCH 1/2] gwl/workflows: Execute independent processes in parallel Ricardo Wurmus
2022-06-16 1:23 ` Olivier Dion via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.guixwl.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220614195337.30570-1-olivier.dion@polymtl.ca \
--to=olivier.dion@polymtl.ca \
--cc=gwl-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).