Code quality: Added consistency between int_t and size_t. Fixed warnings for Win64
This commit is contained in:
@@ -20,7 +20,7 @@ class ISAACAPI Buffer
|
|||||||
friend class Kernel;
|
friend class Kernel;
|
||||||
public:
|
public:
|
||||||
Buffer(cl_mem Buffer, bool take_ownership = true);
|
Buffer(cl_mem Buffer, bool take_ownership = true);
|
||||||
Buffer(Context const & context, int_t size);
|
Buffer(Context const & context, size_t size);
|
||||||
Context const & context() const;
|
Context const & context() const;
|
||||||
bool operator<(Buffer const &) const;
|
bool operator<(Buffer const &) const;
|
||||||
bool operator==(Buffer const &) const;
|
bool operator==(Buffer const &) const;
|
||||||
|
@@ -19,7 +19,7 @@ enum leaf_t
|
|||||||
|
|
||||||
class mapped_object;
|
class mapped_object;
|
||||||
|
|
||||||
typedef std::pair<int_t, leaf_t> mapping_key;
|
typedef std::pair<size_t, leaf_t> mapping_key;
|
||||||
typedef std::map<mapping_key, std::shared_ptr<mapped_object> > mapping_type;
|
typedef std::map<mapping_key, std::shared_ptr<mapped_object> > mapping_type;
|
||||||
|
|
||||||
/** @brief Mapped Object
|
/** @brief Mapped Object
|
||||||
@@ -46,10 +46,10 @@ protected:
|
|||||||
public:
|
public:
|
||||||
struct node_info
|
struct node_info
|
||||||
{
|
{
|
||||||
node_info(mapping_type const * _mapping, array_expression const * _array_expression, int_t _root_idx);
|
node_info(mapping_type const * _mapping, array_expression const * _array_expression, size_t _root_idx);
|
||||||
mapping_type const * mapping;
|
mapping_type const * mapping;
|
||||||
isaac::array_expression const * array_expression;
|
isaac::array_expression const * array_expression;
|
||||||
int_t root_idx;
|
size_t root_idx;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -99,7 +99,7 @@ class mapped_dot : public mapped_object, public binary_leaf
|
|||||||
public:
|
public:
|
||||||
mapped_dot(std::string const & scalartype, unsigned int id, node_info info, std::string const & type_key);
|
mapped_dot(std::string const & scalartype, unsigned int id, node_info info, std::string const & type_key);
|
||||||
|
|
||||||
int_t root_idx() const;
|
size_t root_idx() const;
|
||||||
isaac::array_expression const & array_expression() const;
|
isaac::array_expression const & array_expression() const;
|
||||||
array_expression::node root_node() const;
|
array_expression::node root_node() const;
|
||||||
bool is_index_dot() const;
|
bool is_index_dot() const;
|
||||||
|
@@ -23,14 +23,14 @@ public:
|
|||||||
public:
|
public:
|
||||||
tree(rapidjson::Value const & treerep);
|
tree(rapidjson::Value const & treerep);
|
||||||
std::vector<float> const & predict(std::vector<int_t> const & x) const;
|
std::vector<float> const & predict(std::vector<int_t> const & x) const;
|
||||||
int_t D() const;
|
size_t D() const;
|
||||||
private:
|
private:
|
||||||
std::vector<int> children_left_;
|
std::vector<int> children_left_;
|
||||||
std::vector<int> children_right_;
|
std::vector<int> children_right_;
|
||||||
std::vector<float> threshold_;
|
std::vector<float> threshold_;
|
||||||
std::vector<float> feature_;
|
std::vector<float> feature_;
|
||||||
std::vector<std::vector<float> > value_;
|
std::vector<std::vector<float> > value_;
|
||||||
int_t D_;
|
size_t D_;
|
||||||
};
|
};
|
||||||
|
|
||||||
random_forest(rapidjson::Value const & estimators);
|
random_forest(rapidjson::Value const & estimators);
|
||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
std::vector<tree> const & estimators() const;
|
std::vector<tree> const & estimators() const;
|
||||||
private:
|
private:
|
||||||
std::vector<tree> estimators_;
|
std::vector<tree> estimators_;
|
||||||
int_t D_;
|
size_t D_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ array::array(int_t shape0, numeric_type dtype, driver::Buffer data, int_t start,
|
|||||||
|
|
||||||
template<class DT>
|
template<class DT>
|
||||||
array::array(std::vector<DT> const & x, driver::Context const & context):
|
array::array(std::vector<DT> const & x, driver::Context const & context):
|
||||||
dtype_(to_numeric_type<DT>::value), shape_(x.size(), 1), start_(0, 0, 0, 0), stride_(1, 1, 1, 1), ld_(shape_[0]),
|
dtype_(to_numeric_type<DT>::value), shape_((int_t)x.size(), 1), start_(0, 0, 0, 0), stride_(1, 1, 1, 1), ld_(shape_[0]),
|
||||||
context_(context), data_(context, size_of(dtype_)*dsize())
|
context_(context), data_(context, size_of(dtype_)*dsize())
|
||||||
{ *this = x; }
|
{ *this = x; }
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ Buffer::Buffer(cl_mem buffer, bool take_ownership) : backend_(OPENCL), context_(
|
|||||||
h_.cl() = buffer;
|
h_.cl() = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer::Buffer(Context const & context, int_t size) : backend_(context.backend_), context_(context), h_(backend_, true)
|
Buffer::Buffer(Context const & context, size_t size) : backend_(context.backend_), context_(context), h_(backend_, true)
|
||||||
{
|
{
|
||||||
switch(backend_)
|
switch(backend_)
|
||||||
{
|
{
|
||||||
|
@@ -341,7 +341,7 @@ inline typename detail::return_type<cl_program, CL_PROGRAM_BINARIES>::Result inf
|
|||||||
{
|
{
|
||||||
std::vector<unsigned char *> res;
|
std::vector<unsigned char *> res;
|
||||||
std::vector<size_t> sizes = info<CL_PROGRAM_BINARY_SIZES>(handle);
|
std::vector<size_t> sizes = info<CL_PROGRAM_BINARY_SIZES>(handle);
|
||||||
for(unsigned int s: sizes)
|
for(size_t s: sizes)
|
||||||
res.push_back(new unsigned char[s]);
|
res.push_back(new unsigned char[s]);
|
||||||
clGetProgramInfo(handle, CL_PROGRAM_BINARIES, sizeof(unsigned char**), (void*)res.data(), NULL);
|
clGetProgramInfo(handle, CL_PROGRAM_BINARIES, sizeof(unsigned char**), (void*)res.data(), NULL);
|
||||||
return res;
|
return res;
|
||||||
|
@@ -77,14 +77,14 @@ void Kernel::setSizeArg(unsigned int index, size_t N)
|
|||||||
#ifdef ISAAC_WITH_CUDA
|
#ifdef ISAAC_WITH_CUDA
|
||||||
case CUDA:
|
case CUDA:
|
||||||
{
|
{
|
||||||
int NN = N;
|
int NN = static_cast<cl_int>(N);
|
||||||
setArg(index, sizeof(int), &NN);
|
setArg(index, sizeof(int), &NN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case OPENCL:
|
case OPENCL:
|
||||||
{
|
{
|
||||||
cl_int NN = N;
|
cl_int NN = static_cast<cl_int>(N);
|
||||||
setArg(index, 4, &NN);
|
setArg(index, 4, &NN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -118,9 +118,9 @@ Program::Program(Context const & context, std::string const & source) : backend_
|
|||||||
buffer.resize(len);
|
buffer.resize(len);
|
||||||
cached.read((char*)buffer.data(), std::streamsize(len));
|
cached.read((char*)buffer.data(), std::streamsize(len));
|
||||||
char* cbuffer = buffer.data();
|
char* cbuffer = buffer.data();
|
||||||
h_.cl() = clCreateProgramWithBinary(context_.h_.cl(), devices.size(), devices.data(), &len, (const unsigned char **)&cbuffer, NULL, &err);
|
h_.cl() = clCreateProgramWithBinary(context_.h_.cl(), static_cast<cl_uint>(devices.size()), devices.data(), &len, (const unsigned char **)&cbuffer, NULL, &err);
|
||||||
ocl::check(err);
|
ocl::check(err);
|
||||||
ocl::check(clBuildProgram(h_.cl(), devices.size(), devices.data(), build_opt.c_str(), NULL, NULL));
|
ocl::check(clBuildProgram(h_.cl(), static_cast<cl_uint>(devices.size()), devices.data(), build_opt.c_str(), NULL, NULL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ Program::Program(Context const & context, std::string const & source) : backend_
|
|||||||
const char * csrc = source.c_str();
|
const char * csrc = source.c_str();
|
||||||
h_.cl() = clCreateProgramWithSource(context_.h_.cl(), 1, &csrc, &srclen, &err);
|
h_.cl() = clCreateProgramWithSource(context_.h_.cl(), 1, &csrc, &srclen, &err);
|
||||||
try{
|
try{
|
||||||
ocl::check(clBuildProgram(h_.cl(), devices.size(), devices.data(), build_opt.c_str(), NULL, NULL));
|
ocl::check(clBuildProgram(h_.cl(), static_cast<cl_uint>(devices.size()), devices.data(), build_opt.c_str(), NULL, NULL));
|
||||||
}catch(ocl::exception::build_program_failure const &){
|
}catch(ocl::exception::build_program_failure const &){
|
||||||
for(std::vector<cl_device_id>::const_iterator it = devices.begin(); it != devices.end(); ++it)
|
for(std::vector<cl_device_id>::const_iterator it = devices.begin(); it != devices.end(); ++it)
|
||||||
{
|
{
|
||||||
|
4
lib/external/rapidjson/to_array.hpp
vendored
4
lib/external/rapidjson/to_array.hpp
vendored
@@ -12,7 +12,7 @@ std::vector<T> to_int_array(rapidjson::Value const & a)
|
|||||||
{
|
{
|
||||||
size_t N = a.Size();
|
size_t N = a.Size();
|
||||||
std::vector<T> res(N);
|
std::vector<T> res(N);
|
||||||
for(size_t i = 0 ; i < N ; ++i) res[i] = a[i].GetInt();
|
for(rapidjson::SizeType i = 0 ; i < N ; ++i) res[i] = a[i].GetInt();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ std::vector<T> to_float_array(rapidjson::Value const & a)
|
|||||||
{
|
{
|
||||||
size_t N = a.Size();
|
size_t N = a.Size();
|
||||||
std::vector<T> res(N);
|
std::vector<T> res(N);
|
||||||
for(size_t i = 0 ; i < N ; ++i) res[i] = a[i].GetDouble();
|
for(rapidjson::SizeType i = 0 ; i < N ; ++i) res[i] = a[i].GetDouble();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ void mapped_object::register_attribute(std::string & attribute, std::string cons
|
|||||||
keywords_[key] = attribute;
|
keywords_[key] = attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
mapped_object::node_info::node_info(mapping_type const * _mapping, isaac::array_expression const * _array_expression, int_t _root_idx) :
|
mapped_object::node_info::node_info(mapping_type const * _mapping, isaac::array_expression const * _array_expression, size_t _root_idx) :
|
||||||
mapping(_mapping), array_expression(_array_expression), root_idx(_root_idx) { }
|
mapping(_mapping), array_expression(_array_expression), root_idx(_root_idx) { }
|
||||||
|
|
||||||
mapped_object::mapped_object(std::string const & scalartype, unsigned int id, std::string const & type_key) : type_key_(type_key)
|
mapped_object::mapped_object(std::string const & scalartype, unsigned int id, std::string const & type_key) : type_key_(type_key)
|
||||||
@@ -111,7 +111,7 @@ mapped_dot::mapped_dot(std::string const & scalartype, unsigned int id, node_inf
|
|||||||
mapped_object(scalartype, id, type_key), binary_leaf(info)
|
mapped_object(scalartype, id, type_key), binary_leaf(info)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
int_t mapped_dot::root_idx() const
|
size_t mapped_dot::root_idx() const
|
||||||
{ return info_.root_idx; }
|
{ return info_.root_idx; }
|
||||||
|
|
||||||
isaac::array_expression const & mapped_dot::array_expression() const
|
isaac::array_expression const & mapped_dot::array_expression() const
|
||||||
|
@@ -108,7 +108,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(isaac::array_expression const & array_expression, int_t root_idx, leaf_t leaf_t) const
|
void operator()(isaac::array_expression const & array_expression, size_t root_idx, leaf_t leaf_t) const
|
||||||
{
|
{
|
||||||
array_expression::node const & root_node = array_expression.tree()[root_idx];
|
array_expression::node const & root_node = array_expression.tree()[root_idx];
|
||||||
if (leaf_t==LHS_NODE_TYPE && root_node.lhs.type_family != COMPOSITE_OPERATOR_FAMILY)
|
if (leaf_t==LHS_NODE_TYPE && root_node.lhs.type_family != COMPOSITE_OPERATOR_FAMILY)
|
||||||
|
@@ -12,7 +12,7 @@ namespace templates
|
|||||||
class map_functor : public traversal_functor
|
class map_functor : public traversal_functor
|
||||||
{
|
{
|
||||||
|
|
||||||
numeric_type get_numeric_type(isaac::array_expression const * array_expression, int_t root_idx) const
|
numeric_type get_numeric_type(isaac::array_expression const * array_expression, size_t root_idx) const
|
||||||
{
|
{
|
||||||
array_expression::node const * root_node = &array_expression->tree()[root_idx];
|
array_expression::node const * root_node = &array_expression->tree()[root_idx];
|
||||||
while (root_node->lhs.dtype==INVALID_NUMERIC_TYPE)
|
while (root_node->lhs.dtype==INVALID_NUMERIC_TYPE)
|
||||||
@@ -21,7 +21,7 @@ class map_functor : public traversal_functor
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
std::shared_ptr<mapped_object> binary_leaf(isaac::array_expression const * array_expression, int_t root_idx, mapping_type const * mapping) const
|
std::shared_ptr<mapped_object> binary_leaf(isaac::array_expression const * array_expression, size_t root_idx, mapping_type const * mapping) const
|
||||||
{
|
{
|
||||||
return std::shared_ptr<mapped_object>(new T(to_string(array_expression->dtype()), binder_.get(), mapped_object::node_info(mapping, array_expression, root_idx)));
|
return std::shared_ptr<mapped_object>(new T(to_string(array_expression->dtype()), binder_.get(), mapped_object::node_info(mapping, array_expression, root_idx)));
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(isaac::array_expression const & array_expression, int_t root_idx, leaf_t leaf_t) const
|
void operator()(isaac::array_expression const & array_expression, size_t root_idx, leaf_t leaf_t) const
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
mapping_type::key_type key(root_idx, leaf_t);
|
mapping_type::key_type key(root_idx, leaf_t);
|
||||||
|
@@ -27,7 +27,7 @@ std::vector<float> const & random_forest::tree::predict(std::vector<int_t> const
|
|||||||
return value_[idx];
|
return value_[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
int_t random_forest::tree::D() const { return D_; }
|
size_t random_forest::tree::D() const { return D_; }
|
||||||
|
|
||||||
random_forest::random_forest(rapidjson::Value const & estimators)
|
random_forest::random_forest(rapidjson::Value const & estimators)
|
||||||
{
|
{
|
||||||
@@ -42,10 +42,10 @@ std::vector<float> random_forest::predict(std::vector<int_t> const & x) const
|
|||||||
for(const auto & elem : estimators_)
|
for(const auto & elem : estimators_)
|
||||||
{
|
{
|
||||||
std::vector<float> const & subres = elem.predict(x);
|
std::vector<float> const & subres = elem.predict(x);
|
||||||
for(int_t i = 0 ; i < D_ ; ++i)
|
for(size_t i = 0 ; i < D_ ; ++i)
|
||||||
res[i] += subres[i];
|
res[i] += subres[i];
|
||||||
}
|
}
|
||||||
for(int_t i = 0 ; i < D_ ; ++i)
|
for(size_t i = 0 ; i < D_ ; ++i)
|
||||||
res[i] /= estimators_.size();
|
res[i] /= estimators_.size();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@@ -53,8 +53,8 @@ extern "C"
|
|||||||
cl_uint numEventsInWaitList, const cl_event *eventWaitList, \
|
cl_uint numEventsInWaitList, const cl_event *eventWaitList, \
|
||||||
cl_event *events) \
|
cl_event *events) \
|
||||||
{ \
|
{ \
|
||||||
is::array x(N, TYPE_ISAAC, is::driver::Buffer(mx,false), (is::int_t)offx, incx); \
|
is::array x((is::int_t)N, TYPE_ISAAC, is::driver::Buffer(mx,false), (is::int_t)offx, incx); \
|
||||||
is::array y(N, TYPE_ISAAC, is::driver::Buffer(my,false), (is::int_t)offy, incy); \
|
is::array y((is::int_t)N, TYPE_ISAAC, is::driver::Buffer(my,false), (is::int_t)offy, incy); \
|
||||||
execute(is::assign(y, alpha*x + y), y.context(), numCommandQueues, commandQueues, numEventsInWaitList, eventWaitList, events); \
|
execute(is::assign(y, alpha*x + y), y.context(), numCommandQueues, commandQueues, numEventsInWaitList, eventWaitList, events); \
|
||||||
return clblasSuccess; \
|
return clblasSuccess; \
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ extern "C"
|
|||||||
cl_uint numCommandQueues, cl_command_queue *commandQueues,\
|
cl_uint numCommandQueues, cl_command_queue *commandQueues,\
|
||||||
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *events)\
|
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *events)\
|
||||||
{\
|
{\
|
||||||
is::array x(N, TYPE_ISAAC, is::driver::Buffer(mx,false), (is::int_t)offx, incx);\
|
is::array x((is::int_t)N, TYPE_ISAAC, is::driver::Buffer(mx,false), (is::int_t)offx, incx);\
|
||||||
execute(is::assign(x, alpha*x), x.context(), numCommandQueues, commandQueues, numEventsInWaitList, eventWaitList, events);\
|
execute(is::assign(x, alpha*x), x.context(), numCommandQueues, commandQueues, numEventsInWaitList, eventWaitList, events);\
|
||||||
return clblasSuccess;\
|
return clblasSuccess;\
|
||||||
}
|
}
|
||||||
@@ -85,8 +85,8 @@ extern "C"
|
|||||||
cl_uint numCommandQueues, cl_command_queue *commandQueues,\
|
cl_uint numCommandQueues, cl_command_queue *commandQueues,\
|
||||||
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *events)\
|
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *events)\
|
||||||
{\
|
{\
|
||||||
const is::array x(N, TYPE_ISAAC, is::driver::Buffer(mx, false), (is::int_t)offx, incx);\
|
const is::array x((is::int_t)N, TYPE_ISAAC, is::driver::Buffer(mx, false), (is::int_t)offx, incx);\
|
||||||
is::array y(N, TYPE_ISAAC, is::driver::Buffer(my, false), (is::int_t)offy, incy);\
|
is::array y((is::int_t)N, TYPE_ISAAC, is::driver::Buffer(my, false), (is::int_t)offy, incy);\
|
||||||
execute(is::assign(y, x), y.context(), numCommandQueues, commandQueues, numEventsInWaitList, eventWaitList, events);\
|
execute(is::assign(y, x), y.context(), numCommandQueues, commandQueues, numEventsInWaitList, eventWaitList, events);\
|
||||||
return clblasSuccess;\
|
return clblasSuccess;\
|
||||||
}
|
}
|
||||||
@@ -103,8 +103,8 @@ extern "C"
|
|||||||
cl_command_queue *commandQueues, cl_uint numEventsInWaitList, \
|
cl_command_queue *commandQueues, cl_uint numEventsInWaitList, \
|
||||||
const cl_event *eventWaitList, cl_event *events) \
|
const cl_event *eventWaitList, cl_event *events) \
|
||||||
{ \
|
{ \
|
||||||
is::array x(N, TYPE_ISAAC, is::driver::Buffer(mx, false), (is::int_t)offx, incx); \
|
is::array x((is::int_t)N, TYPE_ISAAC, is::driver::Buffer(mx, false), (is::int_t)offx, incx); \
|
||||||
is::array y(N, TYPE_ISAAC, is::driver::Buffer(my, false), (is::int_t)offy, incy); \
|
is::array y((is::int_t)N, TYPE_ISAAC, is::driver::Buffer(my, false), (is::int_t)offy, incy); \
|
||||||
is::scalar s(TYPE_ISAAC, is::driver::Buffer(dotProduct, false), (is::int_t)offDP); \
|
is::scalar s(TYPE_ISAAC, is::driver::Buffer(dotProduct, false), (is::int_t)offDP); \
|
||||||
execute(is::assign(s, dot(x,y)), s.context(), numCommandQueues, commandQueues, numEventsInWaitList, eventWaitList, events); \
|
execute(is::assign(s, dot(x,y)), s.context(), numCommandQueues, commandQueues, numEventsInWaitList, eventWaitList, events); \
|
||||||
return clblasSuccess; \
|
return clblasSuccess; \
|
||||||
@@ -120,7 +120,7 @@ extern "C"
|
|||||||
cl_mem /*scratchBuff*/, cl_uint numCommandQueues, cl_command_queue *commandQueues,\
|
cl_mem /*scratchBuff*/, cl_uint numCommandQueues, cl_command_queue *commandQueues,\
|
||||||
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *events)\
|
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *events)\
|
||||||
{\
|
{\
|
||||||
is::array x(N, TYPE_ISAAC, is::driver::Buffer(mx, false), (is::int_t)offx, incx);\
|
is::array x((is::int_t)N, TYPE_ISAAC, is::driver::Buffer(mx, false), (is::int_t)offx, incx);\
|
||||||
is::scalar s(TYPE_ISAAC, is::driver::Buffer(asum, false), (is::int_t)offAsum);\
|
is::scalar s(TYPE_ISAAC, is::driver::Buffer(asum, false), (is::int_t)offAsum);\
|
||||||
execute(is::assign(s, sum(abs(x))), s.context(), numCommandQueues, commandQueues, numEventsInWaitList, eventWaitList, events);\
|
execute(is::assign(s, sum(abs(x))), s.context(), numCommandQueues, commandQueues, numEventsInWaitList, eventWaitList, events);\
|
||||||
return clblasSuccess;\
|
return clblasSuccess;\
|
||||||
@@ -145,9 +145,9 @@ extern "C"
|
|||||||
std::swap(M, N);\
|
std::swap(M, N);\
|
||||||
transA = (transA==clblasTrans)?clblasNoTrans:clblasTrans;\
|
transA = (transA==clblasTrans)?clblasNoTrans:clblasTrans;\
|
||||||
}\
|
}\
|
||||||
is::array A(M, N, TYPE_ISAAC, is::driver::Buffer(mA, false), (is::int_t)offA, lda);\
|
is::array A((is::int_t)M, (is::int_t)N, TYPE_ISAAC, is::driver::Buffer(mA, false), (is::int_t)offA, (is::int_t)lda);\
|
||||||
\
|
\
|
||||||
is::int_t sx = N, sy = M;\
|
is::int_t sx = (is::int_t)N, sy = (is::int_t)M;\
|
||||||
if(transA) std::swap(sx, sy);\
|
if(transA) std::swap(sx, sy);\
|
||||||
is::array x(sx, TYPE_ISAAC, is::driver::Buffer(mx, false), (is::int_t)offx, incx);\
|
is::array x(sx, TYPE_ISAAC, is::driver::Buffer(mx, false), (is::int_t)offx, incx);\
|
||||||
is::array y(sy, TYPE_ISAAC, is::driver::Buffer(my, false), (is::int_t)offy, incy);\
|
is::array y(sy, TYPE_ISAAC, is::driver::Buffer(my, false), (is::int_t)offy, incy);\
|
||||||
@@ -186,14 +186,14 @@ extern "C"
|
|||||||
std::swap(M, N);\
|
std::swap(M, N);\
|
||||||
std::swap(transA, transB);\
|
std::swap(transA, transB);\
|
||||||
}\
|
}\
|
||||||
is::int_t As1 = M, As2 = K;\
|
is::int_t As1 = (is::int_t)M, As2 = (is::int_t)K;\
|
||||||
is::int_t Bs1 = K, Bs2 = N;\
|
is::int_t Bs1 = (is::int_t)K, Bs2 = (is::int_t)N;\
|
||||||
if(transA==clblasTrans) std::swap(As1, As2);\
|
if(transA==clblasTrans) std::swap(As1, As2);\
|
||||||
if(transB==clblasTrans) std::swap(Bs1, Bs2);\
|
if(transB==clblasTrans) std::swap(Bs1, Bs2);\
|
||||||
/*Struct*/\
|
/*Struct*/\
|
||||||
is::array A(As1, As2, TYPE_ISAAC, is::driver::Buffer(mA, false), (is::int_t)offA, lda);\
|
is::array A(As1, As2, TYPE_ISAAC, is::driver::Buffer(mA, false), (is::int_t)offA, (is::int_t)lda);\
|
||||||
is::array B(Bs1, Bs2, TYPE_ISAAC, is::driver::Buffer(mB, false), (is::int_t)offB, ldb);\
|
is::array B(Bs1, Bs2, TYPE_ISAAC, is::driver::Buffer(mB, false), (is::int_t)offB, (is::int_t)ldb);\
|
||||||
is::array C(M, N, TYPE_ISAAC, is::driver::Buffer(mC, false), (is::int_t)offC, ldc);\
|
is::array C((is::int_t)M, (is::int_t)N, TYPE_ISAAC, is::driver::Buffer(mC, false), (is::int_t)offC, (is::int_t)ldc);\
|
||||||
is::driver::Context const & context = C.context();\
|
is::driver::Context const & context = C.context();\
|
||||||
/*Operation*/\
|
/*Operation*/\
|
||||||
if((transA==clblasTrans) && (transB==clblasTrans))\
|
if((transA==clblasTrans) && (transB==clblasTrans))\
|
||||||
|
@@ -51,7 +51,7 @@ template<class T>
|
|||||||
class simple_vector : public simple_vector_base<T>
|
class simple_vector : public simple_vector_base<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
simple_vector(size_t N) : simple_vector_base<T>(0, N, 1, data_), data_(N){}
|
simple_vector(int_t N) : simple_vector_base<T>(0, N, 1, data_), data_(N){}
|
||||||
private:
|
private:
|
||||||
std::vector<T> data_;
|
std::vector<T> data_;
|
||||||
};
|
};
|
||||||
|
@@ -57,8 +57,8 @@ void test_reduction(T epsilon, simple_vector_base<T> & cx, simple_vector_base<T
|
|||||||
RUN_TEST("s = exp(x'.y)", cs += cx[i]*cy[i], 0, std::exp(cs), ds = exp(dot(x,y)));
|
RUN_TEST("s = exp(x'.y)", cs += cx[i]*cy[i], 0, std::exp(cs), ds = exp(dot(x,y)));
|
||||||
RUN_TEST("s = 1 + x'.y", cs += cx[i]*cy[i], 0, 1 + cs, ds = 1 + dot(x,y));
|
RUN_TEST("s = 1 + x'.y", cs += cx[i]*cy[i], 0, 1 + cs, ds = 1 + dot(x,y));
|
||||||
RUN_TEST("s = x'.y + y'.y", cs+= cx[i]*cy[i] + cy[i]*cy[i], 0, cs, ds = dot(x,y) + dot(y,y));
|
RUN_TEST("s = x'.y + y'.y", cs+= cx[i]*cy[i] + cy[i]*cy[i], 0, cs, ds = dot(x,y) + dot(y,y));
|
||||||
RUN_TEST("s = max(x)", cs = std::max(cs, cx[i]), -INFINITY, cs, ds = max(x));
|
RUN_TEST("s = max(x)", cs = std::max(cs, cx[i]), std::numeric_limits<T>::min(), cs, ds = max(x));
|
||||||
RUN_TEST("s = min(x)", cs = std::min(cs, cx[i]), INFINITY, cs, ds = min(x));
|
RUN_TEST("s = min(x)", cs = std::min(cs, cx[i]), std::numeric_limits<T>::max(), cs, ds = min(x));
|
||||||
|
|
||||||
#undef RUN_TEST
|
#undef RUN_TEST
|
||||||
|
|
||||||
|
@@ -76,13 +76,13 @@ void test_row_wise_reduction(T epsilon, simple_vector_base<T> & cy, simple_matri
|
|||||||
{
|
{
|
||||||
TEST_OPERATION("x = dot(A.T, y)", N, M, 0, xi+=cA(j,i)*cy[j], cx[i] = xi, x = dot(trans(A),y), x, bufx, cx);
|
TEST_OPERATION("x = dot(A.T, y)", N, M, 0, xi+=cA(j,i)*cy[j], cx[i] = xi, x = dot(trans(A),y), x, bufx, cx);
|
||||||
TEST_OPERATION("x = sum(A, 0)", N, M, 0, xi+=cA(j,i), cx[i] = xi, x = sum(A,0), x, bufx, cx);
|
TEST_OPERATION("x = sum(A, 0)", N, M, 0, xi+=cA(j,i), cx[i] = xi, x = sum(A,0), x, bufx, cx);
|
||||||
TEST_OPERATION("x = max(A, 0)", N, M, -INFINITY, xi=std::max(xi,cA(j,i)), cx[i] = xi, x = max(A,0), x, bufx, cx);
|
TEST_OPERATION("x = max(A, 0)", N, M, std::numeric_limits<T>::min(), xi=std::max(xi,cA(j,i)), cx[i] = xi, x = max(A,0), x, bufx, cx);
|
||||||
TEST_OPERATION("x = min(A, 0)", N, M, INFINITY, xi=std::min(xi,cA(j,i)), cx[i] = xi, x = min(A,0), x, bufx, cx);
|
TEST_OPERATION("x = min(A, 0)", N, M, std::numeric_limits<T>::max(), xi=std::min(xi,cA(j,i)), cx[i] = xi, x = min(A,0), x, bufx, cx);
|
||||||
|
|
||||||
TEST_OPERATION("y = dot(A, x)", M, N, 0, yi+=cA(i,j)*cx[j], cy[i] = yi, y = dot(A,x), y, bufy, cy);
|
TEST_OPERATION("y = dot(A, x)", M, N, 0, yi+=cA(i,j)*cx[j], cy[i] = yi, y = dot(A,x), y, bufy, cy);
|
||||||
TEST_OPERATION("y = sum(A, 1)", M, N, 0, yi+=cA(i,j), cy[i] = yi, y = sum(A,1), y, bufy, cy);
|
TEST_OPERATION("y = sum(A, 1)", M, N, 0, yi+=cA(i,j), cy[i] = yi, y = sum(A,1), y, bufy, cy);
|
||||||
TEST_OPERATION("y = max(A, 1)", M, N, -INFINITY, yi=std::max(yi,cA(i,j)), cy[i] = yi, y = max(A,1), y, bufy, cy);
|
TEST_OPERATION("y = max(A, 1)", M, N, std::numeric_limits<T>::min(), yi=std::max(yi,cA(i,j)), cy[i] = yi, y = max(A,1), y, bufy, cy);
|
||||||
TEST_OPERATION("y = min(A, 1)", M, N, INFINITY, yi=std::min(yi,cA(i,j)), cy[i] = yi, y = min(A,1), y, bufy, cy);
|
TEST_OPERATION("y = min(A, 1)", M, N, std::numeric_limits<T>::max(), yi=std::min(yi,cA(i,j)), cy[i] = yi, y = min(A,1), y, bufy, cy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(failure_count>0)
|
if(failure_count>0)
|
||||||
|
Reference in New Issue
Block a user