Hi,
I am wondering how can I save a codistributed Array, for example, I've a codistributed matrix 3000x3000, and I want to save the first 10 rows of this matrix.
I've tried several command: fwrite, dsave, save, dlmwrite , but none of them works.
Thank you!
Xin
|
|
0
|
|
|
|
Reply
|
Xin
|
6/28/2010 9:42:04 PM |
|
"Xin Xin" <starmuzi@hotmail.com> wrote in message <i0b4vc$o0u$1@fred.mathworks.com>...
> Hi,
>
> I am wondering how can I save a codistributed Array, for example, I've a codistributed matrix 3000x3000, and I want to save the first 10 rows of this matrix.
>
> I've tried several command: fwrite, dsave, save, dlmwrite , but none of them works.
> Thank you!
> Xin
the task seems simple...
now: why does it not work(?)...
eg, how did you use DLMWRITE or SAVE...
us
|
|
0
|
|
|
|
Reply
|
us
|
6/28/2010 9:52:04 PM
|
|
Hi,
I am using the command:
spmd
V_gather = gather( V, 1);
end
dlmwrite('test.dat', V_gather{1}, 'delimiter','\t', 'precision', 16)
where V is my codistributed Array, and it works.
dlmwrite('test.dat', V_gather{1}(1:10,:), 'delimiter','\t', 'precision', 16)
this one won't work unless I let V_gather{1} equal to another matrix, say M.
Now the problem is:
1. when I have a huge matrix V, say 30k x 30k, I am not sure I am able to gather the matrix to a local worker since it is too large.
2. I am not sure whether V_gather{1}=M will cause memory allocation( I am a new user of Matlab)...
Also, Is there a way to directly get the first 10 rows out of a codistributed array and write it to a file?
BTW: if I try to use the dlmwrite in spmd, matlab prompts:
Function is not defined for 'codistributed' inputs
Thank you very much!
Xin
"us " <us@neurol.unizh.ch> wrote in message <i0b5i3$25o$1@fred.mathworks.com>...
> "Xin Xin" <starmuzi@hotmail.com> wrote in message <i0b4vc$o0u$1@fred.mathworks.com>...
> > Hi,
> >
> > I am wondering how can I save a codistributed Array, for example, I've a codistributed matrix 3000x3000, and I want to save the first 10 rows of this matrix.
> >
> > I've tried several command: fwrite, dsave, save, dlmwrite , but none of them works.
> > Thank you!
> > Xin
>
> the task seems simple...
> now: why does it not work(?)...
> eg, how did you use DLMWRITE or SAVE...
>
> us
|
|
0
|
|
|
|
Reply
|
Xin
|
6/28/2010 10:47:04 PM
|
|
"Xin Xin" <starmuzi@hotmail.com> writes:
> I am wondering how can I save a codistributed Array, for example, I've
> a codistributed matrix 3000x3000, and I want to save the first 10 rows
> of this matrix.
>
> I've tried several command: fwrite, dsave, save, dlmwrite , but none
> of them works.
DSAVE should be what you need, but that operates on distributed arrays
(which are the client-side view of codistributed arrays). The reference
page is here:
http://www.mathworks.com/access/helpdesk/help/toolbox/distcomp/dsave.html
You should use it something like this:
spmd
d = codistributed.rand(3000);
end
dsave localFile d
This streams the data from "d" back to the client for saving to disk.
Cheers,
Edric.
|
|
0
|
|
|
|
Reply
|
Edric
|
6/29/2010 7:23:04 AM
|
|
|
3 Replies
224 Views
(page loaded in 0.06 seconds)
|