2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2018-09-18 15:11:08 +08:00
|
|
|
* Copyright (C) 2017-2018 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <cstdlib>
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
|
|
|
|
struct HardwareInfo;
|
2018-08-07 20:46:15 +08:00
|
|
|
class ExecutionEnvironment;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
class DeviceFactory {
|
|
|
|
public:
|
2018-08-07 20:46:15 +08:00
|
|
|
static bool getDevices(HardwareInfo **pHWInfos, size_t &numDevices, ExecutionEnvironment &executionEnvironment);
|
2018-09-18 22:31:47 +08:00
|
|
|
static bool getDevicesForProductFamilyOverride(HardwareInfo **pHWInfos, size_t &numDevices, ExecutionEnvironment &executionEnvironment);
|
2017-12-21 07:45:38 +08:00
|
|
|
static void releaseDevices();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static size_t numDevices;
|
|
|
|
static HardwareInfo *hwInfos;
|
|
|
|
};
|
2018-07-12 17:45:02 +08:00
|
|
|
|
|
|
|
class DeviceFactoryCleaner {
|
|
|
|
public:
|
|
|
|
~DeviceFactoryCleaner() { DeviceFactory::releaseDevices(); }
|
|
|
|
};
|
|
|
|
|
2018-06-13 03:54:39 +08:00
|
|
|
} // namespace OCLRT
|