Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

OpenCL Compilation Fails

Open
#1,044 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cmake, cpp

Research direction

Reproduce with the reported CMake options and make -j12, then inspect BuildPrograms in src/core/device/opencl_device.cc and the pure virtual methods reported in include/singa/core/device.h. Trace the missing OpenCL symbols and OpenclDevice interface errors; done means the OpenCL configuration builds successfully without these compiler errors.

Written by the indexing model from the issue text.

Description

On master branch cmake compile fails

Configuration:

root@1cbf9f240cc2:~/singa/build# cmake -DENABLE_TEST=ON -DUSE_PYTHON3=ON -DUSE_DNNL=ON 
-DUSE_OPENCL=ON ..
-- SINGA git Version 3.3.0
-- SINGA Version 3300
-- FOUND GLOG at /usr/include
-- Found ViennaCL include: /usr/include
-- ********************* Found ViennaCL headers at /usr/include
-- Found DNNL at /root/dnnl_lnx_1.1.0_cpu_gomp/include
-- Configuring done
-- Generating done
-- Build files have been written to: /root/singa/build

with make -j12


[ 25%] Building CXX object src/CMakeFiles/singa_objects.dir/core/tensor/tensor.cc.o
/root/singa/src/core/device/opencl_device.cc: In member function 'void singa::OpenclDevice::BuildPrograms()':
/root/singa/src/core/device/opencl_device.cc:96:46: error: 'distribution_str' is not a member of 'viennacl::backend::opencl'
   ocl::current_context().add_program(opencl::distribution_str,
                                              ^~~~~~~~~~~~~~~~
/root/singa/src/core/device/opencl_device.cc:98:46: error: 'tensormath_str' is not a member of 'viennacl::backend::opencl'
   ocl::current_context().add_program(opencl::tensormath_str,
                                              ^~~~~~~~~~~~~~
/root/singa/src/core/device/opencl_device.cc:100:46: error: 'im2col_str' is not a member of 'viennacl::backend::opencl'
   ocl::current_context().add_program(opencl::im2col_str, "opencl_im2col");
                                              ^~~~~~~~~~
/root/singa/src/core/device/opencl_device.cc:101:46: error: 'pooling_str' is not a member of 'viennacl::backend::opencl'
   ocl::current_context().add_program(opencl::pooling_str, "opencl_pooling");
                                              ^~~~~~~~~~~

and after;


/usr/include/c++/7/bits/shared_ptr.h:344:64:   required from 'std::shared_ptr<_Tp>::shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocator<singa::OpenclDevice>; _Args = {}; _Tp = singa::OpenclDevice]'
/usr/include/c++/7/bits/shared_ptr.h:690:14:   required from 'std::shared_ptr<_Tp> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = singa::OpenclDevice; _Alloc = std::allocator<singa::OpenclDevice>; _Args = {}]'
/usr/include/c++/7/bits/shared_ptr.h:706:39:   required from 'std::shared_ptr<_Tp> std::make_shared(_Args&& ...) [with _Tp = singa::OpenclDevice; _Args = {}]'
/root/singa/src/core/device/platform.cc:169:41:   required from here
/usr/include/c++/7/ext/new_allocator.h:136:4: error: invalid new-expression of abstract class type 'singa::OpenclDevice'
  { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/singa/src/core/device/platform.cc:22:0:
/root/singa/include/singa/core/device.h:253:7: note:   because the following virtual functions are pure within 'singa::OpenclDevice':
 class OpenclDevice : public singa::Device {
       ^~~~~~~~~~~~
/root/singa/include/singa/core/device.h:134:16: note: 	virtual void singa::Device::TimeProfilingDoExec(std::function<void(singa::_Context*)>&&, int, singa::Node*)
   virtual void TimeProfilingDoExec(function<void(Context*)>&& fn, int executor,
                ^~~~~~~~~~~~~~~~~~~
/root/singa/include/singa/core/device.h:136:16: note: 	virtual void singa::Device::EvaluateTimeElapsed(singa::Node*)
   virtual void EvaluateTimeElapsed(Node* node) = 0;


Dominant language
C++
Stars
3.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/singa

All issues in apache/singa

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.