speed up computation of huge matrix?
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I need to compute the mean of a huge matrix (20000*20000*time) at several times, Is there any way to speed up the computation when calculating this?
Cheers
0 comentarios
Respuestas (4)
Jan
el 14 de Oct. de 2011
Yes, or no. It depends.
An arry of the size [20000 x 20000 x time] occupies 3.2 GB, if time is 1 and for type DOUBLE. If time is larger, more memory is needed - in contiguous free blocks.
Calculating the MEAN over the 1st dimension is much faster than over the 2nd one, because the memory is processed in contiguos blocks.
Using INT16 values would reduce the memory footprint, but the values must be integer then.
Without any more detailed description, a more specific answer is impossible.
0 comentarios
Edric Ellis
el 14 de Oct. de 2011
As Jan points out, this is very large data. One option is to use distributed arrays with Parallel Computing Toolbox (and MATLAB Distributed Computing Server to spread the computation over the memory of multiple machines). But it may be better yet not to have all of your data in memory at one time.
If you have a capable GPU, you can use gpuArrays. On my NVIDIA C1060, I can calculate the mean of 20000x20000 doubles in 0.04 seconds vs. 0.2 seconds on my CPU (R2011b). A more recent Tesla card such as the C20xx family would probably out-perform this.
5 comentarios
Edric Ellis
el 17 de Oct. de 2011
Building a 3.2GB gpuArray from a CPU array takes about 2.0 seconds on my system. This is why it's important to keep data on the GPU as long as possible, and preferably build it there (there are zeros/ones etc. functions which can build a 3.2GB gpuArray in 0.025 seconds; rand on the GPU is somewhat slower, but still quicker than building on the host and transferring).
Jan
el 17 de Oct. de 2011
@Edric: Thanks for this summary. I've upgraded from a Pentium-M to a dual-core some month ago. Now my experiments with mutli-threading are less abstract. CUDA is the next step.
park minah
el 14 de Oct. de 2011
I think you'd better use 'parallel computing'. It will be make your process speedy, maybe.
0 comentarios
Thomas
el 21 de Oct. de 2011
Use a GPU card and gpuArray. Our Tesla M2070-Q (448 cores, 6GB) performs this in 0.02125 sec.
I have performed a similar (50000*50000) *100 in less than 2 seconds..
0 comentarios
Ver también
Categorías
Más información sobre GPU Computing in MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!