OP2/PyOP2 — pull request #173 by kynan (2013-05-22 15:52:18+00:00)
Title: Cache kernels

When a new `Kernel` is constructed we call the C preprocessor on the code i.e. we spawn a subprocess. To avoid doing the expensive operation again unnecessarily we cache kernel objects with an md5 hash of the code and the function name as the key.

To avoid code duplication, a common base class for cached objects is introduced, which expects derived classes to override the class method `_cache_key` and optionally `_process_args` if arguments should be sanitized before calling `__init__`. This base class is used for `Sparsity` and `Kernel`. To cache the generated stubs for `ParLoop` objects, the code generation and JIT compilation for all backends is factored out to a new class `JITModule`, which is cached.