AttributeError: 'module' object has no attribute 'adj_variable' on import with Mac OS X + MacPorts

Bug #1107998 reported by Jack Hale
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dolfin-adjoint
New
Undecided
Unassigned

Bug Description

Hi,

I'm trying to compile from source on Mac OS X Mountain Lion using the latest trunk versions of dolfin-adjoint and libadjoint. I am using macports packages and Dolfin 1.1.0 stable which has been compiled using dorsal.

I have tried compiling with both macports GCC 4.7 and Apple's built in clang compiler. I get two successful compiles, but upon import I get the following error:

In [1]: import dolfin_adjoint
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-cda565555280> in <module>()
----> 1 import dolfin_adjoint

/Users/jack/Library/Python/2.7/lib/python/site-packages/dolfin_adjoint/__init__.py in <module>()
     22
     23 import options
---> 24 import solving
     25 import assembly
     26 import expressions

/Users/jack/Library/Python/2.7/lib/python/site-packages/dolfin_adjoint/solving.py in <module>()
     24 import expressions
     25 import coeffstore
---> 26 import adjrhs
     27 import adjglobals
     28 import adjlinalg

/Users/jack/Library/Python/2.7/lib/python/site-packages/dolfin_adjoint/adjrhs.py in <module>()
      3 import ufl
      4 import ufl.algorithms
----> 5 import adjglobals
      6 import adjlinalg
      7

/Users/jack/Library/Python/2.7/lib/python/site-packages/dolfin_adjoint/adjglobals.py in <module>()
      5 # Create the adjointer, the central object that records the forward solve
      6 # as it happens.
----> 7 adjointer = libadjoint.Adjointer()
      8
      9 mem_checkpoints = set()

/usr/local/lib/python2.7/site-packages/libadjoint/libadjoint.pyc in __init__(self, adjointer)
    676 def __init__(self, adjointer=None):
    677 self.functions_registered = []
--> 678 self.set_function_apis()
    679
    680 self.equation_timestep = []

/usr/local/lib/python2.7/site-packages/libadjoint/libadjoint.pyc in set_function_apis(self)
    716
    717 def set_function_apis(self):
--> 718 self.block_assembly_type = ctypes.CFUNCTYPE(None, ctypes.c_int, ctypes.POINTER(clib.adj_variable), ctypes.POINTER(clib.adj_vector), ctypes.c_int, adj_scalar, ctypes.POINTER(None),
    719 ctypes.POINTER(clib.adj_matrix), ctypes.POINTER(clib.adj_vector))
    720 self.block_action_type = ctypes.CFUNCTYPE(None, ctypes.c_int, ctypes.POINTER(clib.adj_variable), ctypes.POINTER(clib.adj_vector), ctypes.c_int, adj_scalar, clib.adj_vector,

AttributeError: 'module' object has no attribute 'adj_variable'

So there is some problem in ctypes/clib. Any ideas what the problem might be?

Revision history for this message
Patrick Farrell (pefarrell) wrote :

Hi Jack,

Yes, libadjoint doesn't compile correctly on OSX; the problem is in the auto-generation of the libadjoint Python bindings. I've been trying to get shell access to an OSX system ever since I became aware of this problem, as that's the only way I'll be able to debug it. Is there any OSX workstation around I could ssh into?

Patrick

Revision history for this message
Jack Hale (jack-hale) wrote :

Hi Patrick,

Your welcome to have access to my machine via ssh. Send me the public part of your ssh key I can give you an account. My imperial email is j.hale09@...

No rush in fixing it, I just got bored writing my PhD up today (!) and thought I would give it a go. Pedro and I are planning on doing some work with dolfin_adjoint once I have submitted.

Jack

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.