Yet Another eXchange Tool 0.11.1
Loading...
Searching...
No Matches
Macros | Functions | Variables
xt_gpu.c File Reference
#include <string.h>
#include "core/core.h"
#include "core/ppm_xfuncs.h"
#include "xt_gpu.h"
Include dependency graph for xt_gpu.c:

Go to the source code of this file.

Macros

#define STR(s)   #s
 
#define CHECK_FOR_HOST_MEM(type)
 

Functions

static void * default_malloc (size_t alloc_size, enum xt_memtype memtype)
 
static void default_free (void *ptr, enum xt_memtype memtype)
 
static void default_memcpy (void *dst, void const *src, size_t buffer_size, enum xt_memtype dst_memtype, enum xt_memtype src_memtype)
 
static enum xt_memtype default_get_memtype (const void *ptr)
 
static int default_instr_push (char const *)
 
static int default_instr_pop (void)
 
void xt_gpu_init (void)
 
static int default_instr_push (char const *XT_UNUSED(name))
 
void * xt_gpu_malloc (size_t alloc_size, enum xt_memtype memtype)
 
void xt_gpu_free (void *ptr, enum xt_memtype memtype)
 
void xt_gpu_memcpy (void *dst, void const *src, size_t buffer_size, enum xt_memtype dst_memtype, enum xt_memtype src_memtype)
 
enum xt_memtype xt_gpu_get_memtype (const void *ptr)
 
int xt_gpu_instr_push (char const *name)
 
int xt_gpu_instr_pop (void)
 

Variables

static const char filename [] = "xt_gpu.c"
 
static struct xt_gpu_vtable vtable
 

Detailed Description

Author
Jörg Behrens behre.nosp@m.ns@d.nosp@m.krz.d.nosp@m.e Moritz Hanke hanke.nosp@m.@dkr.nosp@m.z.de Thomas Jahns jahns.nosp@m.@dkr.nosp@m.z.de

Definition in file xt_gpu.c.

Macro Definition Documentation

◆ CHECK_FOR_HOST_MEM

#define CHECK_FOR_HOST_MEM (   type)
Value:
do { \
if (type != XT_MEMTYPE_HOST) { \
Xt_abort( \
Xt_default_comm, \
"ERROR(" STR(__func__) "): unsupported memory type", \
filename, __LINE__); \
} \
} while (0)
static const char filename[]
Definition xt_gpu.c:57
#define STR(s)
Definition xt_gpu.c:139
@ XT_MEMTYPE_HOST
Definition xt_gpu.h:69

Definition at line 140 of file xt_gpu.c.

◆ STR

#define STR (   s)    #s

Definition at line 139 of file xt_gpu.c.

Function Documentation

◆ default_free()

static void default_free ( void *  ptr,
enum xt_memtype  memtype 
)
static

Definition at line 157 of file xt_gpu.c.

◆ default_get_memtype()

static enum xt_memtype default_get_memtype ( const void *  ptr)
static

Definition at line 174 of file xt_gpu.c.

◆ default_instr_pop()

static int default_instr_pop ( void  )
static

Definition at line 181 of file xt_gpu.c.

◆ default_instr_push() [1/2]

static int default_instr_push ( char const *  )
static

◆ default_instr_push() [2/2]

static int default_instr_push ( char const *  XT_UNUSEDname)
static

Definition at line 180 of file xt_gpu.c.

◆ default_malloc()

static void * default_malloc ( size_t  alloc_size,
enum xt_memtype  memtype 
)
static

Definition at line 150 of file xt_gpu.c.

◆ default_memcpy()

static void default_memcpy ( void *  dst,
void const *  src,
size_t  buffer_size,
enum xt_memtype  dst_memtype,
enum xt_memtype  src_memtype 
)
static

Definition at line 164 of file xt_gpu.c.

◆ xt_gpu_free()

void xt_gpu_free ( void *  ptr,
enum xt_memtype  memtype 
)

frees memory that was previously allocated using xt_gpu_malloc

Parameters
[in]ptrpointer to be freed
[in]memtypetype memory associated to ptr

Definition at line 187 of file xt_gpu.c.

Here is the caller graph for this function:

◆ xt_gpu_get_memtype()

enum xt_memtype xt_gpu_get_memtype ( const void *  ptr)

determines the type of memory associated with the provided pointer

Parameters
[in]ptrpointer to be checked
Returns
type of memory associated to ptr

Definition at line 197 of file xt_gpu.c.

Here is the caller graph for this function:

◆ xt_gpu_init()

void xt_gpu_init ( void  )

initialises xt_gpu

Remarks
if yaxt was compiled with CUDA support, xt_gpu will try to use it
Examples
test_ddt.c.

Definition at line 126 of file xt_gpu.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_gpu_instr_pop()

int xt_gpu_instr_pop ( void  )

Definition at line 205 of file xt_gpu.c.

◆ xt_gpu_instr_push()

int xt_gpu_instr_push ( char const *  name)

Definition at line 201 of file xt_gpu.c.

◆ xt_gpu_malloc()

void * xt_gpu_malloc ( size_t  alloc_size,
enum xt_memtype  memtype 
)

allocates memory of the specified type

Parameters
[in]alloc_sizenumber of bytes to be allocated
[in]memtypetype of memory to be allocated
Returns
allocated memory of specified size and memory type
NULL, if allocation failed

Definition at line 183 of file xt_gpu.c.

Here is the caller graph for this function:

◆ xt_gpu_memcpy()

void xt_gpu_memcpy ( void *  dst,
void const *  src,
size_t  buffer_size,
enum xt_memtype  dst_memtype,
enum xt_memtype  src_memtype 
)

copies memory from src to dst

Parameters
[in]dstpointer to destination memory
[in]srcpointer to source memory
[in]buffer_sizenumber of bytes to be copied
[in]dst_memtypetype of destination memory
[in]src_memtypetype of source memory

Definition at line 191 of file xt_gpu.c.

Here is the caller graph for this function:

Variable Documentation

◆ filename

const char filename[] = "xt_gpu.c"
static

Definition at line 57 of file xt_gpu.c.

◆ vtable

struct xt_gpu_vtable vtable
static
Initial value:
= {
.Malloc = default_malloc,
.Free = default_free,
.Memcpy = default_memcpy,
.Get_memtype = default_get_memtype,
.Instr_push = default_instr_push,
.Instr_pop = default_instr_pop,
}
static enum xt_memtype default_get_memtype(const void *ptr)
Definition xt_gpu.c:174
static void * default_malloc(size_t alloc_size, enum xt_memtype memtype)
Definition xt_gpu.c:150
static void default_memcpy(void *dst, void const *src, size_t buffer_size, enum xt_memtype dst_memtype, enum xt_memtype src_memtype)
Definition xt_gpu.c:164
static int default_instr_push(char const *)
static void default_free(void *ptr, enum xt_memtype memtype)
Definition xt_gpu.c:157
static int default_instr_pop(void)
Definition xt_gpu.c:181

Definition at line 75 of file xt_gpu.c.