Skip to content

Migrate FFC interface to Firedrake - #305

Merged
kynan merged 18 commits into
masterfrom
remove-ffc-interface
Apr 7, 2014
Merged

kynan merged 18 commits into
masterfrom
remove-ffc-interface

Conversation

@kynan

@kynan kynan commented Jan 30, 2014

Copy link
Copy Markdown
Member

Needs to go in with firedrakeproject/firedrake#160.

@kynan

kynan commented Jan 31, 2014

Copy link
Copy Markdown
Member Author

Note that this currently fails since many demos and all of our regressions tests actually depend on the FFC interface. Options include:

  • Remove all regression tests
  • Hard code the FFC generated kernels in those demos

@kynan

kynan commented Jan 31, 2014

Copy link
Copy Markdown
Member Author

Losing all regression tests isn't great, therefore go with option 2 and hard code the generated kernels, but leave the door open to run with Firedrake and optionally update the generated kernels.

Note that this doesn't work for CUDA due to #308.

@wence-

wence- commented Feb 17, 2014

Copy link
Copy Markdown
Member

Did we get anywhere with this?

@kynan

kynan commented Feb 18, 2014

Copy link
Copy Markdown
Member Author

We still need to think about a solution for CUDA and OpenCL which ideally doesn't involved replicating canned regression test kernels for these backends. Otherwise I think this is fine.

I could already push everything up to 01e79c9 to master since it's not really part of this pull request. Any objection to that?

@kynan

kynan commented Mar 13, 2014

Copy link
Copy Markdown
Member Author

This has been ready for a while, any thoughts?

The canned regression test kernels now work for all backends since I'm pickling the AST instead of dumping generated sequential code. The downside is that the pickle files are binaries.

@wence-

wence- commented Mar 14, 2014

Copy link
Copy Markdown
Member

I buy this. This needs to go in at the same time as firedrakeproject/firedrake#194 though, right?

@wence-

wence- commented Mar 14, 2014

Copy link
Copy Markdown
Member

Needs update of pyop2-clean script (which now fails)

@kynan

kynan commented Mar 14, 2014

Copy link
Copy Markdown
Member Author

I've removed pyop2-clean since it has become obsolete. firedrakeproject/firedrake#194 depends on this, and they should be merged at the same time since Firedrake would break otherwise.

@wence-

wence- commented Mar 14, 2014

Copy link
Copy Markdown
Member

Can you add a firedrake-clean script on the other side please?

@kynan

kynan commented Mar 14, 2014

Copy link
Copy Markdown
Member Author

Yes, I'll do that.

@wence-

wence- commented Mar 25, 2014

Copy link
Copy Markdown
Member

Now that we don't use instant for compilation, I think we should still have a pyop2-clean script that deletes the cached compiled libraries. That would look like this:

    Modified   pyop2/compilation.py
diff --git a/pyop2/compilation.py b/pyop2/compilation.py
index 000aee2..0d27c23 100644
--- a/pyop2/compilation.py
+++ b/pyop2/compilation.py
@@ -203,3 +203,37 @@ def load(src, fn_name, cppargs=[], ldargs=[], argtypes=None, restype=None):
     fn.argtypes = argtypes
     fn.restype = restype
     return fn
+
+
+def clear_cache(prompt=False):
+    """Clear the PyOP2 compiler cache.
+
+    :arg prompt: if ``True`` prompt before removing any files
+    """
+    cachedir = configuration['cache_dir']
+
+    files = [os.path.join(cachedir, f) for f in os.listdir(cachedir)
+             if os.path.isfile(os.path.join(cachedir, f))]
+    nfiles = len(files)
+
+    if nfiles == 0:
+        print "No cached libraries to remove"
+        return
+
+    remove = True
+    if prompt:
+
+        user = raw_input("Remove %d cached libraries from %s? [Y/n]: " % (nfiles, cachedir))
+
+        while user.lower() not in ['', 'y', 'n']:
+            print "Please answer y or n."
+            user = raw_input("Remove %d cached libraries from %s? [Y/n]: " % (nfiles, cachedir))
+
+        if user.lower() == 'n':
+            remove = False
+
+    if remove:
+        print "Removing %d cached libraries from %s" % (nfiles, cachedir)
+        [os.remove(f) for f in files]
+    else:
+        print "Not removing cached libraries"
    New        scripts/pyop2-clean
diff --git a/scripts/pyop2-clean b/scripts/pyop2-clean
new file mode 100755
index 0000000..23ac63a
--- /dev/null
+++ b/scripts/pyop2-clean
@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+
+from pyop2.compilation import clear_cache
+
+if __name__ == '__main__':
+    clear_cache(prompt=True)

@kynan

kynan commented Mar 25, 2014

Copy link
Copy Markdown
Member Author

Yes, that makes sense.

@wence-

wence- commented Mar 25, 2014

Copy link
Copy Markdown
Member

I've repurposed pyop2-clean appropriately, barring buildbot/travis happiness, I think this is good. Note that the most recent build (http://buildbot-ocean.ese.ic.ac.uk:8080/builders/pyop2-testing/builds/1210) failed device backend regression tests. Some kind of failure in the canned kernel stuff?

@kynan

kynan commented Mar 25, 2014

Copy link
Copy Markdown
Member Author

I'm not entirely sure what's going on, will investigate.

@wence-

wence- commented Mar 28, 2014

Copy link
Copy Markdown
Member

Can these two changes finally land?

@kynan

kynan commented Mar 28, 2014

Copy link
Copy Markdown
Member Author

Yes as far as I'm concerned. We can have another debate whether to actually scrap the PyOP2 regression tests (and move them all to Firedrake) rather than conserving them.

@wence-

wence- commented Mar 28, 2014

Copy link
Copy Markdown
Member

Please go ahead on both sides then.

kynan added 12 commits April 4, 2014 15:29
This demo is broken and not used as a regression test. Prevent
further bitrot by removing it.
This demo is hard to maintain since it relies on pickled objects that
need updating whenever the relevant class changes. Prevent further
bitrot by removing it.
No more need for demo and demo/meshes to be packages.
kynan and others added 6 commits April 4, 2014 15:32
Now that the ffc interface is gone, pyop2-clean doesn't need to remove
cached kernels anymore.  However, we do need a way to blow away compiled
libraries which we now cache ourselves.
@kynan

kynan commented Apr 4, 2014

Copy link
Copy Markdown
Member Author

So we had another discussion and decided that there's no point keeping the regression tests and conserve pickled FFC kernels for them. The corresponding demos are also removed because they're more or less re-implementations of bits of Firedrake.

Any objections to this?

@wence-

wence- commented Apr 7, 2014

Copy link
Copy Markdown
Member

Assuming firedrake has gained the installation requirements that pyop2 lost, I think yes, go ahead.

@kynan

kynan commented Apr 7, 2014

Copy link
Copy Markdown
Member Author

It has, that's on the requirements branch which I'll propose for merging now.

There is one caveat with this: test coverage of the OpenCL and CUDA backends is significantly reduced, since the unit tests don't nearly have full code coverage. We should probably identify some test cases that solve pre-assembled systems s.t. we can test those with CUDA/OpenCL at the Firedrake level.

kynan added a commit that referenced this pull request Apr 7, 2014
Migrate FFC interface to Firedrake
@kynan
kynan merged commit 637e191 into master Apr 7, 2014
@kynan
kynan deleted the remove-ffc-interface branch April 7, 2014 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants