OmniSciDB  5ade3759e0
GpuMemUtils.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef QUERYENGINE_GPUMEMUTILS_H
18 #define QUERYENGINE_GPUMEMUTILS_H
19 
20 #include "CompilationOptions.h"
21 
22 #include <cstddef>
23 #include <cstdint>
24 #include <memory>
25 #include <utility>
26 #include <vector>
27 
28 #ifdef HAVE_CUDA
29 #include <cuda.h>
30 #else
31 #include "../Shared/nocuda.h"
32 #endif // HAVE_CUDA
33 
34 namespace CudaMgr_Namespace {
35 
36 class CudaMgr;
37 
38 } // namespace CudaMgr_Namespace
39 
40 namespace Data_Namespace {
41 
42 class AbstractBuffer;
43 class DataMgr;
44 
45 } // namespace Data_Namespace
46 
48  CUdeviceptr dst,
49  const void* src,
50  const size_t num_bytes,
51  const int device_id);
52 
54  void* dst,
55  const CUdeviceptr src,
56  const size_t num_bytes,
57  const int device_id);
58 
62  size_t entry_count;
63 };
64 
66 class DeviceAllocator;
67 class Allocator;
68 
70  DeviceAllocator* device_allocator,
71  const std::vector<int64_t*>& group_by_buffers,
72  const QueryMemoryDescriptor&,
73  const unsigned block_size_x,
74  const unsigned grid_size_x,
75  const int device_id,
76  const ExecutorDispatchMode dispatch_mode,
77  const int64_t num_input_rows,
78  const bool prepend_index_buffer,
79  const bool always_init_group_by_on_host,
80  const bool use_bump_allocator,
81  Allocator* insitu_allocator);
82 
84  const std::vector<int64_t*>& group_by_buffers,
85  const size_t groups_buffer_size,
86  const CUdeviceptr group_by_dev_buffers_mem,
87  const QueryMemoryDescriptor& query_mem_desc,
88  const unsigned block_size_x,
89  const unsigned grid_size_x,
90  const int device_id,
91  const bool prepend_index_buffer);
92 
94  CUdeviceptr projection_size_gpu,
95  const int device_id);
96 
98  const GpuGroupByBuffers& gpu_query_buffers,
99  const QueryMemoryDescriptor& query_mem_desc,
100  int8_t* projection_buffer,
101  const size_t projection_count,
102  const int device_id);
103 
104 #endif // QUERYENGINE_GPUMEMUTILS_H
CUdeviceptr first
Definition: GpuMemUtils.h:60
unsigned long long CUdeviceptr
Definition: nocuda.h:27
int64_t * src
const int32_t groups_buffer_size
void copy_to_gpu(Data_Namespace::DataMgr *data_mgr, CUdeviceptr dst, const void *src, const size_t num_bytes, const int device_id)
Definition: GpuMemUtils.cpp:31
ExecutorDispatchMode
size_t get_num_allocated_rows_from_gpu(Data_Namespace::DataMgr *data_mgr, CUdeviceptr projection_size_gpu, const int device_id)
CUdeviceptr second
Definition: GpuMemUtils.h:61
GpuGroupByBuffers create_dev_group_by_buffers(DeviceAllocator *device_allocator, const std::vector< int64_t *> &group_by_buffers, const QueryMemoryDescriptor &, const unsigned block_size_x, const unsigned grid_size_x, const int device_id, const ExecutorDispatchMode dispatch_mode, const int64_t num_input_rows, const bool prepend_index_buffer, const bool always_init_group_by_on_host, const bool use_bump_allocator, Allocator *insitu_allocator)
Definition: GpuMemUtils.cpp:61
void copy_group_by_buffers_from_gpu(Data_Namespace::DataMgr *data_mgr, const std::vector< int64_t *> &group_by_buffers, const size_t groups_buffer_size, const CUdeviceptr group_by_dev_buffers_mem, const QueryMemoryDescriptor &query_mem_desc, const unsigned block_size_x, const unsigned grid_size_x, const int device_id, const bool prepend_index_buffer)
void copy_projection_buffer_from_gpu_columnar(Data_Namespace::DataMgr *data_mgr, const GpuGroupByBuffers &gpu_query_buffers, const QueryMemoryDescriptor &query_mem_desc, int8_t *projection_buffer, const size_t projection_count, const int device_id)
void copy_from_gpu(Data_Namespace::DataMgr *data_mgr, void *dst, const CUdeviceptr src, const size_t num_bytes, const int device_id)