Commit a3df5401 authored by Robert Maynard's avatar Robert Maynard Committed by Kitware Robot
Browse files

Merge topic 'correct_leaks_found_by_asan'

27426b7b Fix warnings found with clang-8 inside the OpenMP device adapter.
cec9af64 Update the lsan suppression to capture tbb leaks.
8ef2c4be

 TransferInfo doesn't leak when holding VirtualObjectTransferShareWithControl
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland's avatarKenneth Moreland <kmorel@sandia.gov>
Merge-request: !1661
parents f3c038f6 27426b7b
leak:libX11* leak:libX11*
leak:loguru.hpp leak:libtbb*
leak:/usr/lib/x86_64-linux-gnu/openmp* leak:/usr/lib/x86_64-linux-gnu/openmp*
leak:/usr/lib/x86_64-linux-gnu/libopen-pal* leak:/usr/lib/x86_64-linux-gnu/libopen-pal*
leak:loguru::set_thread_name
...@@ -43,9 +43,20 @@ void TransferInfoArray::updateDevice(vtkm::cont::DeviceAdapterId devId, ...@@ -43,9 +43,20 @@ void TransferInfoArray::updateDevice(vtkm::cont::DeviceAdapterId devId,
void TransferInfoArray::releaseDevice() void TransferInfoArray::releaseDevice()
{ {
this->DeviceId = vtkm::cont::DeviceAdapterTagUndefined{}; this->DeviceId = vtkm::cont::DeviceAdapterTagUndefined{};
this->Device = nullptr; //The device transfer state own this pointer this->Device = nullptr; //The device transfer state own this pointer
this->DeviceTransferState = nullptr; //release the device transfer state if (this->DeviceTransferState == nullptr)
this->HostCopyOfDevice.release(); //we own this pointer so release it { //When the DeviceTransferState is a nullptr it means that
//that the device and host share memory. In that case we need to free
//the host copy
this->HostCopyOfDevice.reset(nullptr);
}
else
{
//The DeviceTransferState holds ownership of HostCopyOfDevice so we only
//need to delete DeviceTransferState, as it will do the rest
this->DeviceTransferState = nullptr; //release the device transfer state
this->HostCopyOfDevice.release();
}
} }
void TransferInfoArray::releaseAll() void TransferInfoArray::releaseAll()
......
...@@ -160,7 +160,7 @@ struct CopyIfHelper ...@@ -160,7 +160,7 @@ struct CopyIfHelper
void Initialize(vtkm::Id numValues, vtkm::Id valueSize) void Initialize(vtkm::Id numValues, vtkm::Id valueSize)
{ {
this->NumValues = numValues; this->NumValues = numValues;
this->NumThreads = omp_get_num_threads(); this->NumThreads = static_cast<vtkm::Id>(omp_get_num_threads());
this->ValueSize = valueSize; this->ValueSize = valueSize;
// Evenly distribute pages across the threads. We manually chunk the // Evenly distribute pages across the threads. We manually chunk the
...@@ -168,7 +168,7 @@ struct CopyIfHelper ...@@ -168,7 +168,7 @@ struct CopyIfHelper
ComputeChunkSize( ComputeChunkSize(
this->NumValues, this->NumThreads, 8, valueSize, this->NumChunks, this->ChunkSize); this->NumValues, this->NumThreads, 8, valueSize, this->NumChunks, this->ChunkSize);
this->EndIds.resize(this->NumChunks); this->EndIds.resize(static_cast<std::size_t>(this->NumChunks));
} }
template <typename InIterT, typename StencilIterT, typename OutIterT, typename PredicateT> template <typename InIterT, typename StencilIterT, typename OutIterT, typename PredicateT>
...@@ -190,7 +190,7 @@ struct CopyIfHelper ...@@ -190,7 +190,7 @@ struct CopyIfHelper
} }
} }
this->EndIds[chunk] = outPos; this->EndIds[static_cast<std::size_t>(chunk)] = outPos;
} }
template <typename OutIterT> template <typename OutIterT>
...@@ -200,7 +200,7 @@ struct CopyIfHelper ...@@ -200,7 +200,7 @@ struct CopyIfHelper
for (vtkm::Id i = 1; i < this->NumChunks; ++i) for (vtkm::Id i = 1; i < this->NumChunks; ++i)
{ {
vtkm::Id chunkStart = std::min(i * this->ChunkSize, this->NumValues); vtkm::Id chunkStart = std::min(i * this->ChunkSize, this->NumValues);
vtkm::Id chunkEnd = this->EndIds[i]; vtkm::Id chunkEnd = this->EndIds[static_cast<std::size_t>(i)];
vtkm::Id numValuesToCopy = chunkEnd - chunkStart; vtkm::Id numValuesToCopy = chunkEnd - chunkStart;
if (numValuesToCopy > 0 && chunkStart != endPos) if (numValuesToCopy > 0 && chunkStart != endPos)
{ {
...@@ -308,7 +308,7 @@ struct ReduceHelper ...@@ -308,7 +308,7 @@ struct ReduceHelper
accum = f(accum, data[i]); accum = f(accum, data[i]);
} }
threadData[tid] = accum; threadData[static_cast<std::size_t>(tid)] = accum;
} }
} // end parallel } // end parallel
...@@ -565,11 +565,11 @@ private: ...@@ -565,11 +565,11 @@ private:
this->NumValues, numThreads, chunksPerThread, sizeof(ValueType), numChunks, this->LeafSize); this->NumValues, numThreads, chunksPerThread, sizeof(ValueType), numChunks, this->LeafSize);
// Compute an upper-bound of the number of nodes in the tree: // Compute an upper-bound of the number of nodes in the tree:
size_t numNodes = numChunks; std::size_t numNodes = static_cast<std::size_t>(numChunks);
while (numChunks > 1) while (numChunks > 1)
{ {
numChunks = (numChunks + 1) / 2; numChunks = (numChunks + 1) / 2;
numNodes += numChunks; numNodes += static_cast<std::size_t>(numChunks);
} }
this->Nodes.resize(numNodes); this->Nodes.resize(numNodes);
this->NextNode = 0; this->NextNode = 0;
......
...@@ -160,11 +160,11 @@ private: ...@@ -160,11 +160,11 @@ private:
numVals, numThreads, chunksPerThread, sizeof(ValueType), numChunks, this->LeafSize); numVals, numThreads, chunksPerThread, sizeof(ValueType), numChunks, this->LeafSize);
// Compute an upper-bound of the number of nodes in the tree: // Compute an upper-bound of the number of nodes in the tree:
size_t numNodes = numChunks; std::size_t numNodes = static_cast<std::size_t>(numChunks);
while (numChunks > 1) while (numChunks > 1)
{ {
numChunks = (numChunks + 1) / 2; numChunks = (numChunks + 1) / 2;
numNodes += numChunks; numNodes += static_cast<std::size_t>(numChunks);
} }
this->Nodes.resize(numNodes); this->Nodes.resize(numNodes);
this->NextNode = 0; this->NextNode = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment