Problem in fem_wrapper: TypeError: unknown array type
I did a fres install of the newest sfepy from git (on debian sid), and I have trouble running ./runTests.py. Can you see if I am doing something wrong?
cd /home/niels/local/src/ && git clone git://git.sympy.org/sfepy.git && cd sfepy && make && ./runTests.py --debug
./runTests.py --debug<<< directory: tests, test files: 40 <<< tests/test_lcbc_2d.py sfepy: left over: ['__builtins__', '__file__', '__name__', 'wy', 'wx', 'TestLCBC', 'top_dir', '_filename', 'output_name', '__doc__']
test instance prepared (1 test(s)) sfepy: reading mesh (/home/niels/local/src/sfepy/meshes/2d/special/ circle_in_square.mesh)... sfepy: ...done in 0.02 s sfepy: setting up domain edges... sfepy: ...done in 0.01 s sfepy: creating regions... sfepy: Bottom sfepy: Top sfepy: Y1 sfepy: Y sfepy: Y3 sfepy: Y2 sfepy: ...done in 0.02 s <type 'exceptions.TypeError'> Traceback (most recent call last): File "./runTests.py", line 226, in <module> main() File "./runTests.py", line 220, in main op.walk( options.test_dir, run_tests, stats ) File "/usr/lib/python2.5/posixpath.py", line 290, in walk func(arg, top, names) File "./runTests.py", line 148, in run_tests n_fail, n_total, test_time = run_test( conf_name, options ) File "./runTests.py", line 111, in run_test ok, n_fail, n_total = test.run( options.debug ) File "/home/niels/local/src/sfepy/sfepy/base/testing.py", line 38, in run ret = test_method() File "tests/testsBasic.py", line 107, in test_linear_rigid_body_bc nls_status = status ) File "/home/niels/local/src/sfepy/sfepy/solvers/generic.py", line 58, in solve_stationary problem = ProblemDefinition.from_conf( conf ) File "/home/niels/local/src/sfepy/sfepy/fem/problemDef.py", line 84, in from_conf obj.set_fields( conf.fields ) File "/home/niels/local/src/sfepy/sfepy/fem/problemDef.py", line 132, in set_fields self.fields = Fields.from_conf(conf_fields, self.domain.regions) File "/home/niels/local/src/sfepy/sfepy/fem/fields.py", line 19, in from_conf objs.append(Field.from_conf(val, regions)) File "/home/niels/local/src/sfepy/sfepy/fem/fields.py", line 88, in from_conf bases = conf.bases) File "/home/niels/local/src/sfepy/sfepy/fem/fields.py", line 137, in __init__ self.setup_coors() File "/home/niels/local/src/sfepy/sfepy/fem/fields.py", line 210, in setup_coors self.aps.setup_coors( self.domain.mesh, self.cnt_vn ) File "/home/niels/local/src/sfepy/sfepy/fem/fea.py", line 852, in setup_coors ap.eval_extra_coor( self.coors, mesh ) File "/home/niels/local/src/sfepy/sfepy/fem/fea.py", line 239, in eval_extra_coor bf = ginterp.poly_spaces['v'].eval_base(qp_coors) File "/home/niels/local/src/sfepy/sfepy/fem/poly_spaces.py", line 207, in eval_base eps=eps) File "/home/niels/local/src/sfepy/sfepy/fem/poly_spaces.py", line 325, in _eval_base self.mtx_i, bc, suppress_errors, eps) File "/home/niels/local/src/sfepy/sfepy/fem/extmods/fem.py", line 159, in eval_lagrange_simplex return _fem.eval_lagrange_simplex(*args) TypeError: unknown array type
Hi Niels,
Niels L Ellegaard wrote:
I did a fres install of the newest sfepy from git (on debian sid), and I have trouble running ./runTests.py. Can you see if I am doing something wrong?
cd /home/niels/local/src/ && git clone git://git.sympy.org/sfepy.git && cd sfepy && make && ./runTests.py --debug
The same command sequence works for me. Could you send me more info? See below.
40 test file(s) executed in 52.13 s, 0 failure(s) of 55 test(s)
./runTests.py --debug<<< directory: tests, test files: 40 <<< tests/test_lcbc_2d.py sfepy: left over: ['__builtins__', '__file__', '__name__', 'wy', 'wx', 'TestLCBC', 'top_dir', '_filename', 'output_name', '__doc__']
test instance prepared (1 test(s)) sfepy: reading mesh (/home/niels/local/src/sfepy/meshes/2d/special/ circle_in_square.mesh)... sfepy: ...done in 0.02 s sfepy: setting up domain edges... sfepy: ...done in 0.01 s sfepy: creating regions... sfepy: Bottom sfepy: Top sfepy: Y1 sfepy: Y sfepy: Y3 sfepy: Y2 sfepy: ...done in 0.02 s <type 'exceptions.TypeError'> Traceback (most recent call last): File "./runTests.py", line 226, in <module> main() File "./runTests.py", line 220, in main op.walk( options.test_dir, run_tests, stats ) File "/usr/lib/python2.5/posixpath.py", line 290, in walk func(arg, top, names) File "./runTests.py", line 148, in run_tests n_fail, n_total, test_time = run_test( conf_name, options ) File "./runTests.py", line 111, in run_test ok, n_fail, n_total = test.run( options.debug ) File "/home/niels/local/src/sfepy/sfepy/base/testing.py", line 38, in run ret = test_method() File "tests/testsBasic.py", line 107, in test_linear_rigid_body_bc nls_status = status ) File "/home/niels/local/src/sfepy/sfepy/solvers/generic.py", line 58, in solve_stationary problem = ProblemDefinition.from_conf( conf ) File "/home/niels/local/src/sfepy/sfepy/fem/problemDef.py", line 84, in from_conf obj.set_fields( conf.fields ) File "/home/niels/local/src/sfepy/sfepy/fem/problemDef.py", line 132, in set_fields self.fields = Fields.from_conf(conf_fields, self.domain.regions) File "/home/niels/local/src/sfepy/sfepy/fem/fields.py", line 19, in from_conf objs.append(Field.from_conf(val, regions)) File "/home/niels/local/src/sfepy/sfepy/fem/fields.py", line 88, in from_conf bases = conf.bases) File "/home/niels/local/src/sfepy/sfepy/fem/fields.py", line 137, in __init__ self.setup_coors() File "/home/niels/local/src/sfepy/sfepy/fem/fields.py", line 210, in setup_coors self.aps.setup_coors( self.domain.mesh, self.cnt_vn ) File "/home/niels/local/src/sfepy/sfepy/fem/fea.py", line 852, in setup_coors ap.eval_extra_coor( self.coors, mesh ) File "/home/niels/local/src/sfepy/sfepy/fem/fea.py", line 239, in eval_extra_coor bf = ginterp.poly_spaces['v'].eval_base(qp_coors) File "/home/niels/local/src/sfepy/sfepy/fem/poly_spaces.py", line 207, in eval_base eps=eps) File "/home/niels/local/src/sfepy/sfepy/fem/poly_spaces.py", line 325, in _eval_base self.mtx_i, bc, suppress_errors, eps) File "/home/niels/local/src/sfepy/sfepy/fem/extmods/fem.py", line 159, in eval_lagrange_simplex return _fem.eval_lagrange_simplex(*args) TypeError: unknown array type
The crucial line is the line 325 in sfepy/fem/poly_spaces.py, where numpy arrays are passed to a C function wrapped by swig. For this to work, the numpy array arguments must be C-contiguous. Could you check, please, the .flags attributes of base, coors, self.nodes, self.mtx_i and bc arguments?
What are your numpy/scipy versions?
r.
Hi Niels and Robert,
On Wed, Feb 10, 2010 at 4:08 AM, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Hi Niels,
Niels L Ellegaard wrote:
I did a fres install of the newest sfepy from git (on debian sid), and I have trouble running ./runTests.py. Can you see if I am doing something wrong?
cd /home/niels/local/src/ && git clone git://git.sympy.org/sfepy.git && cd sfepy && make && ./runTests.py --debug
The same command sequence works for me. Could you send me more info? See below.
40 test file(s) executed in 52.13 s, 0 failure(s) of 55 test(s)
I'm also seeing this problem in sidux (based on debian sid). Using git bisect, it looks like the bug was introduced in commit c0e243c9.
./runTests.py --debug<<< directory: tests, test files: 40 <<< tests/test_lcbc_2d.py sfepy: left over: ['__builtins__', '__file__', '__name__', 'wy', 'wx', 'TestLCBC', 'top_dir', '_filename', 'output_name', '__doc__']
test instance prepared (1 test(s))
sfepy: reading mesh (/home/niels/local/src/sfepy/meshes/2d/special/ circle_in_square.mesh)... sfepy: ...done in 0.02 s sfepy: setting up domain edges... sfepy: ...done in 0.01 s sfepy: creating regions... sfepy: Bottom sfepy: Top sfepy: Y1 sfepy: Y sfepy: Y3 sfepy: Y2 sfepy: ...done in 0.02 s
<type 'exceptions.TypeError'>
Traceback (most recent call last): File "./runTests.py", line 226, in <module> main() File "./runTests.py", line 220, in main op.walk( options.test_dir, run_tests, stats ) File "/usr/lib/python2.5/posixpath.py", line 290, in walk func(arg, top, names) File "./runTests.py", line 148, in run_tests n_fail, n_total, test_time = run_test( conf_name, options ) File "./runTests.py", line 111, in run_test ok, n_fail, n_total = test.run( options.debug ) File "/home/niels/local/src/sfepy/sfepy/base/testing.py", line 38, in run ret = test_method() File "tests/testsBasic.py", line 107, in test_linear_rigid_body_bc nls_status = status ) File "/home/niels/local/src/sfepy/sfepy/solvers/generic.py", line 58, in solve_stationary problem = ProblemDefinition.from_conf( conf ) File "/home/niels/local/src/sfepy/sfepy/fem/problemDef.py", line 84, in from_conf obj.set_fields( conf.fields ) File "/home/niels/local/src/sfepy/sfepy/fem/problemDef.py", line 132, in set_fields self.fields = Fields.from_conf(conf_fields, self.domain.regions) File "/home/niels/local/src/sfepy/sfepy/fem/fields.py", line 19, in from_conf objs.append(Field.from_conf(val, regions)) File "/home/niels/local/src/sfepy/sfepy/fem/fields.py", line 88, in from_conf bases = conf.bases) File "/home/niels/local/src/sfepy/sfepy/fem/fields.py", line 137, in __init__ self.setup_coors() File "/home/niels/local/src/sfepy/sfepy/fem/fields.py", line 210, in setup_coors self.aps.setup_coors( self.domain.mesh, self.cnt_vn ) File "/home/niels/local/src/sfepy/sfepy/fem/fea.py", line 852, in setup_coors ap.eval_extra_coor( self.coors, mesh ) File "/home/niels/local/src/sfepy/sfepy/fem/fea.py", line 239, in eval_extra_coor bf = ginterp.poly_spaces['v'].eval_base(qp_coors) File "/home/niels/local/src/sfepy/sfepy/fem/poly_spaces.py", line 207, in eval_base eps=eps) File "/home/niels/local/src/sfepy/sfepy/fem/poly_spaces.py", line 325, in _eval_base self.mtx_i, bc, suppress_errors, eps) File "/home/niels/local/src/sfepy/sfepy/fem/extmods/fem.py", line 159, in eval_lagrange_simplex return _fem.eval_lagrange_simplex(*args) TypeError: unknown array type
The crucial line is the line 325 in sfepy/fem/poly_spaces.py, where numpy arrays are passed to a C function wrapped by swig. For this to work, the numpy array arguments must be C-contiguous. Could you check, please, the .flags attributes of base, coors, self.nodes, self.mtx_i and bc arguments?
For me, I get the following flags (using winpdb). It looks like the problem is in self.mtx_i? Can you confirm if you see the same flags, Niels?
eval base.flags C_CONTIGUOUS : True F_CONTIGUOUS : False OWNDATA : True WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False
eval coors.flags C_CONTIGUOUS : True F_CONTIGUOUS : False OWNDATA : True WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False
eval self.nodes.flags C_CONTIGUOUS : True F_CONTIGUOUS : False OWNDATA : True WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False
eval self.mtx_i.flags C_CONTIGUOUS : False F_CONTIGUOUS : True OWNDATA : True WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False
eval bc.flags C_CONTIGUOUS : True F_CONTIGUOUS : False OWNDATA : True WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False
Best regards, Logan
Logan Sorenson wrote:
Hi Niels and Robert,
On Wed, Feb 10, 2010 at 4:08 AM, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Hi Niels,
Niels L Ellegaard wrote:
I did a fres install of the newest sfepy from git (on debian sid), and I have trouble running ./runTests.py. Can you see if I am doing something wrong?
cd /home/niels/local/src/ && git clone git://git.sympy.org/sfepy.git && cd sfepy && make && ./runTests.py --debug The same command sequence works for me. Could you send me more info? See below.
40 test file(s) executed in 52.13 s, 0 failure(s) of 55 test(s)
I'm also seeing this problem in sidux (based on debian sid). Using git bisect, it looks like the bug was introduced in commit c0e243c9.
Yeah, before this very recent commit, the base function evaluation was in pure Python. Now the evaluation is in C for speed, as I needed it for fast data interpolation between different meshes - this is already implemented in my github repo, I will push it to the master repo today, with the fix of this issue.
For me, I get the following flags (using winpdb). It looks like the problem is in self.mtx_i? Can you confirm if you see the same flags, Niels?
eval self.mtx_i.flags C_CONTIGUOUS : False F_CONTIGUOUS : True OWNDATA : True WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False
this one should be C_CONTIGUOUS - it is easy to fix: diff --git a/sfepy/fem/poly_spaces.py b/sfepy/fem/poly_spaces.py index 28ee419..05051b5 100644 --- a/sfepy/fem/poly_spaces.py +++ b/sfepy/fem/poly_spaces.py @@ -232,7 +232,7 @@ class LagrangeSimplexPolySpace(PolySpace): mtx = nm.ones((n_v, n_v), nm.float64) mtx[0:n_v-1,:] = nm.transpose(geometry.coors) - self.mtx_i = nla.inv(mtx) + self.mtx_i = nm.ascontiguousarray(nla.inv(mtx)) self.rhs = nm.ones((n_v,), nm.float64) self.nodes, self.nts, self.node_coors = self._define_nodes() Could you try it, please? With numpy 1.3.0, this was not necessary, though. thanks for debugging! r.
On Feb 11, 10:07 am, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Logan Sorenson wrote:
Hi Niels and Robert,
On Wed, Feb 10, 2010 at 4:08 AM, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Hi Niels,
Niels L Ellegaard wrote:
I did a fres install of the newest sfepy from git (on debian sid), and I have trouble running ./runTests.py. Can you see if I am doing something wrong?
cd /home/niels/local/src/ && git clone git://git.sympy.org/sfepy.git && cd sfepy && make && ./runTests.py --debug The same command sequence works for me. Could you send me more info? See below.
40 test file(s) executed in 52.13 s, 0 failure(s) of 55 test(s)
I'm also seeing this problem in sidux (based on debian sid). Using git bisect, it looks like the bug was introduced in commit c0e243c9.
Yeah, before this very recent commit, the base function evaluation was in pure Python. Now the evaluation is in C for speed, as I needed it for fast data interpolation between different meshes - this is already implemented in my github repo, I will push it to the master repo today, with the fix of this issue.
For me, I get the following flags (using winpdb). It looks like the problem is in self.mtx_i? Can you confirm if you see the same flags, Niels?
eval self.mtx_i.flags C_CONTIGUOUS : False F_CONTIGUOUS : True OWNDATA : True WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False
this one should be C_CONTIGUOUS - it is easy to fix:
diff --git a/sfepy/fem/poly_spaces.py b/sfepy/fem/poly_spaces.py index 28ee419..05051b5 100644 --- a/sfepy/fem/poly_spaces.py +++ b/sfepy/fem/poly_spaces.py @@ -232,7 +232,7 @@ class LagrangeSimplexPolySpace(PolySpace):
mtx = nm.ones((n_v, n_v), nm.float64) mtx[0:n_v-1,:] = nm.transpose(geometry.coors) - self.mtx_i = nla.inv(mtx) + self.mtx_i = nm.ascontiguousarray(nla.inv(mtx)) self.rhs = nm.ones((n_v,), nm.float64)
self.nodes, self.nts, self.node_coors = self._define_nodes()
Could you try it, please?
With numpy 1.3.0, this was not necessary, though.
thanks for debugging! r.
It works. Thank you for the fix. Niels
Niels L Ellegaard wrote:
On Feb 11, 10:07 am, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Logan Sorenson wrote:
Hi Niels and Robert, On Wed, Feb 10, 2010 at 4:08 AM, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Hi Niels, Niels L Ellegaard wrote:
I did a fres install of the newest sfepy from git (on debian sid), and I have trouble running ./runTests.py. Can you see if I am doing something wrong? cd /home/niels/local/src/ && git clone git://git.sympy.org/sfepy.git && cd sfepy && make && ./runTests.py --debug The same command sequence works for me. Could you send me more info? See below. 40 test file(s) executed in 52.13 s, 0 failure(s) of 55 test(s) I'm also seeing this problem in sidux (based on debian sid). Using git bisect, it looks like the bug was introduced in commit c0e243c9. Yeah, before this very recent commit, the base function evaluation was in pure Python. Now the evaluation is in C for speed, as I needed it for fast data interpolation between different meshes - this is already implemented in my github repo, I will push it to the master repo today, with the fix of this issue.
eval self.mtx_i.flags C_CONTIGUOUS : False F_CONTIGUOUS : True OWNDATA : True WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False
For me, I get the following flags (using winpdb). It looks like the problem is in self.mtx_i? Can you confirm if you see the same flags, Niels? this one should be C_CONTIGUOUS - it is easy to fix:
diff --git a/sfepy/fem/poly_spaces.py b/sfepy/fem/poly_spaces.py index 28ee419..05051b5 100644 --- a/sfepy/fem/poly_spaces.py +++ b/sfepy/fem/poly_spaces.py @@ -232,7 +232,7 @@ class LagrangeSimplexPolySpace(PolySpace):
mtx = nm.ones((n_v, n_v), nm.float64) mtx[0:n_v-1,:] = nm.transpose(geometry.coors) - self.mtx_i = nla.inv(mtx) + self.mtx_i = nm.ascontiguousarray(nla.inv(mtx)) self.rhs = nm.ones((n_v,), nm.float64)
self.nodes, self.nts, self.node_coors = self._define_nodes()
Could you try it, please?
With numpy 1.3.0, this was not necessary, though.
thanks for debugging! r.
It works. Thank you for the fix.
Niels
Glad to hear that, thanks for reporting the bug. r.
participants (3)
-
Logan Sorenson
-
Niels L Ellegaard
-
Robert Cimrman