16#ifndef Device_included
17#define Device_included
19#include <TRUSTTabs_forward.h>
23#include <Perf_counters.h>
30#include <nvtx3/nvToolsExt.h>
35#include <rocprofiler-sdk-roctx/roctx.h>
47std::string ptrToString(
const void* adr);
50#define ToDo_Kokkos(str) \
51 Cerr << "[Kokkos " << str << "] Warning, code running slow cause not ported yet: line " << __LINE__ << " in " << __FILE__ << finl;
53#define ToDo_Kokkos(str)
58inline const std::string methodName(
const std::string& prettyFunction,
const int line)
60 size_t colons = prettyFunction.find(
"::");
61 if (colons != std::string::npos)
64 size_t begin = prettyFunction.substr(0, colons).rfind(
" ") + 1;
65 size_t end = prettyFunction.rfind(
"(") - begin;
66 return prettyFunction.substr(begin, end) +
":" + std::to_string(line);
71 colons = prettyFunction.find(
'(');
72 return prettyFunction.substr(0, colons) +
":" + std::to_string(line);
75#define __KERNEL_NAME__ methodName(__PRETTY_FUNCTION__,__LINE__)
77#define __KERNEL_NAME__ ""
80extern std::string start_gpu_timer(std::string str=
"kernel",
int bytes=-1);
82extern void end_gpu_timer(
const std::string& str,
int onDevice=1,
int bytes=-1);
84template <
typename _TYPE_>
85extern _TYPE_* addrOnDevice(_TYPE_* ptr);
87template <
typename _TYPE_,
typename _SIZE_=
int>
90template <
typename _TYPE_,
typename _SIZE_=
int>
96template <
typename _TYPE_,
typename _SIZE_=
int>
99template <
typename _TYPE_,
typename _SIZE_=
int>
105template <
typename _TYPE_>
106extern bool isAllocatedOnDevice(_TYPE_* tab_addr);
108template <
typename _TYPE_,
typename _SIZE_=
int>
111template <
typename _TYPE_,
typename _SIZE_=
int>
114template <
typename _TYPE_,
typename _SIZE_=
int>
117template <
typename _TYPE_,
typename _SIZE_=
int>
120template <
typename _TYPE_,
typename _SIZE_=
int>
123template <
typename _TYPE_,
typename _SIZE_=
int>
126template <
typename _TYPE_,
typename _SIZE_=
int>
129template <
typename _TYPE_,
typename _SIZE_=
int>
130extern _TYPE_* allocateOnDevice(_TYPE_* ptr, _SIZE_ size);
132template <
typename _TYPE_,
typename _SIZE_=
int>
133extern void deleteOnDevice(_TYPE_* ptr, _SIZE_ size);
135template <
typename _TYPE_,
typename _SIZE_=
int>
136extern void copyToDevice(_TYPE_* ptr, _SIZE_ size);
138template <
typename _TYPE_,
typename _SIZE_=
int>
139extern void copyFromDevice(_TYPE_* ptr, _SIZE_ size);
Represents a an array of int/int64/double/... values.