Use ctypes to load jit compiled classes
I suggest introducing this stepwise in a function next to the existing jit, allowing testing on different systems for a while until we trust it.
The dijitso project is a prototype of how to use ctypes to jit and load modules, but I suggest adding this functionality into ffc (perhaps as a submodule). There are a number of issues on the dijitso tracker, most of them small, some of them have been solved in instant, some of them may turn out to be irrelevant: https://bitbucket.org/fenics-project/dijitso/issues?status=new&status=open
One suggestion for an initial ffc.jit using ctypes is to just handle the jitting of elements, dealing with forms when elements are in place.
Comments (8)
-
reporter -
reporter Depends on https://bitbucket.org/fenics-project/ffc/issues/89/generate-factory-functions-to-construct to be completed first.
-
reporter When ctypes is used instead of swig, the ufc interface will not be wrapped and available in python. This is only used very few places, but some adaption of ufc interface might turn up as necessary to do. In particular,
dolfin.Form
usesufc::form::enabled_coefficients()
(name from memory) which returns aconst std::vector<int> &
. New functionsint num_enabled_coefficients()
andint enabled_coefficient(int i)
can replace that and easily be wrapped using ctypes. -
reporter -
reporter We can soon address this issue as the dependencies are in next. I suggest adding a new jit implementation next to the old one and keep the old one until the new is working and trusted. We can use an environment variable to pick the new implementation, allowing non intrusive running of all dolfin tests.
-
- removed milestone
Removing milestone: 1.7 (automated comment)
-
Can this be closed? @martinal
-
- changed status to resolved
- Log in to comment
When the issue on generating elements and forms separately is implemented, see
https://bitbucket.org/fenics-project/ffc/issues/90/split-generation-of-elements-and-forms
class dependencies will need to be handled compile time (include dirs) and link time (libname, rpath). Using the element classname constructed from a signature, .cpp files will #include .h files from other jit modules, and .so files must be linked to other relevant .so files (using rpath to avoid libdir issues).