Yet Another eXchange Tool 0.11.3
Loading...
Searching...
No Matches
xt_gpu.h
Go to the documentation of this file.
1
13/*
14 * Keywords:
15 * Maintainer: Jörg Behrens <behrens@dkrz.de>
16 * Moritz Hanke <hanke@dkrz.de>
17 * Thomas Jahns <jahns@dkrz.de>
18 *
19 * URL: https://dkrz-sw.gitlab-pages.dkrz.de/yaxt/
20 *
21 * Redistribution and use in source and binary forms, with or without
22 * modification, are permitted provided that the following conditions are
23 * met:
24 *
25 * Redistributions of source code must retain the above copyright notice,
26 * this list of conditions and the following disclaimer.
27 *
28 * Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 *
32 * Neither the name of the DKRZ GmbH nor the names of its contributors
33 * may be used to endorse or promote products derived from this software
34 * without specific prior written permission.
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
37 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
38 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
39 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
40 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
41 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
42 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
43 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
44 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
45 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
46 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47 */
48
49#ifndef XT_GPU_H
50#define XT_GPU_H
51
52#ifdef XT_GPU_INSTR_ENABLE
53
54#define XT_GPU_INSTR_PUSH(arg) xt_gpu_instr_push(#arg)
55#define XT_GPU_INSTR_POP xt_gpu_instr_pop()
56
57#else
58
59#define XT_GPU_INSTR_PUSH(arg)
60#define XT_GPU_INSTR_POP
61
62#endif
63
64#include <stddef.h>
65
66#include "core/ppm_visibility.h"
67
73
75 void* (*Malloc)(size_t alloc_size, enum xt_memtype memtype);
76 void (*Free)(void * ptr, enum xt_memtype memtype);
77 void (*Memcpy)(
78 void * dst, void const * src, size_t buffer_size,
79 enum xt_memtype dst_memtype, enum xt_memtype src_memtype);
80 enum xt_memtype (*Get_memtype)(const void *ptr);
81 int (*Instr_push)(char const * name);
82 int (*Instr_pop)(void);
83};
84
90xt_gpu_init(void);
91
100xt_gpu_malloc(size_t alloc_size, enum xt_memtype memtype);
101
108xt_gpu_free(void * ptr, enum xt_memtype memtype);
109
119 void * dst, void const * src, size_t buffer_size,
120 enum xt_memtype dst_memtype, enum xt_memtype src_memtype);
121
127enum xt_memtype xt_gpu_get_memtype(const void *ptr);
128
129PPM_DSO_INTERNAL int xt_gpu_instr_push(char const * name);
131
132#endif // XT_GPU_H
133
134/*
135 * Local Variables:
136 * c-basic-offset: 2
137 * coding: utf-8
138 * indent-tabs-mode: nil
139 * show-trailing-whitespace: t
140 * require-trailing-newline: t
141 * End:
142 */
#define PPM_DSO_INTERNAL
void(* Memcpy)(void *dst, void const *src, size_t buffer_size, enum xt_memtype dst_memtype, enum xt_memtype src_memtype)
Definition xt_gpu.h:77
void(* Free)(void *ptr, enum xt_memtype memtype)
Definition xt_gpu.h:76
int(* Instr_pop)(void)
Definition xt_gpu.h:82
enum xt_memtype(* Get_memtype)(const void *ptr)
Definition xt_gpu.h:80
int(* Instr_push)(char const *name)
Definition xt_gpu.h:81
char name[32]
Definition xt_config.c:93
PPM_DSO_INTERNAL int xt_gpu_instr_push(char const *name)
Definition xt_gpu.c:201
PPM_DSO_INTERNAL void * xt_gpu_malloc(size_t alloc_size, enum xt_memtype memtype)
Definition xt_gpu.c:183
enum xt_memtype xt_gpu_get_memtype(const void *ptr)
Definition xt_gpu.c:197
PPM_DSO_INTERNAL void xt_gpu_init(void)
Definition xt_gpu.c:126
xt_memtype
Definition xt_gpu.h:68
@ XT_MEMTYPE_HOST
Definition xt_gpu.h:69
@ XT_MEMTYPE_DEVICE
Definition xt_gpu.h:70
@ XT_MEMTYPE_COUNT
Definition xt_gpu.h:71
PPM_DSO_INTERNAL void xt_gpu_memcpy(void *dst, void const *src, size_t buffer_size, enum xt_memtype dst_memtype, enum xt_memtype src_memtype)
Definition xt_gpu.c:191
PPM_DSO_INTERNAL int xt_gpu_instr_pop(void)
Definition xt_gpu.c:205
PPM_DSO_INTERNAL void xt_gpu_free(void *ptr, enum xt_memtype memtype)
Definition xt_gpu.c:187