OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CpuBuffer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, 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 #pragma once
18 
20 
21 namespace CudaMgr_Namespace {
22 class CudaMgr;
23 }
24 
25 namespace Buffer_Namespace {
26 class CpuBuffer : public Buffer {
27  public:
28  CpuBuffer(BufferMgr* bm,
29  BufferList::iterator segment_iter,
30  const int device_id,
32  const size_t page_size = 512,
33  const size_t num_bytes = 0);
34 
35  inline Data_Namespace::MemoryLevel getType() const override { return CPU_LEVEL; }
36 
37  private:
38  void readData(int8_t* const dst,
39  const size_t num_bytes,
40  const size_t offset = 0,
41  const MemoryLevel dst_memory_level = CPU_LEVEL,
42  const int dst_device_id = -1) override;
43  void writeData(int8_t* const src,
44  const size_t num_bytes,
45  const size_t offset = 0,
46  const MemoryLevel src_memory_level = CPU_LEVEL,
47  const int src_device_id = -1) override;
48 
50 };
51 } // namespace Buffer_Namespace
void readData(int8_t *const dst, const size_t num_bytes, const size_t offset=0, const MemoryLevel dst_memory_level=CPU_LEVEL, const int dst_device_id=-1) override
Definition: CpuBuffer.cpp:35
Note(s): Forbid Copying Idiom 4.1.
Definition: BufferMgr.h:96
CpuBuffer(BufferMgr *bm, BufferList::iterator segment_iter, const int device_id, CudaMgr_Namespace::CudaMgr *cuda_mgr, const size_t page_size=512, const size_t num_bytes=0)
Definition: CpuBuffer.cpp:27
CudaMgr_Namespace::CudaMgr * cuda_mgr_
Definition: CpuBuffer.h:49
Data_Namespace::MemoryLevel getType() const override
Definition: CpuBuffer.h:35
void writeData(int8_t *const src, const size_t num_bytes, const size_t offset=0, const MemoryLevel src_memory_level=CPU_LEVEL, const int src_device_id=-1) override
Definition: CpuBuffer.cpp:50
Note(s): Forbid Copying Idiom 4.1.
Definition: Buffer.h:42