BB: Sorting values and returning multiple values
Posted: Wed Mar 12, 2014 3:56 pm
I am using a simple bulletin board setup to parallelize my simulations in hoc. However, I'm struggling with 2 things:
A) I would like to return 2 result values (threshold and conduction speed).
B) I would also like to return/read the input arguments of the pc.submit() corresponding to each set of result values so that I know to which set of parameters they belong.
As you can see, I'm not simply looping through a single parameter, and so I cannot simply sort as shown in the initbatpar.hoc example.
I have a couple of ideas, but not sure if they're doable in hoc:
1) Is there a way to have my function (find_thresh) return multiple values? If so, how do I obtain these values with some variant of pc.retval()? This would address issue A.
2) The Parallel Context intro in the online documentation states that: "The arguments to the function executed by the submit call are also available." If so, how can I access the input arguments (in which case I would know where to store the returned threshold value)? This would address issue B.
3) Both issues could be addressed if the following is allowable: I have a matrix that is defined (and allocated memory) before starting pc.runworker(). Then each job would save its results in its correct location in the results matrix. However, I assume that the parallel processors cannot save a matrix in this fashion, correct?
Barring a more elegant solution, my backup plan is to have each job write its own output file (thus not having to return anything to the master via the bulletin board.
Thank you!
Nikki
A) I would like to return 2 result values (threshold and conduction speed).
B) I would also like to return/read the input arguments of the pc.submit() corresponding to each set of result values so that I know to which set of parameters they belong.
As you can see, I'm not simply looping through a single parameter, and so I cannot simply sort as shown in the initbatpar.hoc example.
I have a couple of ideas, but not sure if they're doable in hoc:
1) Is there a way to have my function (find_thresh) return multiple values? If so, how do I obtain these values with some variant of pc.retval()? This would address issue A.
2) The Parallel Context intro in the online documentation states that: "The arguments to the function executed by the submit call are also available." If so, how can I access the input arguments (in which case I would know where to store the returned threshold value)? This would address issue B.
3) Both issues could be addressed if the following is allowable: I have a matrix that is defined (and allocated memory) before starting pc.runworker(). Then each job would save its results in its correct location in the results matrix. However, I assume that the parallel processors cannot save a matrix in this fashion, correct?
Barring a more elegant solution, my backup plan is to have each job write its own output file (thus not having to return anything to the master via the bulletin board.
Thank you!
Nikki