[firedrake] PyOP2 code generation and C interface

Eike Mueller e.mueller at bath.ac.uk
Tue Jan 13 18:45:25 GMT 2015


Hi David,

thanks, yes, that's what I was looking for, I will have a look at the code. I'm asking because our new PhD student, who will work on code generation for Molecular Dynamics, started this week. So I wanted to get some ideas as to what you are doing.

Thanks,

Eike

--

Dr Eike Hermann Mueller
Research Associate (PostDoc)

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

+44 1225 38 5633
e.mueller at bath.ac.uk
http://people.bath.ac.uk/em459/

> On 13 Jan 2015, at 10:21, David Ham <David.Ham at imperial.ac.uk> wrote:
> 
> 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 at 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
>> 
>> +44 1225 38 5633
>> e.mueller at bath.ac.uk
>> http://people.bath.ac.uk/em459/
> 
> 
> 
> -- 
> Dr David Ham
> Departments of Mathematics and Computing
> Imperial College London
> 
> http://www.imperial.ac.uk/people/david.ham
> _______________________________________________
> firedrake mailing list
> firedrake at imperial.ac.uk
> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the firedrake mailing list