Programm doesn't run after update, how can I go back to older release

Asked by Heinz Zorn

I have got a problem with my programm. It had been working fine until about ten days ago. I am using dolfin-adjoint on ubuntu 12.04 and I am using the ppa-source for updates. The currently installes versions are:

python-dolfin/precise uptodate 1.2.0-1~ppa1~precise1
python-dolfin-adjoint/precise uptodate 1.1.0-0~731~precise1
python-libadjoint/precise uptodate 0.9.3-0~431~precise1

I tried to reduce my programm to an minimal running exampla, but it still has nearly 200 lines. So I would like to find the last release which worked with my code and then try to find out if there is a bug or if I did some bad programming.

Can anybody tell me how to go back to an older release? Solving the forward problem with dolfin still works fine. But when I have defined the Functional and the ReducedFunctional and call minimize(reduced_functional) I will get the following error:

Calling FFC just-in-time (JIT) compiler, this may take some time.
Solving linear system of size 2250 x 2250 (PETSc Krylov solver).
Solving linear system of size 2250 x 2250 (PETSc Krylov solver).
Solving linear variational problem.
RUNNING THE L-BFGS-B CODE

           * * *

Machine precision = 2.220D-16
 N = 1 M = 10
 This problem is unconstrained.

At X0 0 variables are exactly at the bounds
Calling FFC just-in-time (JIT) compiler, this may take some time.
Solving linear system of size 2250 x 2250 (PETSc Krylov solver).
Solving linear system of size 2250 x 2250 (PETSc Krylov solver).
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 314, in 'calling callback function'
  File "/usr/lib/python2.7/dist-packages/libadjoint/libadjoint.py", line 544, in cfunc
    output_c[0] = self(adjointer, timestep, dependencies, values)
TypeError: float expected instead of Vector instance

Python traceback:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/libadjoint/libadjoint.py", line 1289, in newfunc
    func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/libadjoint/libadjoint.py", line 1642, in __mat_solve_callback__
    x = A.solve(Variable(var=adj_var), b)
  File "/usr/lib/python2.7/dist-packages/dolfin_adjoint/adjlinalg.py", line 355, in solve
    x = self.basic_solve(var, b)
  File "/usr/lib/python2.7/dist-packages/dolfin_adjoint/adjlinalg.py", line 303, in basic_solve
    wrap_solve(assembled_lhs, x.data.vector(), assembled_rhs, self.solver_parameters)
  File "/usr/lib/python2.7/dist-packages/dolfin_adjoint/adjlinalg.py", line 416, in wrap_solve
    solver.solve(A, x, b)
TypeError: in method 'LUSolver_solve', argument 4 of type 'dolfin::GenericVector const &'

C traceback:
/usr/lib/python2.7/lib-dynload/_ctypes.so(ffi_call_unix64+0x4c)[0x7f1e20901ea4]
/usr/lib/python2.7/lib-dynload/_ctypes.so(ffi_call+0x1e5)[0x7f1e209018c5]
/usr/lib/python2.7/lib-dynload/_ctypes.so(_ctypes_callproc+0x4d2)[0x7f1e208f22c2]
/usr/lib/python2.7/lib-dynload/_ctypes.so(+0xbaa2)[0x7f1e208f2aa2]
python(PyObject_Call+0x36)[0x4e9f36]
python(PyEval_EvalFrameEx+0x86a)[0x49846a]
python(PyEval_EvalCodeEx+0x1a0)[0x49f1c0]
python[0x4a8960]
python(PyObject_Call+0x36)[0x4e9f36]
python(PyEval_CallObjectWithKeywords+0x36)[0x4ea396]
/usr/lib/python2.7/lib-dynload/_ctypes.so(+0x16f40)[0x7f1e208fdf40]
/usr/lib/python2.7/lib-dynload/_ctypes.so(ffi_closure_unix64_inner+0x1b9)[0x7f1e20901ca9]
/usr/lib/python2.7/lib-dynload/_ctypes.so(ffi_closure_unix64+0x46)[0x7f1e2090200c]
//usr/lib/libadjoint.so(adj_get_adjoint_solution+0x1ee)[0x7f1dfd32361d]
/usr/lib/python2.7/lib-dynload/_ctypes.so(ffi_call_unix64+0x4c)[0x7f1e20901ea4]
/usr/lib/python2.7/lib-dynload/_ctypes.so(ffi_call+0x1e5)[0x7f1e209018c5]
/usr/lib/python2.7/lib-dynload/_ctypes.so(_ctypes_callproc+0x4d2)[0x7f1e208f22c2]
/usr/lib/python2.7/lib-dynload/_ctypes.so(+0xbaa2)[0x7f1e208f2aa2]
python(PyObject_Call+0x36)[0x4e9f36]
python(PyEval_EvalFrameEx+0x86a)[0x49846a]
python(PyEval_EvalFrameEx+0xa02)[0x498602]
python(PyEval_EvalCodeEx+0x1a0)[0x49f1c0]
python(PyEval_EvalFrameEx+0x7b8)[0x4983b8]
python(PyEval_EvalCodeEx+0x1a0)[0x49f1c0]
python(PyEval_EvalFrameEx+0x7b8)[0x4983b8]
python(PyEval_EvalCodeEx+0x1a0)[0x49f1c0]
python(PyEval_EvalFrameEx+0x7b8)[0x4983b8]
python(PyEval_EvalCodeEx+0x1a0)[0x49f1c0]
python[0x4a8960]
python(PyObject_Call+0x36)[0x4e9f36]
python(PyEval_EvalFrameEx+0x1fc0)[0x499bc0]
python(PyEval_EvalCodeEx+0x1a0)[0x49f1c0]
python(PyEval_EvalFrameEx+0x7b8)[0x4983b8]
python(PyEval_EvalCodeEx+0x1a0)[0x49f1c0]
python[0x4a8a92]
python(PyObject_Call+0x36)[0x4e9f36]
python(PyEval_EvalFrameEx+0x1fc0)[0x499bc0]
python(PyEval_EvalCodeEx+0x1a0)[0x49f1c0]
python[0x4a8a92]
python(PyObject_Call+0x36)[0x4e9f36]
python(PyEval_EvalFrameEx+0x1fc0)[0x499bc0]
python(PyEval_EvalCodeEx+0x1a0)[0x49f1c0]
python[0x4a8a92]
python(PyObject_Call+0x36)[0x4e9f36]
python(PyEval_EvalFrameEx+0x1fc0)[0x499bc0]
python(PyEval_EvalCodeEx+0x1a0)[0x49f1c0]
python(PyEval_EvalFrameEx+0x7b8)[0x4983b8]
python(PyEval_EvalCodeEx+0x1a0)[0x49f1c0]
python(PyRun_FileExFlags+0xe1)[0x4a9081]
python(PyRun_SimpleFileExFlags+0x1d1)[0x4a9311]
python(Py_Main+0x55d)[0x4aa8bd]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f1e2436d76d]
python[0x41b9b1]

