opening a unix pipe via external FFI call

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

opening a unix pipe via external FFI call

douglas mcpherson
 
Hi,

Short: 
Does anyone know offhand of pitfalls trying to make system calls through pipes via FFI from Squeak on Linux (Ubuntu 14.04 on ARM if it makes a difference)?

Long:
I’ve been having fun playing with the Parallella board [1]. The Parallella board has a Xilinx dual-core ARMv7 with a small FPGA, and an Epiphany coprocessor which has 16 RISC cores.

I managed to get a CogStackVM running on (one of the) ARM cores. Based on Tim’s CogStackVM for the RPi (ARMv6), I made some hacks to get it working on the BeagleBoneBlack (ARMv7). This ARMv7 version was compiled on a Chromebook by Ken Dickey where it magically worked, and now by me on the Parallella where it also “just works”. 

So I wanted to see if I could fire up any of the Epiphany cores. I loaded Squeak OpenCL FFI bindings [2] (very cool) and have been able to do some very simple things such as query the Epiphany capabilities, and create Epiphany buffers and write/read them. So far so good.

If you want to induce any of the Epiphany’s cores to do some actual work, you have to provide some code (kernel in OpenCL-speak). These can be compiled and loaded on the fly by an OpenCL library API. This is where I am stuck.

The OpenCL library for the Parallella is open source so I can see exactly where things go wrong. When the kernel compile API is called, it performs its work by making a bunch of system calls via popen(<cmd>, “r”). None of these works; both Squeak and the command are deadlocked once the first popen() call is made. I rebuilt the OpenCL library from sources with debug enabled, as well as added some additional debug prints. 

In order to communicate with the Epiphany, processes need to be run as root, thus I am running Squeak as root for these tests. And since Squeak is running as root I don’t suspect permission problems getting access to commands and files.

The OpenCL library for Parallella compiles kernels successfully for test programs written in C, so /it/ should be ok. And the Squeak OpenCL bindings seem to work fine (insofar as I have played with them; that alone is a lot of fun :)) on a Mac with GPU.

I know the question is vague, and I’m sure I haven’t provided nearly enough info, but thought I would throw it out there :) 

Thanks!
Doug

[1] http://www.parallella.org
[2] https://sites.google.com/site/schwaj/home/opencl-binding-for-squeak
Reply | Threaded
Open this post in threaded view
|

Re: opening a unix pipe via external FFI call

douglas mcpherson
 
The problem was the linux interval timer interfering with system calls. After re-building the VM with the threaded heartbeat everything works, (or works so far)!  

I managed to get all 16 RISC cores to participate in a very simple parallel task, each filling in their portion of a 256 element buffer. Useless, but cool :)

On Sep 11, 2014, at 18:06 , Douglas McPherson wrote:

Hi,

Short: 
Does anyone know offhand of pitfalls trying to make system calls through pipes via FFI from Squeak on Linux (Ubuntu 14.04 on ARM if it makes a difference)?

Long:
I’ve been having fun playing with the Parallella board [1]. The Parallella board has a Xilinx dual-core ARMv7 with a small FPGA, and an Epiphany coprocessor which has 16 RISC cores.

I managed to get a CogStackVM running on (one of the) ARM cores. Based on Tim’s CogStackVM for the RPi (ARMv6), I made some hacks to get it working on the BeagleBoneBlack (ARMv7). This ARMv7 version was compiled on a Chromebook by Ken Dickey where it magically worked, and now by me on the Parallella where it also “just works”. 

So I wanted to see if I could fire up any of the Epiphany cores. I loaded Squeak OpenCL FFI bindings [2] (very cool) and have been able to do some very simple things such as query the Epiphany capabilities, and create Epiphany buffers and write/read them. So far so good.

If you want to induce any of the Epiphany’s cores to do some actual work, you have to provide some code (kernel in OpenCL-speak). These can be compiled and loaded on the fly by an OpenCL library API. This is where I am stuck.

The OpenCL library for the Parallella is open source so I can see exactly where things go wrong. When the kernel compile API is called, it performs its work by making a bunch of system calls via popen(<cmd>, “r”). None of these works; both Squeak and the command are deadlocked once the first popen() call is made. I rebuilt the OpenCL library from sources with debug enabled, as well as added some additional debug prints. 

In order to communicate with the Epiphany, processes need to be run as root, thus I am running Squeak as root for these tests. And since Squeak is running as root I don’t suspect permission problems getting access to commands and files.

The OpenCL library for Parallella compiles kernels successfully for test programs written in C, so /it/ should be ok. And the Squeak OpenCL bindings seem to work fine (insofar as I have played with them; that alone is a lot of fun :)) on a Mac with GPU.

I know the question is vague, and I’m sure I haven’t provided nearly enough info, but thought I would throw it out there :) 

Thanks!
Doug

[1] http://www.parallella.org
[2] https://sites.google.com/site/schwaj/home/opencl-binding-for-squeak

tty
Reply | Threaded
Open this post in threaded view
|

Re: Re: [Vm-dev] opening a unix pipe via external FFI call

tty
 
That is cool.