Loading...
Searching...
No Matches
opennn_types.h File Reference
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <exception>
#include <filesystem>
#include <format>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <optional>
#include <random>
#include <set>
#include <source_location>
#include <span>
#include <sstream>
#include <stdexcept>
#include <string>
#include <string_view>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <Eigen/Core>
#include <unsupported/Eigen/CXX11/Tensor>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cublas_v2.h>
#include <cublasLt.h>
#include <cudnn.h>
#include <cuda_bf16.h>

Go to the source code of this file.

Classes

class  opennn::ScopeExit< F >
 

Namespaces

namespace  opennn
 
namespace  opennn::detail
 

Macros

#define OPENNN_TYPES_H_
 
#define EIGEN_USE_THREADS
 
#define EIGEN_MAX_ALIGN_BYTES   64
 
#define EIGEN_NO_DEBUG
 
#define NOMINMAX
 
#define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING
 
#define _CRT_SECURE_NO_WARNINGS
 
#define EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
 
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
 
#define CHECK_CUDA(x)
 
#define CHECK_CUBLAS(x)
 
#define CHECK_CUDNN(x)
 
#define OPENNN_CUDA_STUB_BODY(name)
 
#define OPENNN_CUDA_STUB(ret, name, sig)
 
#define OPENNN_CUDA_TEMPLATE_STUB(name)
 
#define throw_if(condition, ...)
 

Typedefs

using type = float
 
using opennn::DeviceStream = cudaStream_t
 
using opennn::DeviceEvent = cudaEvent_t
 
using opennn::DeviceGraph = cudaGraph_t
 
using opennn::DeviceGraphExec = cudaGraphExec_t
 
using opennn::BlasHandle = cublasHandle_t
 
using opennn::BlasLtHandle = cublasLtHandle_t
 
using opennn::DnnHandle = cudnnHandle_t
 
using opennn::DnnOpTensorDescriptor = cudnnOpTensorDescriptor_t
 
using opennn::DnnDataType = cudnnDataType_t
 
using opennn::DnnStatus = cudnnStatus_t
 
using opennn::DnnTensorDescriptor = cudnnTensorDescriptor_t
 
using opennn::DnnRNNDataDescriptor = cudnnRNNDataDescriptor_t
 
using opennn::DnnRNNDescriptor = cudnnRNNDescriptor_t
 
using opennn::DnnDropoutDescriptor = cudnnDropoutDescriptor_t
 
using opennn::DnnPoolingDescriptor = cudnnPoolingDescriptor_t
 
using opennn::DnnRNNMode = cudnnRNNMode_t
 
using opennn::BlasComputeType = cublasComputeType_t
 
using opennn::BlasPointerMode = cublasPointerMode_t
 
using opennn::BlasMathMode = cublasMath_t
 
using opennn::BlasOperation = cublasOperation_t
 
using opennn::DeviceDataType = cudaDataType_t
 
using opennn::bfloat16 = __nv_bfloat16
 
using opennn::type = float
 
using MatrixR = Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Layout>
 
using MatrixI = Eigen::Matrix<Index, Eigen::Dynamic, Eigen::Dynamic, Layout>
 
using MatrixB = Eigen::Matrix<bool, Eigen::Dynamic, Eigen::Dynamic, Layout>
 
using VectorR = Eigen::Matrix<float, Eigen::Dynamic, 1>
 
using VectorI = Eigen::Matrix<Index, Eigen::Dynamic, 1>
 
using VectorB = Eigen::Matrix<bool, Eigen::Dynamic, 1>
 
using VectorMap = Eigen::Map<VectorR, Eigen::AlignedMax>
 
using ConstVectorMap = Eigen::Map<const VectorR, Eigen::AlignedMax>
 
using ConstUnalignedVectorMap = Eigen::Map<const VectorR>
 
using MatrixMap = Eigen::Map<MatrixR, Eigen::AlignedMax>
 
using Tensor0 = Eigen::Tensor<float, 0, Layout | Eigen::AlignedMax>
 
