Translating safely (without executing)

Hello all, Is it possible to use PyPy's translation tool without having it execute the program? I think this would be important for programs with infinite loops, or ones which could do potentially dangerous things ie. when trying to translate a program to control a GPU fan, the fan was commanded off during a high work load. Thank you, Kirk

Hi Kirk, could you please provide more context? the translator does not execute the actual rpython program as code, just the surrounding imports (using python to metaprogramm the rpython) so its likely that the cpu fan off thing is a missunderstanding best, Ronny On 01/28/2013 11:37 PM, Kirk Liberty wrote:

ronny, Well the fan control command turned out not to be in rpython, so it failed to translate, but it still stopped the fan first. Here's an example of a program that would not translate because it just enters an infinite loop. from time import sleep def main(argv): while True: print "looping" sleep(1) return 0 def target(driver,args): return main,None main(1) command to translate > python ~/pypy/translator/goal/translate.py --batch --output loop loop.py Regards, Kirk On Mon, Jan 28, 2013 at 6:35 PM, Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> wrote:

Maciej, I could say I'm being stingy about CPU cycles since the program will be running continuously, but mostly "just because I can", or in this case can't. I think translation is pretty cool, and I've been trying to see what different things I can apply it to. What do you mean by "Python is a meta-programming language for RPython"? Regards, Kirk On Tue, Jan 29, 2013 at 2:49 AM, Maciej Fijalkowski <fijall@gmail.com> wrote:

On Tue, Jan 29, 2013 at 11:07 AM, Kirk Liberty <kirk.liberty@gmail.com> wrote:
I would seriously suggest pypy JIT here. It can sometimes even produce better results.
What do you mean by "Python is a meta-programming language for RPython"?
you can run some python before compiling RPython. we use all the tricks to say exec a bunch of methods.

2013/1/29 Kirk Liberty <kirk.liberty@gmail.com>
Please read: https://pypy.readthedocs.org/en/latest/you-want-to-help.html?highlight=meta#... -- Amaury Forgeot d'Arc

Hi Kirk, On Mon, Jan 28, 2013 at 11:37 PM, Kirk Liberty <kirk.liberty@gmail.com> wrote:
Is it possible to use PyPy's translation tool without having it execute the program?
As you got it, the answer to that is no. I updated https://pypy.readthedocs.org/en/latest/faq.html#do-i-have-to-rewrite-my-prog... . A bientôt, Armin.

Hi Kirk, could you please provide more context? the translator does not execute the actual rpython program as code, just the surrounding imports (using python to metaprogramm the rpython) so its likely that the cpu fan off thing is a missunderstanding best, Ronny On 01/28/2013 11:37 PM, Kirk Liberty wrote:

ronny, Well the fan control command turned out not to be in rpython, so it failed to translate, but it still stopped the fan first. Here's an example of a program that would not translate because it just enters an infinite loop. from time import sleep def main(argv): while True: print "looping" sleep(1) return 0 def target(driver,args): return main,None main(1) command to translate > python ~/pypy/translator/goal/translate.py --batch --output loop loop.py Regards, Kirk On Mon, Jan 28, 2013 at 6:35 PM, Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> wrote:

Maciej, I could say I'm being stingy about CPU cycles since the program will be running continuously, but mostly "just because I can", or in this case can't. I think translation is pretty cool, and I've been trying to see what different things I can apply it to. What do you mean by "Python is a meta-programming language for RPython"? Regards, Kirk On Tue, Jan 29, 2013 at 2:49 AM, Maciej Fijalkowski <fijall@gmail.com> wrote:

On Tue, Jan 29, 2013 at 11:07 AM, Kirk Liberty <kirk.liberty@gmail.com> wrote:
I would seriously suggest pypy JIT here. It can sometimes even produce better results.
What do you mean by "Python is a meta-programming language for RPython"?
you can run some python before compiling RPython. we use all the tricks to say exec a bunch of methods.

2013/1/29 Kirk Liberty <kirk.liberty@gmail.com>
Please read: https://pypy.readthedocs.org/en/latest/you-want-to-help.html?highlight=meta#... -- Amaury Forgeot d'Arc

Hi Kirk, On Mon, Jan 28, 2013 at 11:37 PM, Kirk Liberty <kirk.liberty@gmail.com> wrote:
Is it possible to use PyPy's translation tool without having it execute the program?
As you got it, the answer to that is no. I updated https://pypy.readthedocs.org/en/latest/faq.html#do-i-have-to-rewrite-my-prog... . A bientôt, Armin.
participants (5)
-
Amaury Forgeot d'Arc
-
Armin Rigo
-
Kirk Liberty
-
Maciej Fijalkowski
-
Ronny Pfannschmidt