aclHardware.h
Go to the documentation of this file.
/*
* Advanced Simulation Library <http://asl.org.il>
*
* Copyright 2015 Avtech Scientific <http://avtechscientific.com>
*
*
* This file is part of Advanced Simulation Library (ASL).
*
* ASL is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3 of the License.
*
* ASL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with ASL. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ACLHARDWARE_H
#define ACLHARDWARE_H
//#include <CL/cl.hpp>
// Supply "cl.hpp" with ASL, since it is not present in OpenCL 2.0
// Remove the file after switching to OpenCL 2.1
#include "cl.hpp"
#include "aclStdIncludes.h"
#include <memory>
#include "aclTypes.h"
namespace acl
{
typedef std::shared_ptr<cl::CommandQueue> CommandQueue;
extern const std::vector<std::string> TYPE;
extern const std::vector<unsigned char> TYPE_SIZE;
/* expression in the condition field should have this type */
extern const std::vector<TypeID> TYPE_SELECT;
std::string getPlatformVendor(const CommandQueue & queue);
std::string getDeviceName(const CommandQueue & queue);
std::string getDeviceVersion(const CommandQueue & queue);
std::string getDriverVersion(const CommandQueue & queue);
cl_device_type getDeviceType(const CommandQueue & queue);
cl_uint getNComputeUnits(const CommandQueue & queue);
cl::Device getDevice(const CommandQueue & queue);
cl::Context getContext(const CommandQueue & queue);
unsigned int getAlignment(const CommandQueue & queue);
cl_device_local_mem_type getLocalMemoryType(const CommandQueue & queue);
cl_ulong getLocalMemorySize(const CommandQueue & queue);
size_t getMaxItemSize(const CommandQueue & queue);
cl_uint getVectorWidth(const CommandQueue & queue, const TypeID typeID);
bool extensionAvailable(const CommandQueue & queue, const Extension extension);
cl_device_fp_config doublePrecisionSupport(const CommandQueue & queue);
class Kernel;
cl_ulong getKernelLocalMemSize(const Kernel & kernel);
cl_ulong getKernelPrivateMemSize(const Kernel & kernel);
class Hardware
{
public:
Hardware();
void setDefaultQueue(const std::string & platform = "",
const std::string & device = "");
std::vector<CommandQueue> queues;
CommandQueue defaultQueue;
std::string getDevicesInfo();
std::string getDefaultDeviceInfo();
private:
std::string devicesInfo;
};
// GLOBALS
extern Hardware hardware;
} // namespace acl
#endif // ACLHARDWARE_H
acl::Hardware
Provides access to the underlying hardware.
Definition: aclHardware.h:142
acl::Hardware::getDevicesInfo
std::string getDevicesInfo()
acl::Hardware::getDefaultDeviceInfo
std::string getDefaultDeviceInfo()
acl::Hardware::defaultQueue
CommandQueue defaultQueue
Definition: aclHardware.h:154
acl::Hardware::Hardware
Hardware()
acl::Hardware::queues
std::vector< CommandQueue > queues
Definition: aclHardware.h:153
acl::Hardware::setDefaultQueue
void setDefaultQueue(const std::string &platform="", const std::string &device="")
acl::Kernel
OpenCl Kernel generator.
Definition: aclKernel.h:49
cl::Context
Class interface for cl_context.
Definition: cl.hpp:2343
cl::Device
Class interface for cl_device_id.
Definition: cl.hpp:1907
acl::getDeviceName
std::string getDeviceName(const CommandQueue &queue)
acl::getMaxItemSize
size_t getMaxItemSize(const CommandQueue &queue)
acl::getVectorWidth
cl_uint getVectorWidth(const CommandQueue &queue, const TypeID typeID)
acl::getDeviceType
cl_device_type getDeviceType(const CommandQueue &queue)
acl::getKernelLocalMemSize
cl_ulong getKernelLocalMemSize(const Kernel &kernel)
acl::extensionAvailable
bool extensionAvailable(const CommandQueue &queue, const Extension extension)
acl::getNComputeUnits
cl_uint getNComputeUnits(const CommandQueue &queue)
acl::getPlatformVendor
std::string getPlatformVendor(const CommandQueue &queue)
acl::getAlignment
unsigned int getAlignment(const CommandQueue &queue)
acl::getKernelPrivateMemSize
cl_ulong getKernelPrivateMemSize(const Kernel &kernel)
acl::doublePrecisionSupport
cl_device_fp_config doublePrecisionSupport(const CommandQueue &queue)
acl::getLocalMemorySize
cl_ulong getLocalMemorySize(const CommandQueue &queue)
acl::getLocalMemoryType
cl_device_local_mem_type getLocalMemoryType(const CommandQueue &queue)
acl
Advanced Computational Language.
Definition: acl.h:41
acl::CommandQueue
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition: acl.h:51
acl::hardware
Hardware hardware
Definition: aclHardware.h:163
acl::getDriverVersion
std::string getDriverVersion(const CommandQueue &queue)
acl::TYPE
const std::vector< std::string > TYPE
Definition: aclHardware.h:42
acl::Extension
Extension
Definition: aclTypes.h:30
acl::getContext
cl::Context getContext(const CommandQueue &queue)
acl::TypeID
TypeID
Definition: aclTypes.h:39
acl::getDevice
cl::Device getDevice(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::getDeviceVersion
std::string getDeviceVersion(const CommandQueue &queue)
acl::TYPE_SIZE
const std::vector< unsigned char > TYPE_SIZE
Definition: aclHardware.h:43
aclStdIncludes.h
aclTypes.h
cl.hpp
C++ bindings for OpenCL 1.0 (rev 48), OpenCL 1.1 (rev 33) and OpenCL 1.2 (rev 15)