[Chicken-users] Parallel map

2019-03-31 Thread Francesco Montanari

Hi,

I'm trying to implement a simple parallel map.

(I'm aware about the MPI egg, it actually works fine for me, but I'd
like to have something more lightweight. I managed to write a
parallel map with the hardwood egg, but since it uses green threads it
is not convenient for my use cases. I had a look to past discussions
[1, 2] where POSIX threads were recommended, but I am not familiar
with them and I didn't manage to get the code snippets working.)

[1] 
https://lists.nongnu.org/archive/html/chicken-users/2010-12/msg00213.html
[2] 
https://lists.nongnu.org/archive/html/chicken-users/2016-12/msg00017.html


So, I tried to use openmp. I list a code example at the bottom of the
email. Compilation `csc -L -fopenmp test.scm` is ok and openmp seems
linked correctly, I can call functions defined in :

(omp_get_max_threads) ; 8

But _OPENMP is not enabled:

(is_omp_enabled) ; #f

The openmp pragma directives do not complain during compilation, but
only 1 thread is used in the parallel loop:

(import srfi-1)
(let* ((input (list->f64vector (iota 10)))
   (size (f64vector-length input))
   (output (make-f64vector size)))
  (squaremap size input output)
  output)   ; prints nthreads: 1

Do CHICKEN green threads also limit the number of threads from code
called through the C FFI? If not, do you have suggestions about how to
proceed to enable openmp to use several threads?

(I checked that if I ran the C code directly with GCC then _OPENMP is
defined and several threads are used.)

Best,
Francesco



(import (chicken foreign) srfi-4)

#>
#include 
#include 

bool is_omp_enabled()
{
  bool omp = false;
#ifdef _OPENMP
  omp = true;
#endif
  return omp;
}

void squaremap(int n, double *a, double *b)
{
  int i;
#pragma omp parallel for
  for (i=0; ihttps://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Gnuplot pipe

2019-02-08 Thread Francesco Montanari

Hi Mario,

On 2/6/19 7:46 PM, Mario Domenech Goulart wrote:


Thanks a lot.  Your egg has been added to the coop.


Thanks!


I also added tests. However, if they fail because gnuplot is not
installed maybe I should just rename tests/run.scm?


I'd say it's ok to assume that gnuplot is installed, as it is a basic
requirement for the egg to work at all, right?


Yes that's right. I was thinking to automatic tests on CHICKEN 
infrastructure, but I see that it finds gnuplot.


Best,
Francesco

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Gnuplot pipe

2019-02-04 Thread Francesco Montanari

Hi,

On 1/21/19 7:08 AM, Mario Domenech Goulart wrote:

If you have a chance, please consider porting it to CHICKEN 5 too.


I ported the egg to CHICKEN 5 and added a new release file:

https://gitlab.com/montanari/gnuplot-pipe/raw/master/gnuplot-pipe.c5.release-info

I also added tests. However, if they fail because gnuplot is not 
installed maybe I should just rename tests/run.scm?


Best,
Francesco

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Gnuplot pipe

2019-01-21 Thread Francesco Montanari

Hi Andy,

On 1/20/19 10:23 PM, Andy Bennett wrote:

This is great!
I installed it and worked through the examples in the README. I've been 
thinking for a while about how I might easily draw charts with CHICKEN 
and this seems to be it.


Great! It would be nice to have a more complete plotting interface 
rather than passing strings to the Gnuplot pipe with gp:send that 
already requires acquaintance with Gnuplot. But at least it seems to be 
decently flexible.
When working through the examples, I got this error after trying 
`(gp:send "set terminal wxt nopersist")`. I have Debian Jessie's (8.11) 
gnuplot (4.6.6-2+deb8u1).


-
gnuplot> set terminal wxt nopersist
  ^
     line 0: unknown or ambiguous terminal type; type just 'set 
terminal' for a list

-


Thanks! I'll change wxt to x11 that presumably should work with more 
people, and clarify that the idea is to use any of the interactive 
screen displays like qt, wxt, x11.


Best,
Francesco

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Gnuplot pipe

2019-01-21 Thread Francesco Montanari

Hi Mario,

On 1/21/19 7:08 AM, Mario Domenech Goulart wrote:

Thanks a lot.  Your egg has been added to the coop.


Thanks!


If you have a chance, please consider porting it to CHICKEN 5 too.


Yes, I'll add wiki documentation and also port it to CHICKEN 5 asap.

Best,
Francesco

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Gnuplot pipe

2019-01-18 Thread Francesco Montanari

Hi,

I put together a simple interface to Gnuplot, basically popen() with a 
couple of procedures to plot lists. The motivation is mainly to draw 
exploratory plots from the interpreter. If you think this may be useful 
as an egg I'm happy to add wiki documentation. Comments welcome.


https://gitlab.com/montanari/gnuplot-pipe

(Note that for those who have octave installed, the octave egg already 
provides a gnuplot interface.)


Best,
Francesco

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users