Thanks in advance for any help!

Question information

Language:
English Edit question
Status:
Solved
For:
dolfin-adjoint Edit question
Assignee:
No assignee Edit question
Solved by:
Heinz Zorn
Solved:
Last query:
Last reply:
Revision history for this message
Patrick Farrell (pefarrell) said :
#1

Dear Heinz,

The easiest way to revert to old versions would be

bzr co lp:dolfin-adjoint # get the source
cd dolfin-adjoint
export PYTHONPATH=`pwd`:$PYTHONPATH # find this instance of dolfin-adjoint over the installed one
bzr revert -r<REVISION_NUMBER> # revert to REVISION_NUMBER
python myscript.py # run your script

This looks like a regression in dolfin-adjoint; if you report a bug and/or supply a minimal test case, I'll add it to the test suite so that we catch it in future.

On a hunch: can you add a print statement

=== modified file 'dolfin_adjoint/functional.py'
--- dolfin_adjoint/functional.py 2013-04-09 12:13:06 +0000
+++ dolfin_adjoint/functional.py 2013-06-17 09:53:30 +0000
@@ -79,6 +79,7 @@
   def __call__(self, adjointer, timestep, dependencies, values):

     functional_value = self._substitute_form(adjointer, timestep, dependencies, values)
+ print "functional returning: ", dolfin.assemble(functional_value)

     if functional_value is not None:
       return dolfin.assemble(functional_value)

to functional.py?

Patrick

Revision history for this message
Heinz Zorn (zorn) said :
#2

Hello Patrick,

thank you for your immediate answer. I have tried to go back to an older release. Release 597 up to the current 732 give the same error. Using earlier releases (?-596) my programm breaks with another error. Perhaps there are other dependencies?

Adding the mentioned line into functional.py leads to:

functional returning: <Vector wrapper of <PETScVector of size 648>>

Thanks again for your help!

Revision history for this message
Patrick Farrell (pefarrell) said :
#3

That's quite strange. The functional should of course be returning a real number (rank-0), but it's assembling a rank-1 object (Vector).

Can you post the smallest code you can make, and I'll try to take a look?

Revision history for this message
Patrick Farrell (pefarrell) said :
#5

Dear Heinz,

I think this is a mistake in the user code.

The expression that you've passed into Functional is rank-1, not rank-0. Try printing

import ufl.algorithms
print "Arguments of my form: ", ufl.algorithms.extract_arguments(( inner( sigmaOrth, sym(grad(u)) )* dx ))

It has one argument (i.e. rank-1), but a Functional must be rank-0. I've added an error message to dolfin-adjoint to catch
this case.

What functional are you actually trying to optimise? Perhaps you intend to minimise the norm of that quantity?

Patrick

Revision history for this message
Heinz Zorn (zorn) said :
#6

sigmaOrth and sym(grad(u)) should both be 2-rank tensors. Their inner product should be scalar. And the integral over this scalar should also be scalar.

Revision history for this message
James Maddison (jamesmadd) said :
#7

I think I agree, the functional looks like it should be rank 0?

Revision history for this message
Patrick Farrell (pefarrell) said :
#8

Yes, I agree. inner means summation over all indices. Maybe it's a bug in UFL? I'll ask Martin to take a look.

Revision history for this message
Patrick Farrell (pefarrell) said :
#9

Martin wrote back. The reason is that sigmaOrth depends on the TrialFunction (TrialFunction -> epsilon -> eps[1-6] -> eps -> sig -> sigmaOrth). The expression in the Functional can't depend on a TrialFunction or TestFunction. Perhaps you want to

replace(sigmaOrth, {<a variable that holds the TrialFunction, which is currently overwritten>: u})

before you initialise the Functional?

Revision history for this message
James Maddison (jamesmadd) said :
#10

Ah yes, I see the TrialFunction carries through via epsilon and sigmaOrth.

Revision history for this message
Heinz Zorn (zorn) said :
#12

Me again!

The problem seems to be solved. I just added value=alpha to the InitialConditionParameter (Has this alway been necessary?).

m = InitialConditionParameter( alpha, value=alpha )

Thanks again, I hope this will also work for my full programm!

Revision history for this message
Patrick Farrell (pefarrell) said :
#13

Heinz: yes, that is the correct approach. It's a bit ugly, but the proper fix is a bit involved.

Glad to hear you sorted out your problem.