Loading [MathJax]/extensions/tex2jax.js
Parallel numerical verification of the σ_odd problem  October 6, 2018
All Classes Namespaces Files Functions Variables Typedefs Macros
opencl_infos.cpp
Go to the documentation of this file.
1 /* -*- coding: latin-1 -*- */
2 /** \file opencl/opencl_infos.cpp (December 16, 2017)
3  * \brief
4  * Print infos about OpenCL platforms and devices.
5  *
6  * GPLv3 --- Copyright (C) 2017 Olivier Pirson
7  * http://www.opimedia.be/
8  */
9 
10 // \cond
11 #include <cstdlib>
12 
13 #include <iostream>
14 // \endcond
15 
16 #include "opencl/opencl.hpp"
17 
18 
19 
20 /* ***********
21  * Prototype *
22  *************/
23 
24 void
26 
27 
28 
29 /* **********
30  * Function *
31  ************/
32 
33 void
35  std::cerr << "Usage: opencl_infos [option]" << std::endl
36  << std::endl
37  << "Options:" << std::endl
38  << " --first-gpu only the first GPU device found" << std::endl;
39 
40  exit(EXIT_FAILURE);
41 }
42 
43 
44 
45 /* ******
46  * Main *
47  ********/
48 int
49 main(int argc, const char* const argv[]) {
50  // Read command line parameters
51  for (unsigned int i = 1; i < static_cast<unsigned int>(argc); ++i) {
52  const std::string param(argv[i]);
53 
54  if (param == "--first-gpu") {
55  const cl::Device device = opencl::get_first_device_gpu();
56 
57  std::cout << "OpenCL first GPU device found:" << std::endl;
58  opencl::print_device(device);
59 
60  exit(EXIT_SUCCESS);
61  }
62  else {
63  help_and_exit();
64  }
65  }
66 
67  std::cout << "OpenCL platforms and devices:" << std::endl;
69 
70  return EXIT_SUCCESS;
71 }
cl::Device get_first_device_gpu()
Return the first GPU device found. If not found then print an error message and exit.
Definition: helper.cpp:194
void help_and_exit()
void print_device(const cl::Device &device)
Print information on this device.
Definition: helper.cpp:225
int main(int argc, const char *const argv[])
void print_platforms()
Print information on all platforms.
Definition: helper.cpp:407
Implementation of the OpenCL parallel algorithms presented in the report.