diff --git a/nntrainer/layers/layer_context.h b/nntrainer/layers/layer_context.h index aa3c23cff9..3278cf0f24 100644 --- a/nntrainer/layers/layer_context.h +++ b/nntrainer/layers/layer_context.h @@ -813,21 +813,6 @@ class RunLayerContext { opencl::ContextManager &context_inst_ = opencl::ContextManager::GetInstance(); opencl::Kernel kernel_; - /** - * @brief set the compute engine for this node - * @param compute engine: (CPU/GPU) - */ - void setComputeEngine(const ml::train::LayerComputeEngine &compute_engine = - ml::train::LayerComputeEngine::CPU) { - this->compute_engine = compute_engine; - } - - /** - * @brief get the compute engine for this node - * @return ompute engine: (CPU/GPU) - */ - ml::train::LayerComputeEngine getComputeEngine() { return compute_engine; } - /** * @brief create OpenCl kernel * @param kernel implementation string @@ -846,6 +831,21 @@ class RunLayerContext { } #endif + /** + * @brief set the compute engine for this node + * @param compute engine: (CPU/GPU) + */ + void setComputeEngine(const ml::train::LayerComputeEngine &compute_engine = + ml::train::LayerComputeEngine::CPU) { + this->compute_engine = compute_engine; + } + + /** + * @brief get the compute engine for this node + * @return ompute engine: (CPU/GPU) + */ + ml::train::LayerComputeEngine getComputeEngine() { return compute_engine; } + private: std::tuple props; /**< props of the layer */ float loss; /**< loss of the layer */ diff --git a/nntrainer/layers/layer_node.cpp b/nntrainer/layers/layer_node.cpp index d93ec6e87e..d0577e9f07 100644 --- a/nntrainer/layers/layer_node.cpp +++ b/nntrainer/layers/layer_node.cpp @@ -167,11 +167,10 @@ createLayerNode(std::unique_ptr &&layer, auto lnode = std::make_unique(std::move(layer)); lnode->setProperty(properties); -#ifdef ENABLE_OPENCL + if (compute_engine == ml::train::LayerComputeEngine::GPU) { lnode->setComputeEngine(compute_engine); } -#endif return lnode; } @@ -267,12 +266,10 @@ void LayerNode::setOutputConnection(unsigned nth, const std::string &name, con = std::make_unique(name, index); } -#ifdef ENABLE_OPENCL void LayerNode::setComputeEngine( const ml::train::LayerComputeEngine &compute_engine) { run_context->setComputeEngine(compute_engine); } -#endif const std::string LayerNode::getName() const noexcept { auto &name = std::get(*layer_node_props); @@ -334,9 +331,8 @@ const std::vector LayerNode::getInputLayers() const { names.reserve(input_connections.size()); std::transform( input_connections.begin(), input_connections.end(), - std::back_inserter(names), [](const Connection &con) -> const auto & { - return con.getName(); - }); + std::back_inserter(names), + [](const Connection &con) -> const auto & { return con.getName(); }); return names; } diff --git a/nntrainer/layers/layer_node.h b/nntrainer/layers/layer_node.h index 9eb9baaba9..c1068b0f56 100644 --- a/nntrainer/layers/layer_node.h +++ b/nntrainer/layers/layer_node.h @@ -193,14 +193,12 @@ class LayerNode final : public ml::train::Layer, public GraphNode { void setOutputConnection(unsigned nth, const std::string &name, unsigned index); -#ifdef ENABLE_OPENCL /** * @brief set the compute engine for this node * @param compute engine (CPU/GPU) */ void setComputeEngine(const ml::train::LayerComputeEngine &compute_engine = ml::train::LayerComputeEngine::CPU); -#endif /** * @brief Get the input connections for this node diff --git a/nntrainer/tensor/cl_operations/cl_sgemv.h b/nntrainer/tensor/cl_operations/cl_sgemv.h index e86c72081a..657d5d3b88 100644 --- a/nntrainer/tensor/cl_operations/cl_sgemv.h +++ b/nntrainer/tensor/cl_operations/cl_sgemv.h @@ -36,19 +36,19 @@ class GpuCLSgemv : public nntrainer::opencl::GpuCLOpInterface { })"; public: -/** - * @brief Function to set buffers and kernel arguments for SGEMV - * - * @tparam T - * @param matAdata - * @param vecXdata - * @param vecYdata - * @param alpha - * @param beta - * @param dim1 - * @param dim2 - * @return T* - */ + /** + * @brief Function to set buffers and kernel arguments for SGEMV + * + * @tparam T + * @param matAdata + * @param vecXdata + * @param vecYdata + * @param alpha + * @param beta + * @param dim1 + * @param dim2 + * @return T* + */ template T *cLSgemv(const T *matAdata, const T *vecXdata, T *vecYdata, T alpha, T beta, unsigned int dim1, unsigned int dim2);