ViennaCL - The Vienna Computing Library  1.7.0
Free open-source GPU-accelerated linear algebra and solver library.
viennacl-info.cpp
Go to the documentation of this file.
1 /* =========================================================================
2  Copyright (c) 2010-2015, Institute for Microelectronics,
3  Institute for Analysis and Scientific Computing,
4  TU Wien.
5  Portions of this software are copyright by UChicago Argonne, LLC.
6 
7  -----------------
8  ViennaCL - The Vienna Computing Library
9  -----------------
10 
11  Project Head: Karl Rupp rupp@iue.tuwien.ac.at
12 
13  (A list of authors and contributors can be found in the PDF manual)
14 
15  License: MIT (X11), see file LICENSE in the base directory
16 ============================================================================= */
17 
26 // include necessary system headers
27 #include <iostream>
28 #include <cstdlib>
29 
30 //include ViennaCL headers
31 #include "viennacl/ocl/device.hpp"
33 
37 int main()
38 {
42  typedef std::vector< viennacl::ocl::platform > platforms_type;
43  platforms_type platforms = viennacl::ocl::get_platforms();
44 
45  bool is_first_element = true;
46  for (platforms_type::iterator platform_iter = platforms.begin();
47  platform_iter != platforms.end();
48  ++platform_iter)
49  {
50  typedef std::vector<viennacl::ocl::device> devices_type;
51  devices_type devices = platform_iter->devices(CL_DEVICE_TYPE_ALL);
52 
56  std::cout << "# =========================================" << std::endl;
57  std::cout << "# Platform Information " << std::endl;
58  std::cout << "# =========================================" << std::endl;
59 
60  std::cout << "#" << std::endl;
61  std::cout << "# Vendor and version: " << platform_iter->info() << std::endl;
62  std::cout << "#" << std::endl;
63 
64  if (is_first_element)
65  {
66  std::cout << "# ViennaCL uses this OpenCL platform by default." << std::endl;
67  is_first_element = false;
68  }
69 
70 
74  std::cout << "# " << std::endl;
75  std::cout << "# Available Devices: " << std::endl;
76  std::cout << "# " << std::endl;
77  for (devices_type::iterator iter = devices.begin(); iter != devices.end(); iter++)
78  {
79  std::cout << std::endl;
80 
81  std::cout << " -----------------------------------------" << std::endl;
82  std::cout << iter->full_info();
83  std::cout << " -----------------------------------------" << std::endl;
84  }
85  std::cout << std::endl;
86  std::cout << "###########################################" << std::endl;
87  std::cout << std::endl;
88  }
89 
90  return EXIT_SUCCESS;
91 }
92 
93 
94 
std::vector< platform > get_platforms()
Definition: platform.hpp:124
Represents an OpenCL device within ViennaCL.
Implements a OpenCL platform within ViennaCL.
int main()
Definition: bisect.cpp:91