> We have a memory problem and wonder if you might be able to help.
>
> We are trying to reslice an fMRI dataset composed of 200 scans of 6
> images with an image matrix of 256 by 256. We have SPM96 installed to
> run on a UNIX Sun Sparc Ultra 2 system with Solaris 2.6.
>
> The error message that we get after the first plane has been resliced is
> : error using \
> out of memory
>
> error in spm_realign.m
> line 688 X1 = X1 -G*(G\X1);
> line 288 spm_realign (P,Flags);
>
> We have 256 Mb of main memory and we have increased the swap space to
> 256 Mb. However, we still obtain the same errors, even though the
> overall size of the swap space should be sufficient.
The adjustment part of the realignment loads a plane from all the images
into memory at the same time. 200 images of size 256*256, using 8 bytes per
voxel means that the data by itself requires 100Mbytes. The computation
of the expression "X1 = X1 -G*(G\X1);", therefore needs more than three
times this amount (100Mbytes for G*(G\X1), 100Mbytes for the original X1,
and 100Mbytes for the new X1).
I'm not sure if it is still the case, but certainly the old SunOS 4.x
manuals recommended that there should be at least twice as much swap
as there is RAM.
>
> We have tested the routines by displaying the matlab variables as the
> reslicing progresses. Although the size of the variables does not
> increase as the reslicer progresses through the series of iterations,
> the amount of available swap space is seen to gradualy decrease by
> approximately 1Mb per volume. We think that the routine reslices all the
> first images of the 200 scans then all the second images etc. At the end
> of the first loop (ie the iterations through the first images) we have
> approximately 5Mb of swap space left, which is not big enough for the X1
> matrix. We think that this is the eventual cause of the crash. In
> addition, the swap space is not being freed when the reslicing routine
> ends.
Because of the way that matlab stores it's variables, it is possible for
memory to be wasted (type "help pack" for more info). You are correct
about the routine reslicing all the first images, then all the second images
etc. It is necessary to do it this way because of the adjustment.
>
> We have two questions:
> 1. Do you know where we might be losing all the swap space? E.g. the X
> matrix is approximately 110 Mb. Is there a way either of reducing or
> splitting it?
In principle, it is not necessary to have an X matrix that is this big. It is
this size because each column in the matrix contains all the voxels from a
plane of data. There is no real reason why each column of the matrix couldn't
be just a single row of voxels. This would reduce the memory requirements
by a factor of 256.
> 2. How do we recompile the .mexsol and .c files to be compatible with
> the dynamic link libraries of Solaris 2.6? Would this help?
This isn't something I have looked into, but I also suspect that it wouldn't
really help a great deal.
All the best,
-John
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|