Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

conditional compilation for openmp task on windows #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion vts-libs/vts/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions vts-libs/vts/heightmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ void Morphology<Operator>::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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If kernel radius is not modidifier, shouldn't it be firstprivate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shared preserves the same meaning as before. i do not change program logic, just make it compile with msvc (this is a workaround for a bug in the compiler)

for (std::int64_t idx = 0; idx < std::int64_t(total); ++idx) {
int x = idx % in_.cols;
int y = idx / in_.cols;

Expand Down
8 changes: 4 additions & 4 deletions vts-libs/vts/storage/change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
4 changes: 4 additions & 0 deletions vts-libs/vts/tileset/driver/aggregated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions vts-libs/vts/tileset/merge/coverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions vts-libs/vts/tileset/tileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down