Open Deep Learning API
Loading...
Searching...
No Matches
ODLA
odla_memory.h
Go to the documentation of this file.
1
//===- odla_memory.h ------------------------------------------------------===//
2
//
3
// Copyright (C) 2019-2021 Alibaba Group Holding Limited.
4
//
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
16
// =============================================================================
17
18
#ifndef _ODLA_MEMORY_H_
19
#define _ODLA_MEMORY_H_
20
21
#include <
ODLA/odla_common.h
>
22
27
#ifdef __cplusplus
28
extern
"C"
{
29
#endif
30
32
typedef
enum
{
33
ODLA_MEMCPY_H2H,
34
ODLA_MEMCPY_H2D,
35
ODLA_MEMCPY_D2H,
36
ODLA_MEMCPY_D2D,
37
}
odla_memcpy_type
;
38
40
46
extern
ODLA_API_EXPORT
odla_status
ODLA_API_CALL
47
odla_AllocateDeviceMemory
(
odla_void
** dev_ptr,
odla_size_t
size);
48
50
55
extern
ODLA_API_EXPORT
odla_status
ODLA_API_CALL
56
odla_FreeDeviceMemory
(
odla_void
* ptr);
57
59
65
extern
ODLA_API_EXPORT
odla_status
ODLA_API_CALL
66
odla_AllocateHostMemory
(
odla_void
** host_ptr,
odla_size_t
size);
67
69
74
extern
ODLA_API_EXPORT
odla_status
ODLA_API_CALL
75
odla_FreeHostMemory
(
odla_void
* ptr);
76
78
86
extern
ODLA_API_EXPORT
odla_status
ODLA_API_CALL
odla_CopyMemory
(
87
odla_void
* dst,
odla_void
* src,
odla_size_t
size,
odla_memcpy_type
type);
88
89
#ifdef __cplusplus
90
}
// C extern
91
#endif
92
93
#endif
// _ODLA_MEMORY_H_
odla_common.h
ODLA_API_EXPORT
#define ODLA_API_EXPORT
API export directives.
Definition:
odla_common.h:172
odla_status
odla_status
Return status.
Definition:
odla_common.h:140
odla_size_t
__SIZE_TYPE__ odla_size_t
size_t
Definition:
odla_common.h:134
odla_void
void odla_void
void
Definition:
odla_common.h:137
odla_CopyMemory
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_CopyMemory(odla_void *dst, odla_void *src, odla_size_t size, odla_memcpy_type type)
Copy data between host and device.
odla_FreeDeviceMemory
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_FreeDeviceMemory(odla_void *ptr)
Free device memory.
odla_AllocateDeviceMemory
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_AllocateDeviceMemory(odla_void **dev_ptr, odla_size_t size)
Allocate device memory.
odla_FreeHostMemory
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_FreeHostMemory(odla_void *ptr)
Free host memory.
odla_AllocateHostMemory
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_AllocateHostMemory(odla_void **host_ptr, odla_size_t size)
Allocate host memory.
odla_memcpy_type
odla_memcpy_type
memory copy types
Definition:
odla_memory.h:32
Generated by
1.9.5