Hermes
defs.h File Reference

Data type definitions. More...

Go to the source code of this file.

Classes

class  hermes::DataTypes
 DataType set of auxiliary functions. More...
 

Macros

#define HERMES_HOST_FUNCTION   __host__
 Specifies that the function can only be called from host side.
 
#define HERMES_DEVICE_CALLABLE   __device__ __host__
 Specifies that the function can be called from both host and device sides.
 
#define HERMES_DEVICE_FUNCTION   __device__
 Specifies that the function can only be called from device side.
 
#define HERMES_DEVICE_ENABLED   __CUDA_ARCH__
 Specifies that hermes is compiled with CUDA support.
 
#define HERMES_CUDA_KERNEL(NAME)   __global__ void NAME ## _k
 Defines a CUDA kernel function. More...
 
#define HERMES_CUDA_CODE(CODE)   {CODE}
 Wraps a block of code intended to be compiled only when using CUDA.
 
#define MATCH_TYPE(Type)
 
#define MATCH_TYPE(Type, R)
 
#define TYPE_SIZE(Size, Type)
 
#define DATA_TYPE_NAME(Type)
 
#define ENUM_NAME(E)
 

Typedefs

using real_t = float
 default floating point type
 
using f32 = float
 32 bit size floating point type
 
using f64 = double
 64 bit size floating point type
 
using i8 = int8_t
 8 bit size integer type
 
using i16 = int16_t
 16 bit size integer type
 
using i32 = int32_t
 32 bit size integer type
 
using i64 = int64_t
 64 bit size integer type
 
using u8 = uint8_t
 8 bit size unsigned integer type
 
using u16 = uint16_t
 16 bit size unsigned integer type
 
using u32 = uint32_t
 32 bit size unsigned integer type
 
using u64 = uint64_t
 64 bit size unsigned integer type
 
using ulong = unsigned long
 unsigned long type
 
using uint = unsigned int
 unsigned int type
 
using ushort = unsigned short
 unsigned short type
 
using uchar = unsigned char
 unsigned char type
 
using byte = uint8_t
 unsigned byte
 

Enumerations

enum class  hermes::DataType : u8 {
  I8 = 0 , I16 = 1 , I32 = 2 , I64 = 3 ,
  U8 = 4 , U16 = 5 , U32 = 6 , U64 = 7 ,
  F16 = 8 , F32 = 9 , F64 = 10 , CUSTOM = 11
}
 Enum class for integral types. More...
 
enum class  hermes::MemoryLocation { DEVICE , HOST , UNIFIED }
 Specifies where memory is stored. More...
 

Functions

std::string hermes::memoryLocationName (MemoryLocation location)
 Gets MemoryLocation value string name. More...
 
std::ostream & hermes::operator<< (std::ostream &o, MemoryLocation location)
 MemoryLocation support for std::ostream << operator. More...
 

Detailed Description

Data type definitions.

Copyright (c) 2019, FilipeCN.

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author
FilipeCN (filip.nosp@m.edec.nosp@m.n@gma.nosp@m.il.c.nosp@m.om)
Date
2019-01-04

Macro Definition Documentation

◆ DATA_TYPE_NAME

#define DATA_TYPE_NAME (   Type)
Value:
if(DataType::Type == type) \
return #Type;

◆ ENUM_NAME

#define ENUM_NAME (   E)
Value:
if(MemoryLocation::E == location) \
return #E;

◆ MATCH_TYPE [1/2]

#define MATCH_TYPE (   Type)
Value:
if((u8)DataType::Type == index) \
return DataType::Type;
uint8_t u8
8 bit size unsigned integer type
Definition: defs.h:86

◆ MATCH_TYPE [2/2]

#define MATCH_TYPE (   Type,
 
)
Value:
if(std::is_same_v<T, Type>) \
return DataType::R;

◆ TYPE_SIZE

#define TYPE_SIZE (   Size,
  Type 
)
Value:
if(DataType::Type == type) \
return Size;

Enumeration Type Documentation

◆ DataType

enum hermes::DataType : u8
strong

Enum class for integral types.

Enumerator
I8 

i8 type identifier

I16 

i16 type identifier

I32 

i32 type identifier

I64 

i64 type identifier

U8 

u8 type identifier

U16 

u16 type identifier

U32 

u32 type identifier

U64 

u64 type identifier

F16 

f16 type identifier

F32 

f32 type identifier

F64 

f64 type identifier

CUSTOM 

unidentified type

◆ MemoryLocation

Specifies where memory is stored.

Enumerator
DEVICE 

GPU side.

HOST 

CPU side.

UNIFIED 

unified memory

Function Documentation

◆ memoryLocationName()

std::string hermes::memoryLocationName ( MemoryLocation  location)
inline

Gets MemoryLocation value string name.

Parameters
location
Returns

◆ operator<<()

std::ostream& hermes::operator<< ( std::ostream &  o,
MemoryLocation  location 
)
inline

MemoryLocation support for std::ostream << operator.

Parameters
o
location
Returns