Commit 86561a71 authored by Pierre NARVOR's avatar Pierre NARVOR
Browse files

[cuda] Added compiler check in DeviceVector and HostVector to keep Eigen separated from CUDA

parent 135249e7
......@@ -6,10 +6,12 @@
#include <cuda_runtime.h>
#include <rtac_base/types/common.h>
#include <rtac_base/cuda/utils.h>
#include <rtac_base/types/SharedVector.h>
#ifndef RTAC_CUDACC
#include <rtac_base/types/common.h>
#endif
#include <rtac_base/cuda/utils.h>
namespace rtac { namespace cuda {
......@@ -46,7 +48,6 @@ class DeviceVector
DeviceVector(const DeviceVector<T>& other);
DeviceVector(const HostVector<T>& other);
DeviceVector(const std::vector<T>& other);
DeviceVector(const types::Vector<T>& other);
~DeviceVector();
void copy_from_host(size_t size, const T* data);
......@@ -54,7 +55,11 @@ class DeviceVector
DeviceVector& operator=(const DeviceVector<T>& other);
DeviceVector& operator=(const HostVector<T>& other);
DeviceVector& operator=(const std::vector<T>& other);
#ifndef RTAC_CUDACC
DeviceVector(const types::Vector<T>& other);
DeviceVector& operator=(const types::Vector<T>& other);
#endif
void resize(size_t size);
size_t size() const;
......@@ -107,13 +112,6 @@ DeviceVector<T>::DeviceVector(const std::vector<T>& other) :
*this = other;
}
template <typename T>
DeviceVector<T>::DeviceVector(const types::Vector<T>& other) :
DeviceVector(other.size())
{
*this = other;
}
template <typename T>
DeviceVector<T>::~DeviceVector()
{
......@@ -163,6 +161,14 @@ DeviceVector<T>& DeviceVector<T>::operator=(const std::vector<T>& other)
return *this;
}
#ifndef RTAC_CUDACC
template <typename T>
DeviceVector<T>::DeviceVector(const types::Vector<T>& other) :
DeviceVector(other.size())
{
*this = other;
}
template <typename T>
DeviceVector<T>& DeviceVector<T>::operator=(const types::Vector<T>& other)
{
......@@ -173,6 +179,7 @@ DeviceVector<T>& DeviceVector<T>::operator=(const types::Vector<T>& other)
cudaMemcpyHostToDevice) );
return *this;
}
#endif
template <typename T>
void DeviceVector<T>::allocate(size_t size)
......
......@@ -6,10 +6,12 @@
#include <cuda_runtime.h>
#include <rtac_base/types/common.h>
#include <rtac_base/cuda/utils.h>
#include <rtac_base/types/SharedVector.h>
#include <rtac_base/cuda/utils.h>
#ifndef RTAC_CUDACC
#include <rtac_base/types/common.h>
#endif
namespace rtac { namespace cuda {
......@@ -46,13 +48,16 @@ class HostVector
HostVector(const HostVector<T>& other);
HostVector(const DeviceVector<T>& other);
HostVector(const std::vector<T>& other);
HostVector(const types::Vector<T>& other);
~HostVector();
HostVector& operator=(const HostVector<T>& other);
HostVector& operator=(const DeviceVector<T>& other);
HostVector& operator=(const std::vector<T>& other);
#ifndef RTAC_CUDACC
HostVector(const types::Vector<T>& other);
HostVector& operator=(const types::Vector<T>& other);
#endif
void resize(size_t size);
size_t size() const;
......@@ -113,13 +118,6 @@ HostVector<T>::HostVector(const std::vector<T>& other) :
*this = other;
}
template <typename T>
HostVector<T>::HostVector(const types::Vector<T>& other) :
HostVector(other.size())
{
*this = other;
}
template <typename T>
HostVector<T>::~HostVector()
{
......@@ -159,6 +157,14 @@ HostVector<T>& HostVector<T>::operator=(const std::vector<T>& other)
return *this;
}
#ifndef RTAC_CUDACC
template <typename T>
HostVector<T>::HostVector(const types::Vector<T>& other) :
HostVector(other.size())
{
*this = other;
}
template <typename T>
HostVector<T>& HostVector<T>::operator=(const types::Vector<T>& other)
{
......@@ -169,6 +175,7 @@ HostVector<T>& HostVector<T>::operator=(const types::Vector<T>& other)
cudaMemcpyHostToHost) );
return *this;
}
#endif
template <typename T>
void HostVector<T>::allocate(size_t size)
......
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