← Back to team overview

instant team mailing list archive

Problems with caching of code

 

We still have problems in FFC when using the new feature for caching
generated code in Instant.

If I run the standard Poisson demo in DOLFIN (src/demo/pde/poisson/python)
then the first time Instant generates code and compiles it. Then if I
run again, the code gets reused as expected.

Now, if I remove the code generated in the working directory (the
files in the sub directory ffc_form_0_module), then I get the
following message:

File "/usr/lib/python2.5/site-packages/ffc/jit/jit.py", line 60, in jit
    instant.create_extension(wrap_headers=[filename],
    module=module_name, additional_declarations=ufc_include,
    include_dirs=path)
  File "/usr/lib/python2.5/site-packages/instant.py", line 624, in
  create_extension
    ext.create_extension(**args)
  File "/usr/lib/python2.5/site-packages/instant.py", line 262, in
  create_extension
    shutil.copytree(self.module, os.path.join(instant_dir, md5sum,
    self.module))
  File "/usr/lib/python2.5/shutil.py", line 110, in copytree
    os.makedirs(dst)
  File "/usr/lib/python2.5/os.py", line 172, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists:
'/home/logg/.instant/D99FA4DF3FED2EF28E77D07673A9A358/ffc_form_0_module'

Any ideas what goes wrong?

FFC calls Instant as follows:

  import instant
  instant.COPY = 1

  (path, dummy, dummy, dummy) = instant.header_and_libs_from_pkgconfig("ufc-1")

  if len(path) == 0:
    path = [("/").join(sysconfig.get_python_inc().split("/")[:-2]) + "/include"]
    ufc_include = '%%include "%s/ufc.h"' % path[0]

  module_name = prefix + "_module"
  instant.create_extension(wrap_headers=[filename], module=module_name, additional_declarations=ufc_include, include_dirs=path)

-- 
Anders


Follow ups