[eiffel-users] A work distribution class

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[eiffel-users] A work distribution class

Finnian Reilly

Lately I developed a working test example for the work distribution class EL_WORK_DISTRIBUTER. Originally this was created for Gerrit Leder's bioinformatics project, but was not tested on anything until now. For convenience I made two descendants that makes it easier to work with. EL_FUNCTION_DISTRIBUTER and EL_PROCEDURE_DISTRIBUTER.

The purpose is to let you distribute the work of executing agents over some given number of threads without having to manage the details of multi-threading. The example program shows how to use both classes to achieve the same result. The test program is invoked from the test project directory with the command line:

. run_test.sh -work_distributer -logging -term_count 52 -task_count 4 -delta_count 4000000 -thread_count 4


Output is attached. The script needs editing for individual machines as it needs to set LD_LIBRARY_PATH.


The example program takes input arguments so you can play around with various parameters. While it works well enough it is not perfect. If you give it calculations which finish extremely quickly, then the distributer has trouble joining the threads and hangs. It will take some time to work out why this is happening, but for long calculations it works well enough. Setting the thread priority to max. has very little effect on execution time but I thought i would give that option too.

In the attached output you will notice a small variation in the output result of the integral between the single and multi-threaded example. The reason for this is that with a `term_count' of 52, the sine wave is extremely dense, so even a slight variation in the x_delta count make a difference to the integral. With small values for `term_count' the difference is very tiny, 0.0000000001. The integrals are calculated with these functions.

The new classes are in https://github.com/finnianr/Eiffel-Loop but are not yet part of any release.


If someone has the time to implement this distribution class using the SCOOP model, I would be most interested to see it.

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.

distribution-test.png (220K) Download Attachment
Loading...