I have experience with parallel loops and sections with OpenMP in C++, but now I need to make the threads go ahead and start a function while one thread keep running a forner function
The function table_builder_1 create a matrix and after all threads finish running, only one thread start to write the matrix in a file (currently all others threads wait for him) .
1. How can I do the threads go ahead and start the function table_builder_2?
2. After the writer thread finish he will join with others?
int main{
Class foo
foo.table_builder_1;
foo.table_builder_2;
return 0;
}
void foo:table_builder_1{
#pragma omp parallel for schedule(dynamic)
for (int i = 0; i < N_size; i++){
for (int j = 0; j < N_size; j++) {
create table
}
}
\\write the table in file:
file.write (Table)
return;
}
Remark: 1. I can’t parallelize the write because the data need to be ordered. 2. The function table_builder_2 do the same as table_builder_1