Home > Back-end >  CUDA programming Doppia about the host
CUDA programming Doppia about the host

Time:09-23

 # # ifndef GEOMETRY_HPP 
# define GEOMETRY_HPP

#include

//# include & lt; The boost/geometry/geometries'/point_xy. Hpp>
//# include & lt; The boost/geometry/geometries'/box. Hpp>

//little was catnip to get the proper compilation inside and outside the CUDA NVCC compiler
# if defined (USE_GPU)
#include
# the else//not defined (USE_GPU)
# if not defined (__device__)
# define __device__
# endif
# if not defined (__host__)
# define __host__
# endif
# endif//defined (USE_GPU)

The namespace doppia {

The namespace geometry {
///This namespace contains simplified versions of
///boost: : geometry: : model: : d2: : point_xy & lt;> And boost: : geometry: : model: : box<>

//In order to reuse the same datastructures In the CUDA code,
//we define our simplified point and box classes, which conform to the boost: : geometry API,
//but do not include lexical_cast in one of its dark corners
//typedef boost: : geometry: : model: : d2: : point_xy & lt; Coordinate_t & gt; Point_t;
//typedef boost: : geometry: : model: : box
Template
The class point_xy
{
Public:

Typedef CoordinateType coordinate_t;

///the Default constructor, does not initialize anything
__host__ __device__ inline point_xy ()
{}

///Constructor with x/y values
__host__ __device__ inline point_xy (CoordinateType const& X, CoordinateType const& Y)
: m_x (x), m_y (y)
{}

///the Copy constructor
__host__ __device__ inline point_xy (const point_xy & amp; Other)
: m_x (other) (x)), m_y (other) y ())
{}

///Get the x value
-__host__ __device__ inline CoordinateType const& (x) const
{return m_x; }

///Get y - value
__host__ __device__ inline CoordinateType const& Y () const
{return m_y; }

///Set x - value
__host__ __device__ inline void x (CoordinateType const& V)
{m_x=v; }

///Set y - value
__host__ __device__ inline void y (CoordinateType const& V)
{m_y=v; }

Boolean operator==(const point_xy & amp; Other) const
{
Return (m_x==other. M_x) and (m_y==other. M_y);
}

Boolean operator!=(const point_xy & amp; Other) const
{
Return (* this==other)==false;
}

Protected:

CoordinateType m_x, m_y;
};


The above code to use GPU but the compiler complains error
Error C2485: "__host__" : unable to identify the extension feature
Hope to mention the great god, what is the cause of this error may be
  • Related