MCPcopy Create free account
hub / github.com/NVIDIA/cutlass / parse_

Method parse_

tools/profiler/src/problem_space.cpp:549–711  ·  view source on GitHub ↗

Parses a command line

Source from the content-addressed store, hash-verified

547
548/// Parses a command line
549void ProblemSpace::parse_(KernelArgument *arg, CommandLine const &cmdline) {
550
551 switch (arg->description->type) {
552 case ArgumentTypeID::kScalar:
553 {
554 auto * scalar = static_cast<ScalarArgument *>(arg);
555
556 for (auto const &alias : arg->description->aliases) {
557 if (cmdline.check_cmd_line_flag(alias.c_str())) {
558
559 std::vector<std::vector<std::string>> tokens;
560 cmdline.get_cmd_line_argument_ranges(alias.c_str(), tokens);
561
562 for (auto const & vec : tokens) {
563 if (!vec.empty()) {
564 scalar->values.push_back(vec.front());
565 }
566 }
567 break;
568 }
569 }
570 }
571 break;
572 case ArgumentTypeID::kInteger:
573 {
574 auto *integer = static_cast<IntegerArgument *>(arg);
575
576 for (auto const &alias : arg->description->aliases) {
577 if (cmdline.check_cmd_line_flag(alias.c_str())) {
578
579 std::vector<std::vector<std::string> > tokens;
580 cmdline.get_cmd_line_argument_ranges(alias.c_str(), tokens);
581
582 for (auto &range_tokens : tokens) {
583
584 if (!range_tokens.empty()) {
585
586 Range range;
587
588 if (range_tokens.front() == "rand") {
589 range.mode = Range::Mode::kRandom;
590 }
591 else if (range_tokens.front() == "randlg2") {
592 range.mode = Range::Mode::kRandomLog2;
593 }
594
595 switch (range.mode) {
596 case Range::Mode::kSequence:
597 {
598 range.first = lexical_cast<int64_t>(range_tokens.front());
599
600 if (range_tokens.size() > 1) {
601 range.last = lexical_cast<int64_t>(range_tokens.at(1));
602 }
603 else {
604 range.last = range.first;
605 }
606

Callers

nothing calls this directly

Calls 7

check_cmd_line_flagMethod · 0.80
emptyMethod · 0.45
frontMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected