Commit b861209a authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Fix nvcc warnings on MSVC

There is a strange nvcc warning in CUDA 7.5 that sometimes happens on MSVC
that causes it to emit a warning for an undefined method that is clearly
defined. The CUDA development team is aware of the problem and is going
to fix it, but these changes will work around the problem for now.

Thanks to Tom Fogal from NVIDIA for these fixes.
parent 876ef118
......@@ -55,57 +55,63 @@ public:
PortalConstType PrepareForInput(bool updateData)
{
try
{
return this->Superclass::PrepareForInput(updateData);
}
{
// This alternate form of PrepareForInput works around an issue
// with nvcc 7.5.
return this->Superclass::template _PrepareForInput<void>(updateData);
}
catch (vtkm::cont::ErrorControlBadAllocation error)
{
{
// Thrust does not seem to be clearing the CUDA error, so do it here.
cudaError_t cudaError = cudaPeekAtLastError();
if (cudaError == cudaErrorMemoryAllocation)
{
{
cudaGetLastError();
}
throw error;
}
throw error;
}
}
VTKM_CONT_EXPORT
PortalType PrepareForInPlace(bool updateData)
{
try
{
return this->Superclass::PrepareForInPlace(updateData);
}
{
// This alternate form of PrepareForInPlace works around an issue
// with nvcc 7.5.
return this->Superclass::template _PrepareForInPlace<void>(updateData);
}
catch (vtkm::cont::ErrorControlBadAllocation error)
{
{
// Thrust does not seem to be clearing the CUDA error, so do it here.
cudaError_t cudaError = cudaPeekAtLastError();
if (cudaError == cudaErrorMemoryAllocation)
{
{
cudaGetLastError();
}
throw error;
}
throw error;
}
}
VTKM_CONT_EXPORT
PortalType PrepareForOutput(vtkm::Id numberOfValues)
{
try
{
return this->Superclass::PrepareForOutput(numberOfValues);
}
{
// This alternate form of PrepareForOutput works around an issue
// with nvcc 7.5.
return this->Superclass::template _PrepareForOutput<void>(numberOfValues);
}
catch (vtkm::cont::ErrorControlBadAllocation error)
{
{
// Thrust does not seem to be clearing the CUDA error, so do it here.
cudaError_t cudaError = cudaPeekAtLastError();
if (cudaError == cudaErrorMemoryAllocation)
{
{
cudaGetLastError();
}
throw error;
}
throw error;
}
}
};
......
......@@ -116,6 +116,14 @@ public:
this->Array.data() + static_cast<difference_type>(this->Array.size()));
}
/// Workaround for nvcc 7.5 compiler warning bug.
template<typename DummyType>
VTKM_CONT_EXPORT
PortalConstType _PrepareForInput(bool updateData)
{
return this->PrepareForInput(updateData);
}
/// Allocates the appropriate size of the array and copies the given data
/// into the array.
///
......@@ -135,6 +143,14 @@ public:
this->Array.data() + static_cast<difference_type>(this->Array.size()));
}
/// Workaround for nvcc 7.5 compiler warning bug.
template<typename DummyType>
VTKM_CONT_EXPORT
PortalType _PrepareForInPlace(bool updateData)
{
return this->PrepareForInPlace(updateData);
}
/// Allocates the array to the given size.
///
VTKM_CONT_EXPORT
......@@ -160,6 +176,14 @@ public:
this->Array.data() + static_cast<difference_type>(this->Array.size()));
}
/// Workaround for nvcc 7.5 compiler warning bug.
template<typename DummyType>
VTKM_CONT_EXPORT
PortalType _PrepareForOutput(vtkm::Id numberOfValues)
{
return this->PrepareForOutput(numberOfValues);
}
/// Allocates enough space in \c storage and copies the data in the
/// device vector into it.
///
......
Supports Markdown
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