I'm running my program in a for loop, passing it varying values of num_threads.
for (( j=1; j<9; j++ ))
do
mpirun -n $j ./my_program
done
I understand that bash will store the return value in $? automatically. However, what I am trying to do is get the runtime for a parallel program when passing it arguments of num_threads=1, so that I can use this value to find the speedup when running this program when num_threads>1. I need to return a double for this, and I had tried to return a double from main():
double main(int argc, char** argv) {
double run_time;
...
return run_time;
}
But it seems that main() can only return an int, and I get a 0 back from my bash script.
time=$?
echo $time
output:
0