Viskores  1.0
CudaAllocator.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 
19 #ifndef viskores_cont_cuda_internal_CudaAllocator_h
20 #define viskores_cont_cuda_internal_CudaAllocator_h
21 
24 
25 #include <cstddef>
26 
27 namespace viskores
28 {
29 namespace cont
30 {
31 namespace cuda
32 {
33 namespace internal
34 {
35 
37 struct VISKORES_CONT_EXPORT CudaAllocator
38 {
41  static VISKORES_CONT bool UsingManagedMemory();
42 
44  static VISKORES_CONT void ForceManagedMemoryOff();
45 
49  static VISKORES_CONT void ForceManagedMemoryOn();
50 
51  static VISKORES_CONT void ForceSyncMemoryAllocator();
52  static VISKORES_CONT void ForceAsyncMemoryAllocator();
53 
55  static VISKORES_CONT bool IsDevicePointer(const void* ptr);
56 
59  static VISKORES_CONT bool IsManagedPointer(const void* ptr);
60 
62  static VISKORES_CONT void* Allocate(std::size_t numBytes);
63 
66  static VISKORES_CONT void* AllocateUnManaged(std::size_t numBytes);
67 
69  static VISKORES_CONT void Free(void* ptr);
70 
80  static VISKORES_CONT void FreeDeferred(void* ptr, std::size_t numBytes);
81 
82  static VISKORES_CONT void PrepareForControl(const void* ptr, std::size_t numBytes);
83 
84  static VISKORES_CONT void PrepareForInput(const void* ptr, std::size_t numBytes);
85  static VISKORES_CONT void PrepareForOutput(const void* ptr, std::size_t numBytes);
86  static VISKORES_CONT void PrepareForInPlace(const void* ptr, std::size_t numBytes);
87 
88 private:
89  static VISKORES_CONT void Initialize();
90 };
91 }
92 }
93 }
94 } // end namespace viskores::cont::cuda::internal
95 
96 #endif // viskores_cont_cuda_internal_CudaAllocator_h
ExportMacros.h
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::Initialize
InitializeResult Initialize(int &argc, char *argv[], InitializeOptions opts=InitializeOptions::None)
Initialize the Viskores library, parsing arguments when provided:
viskores_cont_export.h