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
164 
165 } // namespace acl
166 #endif // ACLHARDWARE_H
acl::Extension
Extension
Definition: aclTypes.h:29
acl::getPlatformVendor
std::string getPlatformVendor(const CommandQueue &queue)
acl::TYPE_SELECT
const std::vector< TypeID > TYPE_SELECT
contains trasnlation of types necessery for use in the function select
Definition: aclHardware.h:46
acl::getDevice
cl::Device getDevice(const CommandQueue &queue)
acl::Hardware::queues
std::vector< CommandQueue > queues
Definition: aclHardware.h:153
acl::Hardware::getDefaultDeviceInfo
std::string getDefaultDeviceInfo()
acl::getLocalMemoryType
cl_device_local_mem_type getLocalMemoryType(const CommandQueue &queue)
cl::Context
Class interface for cl_context.
Definition: cl.hpp:2340
acl::Kernel
OpenCl Kernel generator.
Definition: aclKernel.h:48
acl::getLocalMemorySize
cl_ulong getLocalMemorySize(const CommandQueue &queue)
acl::getContext
cl::Context getContext(const CommandQueue &queue)
acl::TYPE_SIZE
const std::vector< unsigned char > TYPE_SIZE
Definition: aclHardware.h:43
acl::TYPE
const std::vector< std::string > TYPE
Definition: aclHardware.h:42
acl::getMaxItemSize
size_t getMaxItemSize(const CommandQueue &queue)
acl::Hardware::Hardware
Hardware()
acl::getDeviceName
std::string getDeviceName(const CommandQueue &queue)
acl::getVectorWidth
cl_uint getVectorWidth(const CommandQueue &queue, const TypeID typeID)
acl::CommandQueue
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition: acl.h:51
acl::doublePrecisionSupport
cl_device_fp_config doublePrecisionSupport(const CommandQueue &queue)
acl::getNComputeUnits
cl_uint getNComputeUnits(const CommandQueue &queue)
acl::Hardware::setDefaultQueue
void setDefaultQueue(const std::string &platform="", const std::string &device="")
aclStdIncludes.h
cl::Device
Class interface for cl_device_id.
Definition: cl.hpp:1905
acl::getKernelPrivateMemSize
cl_ulong getKernelPrivateMemSize(const Kernel &kernel)
cl.hpp
C++ bindings for OpenCL 1.0 (rev 48), OpenCL 1.1 (rev 33) and OpenCL 1.2 (rev 15)
acl::Hardware::getDevicesInfo
std::string getDevicesInfo()
acl::extensionAvailable
bool extensionAvailable(const CommandQueue &queue, const Extension extension)
aclTypes.h
acl::getAlignment
unsigned int getAlignment(const CommandQueue &queue)
acl::hardware
Hardware hardware
Definition: aclHardware.h:163
acl::getDeviceVersion
std::string getDeviceVersion(const CommandQueue &queue)
acl::getDriverVersion
std::string getDriverVersion(const CommandQueue &queue)
acl::Hardware
Provides access to the underlying hardware.
Definition: aclHardware.h:141
acl::getKernelLocalMemSize
cl_ulong getKernelLocalMemSize(const Kernel &kernel)
acl::TypeID
TypeID
Definition: aclTypes.h:38
acl::getDeviceType
cl_device_type getDeviceType(const CommandQueue &queue)
acl::Hardware::defaultQueue
CommandQueue defaultQueue
Definition: aclHardware.h:154
acl
Advanced Computational Language.
Definition: acl.h:40