[Numpy-discussion] "buffer not aligned on 8 byte boundary" errors when running numarray.testall.test()

Todd Miller jmiller at stsci.edu
Thu Jul 8 12:05:02 CDT 2004


On Thu, 2004-07-08 at 13:28, Wendy Langer wrote: 
> Hi there all :)
> 
> I am having trouble with my installation of numarray.  :(
> 
> I am a python newbie and a numarray extreme-newbie, so it could be that I
> don't yet have the first clue what I am doing. ;)
> 
> 
> 
> Python 2.3.3 (#51, Feb 16 2004, 04:07:52) [MSC v.1200 32 bit (Intel)] on
> win32
> numarray 1.0
> 
> 
> The Python I am using is the one that comes with the "Enthought" version
> (www.enthought.com), a distro specifically designed to be useful for
> scientists, so it comes with numerical stuff and scipy and chaco and things
> like that preinstalled.
> 
> I used the windows binary installer. However it came with Numeric and not
> numarray, so I installed numarray "by hand". This seemed to go ok, and it
> seems that there is no problem having both Numeric and numarray in the same
> installation, since they have (obviously) different names (still getting
> used to this whole modules and namespaces &c &c)

I don't normally use SciPy,  but I normally have both numarray and
Numeric installed so there's no inherent conflict there.

> At the bottom of this email I have pasted an example of what it was I was
> trying to do, and the error messages that the interpreter gave me - but
> before anyone bothers reading them in any detail, the essential error seems
> to be as follows:
> 
> error: multiply_Float64_scalar_vector: buffer not aligned on 8 byte
> boundary.

This is a low level exception triggered by a misaligned data buffer. 
It's low level so it's impossible to tell what the real problem is
without more information.

> I have no idea what this means, but I do recall that when I ran the
> numarray.testall.test() procedure after first completing my installation a
> couple of days ago, it  reported a *lot* of problems, many of which sounded
> quite similar to this.

That sounds pretty bad.  Here's roughly how it should look these days:
% python
>>> import numarray.testall as testall
>>> testall.test()
numarray:                               ((0, 1165), (0, 1165))
numarray.records:                       (0, 48)
numarray.strings:                       (0, 176)
numarray.memmap:                        (0, 82)
numarray.objects:                       (0, 105)
numarray.memorytest:                    (0, 16)
numarray.examples.convolve:             ((0, 20), (0, 20), (0, 20), (0,
20))
numarray.convolve:                      (0, 52)
numarray.fft:                           (0, 75)
numarray.linear_algebra:                ((0, 46), (0, 51))
numarray.image:                         (0, 27)
numarray.nd_image:                      (0, 390)
numarray.random_array:                  (0, 53)
numarray.ma:                            (0, 671)

The tuple results for your test should all have leading zeros as above. 
The number of tests varies from release to release.


> I hoped for the best and  thought that perhaps I had "run the test wrong"(!)
> since numarray seemed to be working ok, and I had investigated many of the
> examples in chapters 3 and 4 of the user manual withour any obvious problems
> (chapter 3 = "high level overview" and chapter 4 = "array basics")
> 
> I decided at the time to leave well enough alone until I actually came
> across odd or mysterious behaviour ...however that time has come
> all-too-soon...
> 
> 
> 
> 
> The procedure I am using to run the test is as described on page 11 of the
> excellent user's manual (release 0.8 at
> http://www.pfdubois.com/numpy/numarray.pdf):

There's an updated manual here:
http://prdownloads.sourceforge.net/numpy/numarray-1.0.pdf?download

> --
> Testing your Installation
> Once you have installed numarray, test it with:
> C:\numarray> python
> Python 2.2.2 (#18, Dec 30 2002, 02:26:03) [MSC 32 bit (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
> >>> import numarray.testall as testall
> >>> testall.test()
> numeric: (0, 1115)
> records: (0, 48)
> strings: (0, 166)
> objects: (0, 72)
> memmap: (0, 75)
> Each line in the above output indicates that 0 of X tests failed. X grows
> steadily with each release, so the numbers
> shown above may not be current.
> --
> 
> Anyway, when I ran this, instead of the nice, comforting output above,  I
> got about a million(!) errors and then a final count of 320 failures. This
> number is not always constant - I recall the first time I ran it it was 209.
> [I just ran it again and this time it was 324...it all has a rather
> disturbing air of semi-randomness...]
> 
> 
> So below is the (heavily snipped) output from the testall.test() run, and
> below that is the code where I first noticed a possibly similar error, and
> below *that*  is the output of that code, with the highly suspicous
> error....
> 
> 
> Any suggestions greatly appreciated!

If you've ever had numarray installed before,  go to your site-packages
directory and delete numarray as well as any numarray.pth.  Then
reinstall numarray-1.0.

Also,  just do:

>>> import numarray
>>> numarray

and see what kind of path is involved getting to the numarray module.

> I can give you more info about the setup on my computer and so on if you
> need :)

I think you already included everything important;  the exact variant of
Windows you're using might be helpful;  I'm not aware of any problems
there though.  

It looks like you're on a well supported platform.  I just tested pretty
much the same configuration on Windows 2000 Pro, with Python-2.3.4, and
it worked fine even with SciPy-0.3.

> wendy langer
> 
> 
> ======================================================================
> <output when I ran numarray.testall.test() >
> 

<SNIP>

There's something hugely wrong with your test output.  I've never seen
anything like it other than during development.

> </output when I ran numarray.testall.test() >
> 
> =========================================================================
> <my code>
> ========================
> 
> 
> import numarray
> 
> class anXmatrix:
>     def __init__(self, stepsize = 3):
>         self.stepsize = stepsize
>         self.populate_matrix()
> 
> 
>     def describe(self):
>         print "I am a ", self.__class__
>         print "my stepsize is", self.stepsize
>         print "my matrix is: \n"
>         print self.matrix
> 
>     def populate_matrix(self):
> 
>         def xvalues(i,j):
>             return self.stepsize*j
> 
>         mx = numarray.fromfunction(xvalues, (4,4))
>         self.matrix = mx
> 
> 
> if __name__ == '__main__':
> 
> 
>     print "      "
>     print "Making anXmatrix..."
>     r = anXmatrix(stepsize = 5)
>     r.describe()
>     r = anXmatrix(stepsize = 0.02)
>     r.describe()
> 
> </my code>
> 
> ============================================================================
Here's what I get when I run your code, windows or linux:

Making anXmatrix...
I am a  __main__.anXmatrix
my stepsize is 5
my matrix is:

[[ 0  5 10 15]
 [ 0  5 10 15]
 [ 0  5 10 15]
 [ 0  5 10 15]]
I am a  __main__.anXmatrix
my stepsize is 0.02
my matrix is:

[[ 0.    0.02  0.04  0.06]
 [ 0.    0.02  0.04  0.06]
 [ 0.    0.02  0.04  0.06]
 [ 0.    0.02  0.04  0.06]]

Regards,
Todd





More information about the Numpy-discussion mailing list