[pythran] Re: Pythran 0.7 regression?

  • From: Pierrick Brunet <pierrick.brunet@xxxxxxxx>
  • To: pythran@xxxxxxxxxxxxx, Valerio De Carolis <v.decarolis@xxxxxxxx>
  • Date: Fri, 17 Apr 2015 15:37:20 +0200

Hi valerio,

Looking at the c++ code and you error, it looks like the error come from calc_coriolis which is not included in this email. Can you share this code too?


On 17/04/2015 14:54, Valerio De Carolis wrote:

Hello Pythraners,

I've just spotted a possible regression after installing the new release. This code was compiling fine on 0.6 while it is failing to compiling with the 0.7.

After a quick look at the generated code I can see the approach taken by the pythran runtime is slightly different thus generating a different code compared to 0.6. I know the test function is a little bit naive but in tight loops the use of Pythran is still giving some benefits (ie. reducing the total CPU load). :)

import numpy as np

#pythran export compute_jacobian(float, float, float)
def compute_jacobian(phi, theta, psi):
"""This functions computes the jacobian matrix used for converting body-frame to earth-frame coordinates.

:param phi: pitch angle (k)
:param theta: roll angle (m)
:param psi: yaw angle (n)
:return: J matrix (6x6)
J = np.zeros((6,6))

# jacobian one
J[0, 0] = np.cos(theta) * np.cos(psi)
J[0, 1] = np.cos(psi) * np.sin(theta) * np.sin(phi) - np.sin(psi) * np.cos(phi)
J[0, 2] = np.sin(psi) * np.sin(phi) + np.cos(psi) * np.cos(phi) * np.sin(theta)

J[1, 0] = np.cos(theta) * np.sin(psi)
J[1, 1] = np.cos(psi) * np.cos(phi) + np.sin(phi) * np.sin(theta) * np.sin(psi)
J[1, 2] = np.sin(psi) * np.sin(theta) * np.cos(phi) - np.cos(psi) * np.sin(phi)

J[2, 0] = -np.sin(theta)
J[2, 1] = np.cos(theta) * np.sin(phi)
J[2, 2] = np.cos(theta) * np.cos(phi)

# jacobian two
J[3, 3] = 1.0
J[3, 4] = np.sin(phi) * np.tan(theta)
J[3, 5] = np.cos(phi) * np.tan(theta)

J[4, 3] = 0.0
J[4, 4] = np.cos(phi)
J[4, 5] = -np.sin(phi)

J[5, 3] = 0.0
J[5, 4] = np.sin(phi) / np.cos(theta)
J[5, 5] = np.cos(phi) / np.cos(theta)

return J

Error attached:

CRITICAL Leave the vessel! Women and children first!
C++ compiler failed to compile translated code.
E: Compile error!

******** Command line was: ********
'c++' '/tmp/tmpMtMHzs.cpp' '-I/usr/include/python2.7' '-I/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy' '-I/usr/local/lib/python2.7/dist-packages/.' '-I/usr/local/lib/python2.7/dist-packages/pythran' '-I/usr/local/lib/python2.7/dist-packages/pythran/pythonic/patch' '-DENABLE_PYTHON_MODULE' '-DUSE_GMP' '-DNDEBUG' '-O2' '-g' '-fno-math-errno' '-std=c++11' '-O2' '-shared' '-o' 'dynamic_model.so' '-L/usr/lib/python2.7/config-x86_64-linux-gnu' '-lpthread' '-ldl' '-lutil' '-lpython2.7' '-lboost_python' '-lgmp' '-lgmpxx' '-fPIC' '-ltcmalloc_minimal'

******** Output : ********

In file included from /usr/include/c++/4.8/algorithm:61:0,
from /usr/include/boost/function/detail/prologue.hpp:13,
from /usr/include/boost/function/function_template.hpp:13,
from /usr/include/boost/function/detail/maybe_include.hpp:13,
from /usr/include/boost/function/function0.hpp:11,
from /usr/include/boost/python/errors.hpp:13,
from /usr/include/boost/python/handle.hpp:11,
from /usr/include/boost/python/to_python_value.hpp:12,
from /usr/include/boost/python/default_call_policies.hpp:10,
from /usr/include/boost/python/make_function.hpp:10,
from /usr/include/boost/python/def.hpp:11,
from /usr/local/lib/python2.7/dist-packages/pythran/pythonic/python/core.hpp:6,
from /tmp/tmpMtMHzs.cpp:4:
/usr/include/c++/4.8/bits/stl_algobase.h: In instantiation of ‘static _OI std::__copy_move<false, false, std::random_access_iterator_tag>::__copy_m(_II, _II, _OI) [with _II = const pythonic::types::list<double>*; _OI = double*]’:
/usr/include/c++/4.8/bits/stl_algobase.h:390:70: required from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = const pythonic::types::list<double>*; _OI = double*]’
/usr/include/c++/4.8/bits/stl_algobase.h:428:38: required from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = __gnu_cxx::__normal_iterator<const pythonic::types::list<double>*, std::vector<pythonic::types::list<double>, std::allocator<pythonic::types::list<double> > > >; _OI = __gnu_cxx::__normal_iterator<double*, std::vector<double> >]’
/usr/include/c++/4.8/bits/stl_algobase.h:460:17: required from ‘_OI std::copy(_II, _II, _OI) [with _II = __gnu_cxx::__normal_iterator<const pythonic::types::list<double>*, std::vector<pythonic::types::list<double>, std::allocator<pythonic::types::list<double> > > >; _OI = __gnu_cxx::__normal_iterator<double*, std::vector<double> >]’
/usr/local/lib/python2.7/dist-packages/pythran/pythonic/types/list.hpp:185:70: required from ‘pythonic::types::list<T>::list(const pythonic::types::list<K>&) [with F = pythonic::types::list<double>; T = double]’
/usr/local/lib/python2.7/dist-packages/pythran/pythonic/types/list.hpp:153:72: required from ‘pythonic::types::list<T>::fake_shape::fake_shape(const pythonic::types::list<T>&) [with T = pythonic::types::list<double>]’
/usr/local/lib/python2.7/dist-packages/pythran/pythonic/types/list.hpp:180:83: required from ‘pythonic::types::list<T>::list(std::initializer_list<_Tp>) [with T = pythonic::types::list<double>]’
/tmp/tmpMtMHzs.cpp:944:844: required from ‘typename __pythran_dynamic_model::compute_jacobian::type<argument_type0, argument_type1, argument_type2>::result_type __pythran_dynamic_model::compute_jacobian::operator()(const argument_type0&, const argument_type1&, const argument_type2&) const [with argument_type0 = double; argument_type1 = double; argument_type2 = double; typename __pythran_dynamic_model::compute_jacobian::type<argument_type0, argument_type1, argument_type2>::result_type = pythonic::types::ndarray<double, 2ul>]’
/tmp/tmpMtMHzs.cpp:1059:64: required from here
/usr/include/c++/4.8/bits/stl_algobase.h:335:18: error: cannot convert ‘const pythonic::types::list<double>’ to ‘double’ in assignment
*__result = *__first;

Any idea why this is failing to compile?

Platform: Ubuntu 14.04.2 LTS x86-64


Other related posts: