Thread Subject: how to save data when using remote cluster

Subject: how to save data when using remote cluster

From: chaosheng

Date: 3 Nov, 2009 22:18:03

Message: 1 of 3

hey, I am trying to save data in a file when I run my job on a remote cluster, but i don't know how to save.
This is the script;

clusterHost = '###.###.###.###';
remoteDataLocation = '/home/Matlab';

sched = findResource('scheduler', 'type', 'generic');

set(sched, 'DataLocation', 'F:\Matlab');
set(sched, 'ClusterMatlabRoot', '/share/apps/mtlb');
set(sched, 'HasSharedFilesystem', false);
set(sched, 'ClusterOsType', 'unix');
set(sched, 'GetJobStateFcn', @sgeGetJobState);
set(sched, 'DestroyJobFcn', @sgeDestroyJob);

set(sched, 'SubmitFcn', {@sgeNonSharedSimpleSubmitFcn, clusterHost, remoteDataLocation});

j = createJob(sched);
set(j, 'FileDependencies', {'test.m'});
t = createTask(j,@test,1);

submit(j);

waitForState(j, 'finished');
results = getAllOutputArguments(j);
celldisp(results)

this is test.m which is in my working directory.

function out = test
x = 1;
y = 2;
save('testSaveData.mat','x','y')
out = x+y;

After I run the script I can get the results as results{1} =3. but I couldn't get the file of testSaveData.mat.

Please help me how to save data. Thank you so much.

Subject: how to save data when using remote cluster

From: Edric M Ellis

Date: 4 Nov, 2009 08:35:09

Message: 2 of 3

"chaosheng " <csudeng@126.com> writes:

> hey, I am trying to save data in a file when I run my job on a remote cluster,
> but i don't know how to save.
>
> This is the script; [...]
>
> this is test.m which is in my working directory.
>
> function out = test
> x = 1;
> y = 2;
> save('testSaveData.mat','x','y')
> out = x+y;
>
> After I run the script I can get the results as results{1} =3. but I couldn't
> get the file of testSaveData.mat.

That will save "testSaveData.mat" into the current directory of the workers,
probably not what you want (since that may be a temporary directory
somewhere). I would recommend putting in a full path to some location shared by
the workers and the client, e.g.

save( '/home/me/data/testSaveData.mat', 'x', 'y' );

or similar.

Cheers,

Edric.

Subject: how to save data when using remote cluster

From: chaosheng

Date: 4 Nov, 2009 17:01:03

Message: 3 of 3

That's good. I fixed that problem. thank you!

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
save remote Kaisen deng 3 Nov, 2009 17:19:04
rssFeed for this Thread

Contact us at files@mathworks.com