../configure --with-cuda=$(realpath $(dirname $(which nvcc))/../) --prefix=
unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE
// https://en.wikipedia.org/wiki/Half-precision_floating-point_format | |
#include <cmath> | |
#include <iostream> | |
using half = std::uint16_t; | |
bool is_nan(const half a) { | |
return (((a >> 10) & 0x1f) == 0x1f) && (a & 0x3ff); | |
} |
#include <sstream> | |
#include <stdexcept> | |
inline void cuda_check_error(cudaError_t error, const std::string filename, const std::size_t line, const std::string funcname, const std::string message = ""){ | |
if(error != cudaSuccess){ | |
std::stringstream ss; | |
ss << cudaGetErrorString( error ); | |
if(message.length() != 0){ | |
ss << " : " << message; | |
} |
#include <stdexcept> | |
#include <sstream> | |
#include <cuda_device_runtime_api.h> | |
#include <cuda.h> | |
#define CUDA_CHECK_ERROR(status) cuda_error_check(status, __FILE__, __LINE__, __func__) | |
inline void cuda_error_check(const cudaError_t error, const std::string filename, const std::size_t line, const std::string funcname, const std::string message = ""){ | |
if(error != cudaSuccess){ | |
std::stringstream ss; |