Hi Eike,

Two important questions there. I think the argument for using ctypes rather than swig is that ctypes is automatic and robust. Swig seems to involve more manual intervention and complexity.

The code generation happens in two places. The user kernel is either already a C string or (more usually) is a Coffee AST. The Coffee AST has the built-in ability to generate the C code for that part. However I suspect you are more interested in where the code generation for the wrapper code happens. This happens in host.JITModule.compile . It uses a wrapper template from sequential.JITModule (sequential.JITModule is a subclass of host.JITModule).

Is that what you were after?

Cheers,

David

On 12 January 2015 at 22:46, Eike Mueller <e.mueller@bath.ac.uk> wrote:
Dear firedrakers,

am I right in saying that PyOP2 (and firedrake) uses ctypes to access the methods in the compiled C-libraries? Why did you use ctypes (and not swig, for example)? I.e. you generate c source files, compile them into .so libraries and then call that code through ctypes? Which files should I look at to understand how this works for a simple example (say a parloop)? compilation.py seems to load a .so library, but where is all the code generation?

Thanks,

Eike

--

Dr Eike Hermann Mueller
Research Associate (PostDoc)

Department of Mathematical Sciences
University of Bath
Bath BA2 7AY, United Kingdom




--
Dr David Ham
Departments of Mathematics and Computing
Imperial College London

http://www.imperial.ac.uk/people/david.ham