I'm working on a program that simulates a certain model with several paramters and returns one result value. I want to check how changing each parameter affects the result. What I did before was running the simulation with the base set of paramters to get a baseline and then change one parameter and run it again. Now I found out about fork() and can just run fork() for each set of parameters. This runs a lot faster, so it's preferrable.
I want to return not the absolute result values of each parameter set but the difference to the base. I have learned how to let two processes communicate from http://docstore.mik.ua/orelly/perl/cookbook/ch16_11.htm, but it fails when I try to spawn several forks and get their result back.
in pseudocode:
I want to return not the absolute result values of each parameter set but the difference to the base. I have learned how to let two processes communicate from http://docstore.mik.ua/orelly/perl/cookbook/ch16_11.htm, but it fails when I try to spawn several forks and get their result back.
in pseudocode:
Code:
for parameter = each parameter_set fork() if parent base = sim(base_parameters) wait for return values print return1 - base, return2 - base etc else result = sim(parameter) return result
Comment