GeNN  3.3.0
GPU enhanced Neuronal Networks (GeNN)
variableMode.h
Go to the documentation of this file.
1 #pragma once
2 
3 // Standard C includes
4 #include <cstdint>
5 
6 //----------------------------------------------------------------------------
7 // Enumerations
8 //----------------------------------------------------------------------------
10 enum class VarLocation : uint8_t
11 {
12  HOST = (1 << 0),
13  DEVICE = (1 << 1),
14  ZERO_COPY = (1 << 2),
15 };
16 
18 enum class VarInit : uint8_t
19 {
20  HOST = (1 << 3),
21  DEVICE = (1 << 4),
22 };
23 
25 enum class VarMode : uint8_t
26 {
27  LOC_DEVICE_INIT_DEVICE = static_cast<uint8_t>(VarLocation::DEVICE) | static_cast<uint8_t>(VarInit::DEVICE),
28  LOC_HOST_DEVICE_INIT_HOST = static_cast<uint8_t>(VarLocation::HOST) | static_cast<uint8_t>(VarLocation::DEVICE) | static_cast<uint8_t>(VarInit::HOST),
29  LOC_HOST_DEVICE_INIT_DEVICE = static_cast<uint8_t>(VarLocation::HOST) | static_cast<uint8_t>(VarLocation::DEVICE) | static_cast<uint8_t>(VarInit::DEVICE),
30  LOC_ZERO_COPY_INIT_HOST = static_cast<uint8_t>(VarLocation::HOST) | static_cast<uint8_t>(VarLocation::DEVICE) | static_cast<uint8_t>(VarLocation::ZERO_COPY) | static_cast<uint8_t>(VarInit::HOST),
31  LOC_ZERO_COPY_INIT_DEVICE = static_cast<uint8_t>(VarLocation::HOST) | static_cast<uint8_t>(VarLocation::DEVICE) | static_cast<uint8_t>(VarLocation::ZERO_COPY) | static_cast<uint8_t>(VarInit::DEVICE),
32 };
33 
34 //----------------------------------------------------------------------------
35 // Operators
36 //----------------------------------------------------------------------------
37 inline bool operator & (VarMode mode, VarInit init)
38 {
39  return (static_cast<uint8_t>(mode) & static_cast<uint8_t>(init)) != 0;
40 }
41 
42 inline bool operator & (VarMode mode, VarLocation location)
43 {
44  return (static_cast<uint8_t>(mode) & static_cast<uint8_t>(location)) != 0;
45 }
VarLocation
< Flags defining which memory space variables should be allocated in
Definition: variableMode.h:10
VarMode
Definition: variableMode.h:25
bool operator&(VarMode mode, VarInit init)
Definition: variableMode.h:37
VarInit
Definition: variableMode.h:18