Closed jwallwork23 closed 10 months ago
@ddundo here is a fix! I had to use a custom Pyadjoint branch (see the latest commits). With that and the changes in this PR, all tests passed locally for me :)
Tomorrow I will find a minimum failing example for this and open an issue to Firedrake.
Note that the Docker image has been updated. It uses the jwallwork23/parmmg-rebased
PETSc branch, but Firedrake master
.
Thanks a lot @jwallwork23 ! All demos pass now as well, apart from burgers_time_integrated.py (AttributeError: 'Cofunction' object has no attribute '_ufl_class_'
). I can post the whole traceback if you don't get this.
But now in my glacier experiments I again get the same error as I posted in #61 - the one with the long Traceback that ends with
File "/home/ubuntu/software/firedrake-sep23/src/PyOP2/pyop2/local_kernel.py", line 144, in arguments
assert len(self.accesses) == len(self.dtypes)
Do you have an idea of what this could be please?
I'm not certain, but I think it fails because you are trying to interpolate a Cofunction
onto a Function
(or vice versa). Please could you print the type of the two things being interpolated just before it happens?
Thanks Joe, but sorry - I'm quite lost in the traceback! Could you please tell me what variables exactly you'd like me to print?
Does your program include a call to interpolate
? If so, please can you print out the types of the source and target just before the interpolation? I expect that one will be a Cofunction
and the other will be a Function
.
Oh actually, you might need to print somewhere in the adjoint code. Perhaps print what goes into line 335 of
/home/ubuntu/software/firedrake-sep23/src/firedrake/firedrake/adjoint_utils/blocks/function.py
.
Thanks! It fails in the adjoint code, yup.
Here return self.backend.Interpolator(dJdm, self.V).interpolate(adj_inputs[0], output=output, transpose=True)
, it actually fails at this part self.backend.Interpolator(dJdm, self.V)
and not at the call to interpolate
. The types are type(dJdm) == <class 'ufl.differentiation.CoefficientDerivative'>
and type(self.V) == <class 'firedrake.functionspaceimpl.WithGeometry'>
What code are you testing this on? Are you able to share it? If not, do you have a minimal failing example that I could do some debugging on?
Sorry, I just saw this now! I emailed you the code :)
Closes #61.
Recent updates to Firedrake have introduced various issues. The main ones are that:
Cofunction
andFunctionSpace.dual()
are now used.The temporary fix for the second issue suggested here is just to map
Cofunction
data intoFunction
s. We should handleCofunction
s and dual spaces properly in the future, though.Note that the
firedrake-parmmg
docker image will need to be updated before the CI will give useful output on this PR.