using Tensor1 = Eigen::Tensor<float, 1, Layout | Eigen::AlignedMax>
 
using Tensor2 = Eigen::Tensor<float, 2, Layout | Eigen::AlignedMax>
 
using Tensor3 = Eigen::Tensor<float, 3, Layout | Eigen::AlignedMax>
 
using Tensor4 = Eigen::Tensor<float, 4, Layout | Eigen::AlignedMax>
 
template<int Rank>
using TensorR = Eigen::Tensor<float, Rank, Layout | Eigen::AlignedMax>
 
using TensorMap3 = Eigen::TensorMap<Eigen::Tensor<float, 3, Layout | Eigen::AlignedMax>, Eigen::AlignedMax>
 
using TensorMap4 = Eigen::TensorMap<Eigen::Tensor<float, 4, Layout | Eigen::AlignedMax>, Eigen::AlignedMax>
 
template<int Rank>
using TensorMapR = Eigen::TensorMap<Eigen::Tensor<float, Rank, Layout | Eigen::AlignedMax>, Eigen::AlignedMax>
 

Functions

template<typename T>
void check_cuda_status (T status, const char *msg, source_location loc=source_location::current())
 
float opennn::bfloat16_to_float_host (const uint16_t value)
 
uint16_t opennn::float_to_bfloat16_host (const float value)
 
void opennn::float_2_bfloat16_host (const Index count, const float *source, uint16_t *destination)
 
void opennn::detail::throw_formatted (string_view message, const source_location &loc=source_location::current())
 
template<typename... Args>
void opennn::detail::throw_formatted (format_string< Args... > message, Args &&... args)
 
template<typename Map>
void opennn::detail::make_bounded_cache_room (Map &entries, const size_t capacity)
 
template<typename Map, typename Key>
Map::mapped_type & opennn::detail::bounded_cache_entry (Map &entries, const Key &key, const size_t capacity)
 
template<typename T, typename... Candidates>
constexpr bool opennn::is_one_of (const T &value, const Candidates &... candidates)
 
template<typename F>
 opennn::ScopeExit (F) -> ScopeExit< F >
 
template<typename T>
ostream & opennn::operator<< (ostream &os, const vector< T > &vec)
 
ConstUnalignedVectorMap as_vector_map (const span< const float > values)
 

Variables

constexpr float opennn::EPSILON = numeric_limits<float>::epsilon()
 
constexpr float opennn::MAX = numeric_limits<float>::max()
 
constexpr float opennn::POS_INFINITY = numeric_limits<float>::infinity()
 
constexpr float opennn::NEG_INFINITY = -numeric_limits<float>::infinity()
 
constexpr float opennn::QUIET_NAN = numeric_limits<float>::quiet_NaN()
 
constexpr float opennn::SOFTMAX_MASK_VALUE = float(-1e9f)
 
constexpr int Layout = Eigen::RowMajor
 

Macro Definition Documentation

◆ _CRT_SECURE_NO_WARNINGS

#define _CRT_SECURE_NO_WARNINGS

◆ _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING

#define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING

◆ _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING

#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING

◆ CHECK_CUBLAS

#define CHECK_CUBLAS ( x)
Value:
check_cuda_status(x, "CuBLAS")
void check_cuda_status(T status, const char *msg, source_location loc=source_location::current())
Definition opennn_types.h:77

◆ CHECK_CUDA

#define CHECK_CUDA ( x)
Value:

◆ CHECK_CUDNN

#define CHECK_CUDNN ( x)
Value:
check_cuda_status(x, "cuDNN")

◆ EIGEN_MAX_ALIGN_BYTES

#define EIGEN_MAX_ALIGN_BYTES   64

◆ EIGEN_NO_DEBUG

#define EIGEN_NO_DEBUG

◆ EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS

#define EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS

◆ EIGEN_USE_THREADS

#define EIGEN_USE_THREADS

◆ NOMINMAX

#define NOMINMAX

