VTK  9.7.20261110
vtkDeviceArrayFactory.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
27
28#ifndef vtkDeviceArrayFactory_h
29#define vtkDeviceArrayFactory_h
30
31#include "vtkCommonCoreModule.h" // For export macro
32#include "vtkObject.h"
33#include "vtkSmartPointer.h" // For the descriptor
34
35VTK_ABI_NAMESPACE_BEGIN
36class vtkDataArray;
38
39class VTKCOMMONCORE_EXPORT vtkDeviceArrayFactory : public vtkObject
40{
41public:
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
47
50 vtkSetMacro(NumberOfTuples, vtkIdType);
51 vtkGetMacro(NumberOfTuples, vtkIdType);
52 vtkSetMacro(NumberOfComponents, int);
53 vtkGetMacro(NumberOfComponents, int);
54 vtkSetMacro(DataType, int);
55 vtkGetMacro(DataType, int);
57
59
63 void AddBuffer(vtkMemoryDescriptor* descriptor);
65 int GetNumberOfBuffers() const;
67
74
79 static bool IsMemorySpaceAvailable(const char* space);
80
88 static int GetDeviceOrdinal(vtkMemoryDescriptor* descriptor);
89
91
103 vtkTypeUInt64 driver, vtkTypeUInt64 device, vtkTypeUInt64 context);
104 static bool HasLevelZeroContext();
105 static vtkTypeUInt64 GetLevelZeroDriverHandle();
106 static vtkTypeUInt64 GetLevelZeroDeviceHandle();
107 static vtkTypeUInt64 GetLevelZeroContextHandle();
109
110protected:
113
114private:
115 vtkIdType NumberOfTuples = 0;
116 int NumberOfComponents = 1;
117 int DataType = 0;
119
121 void operator=(const vtkDeviceArrayFactory&) = delete;
122};
123
124VTK_ABI_NAMESPACE_END
125#endif
static bool HasLevelZeroContext()
VTK's Level Zero context, as integers: the ze_driver_handle_t, ze_device_handle_t and ze_context_hand...
static int GetDeviceOrdinal(vtkMemoryDescriptor *descriptor)
The number of the device the memory a descriptor describes is on, as the vendor's runtime counts devi...
static bool IsMemorySpaceAvailable(const char *space)
Whether memory of the space named ("cuda", "hip", "level_zero") can be held: whether the vendor's dri...
static vtkTypeUInt64 GetLevelZeroDriverHandle()
VTK's Level Zero context, as integers: the ze_driver_handle_t, ze_device_handle_t and ze_context_hand...
vtkDataArray * CreateArray()
The array, or nullptr (with an error) if the descriptor, shape or type do not fit,...
void AddBuffer(vtkMemoryDescriptor *descriptor)
The memory: one descriptor, of role "data".
int GetNumberOfBuffers() const
The memory: one descriptor, of role "data".
~vtkDeviceArrayFactory() override
void ClearBuffers()
The memory: one descriptor, of role "data".
static vtkTypeUInt64 GetLevelZeroContextHandle()
VTK's Level Zero context, as integers: the ze_driver_handle_t, ze_device_handle_t and ze_context_hand...
static vtkTypeUInt64 GetLevelZeroDeviceHandle()
VTK's Level Zero context, as integers: the ze_driver_handle_t, ze_device_handle_t and ze_context_hand...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkDeviceArrayFactory * New()
static void SetLevelZeroContext(vtkTypeUInt64 driver, vtkTypeUInt64 device, vtkTypeUInt64 context)
VTK's Level Zero context, as integers: the ze_driver_handle_t, ze_device_handle_t and ze_context_hand...
a simple class to control print indentation
Definition vtkIndent.h:108
Describes a memory buffer on host or device, and who keeps it alive.
Hold a reference to a vtkObjectBase instance.
#define vtkDataArray
int vtkIdType
Definition vtkType.h:366
#define VTK_NEWINSTANCE