ViennaCL - The Vienna Computing Library: examples/tutorial/viennacl-info.cpp Source File

ViennaCL - The Vienna Computing Library 1.7.1 Free open-source GPU-accelerated linear algebra and solver library. |

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
viennacl-info.cpp
Go to the documentation of this file.
1 /* =========================================================================
2 Copyright (c) 2010-2016, 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"
32 #include "viennacl/ocl/platform.hpp"
33 #include "viennacl/device_specific/builtin_database/common.hpp"
34
38 int main()
39 {
43 typedef std::vector< viennacl::ocl::platform > platforms_type;
44 platforms_type platforms = viennacl::ocl::get_platforms();
45
46 bool is_first_element = true;
47 for (platforms_type::iterator platform_iter = platforms.begin();
48 platform_iter != platforms.end();
49 ++platform_iter)
50 {
51 typedef std::vector<viennacl::ocl::device> devices_type;
52 devices_type devices = platform_iter->devices(CL_DEVICE_TYPE_ALL);
53
57 std::cout << "# =========================================" << std::endl;
58 std::cout << "# Platform Information " << std::endl;
59 std::cout << "# =========================================" << std::endl;
60
61 std::cout << "#" << std::endl;
62 std::cout << "# Vendor and version: " << platform_iter->info() << std::endl;
63 std::cout << "#" << std::endl;
64
65 if (is_first_element)
66 {
67 std::cout << "# ViennaCL uses this OpenCL platform by default." << std::endl;
68 is_first_element = false;
69 }
70
71
75 std::cout << "# " << std::endl;
76 std::cout << "# Available Devices: " << std::endl;
77 std::cout << "# " << std::endl;
78 for (devices_type::iterator iter = devices.begin(); iter != devices.end(); iter++)
79 {
80 std::cout << std::endl;
81
82 std::cout << " -----------------------------------------" << std::endl;
83 std::cout << iter->full_info();
84 std::cout << "ViennaCL Device Architecture: " << iter->architecture_family() << std::endl;
85 std::cout << "ViennaCL Database Mapped Name: " << viennacl::device_specific::builtin_database::get_mapped_device_name(iter->name(), iter->vendor_id()) << std::endl;
86 std::cout << " -----------------------------------------" << std::endl;
87 }
88 std::cout << std::endl;
89 std::cout << "###########################################" << std::endl;
90 std::cout << std::endl;
91 }
92
93 return EXIT_SUCCESS;
94 }
95
96
97
viennacl::ocl::get_platforms
std::vector< platform > get_platforms()
Definition: platform.hpp:124
device.hpp
Represents an OpenCL device within ViennaCL.
platform.hpp
Implements a OpenCL platform within ViennaCL.
viennacl::device_specific::builtin_database::get_mapped_device_name
StringT get_mapped_device_name(StringT const &device_name, vendor_id_type vendor_id)
Definition: common.hpp:108
main
int main()
Definition: bisect.cpp:91
common.hpp