dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #14859
Re: [HG DOLFIN] merge
On Tuesday 18 August 2009 22:23:50 Anders Logg wrote:
> On Tue, Aug 18, 2009 at 10:01:49PM +0200, DOLFIN wrote:
> > changeset: 6793:4ec31c652fb02c15906df9b243ac8a95ab17993d
> > parent: 6779:ef3291872c9d92c7937b1808b392cfb00006a0e2
> > user: Anders Logg <logg@xxxxxxxxx>
> > date: Tue Aug 18 21:58:16 2009 +0200
> > files: site-packages/dolfin/jit.py
> > description:
> > Wrap JIT compilation and use barrier to compile first on process 0,
> > then use results from cache on other processes. Only implemented for
> > forms, not other objects.
>
> This changes the way JIT compilation is handled in parallel (after a
> discussion with Hake earlier today).
>
> We now let the first process compile first while the others wait. Then
> the other processes call the JIT compiler and may then reuse the
> compiled form from cache since it's already been compiled by the first
> process. Much better than what we had before.
>
> I've only implemented it for JIT compilation of forms, not other
> objects (like Functions). Johan, could you take a look at this?
>
> I imagine we could put the code from jit.jit into some utility
> function, something like which could be reused in both places:
>
> def jit_wrap(jit, *args):
>
> # Just call foo when running in serial
> if MPI.num_processes() == 1:
> return jit(*args):
>
> # Compile first on process 0
> if MPI.process_number() == 0:
> info("Calling JIT compiler on first process.")
> output = jit(*args)
> MPI.barrier()
>
> # Then compile on all other processes (which may then just read the
> cache) if not MPI.process_number() == 0:
> info("JIT compilation done on first process, reusing from cache.")
> output = jit(*args)
>
> return output
I can look into this.
It should be straightforward, now when I have gathered all jit compilation in
PyDOLFIN in one module. I think I need to add a **kwargs to the function
though. Could you add a dummy **kwargs in ffc.jit, to make it possible? Maybe
together with a check with some appropriate error message if some one is by
accident using it?
Johan
References