Tim wrote:
Thanks Eugene!
My case, after simplified, is to speed up the time-consuming computation in the
loop below by assigning iterations to several nodes in a cluster by MPI. Each
iteration of the loop computes each element of an array. The computation of
each element is independent of others in the array.
int main(int argc, char ** argv)
{
// some operations
f(size);
// some operations
return 0;
}
void f(int size)
{
// some operations
int i;
double * array = new double [size];
for (i = 0; i < size; i++) // need to speed up by MPI.
{
array[i] = complicated_computation(); // time consuming
What are the inputs to complicated_computation()? Does each process
know what the inputs are? Or, do they need to come from the master
process? Are there many inputs?
}
// some operations using all elements in array
delete [] array;
}