Skip to content

Commit

Permalink
Fixing compilation in Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
massimim committed Oct 24, 2022
1 parent 1ec449f commit 367f311
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
3 changes: 3 additions & 0 deletions libNeonCore/include/Neon/core/tools/io/IODense_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,14 @@ auto IODense<ExportType, IntType>::maxDiff(const IODense<ExportType, IntType>& a
const auto newDiff = std::abs(valA - valB);
const int threadId = omp_get_thread_num();
if (newDiff > std::get<0>(max_diff[threadId])) {
#pragma omp critical
if (newDiff > std::get<0>(max_diff[threadId])) {
Values& md = max_diff[threadId];
std::get<0>(md) = newDiff;
std::get<1>(md) = idx;
std::get<2>(md) = c;
}
}
},
b);

Expand Down
19 changes: 13 additions & 6 deletions libNeonCore/include/Neon/core/types/vec/vec3d_integer.timp.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@


// $Id$

// $Log$

#pragma once

#include <cmath>
Expand All @@ -13,6 +7,7 @@
#include <string>
#include <type_traits>

#include "Neon/core/types/Macros.h"
// #include <cuda.h>
// #include <cuda_runtime_api.h>

Expand Down Expand Up @@ -686,7 +681,11 @@ void Vec_3d<IntegerType_ta, true, false>::forEach(const self_t&
std::function<void(Integer idxX, Integer idxY, Integer idxZ)> lambda)
{
if constexpr (computeMode_ta == Neon::computeMode_t::par) {
#ifdef NEON_OS_WINDOWS
#pragma omp parallel for
#else
#pragma omp parallel for simd collapse(3)
#endif
for (Integer z = 0; z < len.z; z++) {
for (Integer y = 0; y < len.y; y++) {
for (Integer x = 0; x < len.x; x++) {
Expand All @@ -713,7 +712,11 @@ auto Vec_3d<IntegerType_ta, true, false>::forEach(const Lambda& lambda) const
{
if constexpr (std::is_invocable_v<Lambda, Integer, Integer, Integer>) {
if constexpr (computeMode_ta == Neon::computeMode_t::par) {
#ifdef NEON_OS_WINDOWS
#pragma omp parallel for
#else
#pragma omp parallel for simd collapse(3)
#endif
for (Integer zIdx = 0; zIdx < this->z; zIdx++) {
for (Integer yIdx = 0; yIdx < this->y; yIdx++) {
for (Integer xIdx = 0; xIdx < this->x; xIdx++) {
Expand All @@ -734,7 +737,11 @@ auto Vec_3d<IntegerType_ta, true, false>::forEach(const Lambda& lambda) const
}
if constexpr (std::is_invocable_v<Lambda, Vec_3d<IntegerType_ta, true, false>>) {
if constexpr (computeMode_ta == Neon::computeMode_t::par) {
#ifdef NEON_OS_WINDOWS
#pragma omp parallel for
#else
#pragma omp parallel for simd collapse(3)
#endif
for (Integer zIdx = 0; zIdx < this->z; zIdx++) {
for (Integer yIdx = 0; yIdx < this->y; yIdx++) {
for (Integer xIdx = 0; xIdx < this->x; xIdx++) {
Expand Down
1 change: 1 addition & 0 deletions libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ TEST(coreUt_io, denseDiffRandom)
ASSERT_EQ(maxDiff.z, id.z);
ASSERT_EQ(maxCard, card);
}
A.ioVtk("A", "A");
}

0 comments on commit 367f311

Please sign in to comment.