ASL 0.1.7
Advanced Simulation Library
Loading...
Searching...
No Matches
aclHardware.h
Go to the documentation of this file.
1/*
2 * Advanced Simulation Library <http://asl.org.il>
3 *
4 * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5 *
6 *
7 * This file is part of Advanced Simulation Library (ASL).
8 *
9 * ASL is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, version 3 of the License.
12 *
13 * ASL is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23
24#ifndef ACLHARDWARE_H
25#define ACLHARDWARE_H
26
27
28//#include <CL/cl.hpp>
29// Supply "cl.hpp" with ASL, since it is not present in OpenCL 2.0
30// Remove the file after switching to OpenCL 2.1
31#include "cl.hpp"
32#include "aclStdIncludes.h"
33#include <memory>
34#include "aclTypes.h"
35
36namespace acl
37{
38
39 typedef std::shared_ptr<cl::CommandQueue> CommandQueue;
40
41
42 extern const std::vector<std::string> TYPE;
43 extern const std::vector<unsigned char> TYPE_SIZE;
45 /* expression in the condition field should have this type */
46 extern const std::vector<TypeID> TYPE_SELECT;
47
50 std::string getPlatformVendor(const CommandQueue & queue);
51
54 std::string getDeviceName(const CommandQueue & queue);
55
57 std::string getDeviceVersion(const CommandQueue & queue);
58
60 std::string getDriverVersion(const CommandQueue & queue);
61
64 cl_device_type getDeviceType(const CommandQueue & queue);
65
68 cl_uint getNComputeUnits(const CommandQueue & queue);
69
72
75 unsigned int getAlignment(const CommandQueue & queue);
76
77
81 cl_device_local_mem_type getLocalMemoryType(const CommandQueue & queue);
82
83
86 cl_ulong getLocalMemorySize(const CommandQueue & queue);
87
88
92 size_t getMaxItemSize(const CommandQueue & queue);
93
94
100 cl_uint getVectorWidth(const CommandQueue & queue, const TypeID typeID);
101
102
105 bool extensionAvailable(const CommandQueue & queue, const Extension extension);
106
107
112 cl_device_fp_config doublePrecisionSupport(const CommandQueue & queue);
113
114 class Kernel;
115
126 cl_ulong getKernelLocalMemSize(const Kernel & kernel);
127
128
137 cl_ulong getKernelPrivateMemSize(const Kernel & kernel);
138
139
142 {
143 public:
151 void setDefaultQueue(const std::string & platform = "",
152 const std::string & device = "");
153 std::vector<CommandQueue> queues;
155 std::string getDevicesInfo();
156 std::string getDefaultDeviceInfo();
157 private:
158 std::string devicesInfo;
159 };
160
161
162 // GLOBALS
163 extern Hardware hardware;
164
165} // namespace acl
166#endif // ACLHARDWARE_H
Provides access to the underlying hardware.
std::string getDevicesInfo()
std::string getDefaultDeviceInfo()
CommandQueue defaultQueue
std::vector< CommandQueue > queues
void setDefaultQueue(const std::string &platform="", const std::string &device="")
OpenCl Kernel generator.
Definition aclKernel.h:49
Class interface for cl_context.
Definition cl.hpp:2343
Class interface for cl_device_id.
Definition cl.hpp:1907
std::string getDeviceName(const CommandQueue &queue)
size_t getMaxItemSize(const CommandQueue &queue)
cl_uint getVectorWidth(const CommandQueue &queue, const TypeID typeID)
cl_device_type getDeviceType(const CommandQueue &queue)
cl_ulong getKernelLocalMemSize(const Kernel &kernel)
bool extensionAvailable(const CommandQueue &queue, const Extension extension)
cl_uint getNComputeUnits(const CommandQueue &queue)
std::string getPlatformVendor(const CommandQueue &queue)
unsigned int getAlignment(const CommandQueue &queue)
cl_ulong getKernelPrivateMemSize(const Kernel &kernel)
cl_device_fp_config doublePrecisionSupport(const CommandQueue &queue)
cl_ulong getLocalMemorySize(const CommandQueue &queue)
cl_device_local_mem_type getLocalMemoryType(const CommandQueue &queue)
Advanced Computational Language.
Definition acl.h:41
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition acl.h:51
Hardware hardware
std::string getDriverVersion(const CommandQueue &queue)
const std::vector< std::string > TYPE
Definition aclHardware.h:42
Extension
Definition aclTypes.h:30
cl::Context getContext(const CommandQueue &queue)
TypeID
Definition aclTypes.h:39
cl::Device getDevice(const CommandQueue &queue)
const std::vector< TypeID > TYPE_SELECT
contains trasnlation of types necessery for use in the function select
Definition aclHardware.h:46
std::string getDeviceVersion(const CommandQueue &queue)
const std::vector< unsigned char > TYPE_SIZE
Definition aclHardware.h:43
C++ bindings for OpenCL 1.0 (rev 48), OpenCL 1.1 (rev 33) and OpenCL 1.2 (rev 15)