提交 05dd5e63 编写于 作者: L liuruilong

complie success

上级 0575e7d7
...@@ -72,6 +72,10 @@ endif() ...@@ -72,6 +72,10 @@ endif()
if (GPU_CL) if (GPU_CL)
add_definitions(-DPADDLE_MOBILE_CL) add_definitions(-DPADDLE_MOBILE_CL)
# opencl version
add_definitions(-DCL_TARGET_OPENCL_VERSION=220)
link_libraries(/Users/liuruilong/GitHub/paddle-mobile/third_party/opencl/libOpenCL.so) link_libraries(/Users/liuruilong/GitHub/paddle-mobile/third_party/opencl/libOpenCL.so)
include_directories(third_party/opencl/OpenCL-Headers) include_directories(third_party/opencl/OpenCL-Headers)
else() else()
...@@ -82,7 +86,6 @@ else() ...@@ -82,7 +86,6 @@ else()
file(GLOB_RECURSE _tmp_list_h src/framework/cl/*.h) file(GLOB_RECURSE _tmp_list_h src/framework/cl/*.h)
foreach(f ${_tmp_list_h}) foreach(f ${_tmp_list_h})
message(STATUS ${f})
list(REMOVE_ITEM PADDLE_MOBILE_H ${f}) list(REMOVE_ITEM PADDLE_MOBILE_H ${f})
endforeach() endforeach()
endif() endif()
......
...@@ -115,7 +115,11 @@ class OperatorWithKernel : public OperatorBase<Dtype> { ...@@ -115,7 +115,11 @@ class OperatorWithKernel : public OperatorBase<Dtype> {
const VariableNameMap &outputs, const AttributeMap &attrs, const VariableNameMap &outputs, const AttributeMap &attrs,
std::shared_ptr<Scope> scope) std::shared_ptr<Scope> scope)
: OperatorBase<Dtype>(type, inputs, outputs, attrs, scope), : OperatorBase<Dtype>(type, inputs, outputs, attrs, scope),
param_(inputs, outputs, attrs, *scope) {} param_(inputs, outputs, attrs, *scope) {
#ifdef PADDLE_MOBILE_CL
kernel_.InitCLHelper(scope->GetCLScpoe());
#endif
}
virtual void RunImpl() { this->kernel_.Compute(this->param_); } virtual void RunImpl() { this->kernel_.Compute(this->param_); }
...@@ -126,6 +130,8 @@ class OperatorWithKernel : public OperatorBase<Dtype> { ...@@ -126,6 +130,8 @@ class OperatorWithKernel : public OperatorBase<Dtype> {
// DLOG << i.first; // DLOG << i.first;
// DLOG << i.second; // DLOG << i.second;
// } // }
PADDLE_MOBILE_ENFORCE(kernel_.Init(&param_), " %s kernel init failed", PADDLE_MOBILE_ENFORCE(kernel_.Init(&param_), " %s kernel init failed",
this->type_.c_str()); this->type_.c_str());
} }
...@@ -141,10 +147,16 @@ class OperatorWithKernel : public OperatorBase<Dtype> { ...@@ -141,10 +147,16 @@ class OperatorWithKernel : public OperatorBase<Dtype> {
template <typename Dtype, typename P> template <typename Dtype, typename P>
class OpKernelBase { class OpKernelBase {
public: public:
OpKernelBase() = default; OpKernelBase() = default;
// OpKernelBase(CLScope *clscope): cl_helper_(CLHelper(clscope)) { #ifdef PADDLE_MOBILE_CL
// }
virtual void InitCLHelper(CLScope *clScope) {
cl_helper_ = CLHelper(clScope);
}
#endif
/* /*
* @b 所有kernel 需实现 Compute 方法 * @b 所有kernel 需实现 Compute 方法
...@@ -163,7 +175,9 @@ class OpKernelBase { ...@@ -163,7 +175,9 @@ class OpKernelBase {
virtual ~OpKernelBase() = default; virtual ~OpKernelBase() = default;
protected: protected:
// CLHelper cl_helper_; #ifdef PADDLE_MOBILE_CL
CLHelper cl_helper_;
#endif
private: private:
#ifdef PADDLE_MOBILE_MALI_GPU #ifdef PADDLE_MOBILE_MALI_GPU
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册