PULSAR  2.0.0
Parallel Ultra-Light Systolic Array Runtime
 All Data Structures Files Functions Typedefs Enumerations Macros Groups
gpu_malloc.h File Reference

Simple device memory allocator. More...

#include <stdlib.h>
#include "cuda_stubs.h"

Go to the source code of this file.

Data Structures

struct  segment
 
struct  gpu_malloc_s
 

Typedefs

typedef struct segment segment_t
 
typedef struct gpu_malloc_s gpu_malloc_t
 

Functions

gpu_malloc_tgpu_malloc_init (int max_segment, size_t unit_size)
 Creates a new device allocator. More...
 
int gpu_malloc_fini (gpu_malloc_t *gdata)
 Destroys a device allocator. More...
 
void * gpu_malloc (gpu_malloc_t *gdata, size_t size)
 Allocates device memory. More...
 
int gpu_free (gpu_malloc_t *gdata, void *ptr)
 Frees device memory. More...
 

Detailed Description

Simple device memory allocator.

Author
Aurelien Bouteiller
Thomas Herault
George Bosilca

PULSAR Runtime http://icl.utk.edu/pulsar/ Copyright (C) 2012-2015 University of Tennessee.

Definition in file gpu_malloc.h.

Function Documentation

int gpu_free ( gpu_malloc_t gdata,
void *  add 
)

Frees device memory.

Parameters
gdata– The allocator to use.
add– The pointer to the memory to free.
Return values
0on success.
-1on error.

Definition at line 143 of file gpu_malloc.c.

void* gpu_malloc ( gpu_malloc_t gdata,
size_t  size 
)

Allocates device memory.

Parameters
gdata– The allocator to use.
size– The size in bytes to allocate.
Returns
A pointer to the allocated memory. NULL on error.

Definition at line 106 of file gpu_malloc.c.

int gpu_malloc_fini ( gpu_malloc_t gdata)

Destroys a device allocator.

Parameters
gdata– The allocator to destroy.
Return values
0on success.
-1on error.

Definition at line 73 of file gpu_malloc.c.

gpu_malloc_t* gpu_malloc_init ( int  _max_segment,
size_t  _unit_size 
)

Creates a new device allocator.

Parameters
_max_segment– The maximum number of segments.
_unit_size– The size of each segment.
Returns
A new allocator. NULL on error.

Definition at line 24 of file gpu_malloc.c.