| Home | Libraries | People | FAQ | More

## Class platform

boost::compute::platform — A compute platform.

## Synopsis

    // In header: <boost/compute/platform.hpp>

    class platform {
    public:

      // public member functions
      explicit platform(cl_platform_id);
      platform(const platform &);
      platform & operator=(const platform &);
      ~platform();
      cl_platform_id id() const;
      std::string name() const;
      std::string vendor() const;
      std::string profile() const;
      std::string version() const;
      std::vector< std::string > extensions() const;
      bool supports_extension(const std::string &) const;
      std::vector< device > devices(cl_device_type = CL_DEVICE_TYPE_ALL) const;
      size_t device_count(cl_device_type = CL_DEVICE_TYPE_ALL) const;
      template<typename T> T get_info(cl_platform_info) const;
      template<int Enum> unspecified get_info() const;
      void * get_extension_function_address(const char *) const;
      void unload_compiler();
      bool operator==(const platform &) const;
      bool operator!=(const platform &) const;
      bool check_version(int, int) const;
    };

## Description

The platform class provides an interface to an OpenCL platform.

To obtain a list of all platforms on the system use the system::platforms() method.

See Also: device, context

### `platform` public member functions

1.     explicit platform(cl_platform_id id);

   Creates a new platform object for `id`.

2.     platform(const platform & other);

   Creates a new platform as a copy of `other`.

3.     platform & operator=(const platform & other);

   Copies the platform id from `other`.

4.     ~platform();

   Destroys the platform object.

5.     cl_platform_id id() const;

   Returns the ID of the platform.

6.     std::string name() const;

   Returns the name of the platform.

7.     std::string vendor() const;

   Returns the name of the vendor for the platform.

8.     std::string profile() const;

   Returns the profile string for the platform.

9.     std::string version() const;

   Returns the version string for the platform.

10.     std::vector< std::string > extensions() const;

    Returns a list of extensions supported by the platform.

11.     bool supports_extension(const std::string & name) const;

    Returns `true` if the platform supports the extension with `name`.

12.     std::vector< device > devices(cl_device_type type = CL_DEVICE_TYPE_ALL) const;

    Returns a list of devices on the platform.

13.     size_t device_count(cl_device_type type = CL_DEVICE_TYPE_ALL) const;

    Returns the number of devices on the platform.

14.     template<typename T> T get_info(cl_platform_info info) const;

    Returns information about the platform.

    See the documentation for

15.     template<int Enum> unspecified get_info() const;

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

16.     void * get_extension_function_address(const char * function_name) const;

    Returns the address of the `function_name` extension function. Returns `0` if `function_name` is invalid.

17.     void unload_compiler();

    Requests that the platform unload any compiler resources.

18.     bool operator==(const platform & other) const;

    Returns `true` if the platform is the same at `other`.

19.     bool operator!=(const platform & other) const;

    Returns `true` if the platform is different from `other`.

20.     bool check_version(int major, int minor) const;

    Returns `true` if the platform OpenCL version is major.minor or newer; otherwise returns `false`.