MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / platforms

Method platforms

compute/include/boost/compute/system.hpp:186–202  ·  view source on GitHub ↗

Returns a vector containing each of the OpenCL platforms on the system. For example, to print out the name of each OpenCL platform present on the system: \code for(const auto &platform : boost::compute::system::platforms()){ std::cout << platform.name() << std::endl; } \endcode

Source from the content-addressed store, hash-verified

184 /// }
185 /// \endcode
186 static std::vector<platform> platforms()
187 {
188 cl_uint count = 0;
189 clGetPlatformIDs(0, 0, &count);
190
191 std::vector<platform> platforms;
192 if(count > 0)
193 {
194 std::vector<cl_platform_id> platform_ids(count);
195 clGetPlatformIDs(count, &platform_ids[0], 0);
196
197 for(size_t i = 0; i < platform_ids.size(); i++){
198 platforms.push_back(platform(platform_ids[i]));
199 }
200 }
201 return platforms;
202 }
203
204 /// Returns the number of compute platforms on the system.
205 static size_t platform_count()

Callers

nothing calls this directly

Calls 3

push_backMethod · 0.80
platformClass · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected