go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkOpenCLPlatform.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright UMC Utrecht and contributors
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkOpenCLPlatform_h
19 #define __itkOpenCLPlatform_h
20 
21 #include "itkOpenCL.h"
22 
23 #include <string>
24 #include <list>
25 
26 namespace itk
27 {
45 {
46 public:
47 
50 
52  OpenCLPlatform() : m_Id( 0 ), m_Version( 0 ) {}
53 
56  OpenCLPlatform( cl_platform_id id ) : m_Id( id ), m_Version( 0 ) {}
57 
65  enum VendorType {
69  AMD,
70  IBM
71  };
72 
74  bool IsNull() const { return this->m_Id == 0; }
75 
77  cl_platform_id GetPlatformId() const { return this->m_Id; }
78 
82 
86  std::string GetVersion() const;
87 
90  bool IsFullProfile() const;
91 
94  bool IsEmbeddedProfile() const;
95 
99  std::string GetProfile() const;
100 
102  std::string GetName() const;
103 
105  std::string GetVendor() const;
106 
110 
113  std::string GetExtensionSuffix() const;
114 
117  std::list< std::string > GetExtensions() const;
118 
125  bool HasExtension( const std::string & name ) const;
126 
128  static std::list< OpenCLPlatform > GetAllPlatforms();
129 
132 
133 private:
134 
135  cl_platform_id m_Id;
136  mutable int m_Version;
137 };
138 
142 bool ITKOpenCL_EXPORT operator==( const OpenCLPlatform & lhs, const OpenCLPlatform & rhs );
143 
147 bool ITKOpenCL_EXPORT operator!=( const OpenCLPlatform & lhs, const OpenCLPlatform & rhs );
148 
150 template< typename charT, typename traits >
151 inline
152 std::basic_ostream< charT, traits > &
153 operator<<( std::basic_ostream< charT, traits > & strm,
154  const OpenCLPlatform & platform )
155 {
156  if( platform.IsNull() )
157  {
158  strm << "OpenCLPlatform(null)";
159  return strm;
160  }
161 
162  const char indent = ' ';
163 
164  strm << "OpenCLPlatform" << std::endl
165  << indent << "Id: " << platform.GetPlatformId() << std::endl;
166 
167  strm << indent << "OpenCL version: ";
168  switch( platform.GetOpenCLVersion() )
169  {
170  case VERSION_1_0:
171  strm << "1.0"; break;
172  case VERSION_1_1:
173  strm << "1.1"; break;
174  case VERSION_1_2:
175  strm << "1.2"; break;
176  case VERSION_2_0:
177  strm << "2.0"; break;
178  case VERSION_2_1:
179  strm << "2.1"; break;
180  default:
181  strm << "Unknown"; break;
182  }
183 
184  strm << std::endl << indent << "Full profile: " << ( platform.IsFullProfile() ? "On" : "Off" ) << std::endl
185  << indent << "Embedded profile: " << ( platform.IsEmbeddedProfile() ? "On" : "Off" ) << std::endl
186  << indent << "Profile: " << platform.GetProfile() << std::endl
187  << indent << "Version: " << platform.GetVersion() << std::endl
188  << indent << "Name: " << platform.GetName() << std::endl
189  << indent << "Vendor: " << platform.GetVendor() << std::endl
190  << indent << "Extension suffix: " << platform.GetExtensionSuffix() << std::endl;
191 
192  const std::list< std::string > extensions = platform.GetExtensions();
193  const std::size_t extensionsSize = extensions.size();
194  strm << indent << "Extensions(" << extensionsSize << "): ";
195  if( extensions.empty() )
196  {
197  strm << "none";
198  }
199  else
200  {
201  strm << std::endl;
202  for( std::list< std::string >::const_iterator it = extensions.begin(); it != extensions.end(); ++it )
203  {
204  strm << indent << indent << "- " << *it << std::endl;
205  }
206  }
207 
208  return strm;
209 }
210 
211 
212 } // end namespace itk
213 
214 #endif /* __itkOpenCLPlatform_h */
itk::OpenCLPlatform::NVidia
@ NVidia
Definition: itkOpenCLPlatform.h:68
itk::operator!=
bool ITKOpenCL_EXPORT operator!=(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
itk::OpenCLPlatform::GetExtensions
std::list< std::string > GetExtensions() const
itk::OpenCLPlatform::GetVersion
std::string GetVersion() const
itk::OpenCLPlatform::Intel
@ Intel
Definition: itkOpenCLPlatform.h:67
ITKOpenCL_EXPORT
#define ITKOpenCL_EXPORT
Definition: itkOpenCLExport.h:31
itk::OpenCLPlatform::GetAllPlatforms
static std::list< OpenCLPlatform > GetAllPlatforms()
itk::VERSION_1_0
@ VERSION_1_0
Definition: itkOpenCL.h:42
itk::OpenCLPlatform::m_Version
int m_Version
Definition: itkOpenCLPlatform.h:136
itk::OpenCLPlatform::VendorType
VendorType
Definition: itkOpenCLPlatform.h:65
itk::OpenCLPlatform::GetVendorType
VendorType GetVendorType() const
itk::VERSION_1_1
@ VERSION_1_1
Definition: itkOpenCL.h:43
itkOpenCL.h
itk::OpenCLPlatform::Default
@ Default
Definition: itkOpenCLPlatform.h:66
itk::OpenCLPlatform::GetPlatformId
cl_platform_id GetPlatformId() const
Definition: itkOpenCLPlatform.h:77
itk::OpenCLPlatform::GetProfile
std::string GetProfile() const
itk::OpenCLPlatform::IsNull
bool IsNull() const
Definition: itkOpenCLPlatform.h:74
itk::operator<<
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &strm, const OpenCLCommandQueue &queue)
Definition: itkOpenCLCommandQueue.h:116
itk::VERSION_2_0
@ VERSION_2_0
Definition: itkOpenCL.h:45
itk::VERSION_1_2
@ VERSION_1_2
Definition: itkOpenCL.h:44
itk::OpenCLPlatform::OpenCLPlatform
OpenCLPlatform(cl_platform_id id)
Definition: itkOpenCLPlatform.h:56
itk::OpenCLPlatform::IsEmbeddedProfile
bool IsEmbeddedProfile() const
itk::OpenCLPlatform::OpenCLPlatform
OpenCLPlatform()
Definition: itkOpenCLPlatform.h:52
itk::OpenCLPlatform::GetName
std::string GetName() const
itk::VERSION_2_1
@ VERSION_2_1
Definition: itkOpenCL.h:46
itk::operator==
bool ITKOpenCL_EXPORT operator==(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
itk::OpenCLPlatform
The OpenCLPlatform represent platform model for OpenCL.
Definition: itkOpenCLPlatform.h:45
itk::OpenCLPlatform::Self
OpenCLPlatform Self
Definition: itkOpenCLPlatform.h:49
itk
Definition: itkAdvancedImageToImageMetric.h:40
itk::OpenCLPlatform::GetOpenCLVersion
OpenCLVersion GetOpenCLVersion() const
itk::OpenCLPlatform::IsFullProfile
bool IsFullProfile() const
itk::OpenCLVersion
OpenCLVersion
Definition: itkOpenCL.h:41
itk::OpenCLPlatform::GetPlatform
static OpenCLPlatform GetPlatform(const OpenCLPlatform::VendorType vendor)
itk::OpenCLPlatform::GetExtensionSuffix
std::string GetExtensionSuffix() const
itk::OpenCLPlatform::GetVendor
std::string GetVendor() const
itk::OpenCLPlatform::AMD
@ AMD
Definition: itkOpenCLPlatform.h:69
itk::OpenCLPlatform::m_Id
cl_platform_id m_Id
Definition: itkOpenCLPlatform.h:135
itk::OpenCLPlatform::HasExtension
bool HasExtension(const std::string &name) const


Generated on OURCE_DATE_EPOCH for elastix by doxygen 1.8.18 elastix logo