(git:b279b6b)
offload_library.c File Reference
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "offload_library.h"
#include "offload_runtime.h"

Go to the source code of this file.

Functions

void offload_init (void)
 Initialize runtime. More...
 
int offload_get_device_count (void)
 Returns the number of available devices. More...
 
void offload_set_chosen_device (int device_id)
 Selects the chosen device to be used. More...
 
int offload_get_chosen_device (void)
 Returns the chosen device. More...
 
void offload_activate_chosen_device (void)
 Activates the device selected via offload_set_chosen_device() More...
 
void offload_timeset (const char *message)
 Starts a timing range. More...
 
void offload_timestop (void)
 Ends a timing range. More...
 
void offload_mem_info (size_t *free, size_t *total)
 Gets free and total device memory. More...
 
int offload_host_malloc (void **ptr__, const size_t size__)
 Allocate pinned memory (or simple malloc when there is no gpu) More...
 
int offload_host_free (void *ptr__)
 free pinned memory (or simple free when there is no gpu) More...
 

Variables

static int chosen_device_id = -1
 
const uint32_t colormap []
 

Function Documentation

◆ offload_init()

void offload_init ( void  )

Initialize runtime.

Initalize runtime.

Author
Rocco Meli

Definition at line 52 of file offload_library.c.

◆ offload_get_device_count()

int offload_get_device_count ( void  )

Returns the number of available devices.

Author
Ole Schuett

Definition at line 71 of file offload_library.c.

◆ offload_set_chosen_device()

void offload_set_chosen_device ( int  device_id)

Selects the chosen device to be used.

Author
Ole Schuett

Definition at line 87 of file offload_library.c.

◆ offload_get_chosen_device()

int offload_get_chosen_device ( void  )

Returns the chosen device.

Author
Ole Schuett

Definition at line 93 of file offload_library.c.

◆ offload_activate_chosen_device()

void offload_activate_chosen_device ( void  )

Activates the device selected via offload_set_chosen_device()

Author
Ole Schuett

Definition at line 99 of file offload_library.c.

Here is the caller graph for this function:

◆ offload_timeset()

void offload_timeset ( const char *  message)

Starts a timing range.

Author
Ole Schuett

Definition at line 113 of file offload_library.c.

Here is the call graph for this function:

◆ offload_timestop()

void offload_timestop ( void  )

Ends a timing range.

Author
Ole Schuett

Definition at line 143 of file offload_library.c.

◆ offload_mem_info()

void offload_mem_info ( size_t *  free,
size_t *  total 
)

Gets free and total device memory.

Author
Ole Schuett

Definition at line 157 of file offload_library.c.

◆ offload_host_malloc()

int offload_host_malloc ( void **  ptr__,
const size_t  size__ 
)

Allocate pinned memory (or simple malloc when there is no gpu)

Definition at line 169 of file offload_library.c.

◆ offload_host_free()

int offload_host_free ( void *  ptr__)

free pinned memory (or simple free when there is no gpu)

Definition at line 179 of file offload_library.c.

Variable Documentation

◆ chosen_device_id

int chosen_device_id = -1
static

Definition at line 31 of file offload_library.c.

◆ colormap

const uint32_t colormap[]
Initial value:
= {0xFFFFFF00,
0xFFFF00FF,
0xFFFF0000,
0xFFC0C0C0,
0xFF808080,
0xFF808000,
0xFF800080,
0xFF800000,
0xFF00FFFF,
0xFF00FF00,
0xFF008080,
0xFF008000,
0xFF0000FF,
0xFF000080}

Definition at line 33 of file offload_library.c.