For my diploma thesis I’m using the grid computing software Condor to distribute complex computations among multiple workstations. After installing Condor on all machines all you have to do is writing a Condor job file and submit this job with Condor’s command line tool “condor_submit”. Condor will copy over the executable (which was specified in that job file) to any idle machine, execute it and copy back any created output files. You don’t have to bother which machines are occupied and you even don’t need an user account on that machine. Condor creates an user account for every job and removes that account when the job is finished. So it’s a quite convenient way to distribute computations.
But you have to write that job file, wait for the job to return and then collect the output files. To automate this wouldn’t it be nice to use a Condor pool out of your code? There is a Java lib which does this. But since I’m writing a C++ app for my diploma thesis I wonder why I could not find something similar written in C++. So I did it myself..
I present the missing Condor C++ Adapter! It’s a C++ library depending on Qt. It incorporates Condor and Condor jobs and is used like this:
Job j1("~/my_working_dir","/usr/local/bin/calculation");
j1.addFileToBeTransfered("~/my_working_dir/data_file");
j1.addArgument("--data data_file");
Condor::getInstance().submit(j1);
while(j1.getState() != _finished){
Sleep(2000);
}
Qt is needed for threading and for its signals and slots. A Job object has signals like started() and finished() which can be connected to your slot instead of using the while(j1.geState() != _finished) loop. So if you have a Qt event loop and a class with some slot you could also write something like this:
connect(&j1, SIGNAL(finished()), this, SLOT(jobFinished());
The code is documented with Qt-style comments which could be read by doxygen.
You can download a tarball here and use this code for your noncommercial as well as commercial projects with out asking or something else (but you need an apropriate Qt licence of course). I will provide an update shortly as soon as I need more features myself..