File Exchange

image thumbnail

PARFOR Progress Monitor v2

version 1.0 (9.97 KB) by

This version is an update of the progress monitor made by Edric Ellis.

19 Downloads

Updated

View License

Original version:
http://www.mathworks.com/matlabcentral/fileexchange/24594-parfor-progress-monitor

This version has a few additional settings:
- progress step size: for loops with a large number of iterations crash in Edric Ellis' implementation.
By setting the progress step size, for example to 1%, crashing of Matlab is prevented.
- width of the screen
- height of the screen

How to start?
In Matlab:
1) go to the directory where you saved the m file
2) change example.m if you want

In the command window:
3) enter matlabpool open
4) enter pctRunOnAll javaaddpath java
5) enter example

Comments and Ratings (20)

Susanne Klein

It sounds to be a very nice and useful tool, but I'm getting the error
Undefined variable "ParforProgsMon" or class "ParforProgsMon.createServer".
Error in ParforProgMon (line 38)
o.JavaBit = ParforProgsMon.createServer( s, N, progressStepSize, width, height );
(Matlab 2017a)
I would be happy to find a solution for my problem.

David

David (view profile)

Jin

Jin (view profile)

This is a very useful tool! I run it on the mac, there is one error:

---------------------
Error using ParforProgMon
Too many input arguments.

Error in example (line 17)
ppm = ParforProgMon('Example: ', N, progressStepSize, 300, 80);

Is anybody helping me figure out how to fix this?

Your code runs well on my computer. But, I get this warning during analysis:

Warning: While loading an object of class 'ParforProgMon':
No method 'createWorker' with matching signature found for class 'ParforProgressMonitor'.

M.M. Pedersen

Great work, thanks.

I'm having trouble deploying the function though. I add the java files to the CTF archive, as suggested by Adam Thomas and the deployed program seems to run fine. However, it hangs when calling ppm.delete().

Any ideas what might be causing this?

Nikolai

Hello I receive the following java error for each iteration of the parfor loop. The progress bar initially comes up, but the increment step never works and the progress bar never updates. Can someone help me understand how to fix this error?

java.net.UnknownHostException: david-pc
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:223)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:431)
at java.net.Socket.connect(Socket.java:527)
at java.net.Socket.connect(Socket.java:476)
at java.net.Socket.<init>(Socket.java:373)
at java.net.Socket.<init>(Socket.java:187)
at ParforProgressMonitor$ProgWorker.increment(ParforProgressMonitor.java:57)

Jerome

Jerome (view profile)

Do you have any idea why this clear all global variables?
Without this waitbar my globals stay fine.

Arwel

Arwel (view profile)

For very large arrays the crash still happens - i.e for an array of 2.5e10 elements (as an array of singles), this still throws "java.lang.IllegalArgumantException: invalid range properties", irrespective of the value of progressStepSize.

very useful in my parallel simulations! by the way, whenever you run parallel simulations where you don't know in advance the number of cycles of the parfor, it would be very useful to have a function to update the total number of cycles given at construction time...

Edmondo

it could be great to have also an estimated remaining time

Adam Thomas

Works perfectly in my application, which is a deployed parallel function.

When deploying a function using this progress monitor note that "pctRunOnAll javaaddpath java" will have no effect, you need to embed the folder containing the java classes into the CTF archive when you compile... then it runs like a charm :)

Thanks

Stephen

I'll answer my own question. 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'];

Ohad

Ohad (view profile)

After figuring out I had to reduce "progressStepSize" for my needs - it really works!

Stephen

I get a "java.net.ConnectException: Connection refused" when I attempt to run this on OSX. Any advice?

Thanks

Stephen

I wonder if this could be enhanced with a button to cancel the jobs. For ex: place a button on the form that sets a variable and when updating the percent done on the jobs, it could return the signal to quit running.

Just a thought from someone who knows nothing about Java. :)

Kevin Moerman

Kevin Moerman (view profile)

Kevin Moerman

Kevin Moerman (view profile)

My previous comment is gone but this was in relation to monotoring progress when using nexted loops or events that occur more than once per parfor loop iteration. E.g.:
parfor i1=1:N1
for i2=1:N2
for i3=1:N3
%increase ppm here if mod(xx,..
end
end
end

Kevin Moerman

Kevin Moerman (view profile)

Got it to work by setting an apropriate N size (N1*N2*N3), I didn't use xx but if the inner for loops are not parfor loops then counters can be used (i.e. something like xx=xx+1 for each inner iteration).

MATLAB Release
MATLAB 7.11 (R2010b)

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

» Watch video