6#ifndef XGBOOST_DATA_SPARSE_PAGE_WRITER_H_
7#define XGBOOST_DATA_SPARSE_PAGE_WRITER_H_
12#include "../common/io.h"
19struct SparsePageFormatReg;
52 LOG(FATAL) <<
"Unknown format type " << name;
64 std::function<SparsePageFormat<T>* ()>> {
79#define SparsePageFmt SparsePageFormat<SparsePage>
80#define XGBOOST_REGISTER_SPARSE_PAGE_FORMAT(Name) \
81 DMLC_REGISTRY_REGISTER(SparsePageFormatReg<SparsePage>, SparsePageFmt, Name)
83#define CSCPageFmt SparsePageFormat<CSCPage>
84#define XGBOOST_REGISTER_CSC_PAGE_FORMAT(Name) \
85 DMLC_REGISTRY_REGISTER(SparsePageFormatReg<CSCPage>, CSCPageFmt, Name)
87#define SortedCSCPageFmt SparsePageFormat<SortedCSCPage>
88#define XGBOOST_REGISTER_SORTED_CSC_PAGE_FORMAT(Name) \
89 DMLC_REGISTRY_REGISTER(SparsePageFormatReg<SortedCSCPage>, SortedCSCPageFmt, Name)
91#define EllpackPageFmt SparsePageFormat<EllpackPage>
92#define XGBOOST_REGISTER_ELLPACK_PAGE_FORMAT(Name) \
93 DMLC_REGISTRY_REGISTER(SparsePageFormatReg<EllpackPage>, EllpackPageFmt, Name)
95#define GHistIndexPageFmt SparsePageFormat<GHistIndexMatrix>
96#define XGBOOST_REGISTER_GHIST_INDEX_PAGE_FORMAT(Name) \
97 DMLC_REGISTRY_REGISTER(SparsePageFormatReg<GHistIndexMatrix>, \
98 GHistIndexPageFmt, Name)
Common base class for function registry.
Definition registry.h:151
Registry class. Registry can be used to register global singletons. The most commonly use case are fa...
Definition registry.h:27
static const EntryType * Find(const std::string &name)
Find the entry with corresponding name.
Definition registry.h:48
Output stream backed by a file.
Definition io.h:426
Wrap resource into a dmlc stream.
Definition io.h:282
Format specification of various data formats like SparsePage.
Definition sparse_page_writer.h:25
virtual size_t Write(const T &page, common::AlignedFileWriteStream *fo)=0
save the data to fo, when a page was written.
virtual bool Read(T *page, common::AlignedResourceReadStream *fi)=0
Load all the segments into page, advance fi to end of the block.
defines serializable interface of dmlc
Copyright 2015-2023 by XGBoost Contributors.
Copyright 2019-2023, XGBoost Contributors.
Definition data.py:1
SparsePageFormat< T > * CreatePageFormat(const std::string &name)
Create sparse page of format.
Definition sparse_page_writer.h:49
Registry utility that helps to build registry singletons.
Registry entry for sparse page format.
Definition sparse_page_writer.h:64