Thread Subject:
viewing screen output when running batch jobs

Subject: viewing screen output when running batch jobs

From: Jiaming

Date: 14 Jun, 2012 03:08:07

Message: 1 of 3

Hi, I'm using the batch command to run a job on a remote cluster (j=batch(schedobj,'myscript.m','Matlabpool',n))). The job is an optimization routine that takes a very long time (say a week) to finish.

I would like to monitor the progress of the optimization while it is running. However, it seems to me that I have to wait until the job finishes and then use diary(JOBID) to view its screen output.

This makes it extremely difficult for me to monitor the performance of my program. (I will have to be left in the dark for a week to find out if the optimization works well or not). Is there any way to get around it?

In addition, I also have the program dynamically writing a data set to a .mat file, which I could like to be able to access before the program finishes. This is all possible if I do not run the program as a batch job, but is there any way to do it when running as a batch job?

Thanks!

Subject: viewing screen output when running batch jobs

From: Bruno Luong

Date: 14 Jun, 2012 06:43:07

Message: 2 of 3

"Jiaming " <stanley.hartwell@gmail.com> wrote in message <jrbkin$5jp$1@newscl01ah.mathworks.com>...
> Hi, I'm using the batch command to run a job on a remote cluster (j=batch(schedobj,'myscript.m','Matlabpool',n))). The job is an optimization routine that takes a very long time (say a week) to finish.
>
> I would like to monitor the progress of the optimization while it is running. However, it seems to me that I have to wait until the job finishes and then use diary(JOBID) to view its screen output.

Have you used the drawnow() instruction to force the graphic events to be flushed ?

Bruno

Subject: viewing screen output when running batch jobs

From: Edric M Ellis

Date: 14 Jun, 2012 07:01:48

Message: 3 of 3

"Jiaming " <stanley.hartwell@gmail.com> writes:

> Hi, I'm using the batch command to run a job on a remote cluster
> (j=batch(schedobj,'myscript.m','Matlabpool',n))). The job is an optimization
> routine that takes a very long time (say a week) to finish.
>
> I would like to monitor the progress of the optimization while it is
> running. However, it seems to me that I have to wait until the job
> finishes and then use diary(JOBID) to view its screen output.

You're right that currently you do have to wait for the job to complete
before the diary output is available.

> This makes it extremely difficult for me to monitor the performance of my
> program. (I will have to be left in the dark for a week to find out if the
> optimization works well or not). Is there any way to get around it?

For now, I would suggest having your batch job periodically print its
status to a text file. You'll need to work out a location on disk
accessible from the workers and from where you want to monitor things. I
would suggest using fopen/fprintf/fclose for each message to ensure the
file is updated. E.g.

fh = fopen('/path/to/logfile', 'at'); % open for appending text
if fh ~= -1
  fprintf(fh, 'My log message\n');
  fclose(fh);
end

Obviously, you could wrap that up in a simple function to make life a
little simpler.

> In addition, I also have the program dynamically writing a data set to
> a .mat file, which I could like to be able to access before the
> program finishes. This is all possible if I do not run the program as
> a batch job, but is there any way to do it when running as a batch
> job?

It should be possible - where are you saving the .mat file? Why can't
you access it? Do you get an error?

Cheers,

Edric.

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
batch Jiaming 13 Jun, 2012 23:09:09
parallel computing Jiaming 13 Jun, 2012 23:09:09
rssFeed for this Thread

Contact us