Code quality: cleaned backend terminology
This commit is contained in:
@@ -171,7 +171,7 @@ void bench(isc::numeric_type dtype, std::string operation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned int dtsize = isc::size_of(dtype);
|
unsigned int dtsize = isc::size_of(dtype);
|
||||||
isc::driver::CommandQueue & queue = isc::driver::backend::queue(isc::driver::backend::default_context(),0);
|
isc::driver::CommandQueue & queue = isc::driver::backend::queues::get(isc::driver::backend::contexts::get_default(),0);
|
||||||
std::map<std::string, std::string> metric{ {"axpy", "GB/s"}, {"dot", "GB/s"}, {"gemv", "GB/s"}, {"gemm", "GFLOPS"}};
|
std::map<std::string, std::string> metric{ {"axpy", "GB/s"}, {"dot", "GB/s"}, {"gemv", "GB/s"}, {"gemm", "GFLOPS"}};
|
||||||
isc::array flush(1e6, dtype);
|
isc::array flush(1e6, dtype);
|
||||||
std::cout << "#" << operation << " (" << metric[operation] << ")" << std::endl;
|
std::cout << "#" << operation << " (" << metric[operation] << ")" << std::endl;
|
||||||
@@ -403,7 +403,8 @@ int main(int argc, char* argv[])
|
|||||||
isc::driver::backend::queue_properties = CL_QUEUE_PROFILING_ENABLE;
|
isc::driver::backend::queue_properties = CL_QUEUE_PROFILING_ENABLE;
|
||||||
|
|
||||||
int device_idx = 0;
|
int device_idx = 0;
|
||||||
std::list<isc::driver::Context const *> const & contexts = isc::driver::backend::contexts();
|
std::list<isc::driver::Context const *> contexts;
|
||||||
|
isc::driver::backend::contexts::get(contexts);
|
||||||
|
|
||||||
std::string operation;
|
std::string operation;
|
||||||
if(contexts.size() > 1)
|
if(contexts.size() > 1)
|
||||||
@@ -415,7 +416,7 @@ int main(int argc, char* argv[])
|
|||||||
unsigned int current=0;
|
unsigned int current=0;
|
||||||
for(isc::driver::Context const * context: contexts)
|
for(isc::driver::Context const * context: contexts)
|
||||||
{
|
{
|
||||||
isc::driver::Device device = isc::driver::backend::queue(*context,0).device();
|
isc::driver::Device device = isc::driver::backend::queues::get(*context,0).device();
|
||||||
std::cout << current++ << ": " << device.name() << " on " << device.platform().name() << " " << device.platform().version() << std::endl;
|
std::cout << current++ << ": " << device.name() << " on " << device.platform().name() << " " << device.platform().version() << std::endl;
|
||||||
}
|
}
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@@ -21,22 +21,22 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
//1D Constructors
|
//1D Constructors
|
||||||
array(int_t size1, numeric_type dtype, driver::Context const & context = driver::backend::default_context());
|
array(int_t size1, numeric_type dtype, driver::Context const & context = driver::backend::contexts::get_default());
|
||||||
array(int_t size1, numeric_type dtype, driver::Buffer data, int_t start, int_t inc);
|
array(int_t size1, numeric_type dtype, driver::Buffer data, int_t start, int_t inc);
|
||||||
|
|
||||||
template<typename DT>
|
template<typename DT>
|
||||||
array(std::vector<DT> const & data, driver::Context const & context = driver::backend::default_context());
|
array(std::vector<DT> const & data, driver::Context const & context = driver::backend::contexts::get_default());
|
||||||
array(array & v, slice const & s1);
|
array(array & v, slice const & s1);
|
||||||
|
|
||||||
//2D Constructors
|
//2D Constructors
|
||||||
array(int_t size1, int_t size2, numeric_type dtype, driver::Context const & context = driver::backend::default_context());
|
array(int_t size1, int_t size2, numeric_type dtype, driver::Context const & context = driver::backend::contexts::get_default());
|
||||||
array(int_t size1, int_t size2, numeric_type dtype, driver::Buffer data, int_t start, int_t ld);
|
array(int_t size1, int_t size2, numeric_type dtype, driver::Buffer data, int_t start, int_t ld);
|
||||||
template<typename DT>
|
template<typename DT>
|
||||||
array(int_t size1, int_t size2, std::vector<DT> const & data, driver::Context const & context = driver::backend::default_context());
|
array(int_t size1, int_t size2, std::vector<DT> const & data, driver::Context const & context = driver::backend::contexts::get_default());
|
||||||
array(array & M, slice const & s1, slice const & s2);
|
array(array & M, slice const & s1, slice const & s2);
|
||||||
|
|
||||||
//3D Constructors
|
//3D Constructors
|
||||||
array(int_t size1, int_t size2, int_t size3, numeric_type dtype, driver::Context const & context = driver::backend::default_context());
|
array(int_t size1, int_t size2, int_t size3, numeric_type dtype, driver::Context const & context = driver::backend::contexts::get_default());
|
||||||
|
|
||||||
//General constructor
|
//General constructor
|
||||||
|
|
||||||
@@ -112,8 +112,8 @@ private:
|
|||||||
template<class T> T cast() const;
|
template<class T> T cast() const;
|
||||||
public:
|
public:
|
||||||
explicit scalar(numeric_type dtype, driver::Buffer const & data, int_t offset);
|
explicit scalar(numeric_type dtype, driver::Buffer const & data, int_t offset);
|
||||||
explicit scalar(value_scalar value, driver::Context const & context = driver::backend::default_context());
|
explicit scalar(value_scalar value, driver::Context const & context = driver::backend::contexts::get_default());
|
||||||
explicit scalar(numeric_type dtype, driver::Context const & context = driver::backend::default_context());
|
explicit scalar(numeric_type dtype, driver::Context const & context = driver::backend::contexts::get_default());
|
||||||
scalar(array_expression const & proxy);
|
scalar(array_expression const & proxy);
|
||||||
scalar& operator=(value_scalar const &);
|
scalar& operator=(value_scalar const &);
|
||||||
// scalar& operator=(scalar const & s);
|
// scalar& operator=(scalar const & s);
|
||||||
@@ -230,8 +230,8 @@ ISAAC_DECLARE_DOT((max))
|
|||||||
ISAAC_DECLARE_DOT((min))
|
ISAAC_DECLARE_DOT((min))
|
||||||
ISAAC_DECLARE_DOT(argmin)
|
ISAAC_DECLARE_DOT(argmin)
|
||||||
|
|
||||||
ISAACAPI array_expression eye(std::size_t, std::size_t, isaac::numeric_type, driver::Context const & context = driver::backend::default_context());
|
ISAACAPI array_expression eye(std::size_t, std::size_t, isaac::numeric_type, driver::Context const & context = driver::backend::contexts::get_default());
|
||||||
ISAACAPI array_expression zeros(std::size_t M, std::size_t N, numeric_type dtype, driver::Context const & context = driver::backend::default_context());
|
ISAACAPI array_expression zeros(std::size_t M, std::size_t N, numeric_type dtype, driver::Context const & context = driver::backend::contexts::get_default());
|
||||||
ISAACAPI array_expression reshape(array const &, int_t, int_t);
|
ISAACAPI array_expression reshape(array const &, int_t, int_t);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -22,6 +22,7 @@ class ISAACAPI backend
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static void init();
|
static void init();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class programs
|
class programs
|
||||||
{
|
{
|
||||||
@@ -33,17 +34,35 @@ public:
|
|||||||
static std::map<driver::Context const *, std::map<std::string, Program*> > programs_;
|
static std::map<driver::Context const *, std::map<std::string, Program*> > programs_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class contexts
|
||||||
|
{
|
||||||
|
friend class backend;
|
||||||
|
public:
|
||||||
|
static Context const & get_default();
|
||||||
|
static Context const & import(cl_context context);
|
||||||
|
static void get(std::list<Context const *> &);
|
||||||
|
private:
|
||||||
|
static void release();
|
||||||
|
static std::list<Context const *> contexts_;
|
||||||
|
};
|
||||||
|
|
||||||
|
class queues
|
||||||
|
{
|
||||||
|
friend class backend;
|
||||||
|
public:
|
||||||
|
static void get(Context const &, std::vector<CommandQueue*> queues);
|
||||||
|
static CommandQueue & get(Context const &, unsigned int id);
|
||||||
|
private:
|
||||||
|
static void release();
|
||||||
|
static std::map< Context const *, std::vector<CommandQueue*> > queues_;
|
||||||
|
};
|
||||||
|
|
||||||
static void platforms(std::vector<Platform> &);
|
static void platforms(std::vector<Platform> &);
|
||||||
static std::list<Context const *> const & contexts();
|
|
||||||
static Context const & import(cl_context context);
|
|
||||||
static Context const & default_context();
|
|
||||||
static void synchronize(Context const &);
|
static void synchronize(Context const &);
|
||||||
static CommandQueue & queue(Context const &, unsigned int id);
|
|
||||||
static void queues(Context const &, std::vector<CommandQueue*> queues);
|
|
||||||
static void release();
|
static void release();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::list<Context const *> contexts_;
|
|
||||||
static std::map< Context const *, std::vector<CommandQueue*> > queues_;
|
|
||||||
public:
|
public:
|
||||||
static unsigned int default_device;
|
static unsigned int default_device;
|
||||||
static cl_command_queue_properties queue_properties;
|
static cl_command_queue_properties queue_properties;
|
||||||
|
@@ -238,7 +238,7 @@ struct execution_options_type
|
|||||||
{
|
{
|
||||||
if(queue_)
|
if(queue_)
|
||||||
return *queue_;
|
return *queue_;
|
||||||
return driver::backend::queue(context, queue_id_);
|
return driver::backend::queues::get(context, queue_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<driver::Event>* events;
|
std::list<driver::Event>* events;
|
||||||
|
@@ -286,7 +286,7 @@ namespace detail
|
|||||||
template<class T>
|
template<class T>
|
||||||
void copy(driver::Context const & context, driver::Buffer const & data, T value)
|
void copy(driver::Context const & context, driver::Buffer const & data, T value)
|
||||||
{
|
{
|
||||||
driver::backend::queue(context,0).write(data, CL_TRUE, 0, sizeof(T), (void*)&value);
|
driver::backend::queues::get(context,0).write(data, CL_TRUE, 0, sizeof(T), (void*)&value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -323,7 +323,7 @@ void scalar::inject(values_holder & v) const
|
|||||||
int_t dtsize = size_of(dtype_);
|
int_t dtsize = size_of(dtype_);
|
||||||
#define HANDLE_CASE(DTYPE, VAL) \
|
#define HANDLE_CASE(DTYPE, VAL) \
|
||||||
case DTYPE:\
|
case DTYPE:\
|
||||||
driver::backend::queue(context_, 0).read(data_, CL_TRUE, start_[0]*dtsize, dtsize, (void*)&v.VAL); break;\
|
driver::backend::queues::get(context_, 0).read(data_, CL_TRUE, start_[0]*dtsize, dtsize, (void*)&v.VAL); break;\
|
||||||
|
|
||||||
switch(dtype_)
|
switch(dtype_)
|
||||||
{
|
{
|
||||||
@@ -370,7 +370,7 @@ TYPE scalar::cast() const
|
|||||||
|
|
||||||
scalar& scalar::operator=(value_scalar const & s)
|
scalar& scalar::operator=(value_scalar const & s)
|
||||||
{
|
{
|
||||||
driver::CommandQueue& queue = driver::backend::queue(context_, 0);
|
driver::CommandQueue& queue = driver::backend::queues::get(context_, 0);
|
||||||
int_t dtsize = size_of(dtype_);
|
int_t dtsize = size_of(dtype_);
|
||||||
|
|
||||||
#define HANDLE_CASE(TYPE, CLTYPE) case TYPE:\
|
#define HANDLE_CASE(TYPE, CLTYPE) case TYPE:\
|
||||||
@@ -827,10 +827,10 @@ void copy(array const & x, void* data, driver::CommandQueue & queue, bool blocki
|
|||||||
}
|
}
|
||||||
|
|
||||||
void copy(void const *data, array &x, bool blocking)
|
void copy(void const *data, array &x, bool blocking)
|
||||||
{ copy(data, x, driver::backend::queue(x.context(), 0), blocking); }
|
{ copy(data, x, driver::backend::queues::get(x.context(), 0), blocking); }
|
||||||
|
|
||||||
void copy(array const & x, void* data, bool blocking)
|
void copy(array const & x, void* data, bool blocking)
|
||||||
{ copy(x, data, driver::backend::queue(x.context(), 0), blocking); }
|
{ copy(x, data, driver::backend::queues::get(x.context(), 0), blocking); }
|
||||||
|
|
||||||
//std::vector<>
|
//std::vector<>
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -855,11 +855,11 @@ void copy(array const & x, std::vector<T> & cx, driver::CommandQueue & queue, bo
|
|||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void copy(std::vector<T> const & cx, array & x, bool blocking)
|
void copy(std::vector<T> const & cx, array & x, bool blocking)
|
||||||
{ copy(cx, x, driver::backend::queue(x.context(), 0), blocking); }
|
{ copy(cx, x, driver::backend::queues::get(x.context(), 0), blocking); }
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void copy(array const & x, std::vector<T> & cx, bool blocking)
|
void copy(array const & x, std::vector<T> & cx, bool blocking)
|
||||||
{ copy(x, cx, driver::backend::queue(x.context(), 0), blocking); }
|
{ copy(x, cx, driver::backend::queues::get(x.context(), 0), blocking); }
|
||||||
|
|
||||||
#define INSTANTIATE(T) \
|
#define INSTANTIATE(T) \
|
||||||
template void ISAACAPI copy<T>(std::vector<T> const &, array &, driver::CommandQueue&, bool);\
|
template void ISAACAPI copy<T>(std::vector<T> const &, array &, driver::CommandQueue&, bool);\
|
||||||
|
@@ -595,7 +595,6 @@ gemm_parameters::gemm_parameters(unsigned int simd_width
|
|||||||
out = tmp.get();
|
out = tmp.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
// std::cout << C << std::endl;
|
|
||||||
driver::Kernel gemm(program, gemm_name.c_str());
|
driver::Kernel gemm(program, gemm_name.c_str());
|
||||||
driver::NDRange local(p_.local_size_0, p_.local_size_1);
|
driver::NDRange local(p_.local_size_0, p_.local_size_1);
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ namespace driver
|
|||||||
|
|
||||||
void backend::init()
|
void backend::init()
|
||||||
{
|
{
|
||||||
if(contexts_.empty())
|
if(contexts::contexts_.empty())
|
||||||
{
|
{
|
||||||
std::vector<Platform> platforms;
|
std::vector<Platform> platforms;
|
||||||
backend::platforms(platforms);
|
backend::platforms(platforms);
|
||||||
@@ -23,14 +23,14 @@ void backend::init()
|
|||||||
std::vector<Device> devices;
|
std::vector<Device> devices;
|
||||||
platform.devices(devices);
|
platform.devices(devices);
|
||||||
for(Device const & device: devices){
|
for(Device const & device: devices){
|
||||||
contexts_.push_back(new Context(device));
|
contexts::contexts_.push_back(new Context(device));
|
||||||
queues_.insert(std::make_pair(contexts_.back(), std::vector<CommandQueue*>{new CommandQueue(*contexts_.back(), device, queue_properties)}));
|
queues::queues_.insert(std::make_pair(contexts::contexts_.back(), std::vector<CommandQueue*>{new CommandQueue(*contexts::contexts_.back(), device, queue_properties)}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandQueue & backend::queue(Context const & context, unsigned int id)
|
CommandQueue & backend::queues::get(Context const & context, unsigned int id)
|
||||||
{
|
{
|
||||||
assert(id < queues_.size());
|
assert(id < queues_.size());
|
||||||
init();
|
init();
|
||||||
@@ -40,13 +40,13 @@ CommandQueue & backend::queue(Context const & context, unsigned int id)
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void backend::queues(Context const & context, std::vector<CommandQueue*> queues)
|
void backend::queues::get(Context const & context, std::vector<CommandQueue*> queues)
|
||||||
{
|
{
|
||||||
queues = queues_[&context];
|
queues = queues_[&context];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Context const & backend::import(cl_context context)
|
Context const & backend::contexts::import(cl_context context)
|
||||||
{
|
{
|
||||||
for(driver::Context const * x: contexts_)
|
for(driver::Context const * x: contexts_)
|
||||||
if(x->handle().cl()==context)
|
if(x->handle().cl()==context)
|
||||||
@@ -56,7 +56,7 @@ Context const & backend::import(cl_context context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Context const & backend::default_context()
|
Context const & backend::contexts::get_default()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
std::list<Context const *>::const_iterator it = contexts_.begin();
|
std::list<Context const *>::const_iterator it = contexts_.begin();
|
||||||
@@ -64,10 +64,19 @@ Context const & backend::default_context()
|
|||||||
return **it;
|
return **it;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::list<Context const *> &backend::contexts()
|
void backend::contexts::get(std::list<Context const *> & contexts)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
return contexts_;
|
contexts = contexts_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void backend::contexts::release()
|
||||||
|
{
|
||||||
|
for(auto & x: contexts_)
|
||||||
|
{
|
||||||
|
delete x;
|
||||||
|
x = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void backend::platforms(std::vector<Platform> & platforms)
|
void backend::platforms(std::vector<Platform> & platforms)
|
||||||
@@ -85,29 +94,25 @@ void backend::platforms(std::vector<Platform> & platforms)
|
|||||||
|
|
||||||
void backend::synchronize(Context const & context)
|
void backend::synchronize(Context const & context)
|
||||||
{
|
{
|
||||||
for(CommandQueue * queue: queues_.at(&context))
|
for(CommandQueue * queue: queues::queues_.at(&context))
|
||||||
queue->synchronize();
|
queue->synchronize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void backend::release()
|
void backend::queues::release()
|
||||||
{
|
{
|
||||||
//programs
|
|
||||||
backend::programs::release();
|
|
||||||
|
|
||||||
//queues
|
|
||||||
for(auto & x: queues_)
|
for(auto & x: queues_)
|
||||||
for(auto & y: x.second)
|
for(auto & y: x.second)
|
||||||
{
|
{
|
||||||
delete y;
|
delete y;
|
||||||
y = NULL;
|
y = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//context
|
void backend::release()
|
||||||
for(auto & x: contexts_)
|
{
|
||||||
{
|
backend::programs::release();
|
||||||
delete x;
|
backend::queues::release();
|
||||||
x = NULL;
|
backend::contexts::release();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---- Programs -----*/
|
/* ---- Programs -----*/
|
||||||
@@ -155,9 +160,9 @@ unsigned int backend::default_device = 0;
|
|||||||
|
|
||||||
cl_command_queue_properties backend::queue_properties = 0;
|
cl_command_queue_properties backend::queue_properties = 0;
|
||||||
|
|
||||||
std::list<Context const *> backend::contexts_;
|
std::list<Context const *> backend::contexts::contexts_;
|
||||||
|
|
||||||
std::map<Context const *, std::vector<CommandQueue*> > backend::queues_;
|
std::map<Context const *, std::vector<CommandQueue*> > backend::queues::queues_;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@ namespace isaac
|
|||||||
namespace driver
|
namespace driver
|
||||||
{
|
{
|
||||||
|
|
||||||
Buffer::Buffer(cl_mem buffer, bool take_ownership) : backend_(OPENCL), context_(backend::import(ocl::info<CL_MEM_CONTEXT>(buffer))), h_(backend_, take_ownership)
|
Buffer::Buffer(cl_mem buffer, bool take_ownership) : backend_(OPENCL), context_(backend::contexts::import(ocl::info<CL_MEM_CONTEXT>(buffer))), h_(backend_, take_ownership)
|
||||||
{
|
{
|
||||||
h_.cl() = buffer;
|
h_.cl() = buffer;
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ namespace isaac
|
|||||||
namespace driver
|
namespace driver
|
||||||
{
|
{
|
||||||
|
|
||||||
CommandQueue::CommandQueue(cl_command_queue const & queue, bool take_ownership) : backend_(OPENCL), context_(&backend::import(ocl::info<CL_QUEUE_CONTEXT>(queue))), device_(ocl::info<CL_QUEUE_DEVICE>(queue), false), h_(backend_, take_ownership)
|
CommandQueue::CommandQueue(cl_command_queue const & queue, bool take_ownership) : backend_(OPENCL), context_(&backend::contexts::import(ocl::info<CL_QUEUE_CONTEXT>(queue))), device_(ocl::info<CL_QUEUE_DEVICE>(queue), false), h_(backend_, take_ownership)
|
||||||
{
|
{
|
||||||
h_.cl() = queue;
|
h_.cl() = queue;
|
||||||
}
|
}
|
||||||
|
@@ -84,12 +84,12 @@ void Kernel::setSizeArg(unsigned int index, size_t N)
|
|||||||
#endif
|
#endif
|
||||||
case OPENCL:
|
case OPENCL:
|
||||||
if(address_bits_==32){
|
if(address_bits_==32){
|
||||||
int32_t NN = N;
|
cl_int NN = N;
|
||||||
ocl::check(clSetKernelArg(h_.cl(), index, 4, &NN));
|
ocl::check(clSetKernelArg(h_.cl(), index, 4, &NN));
|
||||||
}
|
}
|
||||||
else if(address_bits_==64)
|
else if(address_bits_==64)
|
||||||
{
|
{
|
||||||
int64_t NN = N;
|
cl_long NN = N;
|
||||||
ocl::check(clSetKernelArg(h_.cl(), index, 8, &NN));
|
ocl::check(clSetKernelArg(h_.cl(), index, 8, &NN));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -115,7 +115,7 @@ def main():
|
|||||||
include =' src/include'.split() + ['external/boost/include', os.path.join(find_module("numpy")[1], "core", "include")]
|
include =' src/include'.split() + ['external/boost/include', os.path.join(find_module("numpy")[1], "core", "include")]
|
||||||
|
|
||||||
#Source files
|
#Source files
|
||||||
src = 'src/lib/array.cpp src/lib/value_scalar.cpp src/lib/wrap/clBLAS.cpp src/lib/symbolic/expression.cpp src/lib/symbolic/execute.cpp src/lib/symbolic/preset.cpp src/lib/symbolic/io.cpp src/lib/model/model.cpp src/lib/model/predictors/random_forest.cpp src/lib/exception/unknown_datatype.cpp src/lib/exception/operation_not_supported.cpp src/lib/driver/device.cpp src/lib/driver/command_queue.cpp src/lib/driver/backend.cpp src/lib/driver/platform.cpp src/lib/driver/ndrange.cpp src/lib/driver/kernel.cpp src/lib/driver/event.cpp src/lib/driver/check.cpp src/lib/driver/program.cpp src/lib/driver/context.cpp src/lib/driver/buffer.cpp src/lib/driver/handle.cpp src/lib/backend/parse.cpp src/lib/backend/stream.cpp src/lib/backend/mapped_object.cpp src/lib/backend/keywords.cpp src/lib/backend/binder.cpp src/lib/backend/templates/ger.cpp src/lib/backend/templates/gemv.cpp src/lib/backend/templates/gemm.cpp src/lib/backend/templates/dot.cpp src/lib/backend/templates/axpy.cpp src/lib/backend/templates/base.cpp '.split() + [os.path.join('src', 'wrap', sf) for sf in ['_isaac.cpp', 'core.cpp', 'driver.cpp', 'model.cpp', 'exceptions.cpp']]
|
src = 'src/lib/array.cpp src/lib/value_scalar.cpp src/lib/wrap/clBLAS.cpp src/lib/symbolic/expression.cpp src/lib/symbolic/execute.cpp src/lib/symbolic/preset.cpp src/lib/symbolic/io.cpp src/lib/model/model.cpp src/lib/model/predictors/random_forest.cpp src/lib/exception/unknown_datatype.cpp src/lib/exception/operation_not_supported.cpp src/lib/driver/program.cpp src/lib/driver/context.cpp src/lib/driver/platform.cpp src/lib/driver/device.cpp src/lib/driver/kernel.cpp src/lib/driver/command_queue.cpp src/lib/driver/ndrange.cpp src/lib/driver/event.cpp src/lib/driver/check.cpp src/lib/driver/backend.cpp src/lib/driver/buffer.cpp src/lib/driver/handle.cpp src/lib/backend/parse.cpp src/lib/backend/stream.cpp src/lib/backend/mapped_object.cpp src/lib/backend/keywords.cpp src/lib/backend/binder.cpp src/lib/backend/templates/gemv.cpp src/lib/backend/templates/dot.cpp src/lib/backend/templates/ger.cpp src/lib/backend/templates/axpy.cpp src/lib/backend/templates/base.cpp src/lib/backend/templates/gemm.cpp '.split() + [os.path.join('src', 'wrap', sf) for sf in ['_isaac.cpp', 'core.cpp', 'driver.cpp', 'model.cpp', 'exceptions.cpp']]
|
||||||
boostsrc = 'external/boost/libs/'
|
boostsrc = 'external/boost/libs/'
|
||||||
for s in ['numpy','python','smart_ptr','system','thread']:
|
for s in ['numpy','python','smart_ptr','system','thread']:
|
||||||
src = src + [x for x in recursive_glob('external/boost/libs/' + s + '/src/','.cpp') if 'win32' not in x and 'pthread' not in x]
|
src = src + [x for x in recursive_glob('external/boost/libs/' + s + '/src/','.cpp') if 'win32' not in x and 'pthread' not in x]
|
||||||
|
@@ -16,7 +16,7 @@ void test_element_wise_vector(T epsilon, simple_vector_base<T> & cx, simple_vect
|
|||||||
int failure_count = 0;
|
int failure_count = 0;
|
||||||
isc::numeric_type dtype = x.dtype();
|
isc::numeric_type dtype = x.dtype();
|
||||||
isc::driver::Context const & context = x.context();
|
isc::driver::Context const & context = x.context();
|
||||||
isc::driver::CommandQueue queue = isc::driver::backend::queue(context,0);
|
isc::driver::CommandQueue queue = isc::driver::backend::queues::get(context,0);
|
||||||
cl_command_queue clqueue = queue.handle().cl();
|
cl_command_queue clqueue = queue.handle().cl();
|
||||||
int_t N = cz.size();
|
int_t N = cz.size();
|
||||||
|
|
||||||
@@ -138,10 +138,11 @@ void test_impl(T epsilon, isc::driver::Context const & ctx)
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
clblasSetup();
|
clblasSetup();
|
||||||
std::list<isaac::driver::Context const *> const & data = isc::driver::backend::contexts();
|
std::list<isaac::driver::Context const *> data;
|
||||||
|
isc::driver::backend::contexts::get(data);
|
||||||
for(isaac::driver::Context const * context : data)
|
for(isaac::driver::Context const * context : data)
|
||||||
{
|
{
|
||||||
isc::driver::Device device = isc::driver::backend::queue(*context,0).device();
|
isc::driver::Device device = isc::driver::backend::queues::get(*context,0).device();
|
||||||
if(device.type() != isc::driver::DEVICE_TYPE_GPU)
|
if(device.type() != isc::driver::DEVICE_TYPE_GPU)
|
||||||
continue;
|
continue;
|
||||||
std::cout << "Device: " << device.name() << " on " << device.platform().name() << " " << device.platform().version() << std::endl;
|
std::cout << "Device: " << device.name() << " on " << device.platform().name() << " " << device.platform().version() << std::endl;
|
||||||
|
@@ -15,7 +15,7 @@ void test_reduction(T epsilon, simple_vector_base<T> & cx, simple_vector_base<T
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
isc::driver::Context const & ctx = x.context();
|
isc::driver::Context const & ctx = x.context();
|
||||||
int_t N = cx.size();
|
int_t N = cx.size();
|
||||||
isc::driver::CommandQueue queue = isc::driver::backend::queue(ctx,0);
|
isc::driver::CommandQueue queue = isc::driver::backend::queues::get(ctx,0);
|
||||||
cl_command_queue clqueue = queue.handle().cl();
|
cl_command_queue clqueue = queue.handle().cl();
|
||||||
isc::array scratch(N, x.dtype());
|
isc::array scratch(N, x.dtype());
|
||||||
|
|
||||||
@@ -87,13 +87,15 @@ void test_impl(T epsilon, isc::driver::Context const & ctx)
|
|||||||
TEST_OPERATIONS(slice);
|
TEST_OPERATIONS(slice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
clblasSetup();
|
clblasSetup();
|
||||||
std::list<isaac::driver::Context const *> const & data = isc::driver::backend::contexts();
|
std::list<isaac::driver::Context const *> data;
|
||||||
|
isc::driver::backend::contexts::get(data);
|
||||||
for(isaac::driver::Context const * context : data)
|
for(isaac::driver::Context const * context : data)
|
||||||
{
|
{
|
||||||
isc::driver::Device device = isc::driver::backend::queue(*context,0).device();
|
isc::driver::Device device = isc::driver::backend::queues::get(*context,0).device();
|
||||||
std::cout << "Device: " << device.name() << " on " << device.platform().name() << " " << device.platform().version() << std::endl;
|
std::cout << "Device: " << device.name() << " on " << device.platform().name() << " " << device.platform().version() << std::endl;
|
||||||
std::cout << "---" << std::endl;
|
std::cout << "---" << std::endl;
|
||||||
std::cout << ">> float" << std::endl;
|
std::cout << ">> float" << std::endl;
|
||||||
|
@@ -20,7 +20,7 @@ void test_impl(T epsilon, simple_matrix_base<T> & cC, simple_matrix_base<T> cons
|
|||||||
T alpha = 1;
|
T alpha = 1;
|
||||||
T beta = 0;
|
T beta = 0;
|
||||||
|
|
||||||
isc::driver::CommandQueue queue = isc::driver::backend::queue(C.context(),0);
|
isc::driver::CommandQueue queue = isc::driver::backend::queues::get(C.context(),0);
|
||||||
|
|
||||||
for(int i = 0 ; i < M ; ++i)
|
for(int i = 0 ; i < M ; ++i)
|
||||||
{
|
{
|
||||||
@@ -126,10 +126,11 @@ void test_impl(T epsilon, isc::driver::Context const & ctx)
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
clblasSetup();
|
clblasSetup();
|
||||||
std::list<isaac::driver::Context const *> const & data = isc::driver::backend::contexts();
|
std::list<isaac::driver::Context const *> data;
|
||||||
|
isc::driver::backend::contexts::get(data);
|
||||||
for(isaac::driver::Context const * context : data)
|
for(isaac::driver::Context const * context : data)
|
||||||
{
|
{
|
||||||
isc::driver::Device device = isc::driver::backend::queue(*context,0).device();
|
isc::driver::Device device = isc::driver::backend::queues::get(*context,0).device();
|
||||||
if(device.type() != isc::driver::DEVICE_TYPE_GPU)
|
if(device.type() != isc::driver::DEVICE_TYPE_GPU)
|
||||||
continue;
|
continue;
|
||||||
std::cout << "Device: " << device.name() << " on " << device.platform().name() << " " << device.platform().version() << std::endl;
|
std::cout << "Device: " << device.name() << " on " << device.platform().name() << " " << device.platform().version() << std::endl;
|
||||||
|
@@ -20,7 +20,7 @@ void test_row_wise_reduction(T epsilon, simple_vector_base<T> & cy, simple_matri
|
|||||||
|
|
||||||
T alpha = 4.2, beta = 5.6;
|
T alpha = 4.2, beta = 5.6;
|
||||||
|
|
||||||
isc::driver::CommandQueue queue = isc::driver::backend::queue(y.context(),0);
|
isc::driver::CommandQueue queue = isc::driver::backend::queues::get(y.context(),0);
|
||||||
|
|
||||||
T yi = 0, xi = 0;
|
T yi = 0, xi = 0;
|
||||||
#define TEST_OPERATION(NAME, SIZE1, SIZE2, REDUCTION, ASSIGNMENT, GPU_REDUCTION, RES, BUF, CRES)\
|
#define TEST_OPERATION(NAME, SIZE1, SIZE2, REDUCTION, ASSIGNMENT, GPU_REDUCTION, RES, BUF, CRES)\
|
||||||
@@ -108,10 +108,11 @@ void test_impl(T epsilon, isc::driver::Context const & ctx)
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
clblasSetup();
|
clblasSetup();
|
||||||
std::list<isaac::driver::Context const *> const & data = isc::driver::backend::contexts();
|
std::list<isaac::driver::Context const *> data;
|
||||||
|
isc::driver::backend::contexts::get(data);
|
||||||
for(isaac::driver::Context const * context : data)
|
for(isaac::driver::Context const * context : data)
|
||||||
{
|
{
|
||||||
isc::driver::Device device = isc::driver::backend::queue(*context,0).device();
|
isc::driver::Device device = isc::driver::backend::queues::get(*context,0).device();
|
||||||
std::cout << "Device: " << device.name() << " on " << device.platform().name() << " " << device.platform().version() << std::endl;
|
std::cout << "Device: " << device.name() << " on " << device.platform().name() << " " << device.platform().version() << std::endl;
|
||||||
std::cout << "---" << std::endl;
|
std::cout << "---" << std::endl;
|
||||||
std::cout << ">> float" << std::endl;
|
std::cout << ">> float" << std::endl;
|
||||||
|
@@ -124,10 +124,11 @@ void test_impl(T epsilon, isc::driver::Context const & ctx)
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::list<isaac::driver::Context const *> const & data = isc::driver::backend::contexts();
|
std::list<isaac::driver::Context const *> data;
|
||||||
|
isc::driver::backend::contexts::get(data);
|
||||||
for(isaac::driver::Context const * context : data)
|
for(isaac::driver::Context const * context : data)
|
||||||
{
|
{
|
||||||
isc::driver::Device device = isc::driver::backend::queue(*context,0).device();
|
isc::driver::Device device = isc::driver::backend::queues::get(*context,0).device();
|
||||||
std::cout << "Device: " << device.name() << " on " << device.platform().name() << " " << device.platform().version() << std::endl;
|
std::cout << "Device: " << device.name() << " on " << device.platform().name() << " " << device.platform().version() << std::endl;
|
||||||
std::cout << "---" << std::endl;
|
std::cout << "---" << std::endl;
|
||||||
std::cout << ">> float" << std::endl;
|
std::cout << ">> float" << std::endl;
|
||||||
|
Reference in New Issue
Block a user