PULSAR
2.0.0
Parallel Ultra-Light Systolic Array Runtime
Main Page
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Typedefs
Enumerations
Macros
Groups
gpu_malloc.h
Go to the documentation of this file.
1
13
#ifndef GPU_MALLOC_H
14
#define GPU_MALLOC_H
15
16
#include <stdlib.h>
17
18
#ifdef CUDA
19
#include <cuda.h>
20
#include <cuda_runtime.h>
21
#else
22
#include "
cuda_stubs.h
"
23
#endif
24
25
#ifdef __cplusplus
26
extern
"C"
{
27
#endif
28
29
typedef
struct
segment
{
30
int
start_index;
// Index of the first byte of this segment.
31
int
nb_units;
// Number of units occupied by this segment.
32
int
nb_free;
// Number of units free after this segment.
33
struct
segment
*next;
34
}
segment_t
;
35
36
typedef
struct
gpu_malloc_s
{
37
char
*base;
// Base pointer.
38
segment_t
*allocated_segments;
// List of allocated segments.
39
segment_t
*free_segments;
// List of available segments.
40
size_t
unit_size;
// Unit size.
41
int
max_segment;
// Maximum number of segments.
42
}
gpu_malloc_t
;
43
44
gpu_malloc_t
*
gpu_malloc_init
(
int
max_segment,
size_t
unit_size);
45
int
gpu_malloc_fini
(
gpu_malloc_t
*gdata);
46
void
*
gpu_malloc
(
gpu_malloc_t
*gdata,
size_t
size);
47
int
gpu_free
(
gpu_malloc_t
*gdata,
void
*ptr);
48
49
#ifdef __cplusplus
50
}
51
#endif
52
53
#endif
/* GPU_MALLOC_H */
gpu_malloc.h
Generated on Thu Nov 20 2014 18:12:00 for PULSAR by
1.8.4