File Exchange

image thumbnail

PARFOR Progress Monitor

version 1.0.0.1 (7.94 KB) by

A Java progress monitor to track progress through a PARFOR loop running MATLAB® workers

4.57143
9 Ratings

15 Downloads

Updated

View License

A simple Java progress monitor to show a progress bar on the MATLAB client while Parallel Computing Toolbox workers are executing the iterations of a PARFOR loop. This employs a socket connection from the workers back to the MATLAB client to inform the client when an iteration has been executed.
The MATLAB code must be on the MATLAB path of both the client and the workers; additionally, the java classes must be added to the java class path using javaaddpath.

Comments and Ratings (16)

Darryn

Darryn (view profile)

Arthur Dgn

Peter Li

Peter Li (view profile)

@Alexandra, when `javaaddpath` is called it calls `clear java`, which also appears to clear globals. Try putting the java path into your setup on startup so you don't have to worry about it later?

Peter Li

Peter Li (view profile)

Thanks!

I had a little trouble on Linux because my pctconfig hostname was just the machine name and I didn't have anything in /etc/hosts for that. It might be helpful to make the socket connection timeout faster so that in situations like this the thing doesn't just appear to freeze?

It also seems to me that the ProgWorker class isn't strictly necessary. It is sufficient to make the Matlab increment(o) method do something like: s = java.net.Socket(o.HostName, o.Port); s.close(); (assuming you also change the private constructor to save the HostName and Port instead of creating a ProgWorker. This seems a bit nicer to me as you don't have to worry about the javaclasspath of the Workers.

Peter Li

Peter Li (view profile)

Marius

Marius (view profile)

Great tool! Stephen's tip for OSX saved my day.

Eduard

Eduard (view profile)

Stephen

To get this to work on osx, you need to modify the matlab class to append '.local' to the hostname.

o.HostName = [cfg.hostname '.local'];

Alexandra

This is a great tool, but it seems to delete all my global variables which is a bit annoying.
Also, I am of the same opinion as Boris. It is a bit small and I cannot read the full title. A few size options would be nice.

Luke

Luke (view profile)

This is a great little program. However, i also get problems for large loops:

??? No method 'createServer' with matching signature found for class 'ParforProgressMonitor'.

Error in ==> ParforProgMon>ParforProgMon.ParforProgMon at 48
o.JavaBit = ParforProgressMonitor.createServer( s, n );

Boris

Boris (view profile)

Thank you, very usefull!
I have a question though: is it possible to edit the progress bar in some way? In my case even the example won't fully display the word "example' in the upper bar.
It would be nice if the bar could adapt to what it should display or if the user could enter a length (character units?).

Best regards,
Boris

Stefan

Stefan (view profile)

Thank you for your help, now it works.
However, for large values of N (~50000) my Matlab crashes

java.net.SocketException: No buffer space available (maximum connections reached?): connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at ParforProgressMonitor$ProgWorker.increment(ParforProgressMonitor.java:30)

Best wishes,
Stefan

Stefan

Stefan (view profile)

Edric Ellis

Edric Ellis (view profile)

Hi Stefan,
Are you sure you've got the java code on the java path of the workers? I do something like this:
matlabpool local 3
addpath /path/to/stuff
pctRunOnAll javaaddpath /path/to/stuff

Cheers,
Edric.

Stefan

Stefan (view profile)

Nice idea, however it does not work for me. It works fine without matlabpool. With matlabpool it gives the following error within the parfor loop:

??? Error using ==> parallel_function at 594
Error in ==>
ParforProgMon>ParforProgMon.increment at 66
Attempt to reference field of non-structure
array.

Any ideas?

Kind regards,
Stefan

Updates

1.0.0.1

Updated license

MATLAB Release
MATLAB 7.8 (R2009a)
Tags Add Tags
Acknowledgements

Inspired: PARFOR Progress Monitor v2

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video