MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / get

Method get

include/CL/opencl.hpp:2928–2957  ·  view source on GitHub ↗

! \brief Gets a list of available platforms. * * Wraps clGetPlatformIDs(). */

Source from the content-addressed store, hash-verified

2926 * Wraps clGetPlatformIDs().
2927 */
2928 static cl_int get(
2929 vector<Platform>* platforms)
2930 {
2931 cl_uint n = 0;
2932
2933 if( platforms == nullptr ) {
2934 return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
2935 }
2936
2937 cl_int err = ::clGetPlatformIDs(0, nullptr, &n);
2938 if (err != CL_SUCCESS) {
2939 return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2940 }
2941
2942 vector<cl_platform_id> ids(n);
2943 err = ::clGetPlatformIDs(n, ids.data(), nullptr);
2944 if (err != CL_SUCCESS) {
2945 return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2946 }
2947
2948 if (platforms) {
2949 platforms->resize(ids.size());
2950
2951 // Platforms don't reference count
2952 for (size_type i = 0; i < ids.size(); i++) {
2953 (*platforms)[i] = Platform(ids[i]);
2954 }
2955 }
2956 return CL_SUCCESS;
2957 }
2958
2959 /*! \brief Gets the first available platform.
2960 *

Callers

nothing calls this directly

Calls 6

errHandlerFunction · 0.85
clGetPlatformIDsFunction · 0.85
PlatformClass · 0.85
dataMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected