Sage forker

67 weergaven
Naar het eerste ongelezen bericht

Jeroen Demeyer

ongelezen,
15 jan 2011, 01:43:4715-01-2011
aan sage-devel
This afternoon, William gave me a really cool idea of starting up Sage
using fork(). Essentially you have one mothersage which forks off
copies of Sage. Like this, you can get an instant Sage prompt because
Sage is already started. I actually implemented this and it seems to
work (at least under Linux, I haven't tested other systems).

I'm not sure how robust it is, but if you want to play with it, you can
find the code at http://sage.math.washington.edu/home/jdemeyer/forker/


First of all, you need to compile
$ gcc fsage.c -o fsage


Then, start up the mothersage:
$ sage
----------------------------------------------------------------------
| Sage Version 4.6.1, Release Date: 2011-01-11 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: load "sage-forker.pyx"
Compiling ./sage-forker.pyx...
sage: sage_forker()


Now open a new terminal and watch the Sage prompt appear without delay:
$ ./fsage
----------------------------------------------------------------------
| Sage Version 4.6.1, Release Date: 2011-01-11 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage:


Have fun with it and who knows if this might actually be useful.

Jeroen.

Volker Braun

ongelezen,
15 jan 2011, 13:19:2415-01-2011
aan sage-...@googlegroups.com
Maybe combine it with a zeromq-based main loop for the worker Sage process. Then the notebook worker and the command line Sage would use the same codebase...

Of course this is just psychological and won't speed up any actual computation ;-)


Robert Bradshaw

ongelezen,
15 jan 2011, 15:20:0015-01-2011
aan sage-...@googlegroups.com

This is exactly what I was thinking about doing for the notebook
worker processes too. It would be a huge boon for testing as well.

- Robert

Ivan Andrus

ongelezen,
15 jan 2011, 17:16:1415-01-2011
aan sage-...@googlegroups.com
> This afternoon, William gave me a really cool idea of starting up Sage
> using fork(). Essentially you have one mothersage which forks off
> copies of Sage. Like this, you can get an instant Sage prompt because
> Sage is already started. I actually implemented this and it seems to
> work (at least under Linux, I haven't tested other systems).

FWIW it seems to work fine on OS X 10.6.

> I'm not sure how robust it is, but if you want to play with it, you can
> find the code at http://sage.math.washington.edu/home/jdemeyer/forker/
>
>
> First of all, you need to compile
> $ gcc fsage.c -o fsage
>
>
> Then, start up the mothersage:
> $ sage
> ----------------------------------------------------------------------
> | Sage Version 4.6.1, Release Date: 2011-01-11 |
> | Type notebook() for the GUI, and license() for information. |
> ----------------------------------------------------------------------
> sage: load "sage-forker.pyx"
> Compiling ./sage-forker.pyx...
> sage: sage_forker()
>
>
> Now open a new terminal and watch the Sage prompt appear without delay:
> $ ./fsage
> ----------------------------------------------------------------------
> | Sage Version 4.6.1, Release Date: 2011-01-11 |
> | Type notebook() for the GUI, and license() for information. |
> ----------------------------------------------------------------------
> sage:

Sort of a tty server instead of a notebook server.

> Have fun with it and who knows if this might actually be useful.
>
> Jeroen.

I'm not sure I completely understand the code, but it looks like this can't be used to speed up `sage -c`, is that right?

-Ivan

Allen beantwoorden
Auteur beantwoorden
Doorsturen
0 nieuwe berichten