[Numpy-tickets] [NumPy] #551: numpy.ndarray messed up after unpickling

NumPy numpy-tickets@scipy....
Sat Apr 12 19:44:06 CDT 2008


#551: numpy.ndarray messed up after unpickling
---------------------------------------+------------------------------------
 Reporter:  cotackst                   |        Owner:  somebody
     Type:  defect                     |       Status:  new     
 Priority:  normal                     |    Milestone:  1.0.5   
Component:  numpy.core                 |      Version:  1.0.1   
 Severity:  critical                   |   Resolution:          
 Keywords:  pickle, ndarray, segfault  |  
---------------------------------------+------------------------------------
Comment (by pv):

 ... and a minimal testcase:
 {{{
 $ cat sse2-crash-test.c
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>

 #include "cblas.h"

 void *aligned_malloc(unsigned char align, unsigned char offset, int size)
 {
     char *ptr;
     ptr = malloc(size + offset + align);
     memset(ptr, 0, size + offset + align);
     ptr += (((long)ptr) % align) + offset;
     return (void*)ptr;
 }

 int main() {
     int m = 3, n = 4;
     double *good_a, *bad_a, *b, *c;

     good_a = (double*)aligned_malloc(8, 0, m*n*sizeof(double)); /* m x n
 */
     bad_a  = (double*)aligned_malloc(8, 4, m*n*sizeof(double)); /* m x n
 */
     b      = (double*)aligned_malloc(8, 0, m*sizeof(double));   /* m x 1
 */
     c      = (double*)aligned_malloc(8, 0, n*sizeof(double));   /* n x 1
 */

     /* c := a^T b */

     fprintf(stderr, "good_align: ");
     cblas_dgemv(CblasRowMajor,CblasTrans,m,n, 1.0, good_a, n, b, 1, 0.0,
 c, 1);
     fprintf(stderr, "ok\n");

     fprintf(stderr, "bad_align: ");
     cblas_dgemv(CblasRowMajor,CblasTrans,m,n, 1.0, bad_a, n, b, 1, 0.0, c,
 1);
     fprintf(stderr, "ok\n");

     return 0;
 }

 $ dpkg --list|grep -E 'atlas3.*(sse2|base)'
 ii  atlas3-base     3.6.0-20.6     Automatically Tuned Linear Algebra
 Software,
 ii  atlas3-base-dev 3.6.0-20.6     Automatically Tuned Linear Algebra
 Software,
 ii  atlas3-sse2     3.6.0-20.6     Automatically Tuned Linear Algebra
 Software,
 ii  atlas3-sse2-dev 3.6.0-20.6     Automatically Tuned Linear Algebra
 Software,

 $ gcc -o sse2-crash-test sse2-crash-test.c -lcblas -lm
 $ LD_PRELOAD=/usr/lib/sse2/libcblas.so.3.0 ./sse2-crash-test
 good_align: ok
 bad_align: Segmentation fault
 $ LD_PRELOAD=/usr/lib/libcblas.so.3.0 ./sse2-crash-test
 good_align: ok
 bad_align: ok
 }}}

 Can someone else confirm this?

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/551#comment:22>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list