2015-12-02 18:55:49 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2015-12-02 18:55:49 +00:00
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
|
|
//============================================================================
|
|
|
|
#ifndef vtk_m_cont_RuntimeDeviceInformation_h
|
|
|
|
#define vtk_m_cont_RuntimeDeviceInformation_h
|
|
|
|
|
2019-04-03 20:28:31 +00:00
|
|
|
#include <vtkm/cont/DeviceAdapterTag.h>
|
2020-03-26 23:34:18 +00:00
|
|
|
#include <vtkm/cont/internal/DeviceAdapterMemoryManager.h>
|
2021-05-26 19:43:36 +00:00
|
|
|
#include <vtkm/cont/internal/RuntimeDeviceConfiguration.h>
|
2018-10-30 13:49:41 +00:00
|
|
|
#include <vtkm/internal/ExportMacros.h>
|
2018-05-14 20:21:30 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace cont
|
|
|
|
{
|
2015-12-02 18:55:49 +00:00
|
|
|
|
|
|
|
/// A class that can be used to determine if a given device adapter
|
|
|
|
/// is supported on the current machine at runtime. This is very important
|
2019-03-15 19:54:42 +00:00
|
|
|
/// for device adapters where a physical hardware requirements such as a GPU
|
|
|
|
/// or a Accelerator Card is needed for support to exist.
|
2015-12-02 18:55:49 +00:00
|
|
|
///
|
|
|
|
///
|
2018-10-30 13:49:41 +00:00
|
|
|
class VTKM_CONT_EXPORT RuntimeDeviceInformation
|
2015-12-02 18:55:49 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-03-15 19:54:42 +00:00
|
|
|
/// Returns the name corresponding to the device adapter id. If @a id is
|
|
|
|
/// not recognized, `InvalidDeviceId` is returned. Queries for a
|
|
|
|
/// name are all case-insensitive.
|
|
|
|
VTKM_CONT
|
|
|
|
DeviceAdapterNameType GetName(DeviceAdapterId id) const;
|
|
|
|
|
|
|
|
/// Returns the id corresponding to the device adapter name. If @a name is
|
|
|
|
/// not recognized, DeviceAdapterTagUndefined is returned.
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2019-03-15 19:54:42 +00:00
|
|
|
DeviceAdapterId GetId(DeviceAdapterNameType name) const;
|
2015-12-02 18:55:49 +00:00
|
|
|
|
|
|
|
/// Returns true if the given device adapter is supported on the current
|
|
|
|
/// machine.
|
|
|
|
///
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2018-10-30 13:49:41 +00:00
|
|
|
bool Exists(DeviceAdapterId id) const;
|
2020-03-26 23:34:18 +00:00
|
|
|
|
|
|
|
/// Returns a reference to a `DeviceAdapterMemoryManager` that will work with the
|
|
|
|
/// given device. This method will throw an exception if the device id is not a
|
|
|
|
/// real device (for example `DeviceAdapterTagAny`). If the device in question is
|
|
|
|
/// not valid, a `DeviceAdapterMemoryManager` will be returned, but attempting to
|
|
|
|
/// call any of the methods will result in a runtime exception.
|
|
|
|
///
|
|
|
|
VTKM_CONT
|
|
|
|
vtkm::cont::internal::DeviceAdapterMemoryManagerBase& GetMemoryManager(DeviceAdapterId id) const;
|
2021-05-26 19:43:36 +00:00
|
|
|
|
|
|
|
/// Returns a reference to a `RuntimeDeviceConfiguration` that will work with the
|
|
|
|
/// given device. If the device in question is not valid, a placeholder
|
|
|
|
/// `InvalidRuntimeDeviceConfiguration` will be returned. Attempting to
|
|
|
|
/// call any of the methods of this object will result in a runtime exception.
|
|
|
|
/// The fully loaded version of this method is automatically called at the end
|
|
|
|
/// of `vkmt::cont::Initialize` which performs automated setup of all runtime
|
|
|
|
/// devices using parsed vtkm arguments.
|
|
|
|
///
|
|
|
|
/// params:
|
2021-06-17 17:15:56 +00:00
|
|
|
/// id - The specific device to retreive the RuntimeDeviceConfiguration options for
|
2021-05-26 19:43:36 +00:00
|
|
|
/// configOptions - VTKm provided options that should be included when initializing
|
|
|
|
/// a given RuntimeDeviceConfiguration
|
|
|
|
/// argc - The number of command line arguments to parse when Initializing
|
|
|
|
/// a given RuntimeDeviceConfiguration
|
|
|
|
/// argv - The extra command line arguments to parse when Initializing a given
|
|
|
|
/// RuntimeDeviceConfiguration. This argument is mainlued used in conjuction
|
|
|
|
/// with Kokkos config arg parsing to include specific --kokkos command
|
|
|
|
/// line flags and environment variables.
|
|
|
|
VTKM_CONT
|
|
|
|
vtkm::cont::internal::RuntimeDeviceConfigurationBase& GetRuntimeConfiguration(
|
|
|
|
DeviceAdapterId id,
|
|
|
|
const vtkm::cont::internal::RuntimeDeviceConfigurationOptions& configOptions,
|
|
|
|
int& argc,
|
|
|
|
char* argv[] = nullptr) const;
|
|
|
|
|
|
|
|
VTKM_CONT
|
|
|
|
vtkm::cont::internal::RuntimeDeviceConfigurationBase& GetRuntimeConfiguration(
|
|
|
|
DeviceAdapterId id,
|
|
|
|
const vtkm::cont::internal::RuntimeDeviceConfigurationOptions& configOptions) const;
|
|
|
|
|
|
|
|
VTKM_CONT
|
|
|
|
vtkm::cont::internal::RuntimeDeviceConfigurationBase& GetRuntimeConfiguration(
|
|
|
|
DeviceAdapterId id) const;
|
2015-12-02 18:55:49 +00:00
|
|
|
};
|
|
|
|
} // namespace vtkm::cont
|
2021-05-26 19:43:36 +00:00
|
|
|
} // namespace vtkm
|
2015-12-02 18:55:49 +00:00
|
|
|
|
|
|
|
#endif //vtk_m_cont_RuntimeDeviceInformation_h
|