Page 1 of 1

Python?

PostPosted: Fri Dec 21, 2012 5:07 pm
by markd
Is anyone working on or interested in Python on the Epiphany cores?
I don't know if the interpreter will fit in < 32K, but it would be interesting to try.

The Python interpreter will add overhead, and probably consume a fair amount of each core's memory, so it would be more limited compared to straight C or OpenCL. But it would make an easier path for programming the hardware.

Mark

Re: Python?

PostPosted: Fri Dec 21, 2012 5:34 pm
by Gedece
I'm interested, but as you pointed, it could be not very usefull.

Re: Python?

PostPosted: Fri Dec 21, 2012 6:17 pm
by fredd
I think it would be interesting to run python on the host side, and then use a cython/pyopencl style library to include Epiphany c code "kernels" in a python script, and map shared sdram as numpy arrays. In that way the entire process of compiling epiphany code, sending input data, running Code and retrieving and presenting results could be described in a single file.

I'm definitely interested in writing/contributing to that python library!

Re: Python?

PostPosted: Tue Jan 01, 2013 6:04 am
by markd
For a small python interpreter, Python-on-a-chip (p14p) ( http://code.google.com/p/python-on-a-chip/ ) looks interesting.

First step is to get it compiled for Epiphany and running on the emulator.

Re: Python?

PostPosted: Tue Jan 01, 2013 3:28 pm
by piotr5
55k seems a bit too much for the 32kb cached memory, guess we need to find a workaround for the memory-limitation. for example compile in such a way that some parts are re-located at runtime? somehow the usualy cache-mechanism needs to get emulated here. but also the "8KB is the minimum recommended RAM." sounds a bit too much here, when we have only 32 for program and data and stack and whatnot...

Re: Python?

PostPosted: Sun Jan 06, 2013 5:32 am
by ed2k
interesting, saw a clone on google code. Any progress to share?

Re: Python?

PostPosted: Mon Jan 07, 2013 5:45 am
by markd
Yes, there is some progress. I pushed some code to a clone of python-on-a-chip:
http://code.google.com/r/markdewing-epi ... e/checkout

It is enough to compile for Epiphany and run the PyMite interpreter on the simulator.

Steps to run:
1. Download/checkout the code
2. Be sure to be running Python 2.6. (Build system will not work if running 2.7) You might need to compile and install it, preferably somewhere out of the way so it doesn't interfere with the system python, and then put that place on your path.
3. Make sure the E-SDK is on your path
4. Build with 'make PLATFORM=epiphany all'
5. Run an interactive session with 'make PLATFORM=epiphany ipm'

The version built by default uses more than 32K. It is possible to make a version that uses less than 32K, but it requires removing nearly all the features defined in src/platform/epiphany/pmfeatures.py (including, unfortunately, floating point support). For the sake of getting something working, I may target 64k for interpreter+code+data (leave one core out of two idle).

Tentative next steps are to work on the programming model.
- First, I'll try implementing a very minimal subset of numpy arrays (nano numpy?)
- if that works, I'll try extending those arrays to coarrays. Coarrays seem like a natural fit for the Epiphany memory model.

Ultimately, it would be nice to compile the python kernels to object code - this would remove the space and performance overhead of the interpreter on each core. Given that the cores will probably be running a very restricted subset of Python, this should be relatively easy. Particularly with LLVM - assuming someone is making an LLVM backend?

Re: Python?

PostPosted: Tue Jan 08, 2013 4:58 am
by ed2k
nice, after struggling with the python2.6 installation on my ubuntu, pymite running on epiphany simulator now. will try to see how to strip the interpreter. But I remember seeing on the wiki that it is already stripped out, since ipm is running on host, and could send compiled obj to pymite.

Re: Python?

PostPosted: Tue Jan 08, 2013 2:33 pm
by Gedece
shouldn't we start/move this sort of conversations into the Python forum?