[SciPy-user] Bus error on Intel mac pro w/Leopard, gcc 4.2, numpy from svn head

Anand Patil anand.prabhakar.patil@gmail....
Tue Jun 17 16:32:38 CDT 2008


On Tue, Jun 17, 2008 at 9:54 PM, Robert Kern <robert.kern@gmail.com> wrote:

> On Tue, Jun 17, 2008 at 14:56, Pauli Virtanen <pav@iki.fi> wrote:
> > Tue, 17 Jun 2008 13:05:23 -0500, Robert Kern wrote:
> >
> > [clip: very long chain of views -> crash]
> >> Yay! Reproducibility!
> >>
> >> http://scipy.org/scipy/numpy/ticket/822
> >
> > It's probably the same as this one:
> > http://scipy.org/scipy/numpy/ticket/466
>
> Yes.
>

Great, glad to hear it's being addressed & thanks again for the help. MCMC
can be a royal hassle; if there's the slightest chance of something going
wrong it'll eventually find it, often after hours or days of normal
operation.

In case it can still be helpful, my patch was to replace many consecutive
manipulations of PyMC variable 'x' as follows:

x.value = new_value
x.value = x.last_value

with:

x.value = new_value
x._value = x.last_value.

That bypassed calls to x.set_value via the property x.value. set_value casts
input arguments to the declared type of x, if provided, and then stores them
as x._value:

    def set_value(self, value):
        # Record new value and increment counter

        if self.verbose > 0:
            print '\t' + self.__name__ + ': value set to ', value

        # Value can't be updated if isdata=True
        if self.isdata:
            raise AttributeError, 'Stochastic '+self.__name__+'\'s value
cannot be updated if isdata flag is set'

        # Save current value as last_value
        # Don't copy because caching depends on the object's reference.
        self.last_value = self._value

        if isinstance(value, ndarray):
            value.flags['W'] = False
            if self.dtype is not None:
                if not self.dtype is value.dtype:
                    self._value = asarray(value,
dtype=self.dtype).view(value.__class__)
                else:
                    self._value = value
            else:
                self._value = value
        elif self.dtype and self.dtype is not object:
            try:
                self._value = self.dtype(value)
            except TypeError:
                self._value = asarray(value, dtype=self.dtype)
        else:
            self._value = value


    value = property(fget=get_value, fset=set_value, doc="Self's current
value.")

Anand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080617/f304287c/attachment.html 


More information about the SciPy-user mailing list