Skip to content

Commit

Permalink
schedule inner our outer parallelism based on number of poses that ne…
Browse files Browse the repository at this point in the history
…eds to be simulated
  • Loading branch information
amock committed Nov 21, 2024
1 parent 234de18 commit 35da461
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "O1DnSimulatorEmbree.hpp"
#include <rmagine/simulation/SimulationResults.hpp>
#include <limits>
#include <omp.h>

#include "embree_common.h"

Expand Down Expand Up @@ -52,7 +53,7 @@ void O1DnSimulatorEmbree::simulate(
const float range_min = m_model->range.min;
const float range_max = m_model->range.max;

#pragma omp parallel for
#pragma omp parallel for if(Tbm.size() >= omp_get_max_threads())
for(size_t pid = 0; pid < Tbm.size(); pid++)
{
const Transform Tbm_ = Tbm[pid];
Expand All @@ -63,6 +64,7 @@ void O1DnSimulatorEmbree::simulate(

const unsigned int glob_shift = pid * m_model->size();

#pragma omp parallel for if(Tbm.size() < omp_get_max_threads())
for(unsigned int vid = 0; vid < m_model->getHeight(); vid++)
{
for(unsigned int hid = 0; hid < m_model->getWidth(); hid++)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "OnDnSimulatorEmbree.hpp"
#include <rmagine/simulation/SimulationResults.hpp>
#include <limits>
#include <omp.h>

#include "embree_common.h"

Expand Down Expand Up @@ -53,7 +54,7 @@ void OnDnSimulatorEmbree::simulate(
const float range_min = m_model->range.min;
const float range_max = m_model->range.max;

#pragma omp parallel for
#pragma omp parallel for if(Tbm.size() >= omp_get_max_threads())
for(size_t pid = 0; pid < Tbm.size(); pid++)
{
const Transform Tbm_ = Tbm[pid];
Expand All @@ -64,6 +65,7 @@ void OnDnSimulatorEmbree::simulate(

const unsigned int glob_shift = pid * m_model->size();

#pragma omp parallel for if(Tbm.size() < omp_get_max_threads())
for(unsigned int vid = 0; vid < m_model->getHeight(); vid++)
{
for(unsigned int hid = 0; hid < m_model->getWidth(); hid++)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "PinholeSimulatorEmbree.hpp"
#include <rmagine/simulation/SimulationResults.hpp>
#include <limits>
#include <omp.h>

#include "embree_common.h"

Expand Down Expand Up @@ -53,7 +54,7 @@ void PinholeSimulatorEmbree::simulate(
const float range_min = m_model->range.min;
const float range_max = m_model->range.max;

#pragma omp parallel for
#pragma omp parallel for if(Tbm.size() >= omp_get_max_threads())
for(size_t pid = 0; pid < Tbm.size(); pid++)
{
const Transform Tbm_ = Tbm[pid];
Expand All @@ -64,6 +65,7 @@ void PinholeSimulatorEmbree::simulate(

const unsigned int glob_shift = pid * m_model->size();

#pragma omp parallel for if(Tbm.size() < omp_get_max_threads())
for(unsigned int vid = 0; vid < m_model->getHeight(); vid++)
{
for(unsigned int hid = 0; hid < m_model->getWidth(); hid++)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "SphereSimulatorEmbree.hpp"
#include <rmagine/simulation/SimulationResults.hpp>
#include <limits>
#include <omp.h>

#include "embree_common.h"

Expand Down Expand Up @@ -54,7 +55,7 @@ void SphereSimulatorEmbree::simulate(
const float range_max = m_model->range.max;


// #pragma omp parallel for
#pragma omp parallel for if(Tbm.size() >= omp_get_max_threads())
for(size_t pid = 0; pid < Tbm.size(); pid++)
{
const Transform Tbm_ = Tbm[pid];
Expand All @@ -65,6 +66,7 @@ void SphereSimulatorEmbree::simulate(

const unsigned int glob_shift = pid * m_model->size();

#pragma omp parallel for if(Tbm.size() < omp_get_max_threads())
for(unsigned int vid = 0; vid < m_model->getHeight(); vid++)
{
for(unsigned int hid = 0; hid < m_model->getWidth(); hid++)
Expand Down

0 comments on commit 35da461

Please sign in to comment.