From 708bc840b8f883d4572ab1e9856a8477fb21dbdb Mon Sep 17 00:00:00 2001 From: Tomas Maly Date: Mon, 28 Mar 2022 07:44:28 +0200 Subject: [PATCH 1/2] conditional compilation for openmp task on windows --- vts-libs/vts/encoder.cpp | 6 +++++- vts-libs/vts/heightmap.cpp | 4 ++-- vts-libs/vts/storage/change.cpp | 8 ++++---- vts-libs/vts/tileset/driver/aggregated.cpp | 4 ++++ vts-libs/vts/tileset/merge/coverage.cpp | 4 ++-- vts-libs/vts/tileset/tileset.cpp | 2 ++ 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/vts-libs/vts/encoder.cpp b/vts-libs/vts/encoder.cpp index 5a6eef41..dc61031c 100644 --- a/vts-libs/vts/encoder.cpp +++ b/vts-libs/vts/encoder.cpp @@ -379,8 +379,12 @@ void Encoder::Detail::process(const TileId &tileId // compute child node auto childNode(nodeInfo.child(child)); +#ifndef _MSC_VER // omp task is not supported by msvc UTILITY_OMP(task) - process(child, useConstraints, childNode, tile); +#endif + { + process(child, useConstraints, childNode, tile); + } } } diff --git a/vts-libs/vts/heightmap.cpp b/vts-libs/vts/heightmap.cpp index 2822d9a9..8c2e19f8 100644 --- a/vts-libs/vts/heightmap.cpp +++ b/vts-libs/vts/heightmap.cpp @@ -201,8 +201,8 @@ void Morphology::run(int kernelRadius) { const std::size_t total(in_.rows * in_.cols); - UTILITY_OMP(parallel for) - for (std::size_t idx = 0; idx < total; ++idx) { + UTILITY_OMP(parallel for shared(kernelRadius)) + for (std::int64_t idx = 0; idx < (std::int64_t)total; ++idx) { int x = idx % in_.cols; int y = idx / in_.cols; diff --git a/vts-libs/vts/storage/change.cpp b/vts-libs/vts/storage/change.cpp index 149c389f..2719d40a 100644 --- a/vts-libs/vts/storage/change.cpp +++ b/vts-libs/vts/storage/change.cpp @@ -490,14 +490,14 @@ struct Ts { } bool tileindexIdentical(const const_ptrlist &tss) const { - // tile indices are identical if they have same quality for mesh and - // watertighness - const TileIndex::Flag::value_type mask - (TileIndex::Flag::mesh | TileIndex::Flag::watertight); const auto compare([](TileIndex::Flag::value_type v1 , TileIndex::Flag::value_type v2) { + // tile indices are identical if they have same quality for mesh and + // watertighness + const TileIndex::Flag::value_type mask + (TileIndex::Flag::mesh | TileIndex::Flag::watertight); return (v1 & mask) == (v2 & mask); }); diff --git a/vts-libs/vts/tileset/driver/aggregated.cpp b/vts-libs/vts/tileset/driver/aggregated.cpp index 704f377a..6b08c59c 100644 --- a/vts-libs/vts/tileset/driver/aggregated.cpp +++ b/vts-libs/vts/tileset/driver/aggregated.cpp @@ -1123,7 +1123,9 @@ void AggregatedDriver::generateMetatiles(AggregatedOptions &options) UTILITY_OMP(single) traverse(mi, lodRange, [=](TileId tid, QTree::value_type) { +#ifndef _MSC_VER // omp task is not supported by msvc UTILITY_OMP(task) +#endif { // expand shrinked metatile identifiers tid.x <<= mbo; @@ -1181,7 +1183,9 @@ void AggregatedDriver::copyMetatiles(AggregatedOptions &options UTILITY_OMP(single) traverse(mi, lodRange, [=](TileId tid, QTree::value_type) { +#ifndef _MSC_VER // omp task is not supported by msvc UTILITY_OMP(task) +#endif { // expand shrinked metatile identifiers tid.x <<= mbo; diff --git a/vts-libs/vts/tileset/merge/coverage.cpp b/vts-libs/vts/tileset/merge/coverage.cpp index e36eb619..c052f192 100644 --- a/vts-libs/vts/tileset/merge/coverage.cpp +++ b/vts-libs/vts/tileset/merge/coverage.cpp @@ -705,8 +705,8 @@ void Coverage::dilateHm() auto filter([&]() -> void { - UTILITY_OMP(parallel for) - for (std::size_t idx = 0; idx < total; ++idx) { + UTILITY_OMP(parallel for shared(tmp)) + for (std::int64_t idx = 0; idx < (std::int64_t)total; ++idx) { int x(idx % hm.cols); int y(idx / hm.cols); diff --git a/vts-libs/vts/tileset/tileset.cpp b/vts-libs/vts/tileset/tileset.cpp index 93c9e1cc..d6d8312d 100644 --- a/vts-libs/vts/tileset/tileset.cpp +++ b/vts-libs/vts/tileset/tileset.cpp @@ -492,7 +492,9 @@ struct TileSet::Factory return; } +#ifndef _MSC_VER // omp task is not supported by msvc UTILITY_OMP(task) +#endif { bool mesh(mask & TileIndex::Flag::mesh); bool atlas(mask & TileIndex::Flag::atlas); From 49b20140f71fc6ac97396bf6357e8535a9c60edb Mon Sep 17 00:00:00 2001 From: Tomas Maly Date: Wed, 30 Mar 2022 15:24:24 +0200 Subject: [PATCH 2/2] no c-style cast --- vts-libs/vts/heightmap.cpp | 2 +- vts-libs/vts/tileset/merge/coverage.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vts-libs/vts/heightmap.cpp b/vts-libs/vts/heightmap.cpp index 8c2e19f8..2f0cb916 100644 --- a/vts-libs/vts/heightmap.cpp +++ b/vts-libs/vts/heightmap.cpp @@ -202,7 +202,7 @@ void Morphology::run(int kernelRadius) const std::size_t total(in_.rows * in_.cols); UTILITY_OMP(parallel for shared(kernelRadius)) - for (std::int64_t idx = 0; idx < (std::int64_t)total; ++idx) { + for (std::int64_t idx = 0; idx < std::int64_t(total); ++idx) { int x = idx % in_.cols; int y = idx / in_.cols; diff --git a/vts-libs/vts/tileset/merge/coverage.cpp b/vts-libs/vts/tileset/merge/coverage.cpp index c052f192..240c5978 100644 --- a/vts-libs/vts/tileset/merge/coverage.cpp +++ b/vts-libs/vts/tileset/merge/coverage.cpp @@ -706,7 +706,7 @@ void Coverage::dilateHm() auto filter([&]() -> void { UTILITY_OMP(parallel for shared(tmp)) - for (std::int64_t idx = 0; idx < (std::int64_t)total; ++idx) { + for (std::int64_t idx = 0; idx < std::int64_t(total); ++idx) { int x(idx % hm.cols); int y(idx / hm.cols);