You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We see from the above that one thread is writing to 0x000107a039c8 and another is simultaneously writing to the same address. I didn't check if each thread is writing the same value or not.
Here is the relevant code, NB the fire emojis:
template <typename TInputImage, typename TOutputImage, typename TKernel>
void
ObjectMorphologyImageFilter<TInputImage, TOutputImage, TKernel>::DynamicThreadedGenerateData(
const OutputImageRegionType & outputRegionForThread)
{
ImageRegionConstIterator<TInputImage> iRegIter;
ImageRegionIterator<TOutputImage> oRegIter;
iRegIter = ImageRegionConstIterator<InputImageType>(this->GetInput(), outputRegionForThread);
oRegIter = ImageRegionIterator<OutputImageType>(this->GetOutput(), outputRegionForThread);
/* Copy the input image to the output image - then only boundary pixels * need to be changed in the output image */while (!oRegIter.IsAtEnd())
{
if (Math::NotExactlyEquals(oRegIter.Get(), m_ObjectValue))
{
oRegIter.Set(iRegIter.Get());// 🔥🔥🔥🔥 "Previous write of size 2"
}
++oRegIter;
++iRegIter;
}
// Find the boundary "faces"
NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<InputImageType> fC;
typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<InputImageType>::FaceListType faceList =
fC(this->GetInput(), outputRegionForThread, m_Kernel.GetRadius());
// Setup the kernel that spans the immediate neighbors of the current// input pixel - used to determine if that pixel abuts a non-object// pixel, i.e., is a boundary pixelconstexprauto bKernelSize = MakeFilled<RadiusType>(1);
TotalProgressReporter progress(this, this->GetOutput()->GetRequestedRegion().GetNumberOfPixels());
OutputNeighborhoodIteratorType oSNIter;
InputNeighborhoodIteratorType iSNIter;
for (constauto & face : faceList)
{
oSNIter = OutputNeighborhoodIteratorType(m_Kernel.GetRadius(), this->GetOutput(), face);
// No need to overwrite on output...and m_BoundaryCondition is// templated over inputImageType - and cannot be applied to the// output image// oSNIter.OverrideBoundaryCondition(m_BoundaryCondition);
oSNIter.GoToBegin();
iSNIter = InputNeighborhoodIteratorType(bKernelSize, this->GetInput(), face);
iSNIter.OverrideBoundaryCondition(m_BoundaryCondition);
iSNIter.GoToBegin();
while (!iSNIter.IsAtEnd())
{
if (Math::ExactlyEquals(iSNIter.GetCenterPixel(), m_ObjectValue))
{
if (this->IsObjectPixelOnBoundary(iSNIter))
{
this->Evaluate(oSNIter, m_Kernel); // 🔥🔥🔥🔥 "Write of size 2", this Evaluate() calls SetPixel()
}
}
++iSNIter;
++oSNIter;
progress.CompletedPixel();
}
}
}
The text was updated successfully, but these errors were encountered:
seanm
added
the
type:Bug
Inconsistencies or issues which will cause an incorrect result under some or all circumstances
label
Nov 20, 2024
Juts wondering... Could it be that multiple threads share one and the same region as outputRegionForThread? Or at least, could there be any overlap between the output regions of threads?
Otherwise, could it possibly be that input and output image may be one and the same image?
Running the itkParallelSparseFieldLevelSetImageFilterTest test with TSan:
We see from the above that one thread is writing to 0x000107a039c8 and another is simultaneously writing to the same address. I didn't check if each thread is writing the same value or not.
Here is the relevant code, NB the fire emojis:
The text was updated successfully, but these errors were encountered: