【发布时间】:2020-11-05 17:33:34
【问题描述】:
我想跳转到 openCL 200,我的 ARM G72 支持它。 但是我发现 cl.hpp (old openCL ;))) 和 cl2.hpp 之间有很大的不同。
在我加载内核之前:
int src_length = 0;
const char* src = file_contents("/data/data/com.example/app_execdir/kernels.cl",&src_length);
cl::Program::Sources sources(1,std::make_pair(src, src_length) );
program = cl::Program(gContext, sources);
program.build(devices,NULL,cb);
while(program.getBuildInfo<CL_PROGRAM_BUILD_STATUS>(devices[0]) != CL_BUILD_SUCCESS);
gCompression = cl::Kernel(program, "compression", &err);
但是当我使用 cl2.hpp 和所有新的#define 编译我的 cpp 时。我使用 CL_HPP_TARGET_OPENCL_VERSION 200 收到大量错误消息
error: 'CL_DEVICE_QUEUE_ON_HOST_PROPERTIES' was not declared
note: in definition of macro 'CL_HPP_DECLARE_PARAM_TRAITS_'
note: in expansion of macro 'CL_HPP_PARAM_NAME_INFO_2_0_'
当我使用 CL_HPP_TARGET_OPENCL_VERSION 120 时,我只收到 1 个编译错误 ;)) 但这与内核编译有关。 cl::Program::Sources 来源(1,std::make_pair(src, src_length) );这是我的日志:
C:/Users/user/Documents/AndroidStudioProjects/androidcl-master/app/src/main/jni/processor.cpp:564:72: error: no matching function for call to 'std::vector<std::basic_string<char>, std::allocator<std::basic_string<char> > >::vector(int, std::pair<const char*, int>)'
cl::Program::Sources sources(1,std::make_pair(src, src_length) );
^
C:/Users/user/Documents/AndroidStudioProjects/androidcl-master/app/src/main/jni/processor.cpp:564:72: note: candidates are:
In file included from C:/android-ndk-r12b/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/vector:64:0,
from C:/android-ndk-r12b/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/bits/random.h:34,
from C:/android-ndk-r12b/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/random:49,
from C:/android-ndk-r12b/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/bits/stl_algo.h:66,
from C:/android-ndk-r12b/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/algorithm:62,
from C:/Users/user/Documents/AndroidStudioProjects/androidcl-master/app/src/main/jni/processor.cpp:23:
C:/android-ndk-r12b/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/bits/stl_vector.h:445:9: note: template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&)
vector(_InputIterator __first, _InputIterator __last,
^
C:/android-ndk-r12b/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/bits/stl_vector.h:445:9: note: template argument deduction/substitution failed:
C:/Users/user/Documents/AndroidStudioProjects/androidcl-master/app/src/main/jni/processor.cpp:564:72: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::pair<const char*, int>')
cl::Program::Sources sources(1,std::make_pair(src, src_length) );
我真的不明白是什么问题。我不再擅长 C 和 C++。在过去的 25 年里发生了很大的变化;))
【问题讨论】: