Nice job using track-allocation to figure out where the problem is.

If you really don't want allocation, then you should investigate Devec.jl or 
InPlaceOps.jl, or write out these steps using loops to access each element of 
those matrices.

--Tim

On Wednesday, November 26, 2014 07:55:59 AM Colin Lea wrote:
> I'm implementing an inference algorithm and am running into memory
> allocation issues that are slowing it down. I created a minimal example
> that resembles my algorithm and see that the problem persists.
> 
> The issue is that Julia is allocating a lot of extra memory when adding
> matrices together. This happens regardless of whether or not I preallocate
> the output matrix.
> 
> Minimal example:
> https://gist.github.com/colincsl/ab44884c5542539f813d
> 
> Memory output of minimal example (using julia --track-allocation=user):
> https://gist.github.com/colincsl/c9c9dd86fca277705873
> 
> Am I misunderstanding something? Should I be performing the operation
> differently?
> 
> One thing I've played with is the matrix C. The indices are a sliding
> window (e.g. use C[t-10:t] for all t). When I remove C from the equation
> the performance increases by a factor of 2.5. However, it still uses more
> memory than expected. Could this be the primary issue?

Reply via email to