0

i am working on a project that i am trying to use parallel programming with OpenMP. the part is using one of OpenCV functions for image left and right, i want it to happen in parallel inside visual studio i set the Project properties -> C/C++->Language->openmp support to yes.

in my main function use :

#include <omp.h>
#include <iostream>
#include <Windows.h>
#include <time.h>

int main(int argc, char* argv[])
{   
   omp_set_num_threads(2);
   #pragma omp parallel
   {
      int thread_id = omp_get_thread_num();
      if(thread_is == 0){
        //image left calc goes here
      }

      if(thread_id == 1){
        image right calc goes here
      }

   }
   return 0;
}

when benchmarking execution times this is doesn't so stable. is it the currect way the parallelize this tasks? thanks!

orthehelper
  • 4,009
  • 10
  • 40
  • 67

0 Answers0