Skip to content

Instantly share code, notes, and snippets.

@chromy
Created April 27, 2015 12:31
Show Gist options
  • Save chromy/9117a372d1b2c3b9d27d to your computer and use it in GitHub Desktop.
Save chromy/9117a372d1b2c3b9d27d to your computer and use it in GitHub Desktop.
Firedrake CUDA bug
#!/usr/bin/env python
# Run with PYOP2_BACKEND=cuda
from firedrake import *
degree = 1
mesh = UnitSquareMesh(10, 10)
def p():
V = FunctionSpace(mesh, "CG", degree)
u = TrialFunction(V)
v = TestFunction(V)
a = u * v * dx
A = assemble(a)
A.M
# This should work.but fails with:
# AttributeError: 'Dat' object has no attribute 'vec_ro'
p()
Traceback (most recent call last):
File "../project/bugs/cuda_broken_109e128133d6622d99d80fe99144cf269e1039bf.py", line 17, in <module>
p()
File "../project/bugs/cuda_broken_109e128133d6622d99d80fe99144cf269e1039bf.py", line 8, in p
V = FunctionSpace(mesh, "CG", degree)
File "/homes/hjd11/proj/Firedrake/PyOP2/pyop2/caching.py", line 161, in __new__
obj = make_obj()
File "/homes/hjd11/proj/Firedrake/PyOP2/pyop2/caching.py", line 142, in make_obj
obj.__init__(*args, **kwargs)
File "/homes/hjd11/proj/Firedrake/firedrake/firedrake/functionspace.py", line 518, in __init__
mesh.init()
File "/homes/hjd11/proj/Firedrake/firedrake/firedrake/mesh.py", line 421, in init
self._callback(self)
File "/homes/hjd11/proj/Firedrake/firedrake/firedrake/mesh.py", line 388, in callback
self._coordinate_fs = functionspace.VectorFunctionSpace(self, "Lagrange", 1)
File "/homes/hjd11/proj/Firedrake/PyOP2/pyop2/caching.py", line 161, in __new__
obj = make_obj()
File "/homes/hjd11/proj/Firedrake/PyOP2/pyop2/caching.py", line 142, in make_obj
obj.__init__(*args, **kwargs)
File "/homes/hjd11/proj/Firedrake/firedrake/firedrake/functionspace.py", line 585, in __init__
super(VectorFunctionSpace, self).__init__(mesh, element, name, dim=dim, rank=1)
File "/homes/hjd11/proj/Firedrake/firedrake/firedrake/functionspace.py", line 121, in __init__
with function.Function(self).dat.vec_ro as v:
AttributeError: 'Dat' object has no attribute 'vec_ro'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment