Subject: [Instant-dev] Problems with caching of code

From: Anders Logg <[email-masked]>
Date: Mon, 10 Dec 2007 21:35:26 +0100

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

---

From: Kent-Andre Mardal <[email-masked]>
Date: Tue, 11 Dec 2007 15:29:25 +0100

Strange, I will try to run your example, but currently I don't manage to
compile dolfin. I do ./configure --disable-mpi but still mpicxx is
used. 

> files in the sub directory ffc_form_0_module), then I get the

OK, you don't want anything in your working directory. I didn't get
that. 

Kent

---

From: Kent-Andre Mardal <[email-masked]>
Date: Tue, 11 Dec 2007 16:45:31 +0100

I get: 

 mpicxx -DPACKAGE_NAME=\"DOLFIN\" -DPACKAGE_TARNAME=\"dolfin\"
-DPACKAGE_VERSION=\"0.7.1\" "-DPACKAGE_STRING=\"DOLFIN 0.7.1\""
-DPACKAGE_BUGREPORT=\"http://www.fenics.org/bugzilla/\" -DSTDC_HEADERS=1
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1
-DHAVE_BOOST= -I. -I/usr/include/python2.5 -I../../src/kernel/common
-I../../src/kernel/elements -I../../src/kernel/fem
-I../../src/kernel/function -I../../src/kernel/graph
-I../../src/kernel/io -I../../src/kernel/la -I../../src/kernel/main
-I../../src/kernel/math -I../../src/kernel/mesh -I../../src/kernel/mf
-I../../src/kernel/nls -I../../src/kernel/ode -I../../src/kernel/pde
-I../../src/kernel/quadrature -I../../src/kernel/parameter
-I../../src/kernel/log -I../../src/kernel/plot -I/usr/include
-I/usr/include/libxml2 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/local/include -I../../src/pydolfin
-I/usr/include/python2.5
-I/usr/lib/python2.5/site-packages/numpy/core/include -DNDEBUG -g -O2
-fno-strict-aliasing -Wall -Werror -ansi -Wno-uninitialized -MT
_dolfin_la-dolfin_wrap.lo -MD -MP -MF .deps/_dolfin_la-dolfin_wrap.Tpo
-c dolfin_wrap.cpp  -fPIC -DPIC -o .libs/_dolfin_la-dolfin_wrap.o
dolfin_wrap.cpp: In function 'PyObject* _wrap_new_Assembler(PyObject*,
PyObject*)':
dolfin_wrap.cpp:64884: error: no matching function for call to
'dolfin::Assembler::Assembler()'
../../src/kernel/fem/dolfin/Assembler.h:37: note: candidates are:
dolfin::Assembler::Assembler(dolfin::Mesh&)
../../src/kernel/fem/dolfin/Assembler.h:33: note:
dolfin::Assembler::Assembler(const dolfin::Assembler&)
dolfin_wrap.cpp: In function 'PyObject*
_wrap_Assembler_assemble__SWIG_0(PyObject*, PyObject*)':
dolfin_wrap.cpp:65010: error: no matching function for call to
'dolfin::Assembler::assemble(dolfin::GenericTensor&, const
dolfin::Form&, dolfin::Mesh&, bool&)'
../../src/kernel/fem/dolfin/Assembler.h:43: note: candidates are: void
dolfin::Assembler::assemble(dolfin::GenericTensor&, const dolfin::Form&,
bool)
../../src/kernel/fem/dolfin/Assembler.h:47: note:                 void
dolfin::Assembler::assemble(dolfin::GenericTensor&, const dolfin::Form&,
const dolfin::SubDomain&, bool)
../../src/kernel/fem/dolfin/Assembler.h:53: note:                 void
dolfin::Assembler::assemble(dolfin::GenericTensor&, const dolfin::Form&,
const dolfin 

.....

tir, 11.12.2007 kl. 13.40 +0000, skrev Garth N. Wells:
> Kent-Andre Mardal wrote:
> It should still compile ok. --disable-mpi sets a flag such that 
> mpi-related code inside DOLFIN is not compiled.
> 
> Garth
> 
> 
> > 
> > _______________________________________________
> > DOLFIN-dev mailing list
> > [email-masked]
> > http://www.fenics.org/mailman/listinfo/dolfin-dev
>

---

From: Kent-Andre Mardal <[email-masked]>
Date: Tue, 11 Dec 2007 16:57:38 +0100

tir, 11.12.2007 kl. 14.45 +0000, skrev Garth N. Wells:
> Did you do
>    touch src/pydolfin/dolfin.i
> 
> to force re-generation of the Python interface?
> 
> Garth
> 
> 

yes

---

From: Kent-Andre Mardal <[email-masked]>
Date: Tue, 11 Dec 2007 19:47:22 +0100

Ok, by removing  Werror dolfin compiles (using mpicxx) but when I run: 

~/tmp >python demo.py 
Debug: Initializing MPI [at MPIManager.cpp:41 in init()]
Segmentation fault