ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkOpenCLUtil.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 #ifdef __APPLE__
31 
32 #include <OpenCL/opencl.h>
33 
34 #else
35 
36 #include <CL/opencl.h>
37 
38 #endif
39 
40 #include <itkMacro.h>
41 
42 namespace itk
43 {
51 int OpenCLGetLocalBlockSize(unsigned int ImageDim);
52 
54 cl_device_id* OpenCLGetAvailableDevices(cl_platform_id platform, cl_device_type devType, cl_uint* numAvailableDevices);
55 
57 cl_device_id OpenCLGetMaxFlopsDev(cl_context cxGPUContext);
58 
60 void OpenCLPrintDeviceInfo(cl_device_id device, bool verbose=false);
61 
63 cl_platform_id OpenCLSelectPlatform(const char* name);
64 
66 void OpenCLCheckError(cl_int error, const char* filename="", int lineno=0, const char* location="");
67 
69 bool IsGPUAvailable();
70 
72 std::string GetTypename(const std::type_info& intype);
73 
75 bool GetValidTypename(const std::type_info& intype, const std::vector<std::string>& validtypes, std::string& retTypeName);
76 
78 std::string Get64BitPragma();
79 
81 void GetTypenameInString( const std::type_info& intype, std::ostringstream& ret );
82 
85 int GetPixelDimension( const std::type_info& intype );
86 
87 }
88 
89 #endif
std::string GetTypename(const std::type_info &intype)
cl_platform_id OpenCLSelectPlatform(const char *name)
void GetTypenameInString(const std::type_info &intype, std::ostringstream &ret)
int OpenCLGetLocalBlockSize(unsigned int ImageDim)
void OpenCLPrintDeviceInfo(cl_device_id device, bool verbose=false)
cl_device_id OpenCLGetMaxFlopsDev(cl_context cxGPUContext)
int GetPixelDimension(const std::type_info &intype)
cl_device_id * OpenCLGetAvailableDevices(cl_platform_id platform, cl_device_type devType, cl_uint *numAvailableDevices)
bool GetValidTypename(const std::type_info &intype, const std::vector< std::string > &validtypes, std::string &retTypeName)
std::string Get64BitPragma()
void OpenCLCheckError(cl_int error, const char *filename="", int lineno=0, const char *location="")
bool IsGPUAvailable()