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

Class system

compute/include/boost/compute/system.hpp:42–283  ·  view source on GitHub ↗

\class system \brief Provides access to platforms and devices on the system. The system class contains a set of static functions which provide access to the OpenCL platforms and compute devices on the host system. The default_device() convenience method automatically selects and returns the "best" compute device for the system following a set of heuristics and environment variables. This simplif

Source from the content-addressed store, hash-verified

40///
41/// \see platform, device, context
42class system
43{
44public:
45 /// Returns the default compute device for the system.
46 ///
47 /// The default device is selected based on a set of heuristics and can be
48 /// influenced using one of the following environment variables:
49 ///
50 /// \li \c BOOST_COMPUTE_DEFAULT_DEVICE -
51 /// name of the compute device (e.g. "GTX TITAN")
52 /// \li \c BOOST_COMPUTE_DEFAULT_DEVICE_TYPE
53 /// type of the compute device (e.g. "GPU" or "CPU")
54 /// \li \c BOOST_COMPUTE_DEFAULT_PLATFORM -
55 /// name of the platform (e.g. "NVIDIA CUDA")
56 /// \li \c BOOST_COMPUTE_DEFAULT_VENDOR -
57 /// name of the device vendor (e.g. "NVIDIA")
58 /// \li \c BOOST_COMPUTE_DEFAULT_ENFORCE -
59 /// If this is set to "1", then throw a no_device_found() exception
60 /// if any of the above environment variables is set, but a matching
61 /// device was not found.
62 ///
63 /// The default device is determined once on the first time this function
64 /// is called. Calling this function multiple times will always result in
65 /// the same device being returned.
66 ///
67 /// If no OpenCL device is found on the system, a no_device_found exception
68 /// is thrown.
69 ///
70 /// For example, to print the name of the default compute device on the
71 /// system:
72 /// \code
73 /// // get the default compute device
74 /// boost::compute::device device = boost::compute::system::default_device();
75 ///
76 /// // print the name of the device
77 /// std::cout << "default device: " << device.name() << std::endl;
78 /// \endcode
79 static device default_device()
80 {
81 static device default_device = find_default_device();
82
83 return default_device;
84 }
85
86 /// Returns the device with \p name.
87 ///
88 /// \throws no_device_found if no device with \p name is found.
89 static device find_device(const std::string &name)
90 {
91 const std::vector<device> devices = system::devices();
92 for(size_t i = 0; i < devices.size(); i++){
93 const device& device = devices[i];
94
95 if(device.name() == name){
96 return device;
97 }
98 }
99

Callers 3

compile_cppFunction · 0.85
find_lib_pathFunction · 0.85
find_lib_pathFunction · 0.85

Calls

no outgoing calls

Tested by 1

find_lib_pathFunction · 0.68