Skip to content

Commit

Permalink
Add pragma to alternative routing
Browse files Browse the repository at this point in the history
  • Loading branch information
YasmineMoumou committed Aug 26, 2021
1 parent 4ee7d3a commit adfe611
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions connection_scan_algorithm/src/alternatives_routing.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// OpenMP header
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>

#include "calculator.hpp"
#include "constants.hpp"

Expand Down Expand Up @@ -144,9 +150,23 @@ namespace TrRouting
}
}

int nthreads, tid;
/* Fork a team of threads */
std::vector<int> combination;
#pragma omp parallel for private(nthreads, tid)
for (int i = 0; i < allCombinations.size(); i++)
{
/* Obtain thread number */
tid = omp_get_thread_num();
std::cout << "Hello World from thread = " << tid << std::endl;

/* Only master thread does this */
if (tid == 0)
{
nthreads = omp_get_num_threads();
std::cout << "Number of threads = " << nthreads << std::endl;
}

if (alternativesCalculatedCount < maxAlternatives && alternativeSequence - 1 < params.maxValidAlternatives)
{

Expand Down

0 comments on commit adfe611

Please sign in to comment.