Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
decsOpenCLInfo.cpp
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003, 2004 (see file CONTACTS for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 #include <iostream>
26 
27 #include <OpenCLFramework/clfContext.hh>
28 #include <Utils/Param.hh>
29 #include <Utils/IOUtils.hh>
30 
31 using namespace std;
32 using namespace BIAS;
33 using namespace BIAS;
34 
35 int main(int argc, char* argv[]) {
36 
37  Param par;
38  bool *printimgformats = par.AddParamBool("imageformats", "print available image formats", false, 'i');
39 
40  if (IOUtils::ParseCommandLineEvalHelp(par, argc, argv) == 0) {
41  par.Usage();
42  }
43 
44  try {
45 
46  clfContext context;
47 
48  context.PrintPlatformsInfo();
49 
50  for (unsigned int d=0;d<context.GetNumDevices();d++) {
51  context.PrintDeviceInfo(d, true);
52  }
53 
54  if (*printimgformats) {
55  clfImage2D *img = context.CreateImage2D();
56  vector<string> formats = img->GetSupportedImageFormats(false, false);
57  cout << "Available Image Formats for Device 0:" << endl;
58  for (unsigned int i=0;i<formats.size();i++) {
59  cout << formats[i] << endl;
60  }
61  delete img;
62  }
63 
64  } catch (clfException &err) {
65  cout << err.GetDetailedString() << endl;
66  }
67  try {
68 
69  clfContext context(false, clfContext::clfContextTypeCPU);
70 
71  context.PrintPlatformsInfo();
72 
73  for (unsigned int d=0;d<context.GetNumDevices();d++) {
74  context.PrintDeviceInfo(d, true);
75  }
76 
77  if (*printimgformats) {
78  clfImage2D *img = context.CreateImage2D();
79  vector<string> formats = img->GetSupportedImageFormats(false, false);
80  cout << "Available Image Formats for Device 0:" << endl;
81  for (unsigned int i=0;i<formats.size();i++) {
82  cout << formats[i] << endl;
83  }
84  delete img;
85  }
86 
87  } catch (clfException &err) {
88  cout << err.GetDetailedString() << endl;
89  }
90 
91  return 0;
92 }
std::vector< std::string > GetSupportedImageFormats(bool readonly=false, bool writeonly=false)
Definition: clfImage2D.cpp:356
void PrintPlatformsInfo(std::ostream &out=std::cout)
print info on available platforms
Definition: clfContext.cpp:204
OpenCL Image2D wrapper.
Definition: clfImage2D.hh:46
void PrintDeviceInfo(unsigned int device=0, bool verbose=false, std::ostream &out=std::cout)
print info on computing device
Definition: clfContext.cpp:127
bool * AddParamBool(const std::string &name, const std::string &help, bool deflt=false, char cmdshort=0, int Group=GRP_NOSHOW)
Definition: Param.cpp:305
unsigned int GetNumDevices()
Definition: clfContext.hh:137
const std::string & GetDetailedString() const
detailed combination of all info available
void Usage(std::ostream &os=std::cout)
print Help-Information to stdout
Definition: Param.cpp:176
OpenCL Context wrapper.
Definition: clfContext.hh:49
clf Exception wrapper, is thrown in case of most clf errors
Definition: clfException.hh:48
This class Param provides generic support for parameters.
Definition: Param.hh:231
clfImage2D * CreateImage2D()
create buffer object
Definition: clfContext.hh:87