cuSBF
Loading...
Searching...
No Matches
fastx_host_limits.cuh
Go to the documentation of this file.
1#pragma once
2
3#include <algorithm>
4#include <cstddef>
5#include <cstdint>
6#include <limits>
7
9
10namespace cusbf::detail {
11
12static_assert(sizeof(size_t) == sizeof(uint64_t), "cuSBF assumes size_t is 64-bit");
13
14[[nodiscard]] inline size_t parse_host_chunk_max_bytes(const char* env_name) {
16 if (mebibytes == 0) {
17 return 0;
18 }
19 return static_cast<size_t>(mebibytes) << 20;
20}
21
26 if (const size_t override_bytes = parse_host_chunk_max_bytes("CUSBF_FASTX_MAX_HOST_CHUNK_MB");
27 override_bytes != 0) {
28 return override_bytes;
29 }
30
31 if (const size_t large_bytes = parse_host_chunk_max_bytes("CUSBF_LARGE_FASTX_HOST_CHUNK_MB");
32 large_bytes != 0) {
33 return large_bytes;
34 }
35
36 return std::numeric_limits<size_t>::max();
37}
38
43) noexcept {
44 return host_chunk_max_bytes != std::numeric_limits<size_t>::max() &&
46}
47
48} // namespace cusbf::detail
size_t fastx_host_chunk_max_bytes()
Optional host assembly byte cap before flush (debug / low-RAM safety valve).
constexpr bool fastx_chunk_reached_host_byte_limit(size_t host_chunk_max_bytes, uint64_t raw_chunk_bytes) noexcept
True when raw_chunk_bytes reaches the optional host assembly cap.
uint64_t parse_env_mebibytes(std::string_view value)
Parses a decimal mebibyte count from value.
size_t parse_host_chunk_max_bytes(const char *env_name)
consteval bool separatorPositionAlwaysEncodesInvalid(char *input, uint64_t separatorPosition, uint64_t index)
Recursively tests whether placing the separator byte at any position in an input of valid bytes alway...
Definition Alphabet.cuh:37
std::string_view getenv_value(const char *env_name)
Reads env_name via getenv, or an empty view when unset.