Click here to Skip to main content
15,913,722 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,


How to access three different function using OpenMP??
i have three different functions, i need to use/operate using OpenMP - so after three function execution - going to use the three functions OUTPUT in fourth Function as input
Ex A:

int Funct1(int x,int y)
{
  // Some Calculation
}

float Func2(float x, float y)
{
  // some Calculation
}

double Func3(double x,double y)
{
  /// Performs some different operation 
}

double d = Func1 + func2 + func3 ;


How to do?? i am new to this OpenMP
Posted
Comments
Mohibur Rashid 26-Apr-12 1:28am    
What is OpenMP?
Pixel86 26-Apr-12 1:40am    
its Open Multi-Processing - for Parallel processing instead of thread we can use this..

1 solution

You can do something like this:

C++
int a;
float b;
double c;

#pragma omp parallel sections
{
   // Run each section in parallel
   #pragma omp section
   { a = func1(); }
   #pragma omp section
   { b = func2(); }
   #pragma omp section
   { c = func3(); }
}

// We are back in main thread, sum it up
double d = a + b + c;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900