[Numpy-discussion] failure building numpy using icc

Glen W. Mabey Glen.Mabey@swri....
Tue Apr 29 10:21:51 CDT 2008


Robert,

I do appreciate your response to this question (oh way back when) and am
just now getting back to this problem.

On Sat, Mar 01, 2008 at 02:17:46AM -0600, Robert Kern wrote:
> On Thu, Feb 28, 2008 at 1:21 PM, Glen W. Mabey <Glen.Mabey@swri.org> wrote:
> > Hello,
> >
> >  I'm using svn numpy and get the following error upon executing
> >
> >   /usr/local/bin/python2.5 setup.py config --noisy --cc=/opt/intel/cce/10.0.025/bin/icc --compiler=intel --fcompiler=intel build_clib build_ext
> >
> >  I see:
> >
> >  conv_template:> build/src.linux-x86_64-2.5/numpy/core/src/scalartypes.inc
> >  Traceback (most recent call last):
> >   File "setup.py", line 96, in <module>
> >     setup_package()
> >   File "setup.py", line 89, in setup_package
> >     configuration=configuration )
> >   File "/home/gmabey/src/DiamondBack/Diamondback/src/numpy-20080228_svn/numpy/distutils/core.py", line 184, in setup
> >     return old_setup(**new_attr)
> >   File "/usr/local/lib/python2.5/distutils/core.py", line 151, in setup
> >     dist.run_commands()
> >   File "/usr/local/lib/python2.5/distutils/dist.py", line 974, in run_commands
> >     self.run_command(cmd)
> >   File "/usr/local/lib/python2.5/distutils/dist.py", line 994, in run_command
> >     cmd_obj.run()
> >   File "/home/gmabey/src/DiamondBack/Diamondback/src/numpy-20080228_svn/numpy/distutils/command/build_ext.py", line 56, in run
> >     self.run_command('build_src')
> >   File "/usr/local/lib/python2.5/distutils/cmd.py", line 333, in run_command
> >     self.distribution.run_command(command)
> >   File "/usr/local/lib/python2.5/distutils/dist.py", line 994, in run_command
> >     cmd_obj.run()
> >   File "/home/gmabey/src/DiamondBack/Diamondback/src/numpy-20080228_svn/numpy/distutils/command/build_src.py", line 130, in run
> >     self.build_sources()
> >   File "/home/gmabey/src/DiamondBack/Diamondback/src/numpy-20080228_svn/numpy/distutils/command/build_src.py", line 147, in build_sources
> >     self.build_extension_sources(ext)
> >   File "/home/gmabey/src/DiamondBack/Diamondback/src/numpy-20080228_svn/numpy/distutils/command/build_src.py", line 252, in build_extension_sources
> >     sources = self.template_sources(sources, ext)
> >   File "/home/gmabey/src/DiamondBack/Diamondback/src/numpy-20080228_svn/numpy/distutils/command/build_src.py", line 359, in template_sources
> >     outstr = process_c_file(source)
> >   File "/home/gmabey/src/DiamondBack/Diamondback/src/numpy-20080228_svn/numpy/distutils/conv_template.py", line 185, in process_file
> >     % (sourcefile, process_str(''.join(lines))))
> >   File "/home/gmabey/src/DiamondBack/Diamondback/src/numpy-20080228_svn/numpy/distutils/conv_template.py", line 150, in process_str
> >     newstr[sub[0]:sub[1]], sub[4])
> >   File "/home/gmabey/src/DiamondBack/Diamondback/src/numpy-20080228_svn/numpy/distutils/conv_template.py", line 117, in expand_sub
> >     % (line, template_re.sub(namerepl, substr)))
> >   File "/home/gmabey/src/DiamondBack/Diamondback/src/numpy-20080228_svn/numpy/distutils/conv_template.py", line 113, in namerepl
> >     return names[name][thissub[0]]
> >  KeyError: 'PREFIX'
> >
> >
> >  And I do not see any errors when building the same svn version with gcc (on
> >  a different machine).
> >
> >  I've unsuccessfully tried to follow that backtrace of functions to
> >  figure out exactly what is going on.
> >
> >  Any hints/suggestions?
> 
> Off-hand, no, sorry. I'm not sure why the compiler would matter in
> this part of the code, though. Can you try using gcc on the same
> machine?

I did successfully use gcc on the same machine without any problems.
However, I still encounter a similar error with today's svn.

Now, I don't know anything about how code is produced within numpy, but
within pdb I was able to find this string that some sort of pattern
substitution is acting on.  It suspiciously looks like the first function 
belongs after the last one ...



static PyObject *
gentype_@name@(PyObject *m1)
{
        PyObject *arr, *ret;

        arr = PyArray_FromScalar(m1, NULL);
        if (arr == NULL) return NULL;
        ret = arr->ob_type->tp_as_number->nb_@name@(arr);
        Py_DECREF(arr);
        return ret;
}
/**end repeat**/

static int
gentype_nonzero_number(PyObject *m1)
{
        PyObject *arr;
        int ret;

        arr = PyArray_FromScalar(m1, NULL);
        if (arr == NULL) return -1;
        ret = arr->ob_type->tp_as_number->nb_nonzero(arr);
        Py_DECREF(arr);
        return ret;
}

static PyObject *
gentype_str(PyObject *self)
{
        PyArrayObject *arr;
        PyObject *ret;

        arr = (PyArrayObject *)PyArray_FromScalar(self, NULL);
        if (arr==NULL) return NULL;
        ret = PyObject_Str((PyObject *)arr);
        Py_DECREF(arr);
        return ret;
}


static PyObject *
gentype_repr(PyObject *self)
{
        PyArrayObject *arr;
        PyObject *ret;

        arr = (PyArrayObject *)PyArray_FromScalar(self, NULL);
        if (arr==NULL) return NULL;
        ret = PyObject_Str((PyObject *)arr);
        Py_DECREF(arr);
        return ret;
}
/**begin repeat

#name=float, double, longdouble#
#NAME=FLOAT, DOUBLE, LONGDOUBLE#
#PREFIX=NPY_,NPY_,NPY_#
*/
static void
format_@name@(char *buf, size_t buflen, @name@ val,
                  unsigned int precision)
{
        char *cp;

        PyOS_snprintf(buf, buflen, "%.*" @PREFIX@@NAME@_FMT, precision, val);
        cp = buf;
        if (*cp == '-')
                cp++;
        for (; *cp != '\0'; cp++) {
                if (!isdigit(Py_CHARMASK(*cp)))
                        break;
        }
        if (*cp == '\0') {
                *cp++ = '.';
                *cp++ = '0';
                *cp++ = '\0';
        }
}



And the command I ran to get to this point was:

  python setup.py config --noisy --cc=/opt/intel/cce/10.0.025/bin/icc --compiler=intel --fcompiler=intel build_clib build_ext

Thank you,
Glen Mabey


More information about the Numpy-discussion mailing list