54template <
typename Config>
88template <
typename Config>
113template <
typename Config>
115 const std::filesystem::path&
path,
130 typename T::value_type;
131 typename T::error_type;
132} && std::same_as<typename T::error_type, cusbf::Error>;
135template <
typename Handler>
137 std::invoke_result_t<Handler&, FastxReader&, fastx_dispatch_path>;
142template <
typename Handler>
158template <
typename Config, fastx_dispatch_handler Handler>
160 const std::filesystem::path&
path,
173 return Err(buffer.error());
FASTA/FASTQ parser over a contiguous in-memory buffer.
static Result< std::unique_ptr< FastxFileBuffer > > load(const std::filesystem::path &path)
Loads an uncompressed file via mmap (Linux) or read into memory.
Streaming FASTA/FASTQ parser.
Handler invoked by dispatch_fastx_file with either reader type and a dispatch path.
Result< cuda_free_memory > query_cuda_free_memory()
Queries current device free memory via cudaMemGetInfo.
bool isGzipFile(const std::filesystem::path &path)
True when path begins with the gzip magic bytes (0x1F, 0x8B).
Result< std::unique_ptr< std::istream > > openFastxFile(const std::filesystem::path &path)
Opens a FASTA/FASTQ file for reading.
uint64_t fastx_file_bytes(const std::filesystem::path &path)
bool fastx_fits_single_gpu_chunk(fastx_chunk_mode mode, double fill_fraction, uint64_t file_bytes)
Whether the entire file fits in a single GPU staging chunk at fill_fraction.
fastx_dispatch_path
How a FASTX file is read and chunked for GPU processing.
@ chunked_mmap
Multiple GPU chunks, file mmap'd when it fits in host RAM.
@ single_chunk_mmap
Whole file in one GPU chunk, mmap'd when it fits in host RAM.
@ chunked_stream
Multiple GPU chunks, stream via istream (gzip or larger than RAM).
@ single_chunk_stream
Whole file in one GPU chunk, stream via istream (no mmap).
constexpr bool fastx_is_single_chunk_path(fastx_dispatch_path path) noexcept
True for fastx_dispatch_path::single_chunk_stream or fastx_dispatch_path::single_chunk_mmap.
fastx_dispatch_handler_result_t< Handler > dispatch_fastx_file(const std::filesystem::path &path, fastx_chunk_mode mode, double fill_fraction, Handler &&handler)
Opens a FASTX path and invokes handler with a reader and dispatch path.
fastx_dispatch_path select_fastx_dispatch_path_for_file_bytes(uint64_t file_bytes, fastx_chunk_mode mode, double fill_fraction, bool file_fits_in_memory)
Selects mmap vs stream and single- vs multi-chunk processing from file size.
fastx_dispatch_path select_fastx_dispatch_path(const std::filesystem::path &path, fastx_chunk_mode mode, double fill_fraction)
Selects mmap vs stream and single- vs multi-chunk processing for a path.
fastx_chunk_mode
FASTX mode used to size GPU staging buffers.
bool fastx_file_fits_in_memory(const std::filesystem::path &path)
True when uncompressed path size is within fastx_memory_map_max_bytes.
constexpr bool fastx_uses_mmap_reader(fastx_dispatch_path path) noexcept
True when dispatch uses FastxBufferReader over an mmap'd file.
uint64_t parse_env_mebibytes(std::string_view value)
Parses a decimal mebibyte count from value.
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...
std::invoke_result_t< Handler &, FastxReader &, fastx_dispatch_path > fastx_dispatch_handler_result_t
Return type of a fastx_dispatch_handler when invoked with a stream reader.
std::string_view getenv_value(const char *env_name)
Reads env_name via getenv, or an empty view when unset.
uint64_t fastx_single_chunk_stream_max_bytes()
Max raw file size for fastx_dispatch_path::single_chunk_stream (istream, no mmap).
cuda::std::unexpected< Error > Err(Error error)
Failure return; converts to any Result<T> via cuda::std::unexpected.