Class platform

| Home | Libraries | People | FAQ | More

## Class platform

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

## Synopsis

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

    class platform {
    public:
      // construct/copy/destruct
      explicit platform(cl_platform_id);
      platform(const platform &);
      platform & operator=(const platform &);
      ~platform();

      // public member functions
      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;
    };

## 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 construct/copy/destruct

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.

### `platform` public member functions

1.     cl_platform_id id() const;

   Returns the ID of the platform.

2.     std::string name() const;

   Returns the name of the platform.

3.     std::string vendor() const;

   Returns the name of the vendor for the platform.

4.     std::string profile() const;

   Returns the profile string for the platform.

5.     std::string version() const;

   Returns the version string for the platform.

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

   Returns a list of extensions supported by the platform.

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

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

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

   Returns a list of devices on the platform.

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

   Returns the number of devices on the platform.

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

    Returns information about the platform.

    See the documentation for clGetPlatformInfo() for more information.

11.     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.

12.     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.

13.     void unload_compiler();

    Requests that the platform unload any compiler resources.

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

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

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

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