From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Mattei Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.devel Subject: Re: map-par slower than map Date: Thu, 13 Oct 2022 16:21:02 +0200 Message-ID: References: <87bkqg7lmp.fsf@laura> <8735bs6lac.fsf@laura> <87zgdz6glm.fsf@laura> <87v8on6co6.fsf@laura> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2244"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user , guile-devel To: Olivier Dion Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Thu Oct 13 16:29:16 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oizD1-0000NW-SW for guile-user@m.gmane-mx.org; Thu, 13 Oct 2022 16:29:15 +0200 Original-Received: from localhost ([::1]:57126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oizD0-00007B-NT for guile-user@m.gmane-mx.org; Thu, 13 Oct 2022 10:29:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiz5J-0002Q2-Ss; Thu, 13 Oct 2022 10:21:17 -0400 Original-Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]:40493) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiz5H-0008Su-Pt; Thu, 13 Oct 2022 10:21:17 -0400 Original-Received: by mail-ej1-x634.google.com with SMTP id r17so4256286eja.7; Thu, 13 Oct 2022 07:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=/AhI3xJB/qp/um6KbD8SQBQAy7GKI7Wn43zLG+WsUU4=; b=YZjvw/MACigCQTGk2ReJK/7AY+H8XaCF1BsggBQvqxXq3OtBy/VLDo8QFy7CyqsSqf sovNcYa6K8SNS8UnmNQaqxmBz8Wnb9eMUbe9/7o8nIfZqby9TQGIE878/XixPpmWCawa gwaUXVBUuvH6yFQZqkDnp6f7EkFLEWpHu5Tg278SDcbLb6F7BsRtLP8WSaqP5yFwi9SC TuVzALRAmqAU8AY6VIzmUhhofh6Nx61JE6dxc0/JGlmpE+cQFA7QDAW1GSDTtuvV45SY gkHGOvdCWNGt05JuqNfGnFY00gDcnN8mtWEYFpIf1hJBJb7qzGDUtngWdBbYGPwTV6/c 1A6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/AhI3xJB/qp/um6KbD8SQBQAy7GKI7Wn43zLG+WsUU4=; b=15nI112f4X3VE242cBLH4ycxI6BuQmocgzfgHRZDJmHsZN7ImR2AjgeZ9QBZLb1cSQ Rcawlbn/ffFi15/4HgsLWVZS8Uo1MXJVCfUWv8qIxT1qMz/8+FNkWdNk9lS93mQOK7jo d7Ma5XQRHgANIkt6LrzG7QmaaD2zNR9MWFHrzdppk6bmLudXWYY4wW1Drbtvrqt2UdHk XjpELExS+pQ1a2tv49aGVmn6F1g6tPOHy6h4XdKQjMtuaTML0fd6wEHSBFra00TCH6Rh Ze2bKBb5SxSnGzHIvDP+eGa1swu6qGeKfmrmF9J4U6g9jc1znXkknEeCTcrWLY53yYul IgbQ== X-Gm-Message-State: ACrzQf3w9v905Ei8yr6c318wwjiRujcr4BXb1ZziPFTxozPq4iXsvKqe HjTQtI75E080WniwIzNQQY9G8aw2hUAdxV6qvYCfBkAAm7o= X-Google-Smtp-Source: AMsMyM7MkzbtZO5EC1hKb0jtGqlm5KvV3yUYZ6jTrhUYEQA5tdRId1XN5qQDlTvLqB9BbzRUvAT8aS47EBY7D/fX6Us= X-Received: by 2002:a17:907:2672:b0:734:a952:439a with SMTP id ci18-20020a170907267200b00734a952439amr25159585ejc.539.1665670873619; Thu, 13 Oct 2022 07:21:13 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=damien.mattei@gmail.com; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:18645 gmane.lisp.guile.devel:21433 Archived-At: ok i have the proof, this time (second time) the process stopped itself on your example ("processus stopp=C3=A9 " in french) : mattei@pc-mattei:~/Dropbox/git/library-FunctProg$ guile GNU Guile 3.0.1 Copyright (C) 1995-2020 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> (use-modules (srfi srfi-1) (ice-9 threads)) scheme@(guile-user)> (define* (par-map-vector proc input #:optional (max-thread (current-processor-count))) (if (< (vector-length input) max-thread) (list->vector (map proc (vector->list input))) ;; less data than threads or CPUs (let* ((block-size (quotient (vector-length input) max-thread)) (rest (remainder (vector-length input) max-thread)) (output (make-vector (vector-length input) #f))) (when (not (zero? block-size)) (let ((mtx (make-mutex)) (cnd (make-condition-variable)) (n 0)) (fold (lambda (scale output) (begin-thread (let lp ((i 0)) (when (< i block-size) (let ((i (+ i (* scale block-size)))) (vector-set! output i (proc (vector-ref input i)))) (lp (1+ i)))) (with-mutex mtx (set! n (1+ n)) (signal-condition-variable cnd))) output) output (iota max-thread)) (with-mutex mtx (while (not (< n max-thread)) (wait-condition-variable cnd mtx)))) ;; (let ((base (- (vector-length input) rest))) ;; (let lp ((i 0)) ;; (when (< i rest) ;; (let ((i (+ i base))) ;; (vector-set! output i (proc (vector-ref input i)))) ;; (lp (1+ i))))) output)))) scheme@(guile-user)> (define v (list->vector (iota 100000000) )) scheme@(guile-user)> (define r (par-map-vector sqrt v)) scheme@(guile-user)> (define v (list->vector (iota 100000000) )) scheme@(guile-user)> (define r (par-map-vector sqrt v)) Processus arr=C3=AAt=C3=A9 the first time is ok but the second time, Guile quit to the terminal. seems something makes the guile system instable after one run, i test it out of my program and out of my Scheme+ but my .guile is in this directory like that: ; Guile config file ;; history (use-modules (ice-9 readline) (ice-9 history) (srfi srfi-43) ;; vector ;; guile object oriented programming system (oop goops) (oop goops describe)) (activate-readline) ;;(disable-value-history!) ;; curly infix as in srfi-105 (read-enable 'curly-infix) ;; set current path in load path (set! %load-path (reverse (cons "." (reverse %load-path)))) ;; other solution is to put this in shell: ;; export GUILE_LOAD_PATH=3D"...:." On Thu, Oct 13, 2022 at 4:10 PM Damien Mattei wrote: > > > On Thu, Oct 13, 2022 at 4:06 PM Olivier Dion > wrote: > >> On Thu, 13 Oct 2022, Damien Mattei wrote: >> > i do not see what has changed in your code ? >> >> Just copy it. Trust me it has changed. >> > really ? :-) i read it 3 times line by line, yes the end is cut ,still no > ending ) and i use it and freeze,crash or ok randomly, the first times it > works but try 4 or 5 examples.... :-( > >> >> > really strange,even with bad code the moment it crash should be the >> same, >> > sometimes works,crash or freeze.... >> >> I don't get any of these problem .. running with (iota 100000000) I >> don't see any synchornization issue also. >> >> -- >> Olivier Dion >> oldiob.dev >> >