ASL  0.1.7
Advanced Simulation Library
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 
36 namespace 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 
70  cl::Device getDevice(const CommandQueue & queue);
71  cl::Context getContext(const CommandQueue & queue);
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 
141  class Hardware
142  {
143  public:
147  Hardware();
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
cl_uint getVectorWidth(const CommandQueue &queue, const TypeID typeID)
Extension
Definition: aclTypes.h:29
cl::Device getDevice(const CommandQueue &queue)
cl_uint getNComputeUnits(const CommandQueue &queue)
Advanced Computational Language.
Definition: acl.h:40
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition: acl.h:51
cl_ulong getLocalMemorySize(const CommandQueue &queue)
std::string getDevicesInfo()
cl::Context getContext(const CommandQueue &queue)
CommandQueue defaultQueue
Definition: aclHardware.h:154
C++ bindings for OpenCL 1.0 (rev 48), OpenCL 1.1 (rev 33) and OpenCL 1.2 (rev 15)
unsigned int getAlignment(const CommandQueue &queue)
const std::vector< unsigned char > TYPE_SIZE
cl_device_fp_config doublePrecisionSupport(const CommandQueue &queue)
cl_device_type getDeviceType(const CommandQueue &queue)
cl_ulong getKernelPrivateMemSize(const Kernel &kernel)
std::string getDefaultDeviceInfo()
const std::vector< std::string > TYPE
bool extensionAvailable(const CommandQueue &queue, const Extension extension)
std::string getPlatformVendor(const CommandQueue &queue)
Provides access to the underlying hardware.
Definition: aclHardware.h:141
std::string getDeviceName(const CommandQueue &queue)
const std::vector< TypeID > TYPE_SELECT
contains trasnlation of types necessery for use in the function select
cl_device_local_mem_type getLocalMemoryType(const CommandQueue &queue)
TypeID
Definition: aclTypes.h:38
Class interface for cl_device_id.
Definition: cl.hpp:1906
std::string getDeviceVersion(const CommandQueue &queue)
cl_ulong getKernelLocalMemSize(const Kernel &kernel)
std::vector< CommandQueue > queues
Definition: aclHardware.h:153
Class interface for cl_context.
Definition: cl.hpp:2341
void setDefaultQueue(const std::string &platform="", const std::string &device="")
size_t getMaxItemSize(const CommandQueue &queue)
Hardware hardware
std::string getDriverVersion(const CommandQueue &queue)