◆ OPENNN_CUDA_STUB

#define OPENNN_CUDA_STUB ( ret,
name,
sig )
Value:
static ret name sig OPENNN_CUDA_STUB_BODY(name)
#define OPENNN_CUDA_STUB_BODY(name)
Definition opennn_types.h:123

◆ OPENNN_CUDA_STUB_BODY

#define OPENNN_CUDA_STUB_BODY ( name)
Value:
{ throw runtime_error(#name " requires CUDA support."); }

◆ OPENNN_CUDA_TEMPLATE_STUB

#define OPENNN_CUDA_TEMPLATE_STUB ( name)
Value:
template<typename... Ts, typename... As> static void name(As&&...) OPENNN_CUDA_STUB_BODY(name)

◆ OPENNN_TYPES_H_

#define OPENNN_TYPES_H_

◆ throw_if

#define throw_if ( condition,
... )
Value:
do { if (condition) ::opennn::detail::throw_formatted(__VA_ARGS__); } while (false)
void throw_formatted(string_view message, const source_location &loc=source_location::current())
Definition opennn_types.h:216

Typedef Documentation

◆ ConstUnalignedVectorMap

using ConstUnalignedVectorMap = Eigen::Map<const VectorR>

◆ ConstVectorMap

using ConstVectorMap = Eigen::Map<const VectorR, Eigen::AlignedMax>

◆ MatrixB

using MatrixB = Eigen::Matrix<bool, Eigen::Dynamic, Eigen::Dynamic, Layout>

◆ MatrixI

using MatrixI = Eigen::Matrix<Index, Eigen::Dynamic, Eigen::Dynamic, Layout>

◆ MatrixMap

using MatrixMap = Eigen::Map<MatrixR, Eigen::AlignedMax>

◆ MatrixR

using MatrixR = Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Layout>

◆ Tensor0

using Tensor0 = Eigen::Tensor<float, 0, Layout | Eigen::AlignedMax>

◆ Tensor1

using Tensor1 = Eigen::Tensor<float, 1, Layout | Eigen::AlignedMax>

◆ Tensor2

using Tensor2 = Eigen::Tensor<float, 2, Layout | Eigen::AlignedMax>

◆ Tensor3

using Tensor3 = Eigen::Tensor<float, 3, Layout | Eigen::AlignedMax>

◆ Tensor4

using Tensor4 = Eigen::Tensor<float, 4, Layout | Eigen::AlignedMax>

◆ TensorMap3

using TensorMap3 = Eigen::TensorMap<Eigen::Tensor<float, 3, Layout | Eigen::AlignedMax>, Eigen::AlignedMax>

◆ TensorMap4

using TensorMap4 = Eigen::TensorMap<Eigen::Tensor<float, 4, Layout | Eigen::AlignedMax>, Eigen::AlignedMax>

◆ TensorMapR

template<int Rank>
using TensorMapR = Eigen::TensorMap<Eigen::Tensor<float, Rank, Layout | Eigen::AlignedMax>, Eigen::AlignedMax>

◆ TensorR

template<int Rank>
using TensorR = Eigen::Tensor<float, Rank, Layout | Eigen::AlignedMax>

◆ type

using type = float

◆ VectorB

using VectorB = Eigen::Matrix<bool, Eigen::Dynamic, 1>

◆ VectorI

using VectorI = Eigen::Matrix<Index, Eigen::Dynamic, 1>

◆ VectorMap

using VectorMap = Eigen::Map<VectorR, Eigen::AlignedMax>

◆ VectorR

using VectorR = Eigen::Matrix<float, Eigen::Dynamic, 1>

Function Documentation

◆ as_vector_map()

ConstUnalignedVectorMap as_vector_map ( const span< const float > values)
inline

◆ check_cuda_status()

template<typename T>
void check_cuda_status ( T status,
const char * msg,
source_location loc = source_location::current() )

Variable Documentation

◆ Layout

int Layout = Eigen::RowMajor
constexpr