mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-07-29 20:37:56 -05:00
fix indendation and needless conversions
This commit is contained in:
@@ -40,7 +40,7 @@ CuBuffer<T>::CuBuffer(const size_t numberOfElements)
|
|||||||
if (numberOfElements < 1) {
|
if (numberOfElements < 1) {
|
||||||
OPM_THROW(std::invalid_argument, "Setting a CuBuffer size to a non-positive number is not allowed");
|
OPM_THROW(std::invalid_argument, "Setting a CuBuffer size to a non-positive number is not allowed");
|
||||||
}
|
}
|
||||||
OPM_CUDA_SAFE_CALL(cudaMalloc(&m_dataOnDevice, sizeof(T) * detail::to_size_t(m_numberOfElements)));
|
OPM_CUDA_SAFE_CALL(cudaMalloc(&m_dataOnDevice, sizeof(T) * m_numberOfElements));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -49,7 +49,7 @@ CuBuffer<T>::CuBuffer(const T* dataOnHost, const size_t numberOfElements)
|
|||||||
{
|
{
|
||||||
|
|
||||||
OPM_CUDA_SAFE_CALL(cudaMemcpy(
|
OPM_CUDA_SAFE_CALL(cudaMemcpy(
|
||||||
m_dataOnDevice, dataOnHost, detail::to_size_t(m_numberOfElements) * sizeof(T), cudaMemcpyHostToDevice));
|
m_dataOnDevice, dataOnHost, m_numberOfElements * sizeof(T), cudaMemcpyHostToDevice));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -60,7 +60,7 @@ CuBuffer<T>::CuBuffer(const CuBuffer<T>& other)
|
|||||||
assertSameSize(other);
|
assertSameSize(other);
|
||||||
OPM_CUDA_SAFE_CALL(cudaMemcpy(m_dataOnDevice,
|
OPM_CUDA_SAFE_CALL(cudaMemcpy(m_dataOnDevice,
|
||||||
other.m_dataOnDevice,
|
other.m_dataOnDevice,
|
||||||
detail::to_size_t(m_numberOfElements) * sizeof(T),
|
m_numberOfElements * sizeof(T),
|
||||||
cudaMemcpyDeviceToDevice));
|
cudaMemcpyDeviceToDevice));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ template <typename T>
|
|||||||
typename CuBuffer<T>::size_type
|
typename CuBuffer<T>::size_type
|
||||||
CuBuffer<T>::size() const
|
CuBuffer<T>::size() const
|
||||||
{
|
{
|
||||||
return detail::to_size_t(m_numberOfElements);
|
return m_numberOfElements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@@ -109,7 +109,7 @@ template <typename T>
|
|||||||
std::vector<T>
|
std::vector<T>
|
||||||
CuBuffer<T>::asStdVector() const
|
CuBuffer<T>::asStdVector() const
|
||||||
{
|
{
|
||||||
std::vector<T> temporary(detail::to_size_t(m_numberOfElements));
|
std::vector<T> temporary(m_numberOfElements);
|
||||||
copyToHost(temporary);
|
copyToHost(temporary);
|
||||||
return temporary;
|
return temporary;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace Opm::cuistl
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
CuView<T>::CuView(std::vector<T>& data)
|
CuView<T>::CuView(std::vector<T>& data)
|
||||||
: CuView(data.data(), detail::to_int(data.size()))
|
: CuView(data.data(), data.size())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ template <typename T>
|
|||||||
std::vector<T>
|
std::vector<T>
|
||||||
CuView<T>::asStdVector() const
|
CuView<T>::asStdVector() const
|
||||||
{
|
{
|
||||||
std::vector<T> temporary(detail::to_size_t(m_numberOfElements));
|
std::vector<T> temporary(m_numberOfElements);
|
||||||
copyToHost(temporary);
|
copyToHost(temporary);
|
||||||
return temporary;
|
return temporary;
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ template <class T>
|
|||||||
void
|
void
|
||||||
CuView<T>::copyToHost(T* dataPointer, size_t numberOfElements) const
|
CuView<T>::copyToHost(T* dataPointer, size_t numberOfElements) const
|
||||||
{
|
{
|
||||||
assertSameSize(detail::to_int(numberOfElements));
|
assertSameSize(numberOfElements);
|
||||||
OPM_CUDA_SAFE_CALL(cudaMemcpy(dataPointer, data(), numberOfElements * sizeof(T), cudaMemcpyDeviceToHost));
|
OPM_CUDA_SAFE_CALL(cudaMemcpy(dataPointer, data(), numberOfElements * sizeof(T), cudaMemcpyDeviceToHost));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user