ITK  5.3.0
Insight Toolkit
itkOpenCLUtil.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 itkOpenCLUtil_h
19 #define itkOpenCLUtil_h
20 
21 #include <cstring>
22 #include <cstdlib>
23 #include <cstdio>
24 
25 #include <iostream>
26 #include <sstream>
27 
28 #include <itkVector.h>
29 
30 #ifndef CL_TARGET_OPENCL_VERSION
31 # define CL_TARGET_OPENCL_VERSION 120
32 #endif
33 
34 #ifdef __APPLE__
35 
36 # include <OpenCL/opencl.h>
37 
38 #else
39 
40 # include <CL/opencl.h>
41 
42 #endif
43 
44 #include <itkMacro.h>
45 
46 namespace itk
47 {
55 int
56 OpenCLGetLocalBlockSize(unsigned int ImageDim);
57 
59 cl_device_id *
60 OpenCLGetAvailableDevices(cl_platform_id platform, cl_device_type devType, cl_uint * numAvailableDevices);
61 
63 cl_device_id
64 OpenCLGetMaxFlopsDev(cl_context cxGPUContext);
65 
67 void
68 OpenCLPrintDeviceInfo(cl_device_id device, bool verbose = false);
69 
71 cl_platform_id
72 OpenCLSelectPlatform(const char * name);
73 
75 void
76 OpenCLCheckError(cl_int error, const char * filename = "", int lineno = 0, const char * location = "");
77 
79 bool
81 
83 std::string
84 GetTypename(const std::type_info & intype);
85 
87 bool
88 GetValidTypename(const std::type_info & intype, const std::vector<std::string> & validtypes, std::string & retTypeName);
89 
91 std::string
93 
95 void
96 GetTypenameInString(const std::type_info & intype, std::ostringstream & ret);
97 
100 int
101 GetPixelDimension(const std::type_info & intype);
102 
103 } // namespace itk
104 
105 #endif
itk::OpenCLSelectPlatform
cl_platform_id OpenCLSelectPlatform(const char *name)
itk::GetValidTypename
bool GetValidTypename(const std::type_info &intype, const std::vector< std::string > &validtypes, std::string &retTypeName)
itk::OpenCLGetMaxFlopsDev
cl_device_id OpenCLGetMaxFlopsDev(cl_context cxGPUContext)
itk::OpenCLCheckError
void OpenCLCheckError(cl_int error, const char *filename="", int lineno=0, const char *location="")
itk::OpenCLGetAvailableDevices
cl_device_id * OpenCLGetAvailableDevices(cl_platform_id platform, cl_device_type devType, cl_uint *numAvailableDevices)
itk::OpenCLPrintDeviceInfo
void OpenCLPrintDeviceInfo(cl_device_id device, bool verbose=false)
itkMacro.h
itk::Get64BitPragma
std::string Get64BitPragma()
itk::GetTypename
std::string GetTypename(const std::type_info &intype)
itk::GetPixelDimension
int GetPixelDimension(const std::type_info &intype)
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::GetTypenameInString
void GetTypenameInString(const std::type_info &intype, std::ostringstream &ret)
itkVector.h
itk::OpenCLGetLocalBlockSize
int OpenCLGetLocalBlockSize(unsigned int ImageDim)
itk::IsGPUAvailable
bool IsGPUAvailable()