I'll be keeping this simple.
void func1(){
//gnarly math1
}
void func2(){
//gnarly math2
}
How do I execute this function in parallel using open mp?
EDIT: To be more precise at what the heck I'm writing about. If you have tried using ffmpeg (like trying to convert wav to mp3), it would show you the progress while converting it.
I'm trying to do it without multi threading like this:
for(i=0;i<length;i++) {
double t = (double) i / WAVFILE_SAMPLES_PER_SECOND;
waveform[i] = volume*sin(frequency*t*2*M_PI);
int progress = ( 900 )*b;
if (progress == i){
b++;
printf("Writing: %d/%d amplitude=\"%d\"\n", i, length, __SUM);
}
}
Output:
Writing: 900/88200 amplitude="825"
Writing: 1800/88200 amplitude="1530"
Writing: 2700/88200 amplitude="2011"
Writing: 3600/88200 amplitude="2198"
Writing: 4500/88200 amplitude="2064"
...
real source code is found at https://github.com/harieamjari/kunin
While I totally forgotten about this question of mine, I've found a way a couple of days ago while reading this directives and construct for OPM: https://www.openmp.org/wp-content/uploads/OpenMP-4.5-1115-CPP-web.pdf.
So:
#pragma omp parallel sections
{
#pragma omp section
// func 1
#pragma omp section
{
// func 2
}
}