Loading...
Searching...
No Matches
itkOpenCLPlatform.h
Go to the documentation of this file.
/*=========================================================================
*
* Copyright UMC Utrecht and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkOpenCLPlatform_h
#define itkOpenCLPlatform_h
#include "itkOpenCL.h"
#include <string>
#include <list>
namespace itk
{
class ITKOpenCL_EXPORT OpenCLPlatform
{
public:
using Self = OpenCLPlatform;
OpenCLPlatform()
: m_Id(0)
, m_Version(0)
{}
OpenCLPlatform(cl_platform_id id)
: m_Id(id)
, m_Version(0)
{}
enum VendorType
{
Default,
Intel,
NVidia,
AMD,
IBM
};
bool
IsNull() const
{
return this->m_Id == 0;
}
cl_platform_id
GetPlatformId() const
{
return this->m_Id;
}
OpenCLVersion
GetOpenCLVersion() const;
std::string
GetVersion() const;
bool
IsFullProfile() const;
bool
IsEmbeddedProfile() const;
std::string
GetProfile() const;
std::string
GetName() const;
std::string
GetVendor() const;
VendorType
GetVendorType() const;
std::string
GetExtensionSuffix() const;
std::list<std::string>
GetExtensions() const;
bool
HasExtension(const std::string & name) const;
static std::list<OpenCLPlatform>
GetAllPlatforms();
static OpenCLPlatform
GetPlatform(const OpenCLPlatform::VendorType vendor);
private:
cl_platform_id m_Id;
mutable int m_Version;
};
bool ITKOpenCL_EXPORT
operator==(const OpenCLPlatform & lhs, const OpenCLPlatform & rhs);
bool ITKOpenCL_EXPORT
operator!=(const OpenCLPlatform & lhs, const OpenCLPlatform & rhs);
template <typename charT, typename traits>
inline std::basic_ostream<charT, traits> &
operator<<(std::basic_ostream<charT, traits> & strm, const OpenCLPlatform & platform)
{
if (platform.IsNull())
{
strm << "OpenCLPlatform(null)";
return strm;
}
const char indent = ' ';
strm << "OpenCLPlatform\n" << indent << "Id: " << platform.GetPlatformId() << std::endl;
strm << indent << "OpenCL version: ";
switch (platform.GetOpenCLVersion())
{
case VERSION_1_0:
strm << "1.0";
break;
case VERSION_1_1:
strm << "1.1";
break;
case VERSION_1_2:
strm << "1.2";
break;
case VERSION_2_0:
strm << "2.0";
break;
case VERSION_2_1:
strm << "2.1";
break;
default:
strm << "Unknown";
break;
}
strm << '\n'
<< indent << "Full profile: " << (platform.IsFullProfile() ? "On" : "Off") << '\n'
<< indent << "Embedded profile: " << (platform.IsEmbeddedProfile() ? "On" : "Off") << '\n'
<< indent << "Profile: " << platform.GetProfile() << '\n'
<< indent << "Version: " << platform.GetVersion() << '\n'
<< indent << "Name: " << platform.GetName() << '\n'
<< indent << "Vendor: " << platform.GetVendor() << '\n'
<< indent << "Extension suffix: " << platform.GetExtensionSuffix() << std::endl;
const std::list<std::string> extensions = platform.GetExtensions();
const std::size_t extensionsSize = extensions.size();
strm << indent << "Extensions(" << extensionsSize << "): ";
if (extensions.empty())
{
strm << "none";
}
else
{
strm << std::endl;
for (std::list<std::string>::const_iterator it = extensions.begin(); it != extensions.end(); ++it)
{
strm << indent << indent << "- " << *it << std::endl;
}
}
return strm;
}
} // end namespace itk
#endif /* itkOpenCLPlatform_h */
itk::OpenCLPlatform
The OpenCLPlatform represent platform model for OpenCL.
Definition itkOpenCLPlatform.h:45
itk::OpenCLPlatform::Self
OpenCLPlatform Self
Definition itkOpenCLPlatform.h:48
itk::OpenCLPlatform::IsEmbeddedProfile
bool IsEmbeddedProfile() const
itk::OpenCLPlatform::GetProfile
std::string GetProfile() const
itk::OpenCLPlatform::GetName
std::string GetName() const
itk::OpenCLPlatform::GetAllPlatforms
static std::list< OpenCLPlatform > GetAllPlatforms()
itk::OpenCLPlatform::OpenCLPlatform
OpenCLPlatform(cl_platform_id id)
Definition itkOpenCLPlatform.h:58
itk::OpenCLPlatform::GetOpenCLVersion
OpenCLVersion GetOpenCLVersion() const
itk::OpenCLPlatform::HasExtension
bool HasExtension(const std::string &name) const
itk::OpenCLPlatform::GetPlatformId
cl_platform_id GetPlatformId() const
Definition itkOpenCLPlatform.h:88
itk::OpenCLPlatform::IsFullProfile
bool IsFullProfile() const
itk::OpenCLPlatform::GetVendorType
VendorType GetVendorType() const
itk::OpenCLPlatform::GetExtensions
std::list< std::string > GetExtensions() const
itk::OpenCLPlatform::IsNull
bool IsNull() const
Definition itkOpenCLPlatform.h:81
itk::OpenCLPlatform::OpenCLPlatform
OpenCLPlatform()
Definition itkOpenCLPlatform.h:51
itk::OpenCLPlatform::GetVersion
std::string GetVersion() const
itk::OpenCLPlatform::m_Version
int m_Version
Definition itkOpenCLPlatform.h:162
itk::OpenCLPlatform::m_Id
cl_platform_id m_Id
Definition itkOpenCLPlatform.h:161
itk::OpenCLPlatform::GetExtensionSuffix
std::string GetExtensionSuffix() const
itk::OpenCLPlatform::GetPlatform
static OpenCLPlatform GetPlatform(const OpenCLPlatform::VendorType vendor)
itk::OpenCLPlatform::VendorType
VendorType
Definition itkOpenCLPlatform.h:71
itk::OpenCLPlatform::NVidia
@ NVidia
Definition itkOpenCLPlatform.h:74
itk::OpenCLPlatform::Default
@ Default
Definition itkOpenCLPlatform.h:72
itk::OpenCLPlatform::AMD
@ AMD
Definition itkOpenCLPlatform.h:75
itk::OpenCLPlatform::IBM
@ IBM
Definition itkOpenCLPlatform.h:76
itk::OpenCLPlatform::Intel
@ Intel
Definition itkOpenCLPlatform.h:73
itk::OpenCLPlatform::GetVendor
std::string GetVendor() const
ITKOpenCL_EXPORT
#define ITKOpenCL_EXPORT
Definition itkOpenCLExport.h:33
itkOpenCL.h
itk
Definition itkAdvancedImageToImageMetric.h:43
itk::operator==
bool ITKOpenCL_EXPORT operator==(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
itk::operator!=
bool ITKOpenCL_EXPORT operator!=(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
itk::OpenCLVersion
OpenCLVersion
Definition itkOpenCL.h:46
itk::VERSION_2_1
@ VERSION_2_1
Definition itkOpenCL.h:51
itk::VERSION_1_2
@ VERSION_1_2
Definition itkOpenCL.h:49
itk::VERSION_1_0
@ VERSION_1_0
Definition itkOpenCL.h:47
itk::VERSION_1_1
@ VERSION_1_1
Definition itkOpenCL.h:48
itk::VERSION_2_0
@ VERSION_2_0
Definition itkOpenCL.h:50
itk::operator<<
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &strm, const OpenCLCommandQueue &queue)
Definition itkOpenCLCommandQueue.h:135

Generated on 1768596610 for elastix by 1.15.0 |