> 
> People,
> 
> I am trying to interface a C program  fifoToA.c  to  Axiom (friCAS)
> by  named pipes  in Linux (Unix).
> These pipes are created by the system commands   > mkfifo toA
>                                                  > mkfifo fromA
> 
> fifoToA  builds  n  strings  "ABC0", "ABC1", "ABC2", ...  in a loop,
>          outputs each string to the pipe          toA,
>          inputs the respond string from the pipe  fromA.
> 
> fifoFromA.input  is interpreted by Fricas.
>                  It inputs a string  iStr  from  toA,  
>                  converts each character in iStr to the lower case,
>                  outputs the result string to  fromA.
> 
> 1. C <-> C
> ----------
> First, I replace  fifoFromA.input  with the C program  fifoFromA.c.
> 
> fifoToA      opens  toA    once and only for writing,
>              opens  fromA  once and only for reading.
> fifoFromA.c  opens  toA    once and only for reading,
>              opens  fromA  once and only for writing.
> 
> A particular point is that in both C programs the function `open' 
> (`close') is envoced only once. And the C programs use  read/write  
> (somewhat of a lower level) instead of  fgets/fputs
> (I do not know why  fgets-fputs-fflush  did not work as needed).  
> 
> The source is presented below.
> 
> Compilation:  gcc -O2 -o fifoToA fifoToA.c 
>               gcc -O2 -o fifoToA fifoToA.c 
> 
> First, run       > ./fifoFromA
> on terminal-2,   
> then, run        > ./fifoToA
> on terminal-1.   
> 
> This C <-> C exchange performance (with no intermediate printing in 
> the loop) at  133000 strings/sec  on a 2 GHz machine
> (say, put  n = 400000 in `main').
> It is slow (I need to find out, why).

It is about 10 times slower than my first guess, but within
reasonable margin.  Google for 'pipe based context switching'
to learn about expected results.

> But so far, it looks admissible to start with and to experiment 
> further with parsing a string and applying algebra at the Axiom end.
> 
> 2. C <-> Axiom
> --------------
> Only I failed to replace  ./fifoToA.c  with a correct code in
>                                                       fifoFromA.input
> 
> (first, run on terminal-2   fricas    and   )r fifoFromA.input
> Then, command                               > ./fifoToA
> on  terminal-1
> ).
> Can you, please, fix the below code in  fifoFromA.input  ?
> 

The fifoFromA.input that I posted works for me when using 
trunk build using debian CLISP 2.48, after about 24 min it did 332000
iterations.  Btw: I use C code with fix from the other message.

As I wrote, older sbcl (and this seem to include SBCL 1.0.40.0.debian)
has bug so the code will not work.

-- 
                              Waldek Hebisch
[email protected] 

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to