33 namespace suffix_sorting {
35 static constexpr
bool debug =
false;
39 template <
typename InputDIA>
42 uint64_t max_value = input_dia.Max();
43 sLOG <<
"max_value" << max_value;
46 uint64_t mask = (~uint64_t(0)) << level;
47 uint64_t maskbit = uint64_t(1) << level;
50 if (debug) wt.
Print(
"wt");
52 while (mask != (~uint64_t(0))) {
56 mask = (mask >> 1) | 0x8000000000000000llu;
59 sLOG <<
"maskbit" << maskbit <<
"mask" << std::hex << mask;
62 [maskbit](
const uint64_t& a) {
63 return (a & maskbit) != 0;
68 [mask](
const uint64_t& a,
const uint64_t& b) {
69 return (a & mask) < (b & mask);
72 if (debug) wt.
Print(
"wt");
79 int main(
int argc,
char* argv[]) {
91 "Path to input file.");
98 if (input_path.size()) {
99 auto input_dia = ReadBinary<uint64_t>(ctx, input_path);
103 std::default_random_engine rng(std::random_device { } ());
106 [&](
size_t) {
return uint64_t(rng() % 32); });
#define sLOG
Default logging method: output if the local debug variable is true.
DIA is the interface between the user and the Thrill framework.
auto Generate(Context &ctx, size_t size, const GenerateFunction &generate_function)
Generate is a Source-DOp, which creates a DIA of given size using a generator function.
int Run(const std::function< void(Context &)> &job_startpoint)
Runs the given job startpoint with a Context instance.
void add_opt_param_string(const std::string &name, std::string &dest, const std::string &desc)
add optional string parameter [name] with description and store to dest
int main(int argc, char *argv[])
void Print(const std::string &name=std::string()) const
Print is an Action, which collects all data of the DIA at the worker 0 and prints using ostream seria...
std::string ssprintf(const char *fmt,...)
Helper for return the result of a sprintf() call inside a std::string.
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
auto Sort(const CompareFunction &compare_function=CompareFunction()) const
Sort is a DOp, which sorts a given DIA according to the given compare_function.
static constexpr bool debug
Command line parser which automatically fills variables and prints nice usage messages.
auto Map(const MapFunction &map_function) const
Map applies map_function : to each item of a DIA and delivers a new DIA contains the returned values...
auto ConstructWaveletTree(const InputDIA &input_dia, const std::string &output_path)
static unsigned integer_log2_ceil(int i)
calculate the log2 floor of an integer type
void set_author(const std::string &author)
Set author of program, will be wrapped.
DIA< ValueType > Collapse() const
Create a CollapseNode which is mainly used to collapse the LOp chain into a DIA<T> with an empty stac...
bool process(int argc, const char *const *argv, std::ostream &os)