ITK  6.0.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 * https://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
46namespace itk
47{
55int
56OpenCLGetLocalBlockSize(unsigned int ImageDim);
57
59cl_device_id *
60OpenCLGetAvailableDevices(cl_platform_id platform, cl_device_type devType, cl_uint * numAvailableDevices);
61
63cl_device_id
64OpenCLGetMaxFlopsDev(cl_context cxGPUContext);
65
67void
68OpenCLPrintDeviceInfo(cl_device_id device, bool verbose = false);
69
71cl_platform_id
72OpenCLSelectPlatform(const char * name);
73
75void
76OpenCLCheckError(cl_int error, const char * filename = "", int lineno = 0, const char * location = "");
77
79bool
81
83std::string
84GetTypename(const std::type_info & intype);
85
87bool
88GetValidTypename(const std::type_info & intype, const std::vector<std::string> & validtypes, std::string & retTypeName);
89
91std::string
93
95void
96GetTypenameInString(const std::type_info & intype, std::ostringstream & ret);
97
100int
101GetPixelDimension(const std::type_info & intype);
102
103} // namespace itk
104
105#endif
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
cl_device_id * OpenCLGetAvailableDevices(cl_platform_id platform, cl_device_type devType, cl_uint *numAvailableDevices)
void GetTypenameInString(const std::type_info &intype, std::ostringstream &ret)
bool GetValidTypename(const std::type_info &intype, const std::vector< std::string > &validtypes, std::string &retTypeName)
int OpenCLGetLocalBlockSize(unsigned int ImageDim)
std::string Get64BitPragma()
cl_platform_id OpenCLSelectPlatform(const char *name)
cl_device_id OpenCLGetMaxFlopsDev(cl_context cxGPUContext)
bool IsGPUAvailable()
std::string GetTypename(const std::type_info &intype)
int GetPixelDimension(const std::type_info &intype)
void OpenCLPrintDeviceInfo(cl_device_id device, bool verbose=false)
void OpenCLCheckError(cl_int error, const char *filename="", int lineno=0, const char *location="")