Print

Print


On Dec 4, 2014, at 10:10 AM, Rodrigo Moreno Garcia <[log in to unmask]> wrote:

> Is there a way to identify different threads in the multithread case so that one thread would only control one simulator instance at a time?

If ECJ spawns threads, it assigns each a unique number starting at 0.  (if it's a single thread, the thread number is 0).  This number is primarily used to identify which random number generator to use (there's an array of them) in the given thread.  Many functions are passed the thread number, and you can use that to determine which thread you're in.

Otherwise, you can always use Thread.currentThread().getID() to give you a unique identifier but I would not rely on it because in-between generations there is no guarantee that you won't wind up with all new threads.

> or is there a way to know in which slave a problem is running in the parallel process case?

You can probably use Java APIs to determine what process ID and machine IP address your slave is running on.  But I'm not sure why you'd really need this.

> Can the master-slave parallel process system be run on one computer or should it be always used in a cluster?

It can easily be run on a single computer.  It's not efficient though -- I'd stick with multithreaded evaluation.  If your plan is to run multiple simulators, I'd fire them up during ECJ's startup sequence.

I've made some tweaks to Section 2.7.2 of the manual discussing multithreaded evaluation and simulators.  I think it might be useful to you -- check it out via SVN.

Sean