Python: fixed compilation issues
This commit is contained in:
committed by
Philippe Tillet
parent
97a0d65a4d
commit
6bc5d9e1cb
@@ -62,6 +62,7 @@ public:
|
||||
array_base(tuple const & shape, std::vector<DT> const & data, driver::Context const & context = driver::backend::contexts::get_default());
|
||||
array_base(tuple const & shape, numeric_type dtype, driver::Context const & context = driver::backend::contexts::get_default());
|
||||
array_base(tuple const & shape, numeric_type dtype, int_t start, tuple const & stride, driver::Context const & context = driver::backend::contexts::get_default());
|
||||
array_base(tuple const & shape, numeric_type dtype, int_t start, tuple const & stride, driver::Buffer const & data);
|
||||
explicit array_base(runtime::execution_handler const &);
|
||||
|
||||
//Make the class virtual
|
||||
|
@@ -76,6 +76,7 @@ union handle_t
|
||||
CUdeviceptr cu;
|
||||
};
|
||||
|
||||
|
||||
struct array_holder
|
||||
{
|
||||
int_t start;
|
||||
|
@@ -51,6 +51,11 @@ INSTANTIATE(float);\
|
||||
INSTANTIATE(double);
|
||||
|
||||
//General
|
||||
array_base::array_base(tuple const & shape, numeric_type dtype, int_t start, tuple const & stride, driver::Buffer const & data) :
|
||||
dtype_(dtype), shape_(shape), start_(start), stride_(stride), context_(data.context()), data_(data),
|
||||
T(isaac::trans(*this))
|
||||
{}
|
||||
|
||||
array_base::array_base(tuple const & shape, numeric_type dtype, int_t start, tuple const & stride, driver::Context const & context) :
|
||||
dtype_(dtype), shape_(shape), start_(start), stride_(stride), context_(context), data_(context_, dsize()),
|
||||
T(isaac::trans(*this))
|
||||
|
@@ -83,7 +83,7 @@ namespace detail
|
||||
std::shared_ptr<sc::driver::Context> make_context(sc::driver::Device const & dev)
|
||||
{ return std::shared_ptr<sc::driver::Context>(new sc::driver::Context(dev)); }
|
||||
|
||||
bp::object enqueue(sc::expression_tree const & expression, unsigned int queue_id, bp::list dependencies, bool tune, int label, std::string const & program_name, bool force_recompile)
|
||||
bp::object enqueue(sc::expression_tree const & tree, unsigned int queue_id, bp::list dependencies, bool tune, int label, std::string const & program_name, bool force_recompile)
|
||||
{
|
||||
std::list<sc::driver::Event> events;
|
||||
std::vector<sc::driver::Event> cdependencies = tools::to_vector<sc::driver::Event>(dependencies);
|
||||
@@ -91,15 +91,18 @@ namespace detail
|
||||
sc::execution_options_type execution_options(queue_id, &events, &cdependencies);
|
||||
sc::dispatcher_options_type dispatcher_options(tune, label);
|
||||
sc::compilation_options_type compilation_options(program_name, force_recompile);
|
||||
sc::expression_tree::container_type::value_type root = expression.tree()[expression.root()];
|
||||
if(sc::detail::is_assignment(root.op))
|
||||
sc::expression_tree::node const & root = tree[tree.root()];
|
||||
if(sc::is_assignment(root.binary_operator.op.type))
|
||||
{
|
||||
sc::execute(sc::execution_handler(expression, execution_options, dispatcher_options, compilation_options), isaac::profiles::get(execution_options.queue(expression.context())));
|
||||
return bp::make_tuple(bp::ptr(root.lhs.array), tools::to_list(events.begin(), events.end()));
|
||||
sc::symbolic::execute(sc::execution_handler(tree, execution_options, dispatcher_options, compilation_options), isaac::profiles::get(execution_options.queue(tree.context())));
|
||||
sc::expression_tree::node const & lhs = tree[root.binary_operator.lhs];
|
||||
sc::driver::Buffer const & data = sc::driver::make_buffer(tree.context().backend(), lhs.array.handle.cl, lhs.array.handle.cu, false);
|
||||
std::shared_ptr<sc::array> parray(new sc::array(lhs.shape, lhs.dtype, lhs.array.start, lhs.ld, data));
|
||||
return bp::make_tuple(parray, tools::to_list(events.begin(), events.end()));
|
||||
}
|
||||
else
|
||||
{
|
||||
std::shared_ptr<sc::array> parray(new sc::array(sc::execution_handler(expression, execution_options, dispatcher_options, compilation_options)));
|
||||
std::shared_ptr<sc::array> parray(new sc::array(sc::execution_handler(tree, execution_options, dispatcher_options, compilation_options)));
|
||||
return bp::make_tuple(parray, tools::to_list(events.begin(), events.end()));
|
||||
}
|
||||
}
|
||||
|
@@ -22,8 +22,8 @@
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/python.hpp>
|
||||
|
||||
#include "isaac/exception/operation_not_supported.h"
|
||||
#include "isaac/driver/common.h"
|
||||
#include "isaac/exception/api.h"
|
||||
#include "isaac/exception/driver.h"
|
||||
|
||||
#include "common.hpp"
|
||||
#include "exceptions.h"
|
||||
@@ -102,18 +102,20 @@ private:
|
||||
|
||||
void export_exceptions()
|
||||
{
|
||||
namespace exc = isaac::exception;
|
||||
|
||||
#define BIND_EXCEPTION(CPPNAME, PYTHONNAME) \
|
||||
wrap::exception<isaac::CPPNAME>(PYTHONNAME, bp::init<std::string>())\
|
||||
.def("__str__", &isaac::CPPNAME::what)
|
||||
|
||||
BIND_EXCEPTION(operation_not_supported_exception, "OperationNotSupported");
|
||||
BIND_EXCEPTION(semantic_error, "SemanticError");
|
||||
|
||||
//OCL
|
||||
wrap::exception<isaac::driver::ocl::exception::base>("OclException", bp::no_init);
|
||||
wrap::exception<exc::ocl::base>("OclException", bp::no_init);
|
||||
#define BIND_OCL_EXCEPTION(CPPNAME, PYTHONNAME) \
|
||||
wrap::exception<isaac::driver::ocl::exception::CPPNAME, bp::bases<isaac::driver::ocl::exception::base> >(PYTHONNAME)\
|
||||
.def("__str__", &isaac::driver::ocl::exception::CPPNAME::what)
|
||||
wrap::exception<exc::ocl::CPPNAME, bp::bases<exc::ocl::base> >(PYTHONNAME)\
|
||||
.def("__str__", &exc::ocl::CPPNAME::what)
|
||||
|
||||
|
||||
BIND_OCL_EXCEPTION(out_of_resources, "OclLaunchOutOfResources");
|
||||
@@ -123,10 +125,10 @@ void export_exceptions()
|
||||
BIND_OCL_EXCEPTION(invalid_value, "InvalidValue");
|
||||
|
||||
//CUDA
|
||||
wrap::exception<isaac::driver::cuda::exception::base>("CudaException", bp::no_init);
|
||||
wrap::exception<exc::cuda::base>("CudaException", bp::no_init);
|
||||
#define BIND_CUDA_EXCEPTION(CPPNAME, PYTHONNAME) \
|
||||
wrap::exception<isaac::driver::cuda::exception::CPPNAME, bp::bases<isaac::driver::cuda::exception::base> >(PYTHONNAME)\
|
||||
.def("__str__", &isaac::driver::cuda::exception::CPPNAME::what)
|
||||
wrap::exception<exc::cuda::CPPNAME, bp::bases<exc::cuda::base> >(PYTHONNAME)\
|
||||
.def("__str__", &exc::cuda::CPPNAME::what)
|
||||
|
||||
|
||||
BIND_CUDA_EXCEPTION(launch_out_of_resources, "CudaLaunchOutOfResources");
|
||||
|
@@ -19,11 +19,11 @@
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "isaac/kernels/templates/elementwise_1d.h"
|
||||
#include "isaac/kernels/templates/elementwise_2d.h"
|
||||
#include "isaac/kernels/templates/reduce_1d.h"
|
||||
#include "isaac/kernels/templates/reduce_2d.h"
|
||||
#include "isaac/kernels/templates/matrix_product.h"
|
||||
#include "isaac/templates/elementwise_1d.h"
|
||||
#include "isaac/templates/elementwise_2d.h"
|
||||
#include "isaac/templates/reduce_1d.h"
|
||||
#include "isaac/templates/reduce_2d.h"
|
||||
#include "isaac/templates/matrix_product.h"
|
||||
|
||||
#include "common.hpp"
|
||||
#include "kernels.h"
|
||||
|
Reference in New Issue
Block a user