fix indendation and needless conversions

This commit is contained in:
Tobias Meyer Andersen
2024-08-05 11:47:18 +02:00
parent e8ac31da16
commit 62ee7bf495
4 changed files with 14 additions and 14 deletions

View File

@@ -40,7 +40,7 @@ CuBuffer<T>::CuBuffer(const size_t numberOfElements)
if (numberOfElements < 1) {
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>
@@ -49,7 +49,7 @@ CuBuffer<T>::CuBuffer(const T* dataOnHost, const size_t numberOfElements)
{
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>
@@ -60,7 +60,7 @@ CuBuffer<T>::CuBuffer(const CuBuffer<T>& other)
assertSameSize(other);
OPM_CUDA_SAFE_CALL(cudaMemcpy(m_dataOnDevice,
other.m_dataOnDevice,
detail::to_size_t(m_numberOfElements) * sizeof(T),
m_numberOfElements * sizeof(T),
cudaMemcpyDeviceToDevice));
}
@@ -74,7 +74,7 @@ template <typename T>
typename CuBuffer<T>::size_type
CuBuffer<T>::size() const
{
return detail::to_size_t(m_numberOfElements);
return m_numberOfElements;
}
template <typename T>
@@ -109,7 +109,7 @@ template <typename T>
std::vector<T>
CuBuffer<T>::asStdVector() const
{
std::vector<T> temporary(detail::to_size_t(m_numberOfElements));
std::vector<T> temporary(m_numberOfElements);
copyToHost(temporary);
return temporary;
}

View File

@@ -125,7 +125,7 @@ public:
__host__ __device__ T& front()
{
#ifndef NDEBUG
assertHasElements();
assertHasElements();
#endif
return m_dataOnDevice[0];
}
@@ -136,7 +136,7 @@ public:
__host__ __device__ T& back()
{
#ifndef NDEBUG
assertHasElements();
assertHasElements();
#endif
return m_dataOnDevice[m_numberOfElements-1];
}
@@ -147,7 +147,7 @@ public:
__host__ __device__ T front() const
{
#ifndef NDEBUG
assertHasElements();
assertHasElements();
#endif
return m_dataOnDevice[0];
}
@@ -158,7 +158,7 @@ public:
__host__ __device__ T back() const
{
#ifndef NDEBUG
assertHasElements();
assertHasElements();
#endif
return m_dataOnDevice[m_numberOfElements-1];
}

View File

@@ -28,7 +28,7 @@ namespace Opm::cuistl
template <class T>
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>
CuView<T>::asStdVector() const
{
std::vector<T> temporary(detail::to_size_t(m_numberOfElements));
std::vector<T> temporary(m_numberOfElements);
copyToHost(temporary);
return temporary;
}
@@ -58,7 +58,7 @@ template <class T>
void
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));
}

View File

@@ -67,7 +67,7 @@ public:
*/
__host__ __device__ T& operator[](size_t idx){
#ifndef NDEBUG
assertInRange(idx);
assertInRange(idx);
#endif
return m_dataPtr[idx];
}
@@ -79,7 +79,7 @@ public:
*/
__host__ __device__ T operator[](size_t idx) const {
#ifndef NDEBUG
assertInRange(idx);
assertInRange(idx);
#endif
return m_dataPtr[idx];
}