VTK-m  2.0
CudaAllocator.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 
11 #ifndef vtk_m_cont_cuda_internal_CudaAllocator_h
12 #define vtk_m_cont_cuda_internal_CudaAllocator_h
13 
14 #include <vtkm/cont/vtkm_cont_export.h>
16 
17 #include <cstddef>
18 
19 namespace vtkm
20 {
21 namespace cont
22 {
23 namespace cuda
24 {
25 namespace internal
26 {
27 
29 struct VTKM_CONT_EXPORT CudaAllocator
30 {
33  static VTKM_CONT bool UsingManagedMemory();
34 
36  static VTKM_CONT void ForceManagedMemoryOff();
37 
41  static VTKM_CONT void ForceManagedMemoryOn();
42 
43  static VTKM_CONT void ForceSyncMemoryAllocator();
44  static VTKM_CONT void ForceAsyncMemoryAllocator();
45 
47  static VTKM_CONT bool IsDevicePointer(const void* ptr);
48 
51  static VTKM_CONT bool IsManagedPointer(const void* ptr);
52 
54  static VTKM_CONT void* Allocate(std::size_t numBytes);
55 
58  static VTKM_CONT void* AllocateUnManaged(std::size_t numBytes);
59 
61  static VTKM_CONT void Free(void* ptr);
62 
72  static VTKM_CONT void FreeDeferred(void* ptr, std::size_t numBytes);
73 
74  static VTKM_CONT void PrepareForControl(const void* ptr, std::size_t numBytes);
75 
76  static VTKM_CONT void PrepareForInput(const void* ptr, std::size_t numBytes);
77  static VTKM_CONT void PrepareForOutput(const void* ptr, std::size_t numBytes);
78  static VTKM_CONT void PrepareForInPlace(const void* ptr, std::size_t numBytes);
79 
80 private:
81  static VTKM_CONT void Initialize();
82 };
83 }
84 }
85 }
86 } // end namespace vtkm::cont::cuda::internal
87 
88 #endif // vtk_m_cont_cuda_internal_CudaAllocator_h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
ExportMacros.h
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::cont::Initialize
VTKM_CONT_EXPORT VTKM_CONT InitializeResult Initialize(int &argc, char *argv[], InitializeOptions opts=InitializeOptions::None)
Initialize the VTKm library, parsing arguments when provided: