1st question:
I wonder how I can parallelize function calls to the same function, but with different input parameters in a for loop. For example (C code):
//a[i] and b[i] are defined as elements of a list with 2 columns and N rows
//i is the row number
#pragma omp parallel
{
char cmd[1000];
#pragma omp for nowait
for(i=0; i<N; i++) {
//call the serial programm
sprintf(cmd, "./serial_program %f %f", a[i], b[i]);
system(cmd);
}
}
If I just apply a pragma omp for (+the omp header of course) nothing happens. Maybe this is not possible with OpenMP, but would it be possible with MPI and how would it look like then? I have experience only with OpenMP so far, but not with MPI. update: defined cmd within parallel region
Status: solved
2nd question:
If i have a OpenMP parallelized program and i want to use it among different nodes within a cluster, how can i distribute the calls among the different nodes with MPI and how would i compile it?
//a[i] and b[i] are defined as elements of a list with 2 columns and N rows
//i is the row number
for(i=0; i<N; i++) {
//call the parallelized program
sprintf(cmd, "./openmp_parallelized_program %f %f", a[i], b[i]);
system(cmd);
}
Status: unsolved
omp_set_num_threads()
)? – stefan#pragma omp parallel for
? You must have#pragma omp parallel
somewhere to let omp spawn threads. – stefan