33 #include <cuda_runtime.h>    45   std::vector<std::string> 
keys;
    47   std::vector<std::string> 
args;
    55     for (
int i = 1; i < argc; i++) {
    58       if ((arg[0] != 
'-') || (arg[1] != 
'-')) {
    63       string::size_type pos;
    65       if ((pos = arg.find(
'=')) == string::npos) {
    66         key = string(arg, 2, arg.length() - 2);
    69         key = string(arg, 2, pos - 2);
    70         val = string(arg, pos + 1, arg.length() - 1);
    74       values.push_back(val);
    84     for (
int i = 0; i < int(keys.size()); ++i) {
    85       if (keys[i] == 
string(arg_name)) 
return true;
    93   template <
typename value_t>
   101   template <
typename value_t>
   104     if (index < args.size()) {
   105       istringstream str_stream(args[index]);
   119       val = !(value == 
"0" || value == 
"false");
   126   template <
typename value_t>
   129                              value_t 
const& _default = value_t())
 const {
   134     for (
int i = 0; i < int(keys.size()); ++i) {
   135       if (keys[i] == 
string(arg_name)) {
   136         istringstream str_stream(values[i]);
   145   template <
typename value_t>
   147                               std::vector<value_t>& vals,
   148                               char sep = 
',')
 const {
   156       for (
int i = 0; i < keys.size(); ++i) {
   157         if (keys[i] == 
string(arg_name)) {
   158           string val_string(values[i]);
   170                                    std::vector<std::pair<std::string, std::string> >& tokens,
   172                                    char sep = 
':')
 const {
   177       tokenize(tokens, value, delim, sep);
   186                                     std::vector<std::vector<std::string> >& vals,
   188                                     char sep = 
':')
 const {
   189     std::vector<std::string> ranges;
   192     for (std::vector<std::string>::const_iterator range = ranges.begin();
   193       range != ranges.end(); ++range) {
   195       std::vector<std::string> range_vals;
   197       vals.push_back(range_vals);
   211   static void tokenize(std::vector<std::pair<std::string, std::string> >& tokens,
   212                        std::string 
const& str,
   217     size_t d_idx = std::string::npos;
   218     while (s_idx < str.size()) {
   219       d_idx = str.find_first_of(delim, s_idx);
   221       size_t end_idx = (d_idx != std::string::npos ? d_idx : str.size());
   222       size_t sep_idx = str.find_first_of(sep, s_idx);
   224       if (sep_idx == std::string::npos || sep_idx >= end_idx) {
   229       std::pair<std::string, std::string> item(
   230           str.substr(s_idx, sep_idx - s_idx),
   231           str.substr(sep_idx + offset, end_idx - sep_idx - offset));
   233       tokens.push_back(item);
   239   static void tokenize(std::vector<std::string>& tokens,
   240                        std::string 
const& str,
   243     typedef std::vector<std::pair<std::string, std::string> > TokenVector;
   244     typedef TokenVector::const_iterator token_iterator;
   246     std::vector<std::pair<std::string, std::string> > token_pairs;
   247     tokenize(token_pairs, str, delim, sep);
   248     for (token_iterator tok = token_pairs.begin(); tok != token_pairs.end(); ++tok) {
   249       tokens.push_back(tok->first);
   253   template <
typename value_t>
   255                               std::vector<value_t>& vals,
   257     std::istringstream str_stream(str);
   258     std::string::size_type old_pos = 0;
   259     std::string::size_type new_pos = 0;
   263     while ((new_pos = str.find(sep, old_pos)) != std::string::npos) {
   264       if (new_pos != old_pos) {
   265         str_stream.width(new_pos - old_pos);
   271       str_stream.ignore(1);
   272       old_pos = new_pos + 1;
 Definition: aligned_buffer.h:35
void get_cmd_line_argument(const char *arg_name, value_t &val, value_t const &_default=value_t()) const 
Definition: command_line.h:127
void get_cmd_line_argument_pairs(const char *arg_name, std::vector< std::pair< std::string, std::string > > &tokens, char delim= ',', char sep= ':') const 
Definition: command_line.h:169
void get_cmd_line_arguments(const char *arg_name, std::vector< value_t > &vals, char sep= ',') const 
Definition: command_line.h:146
static void tokenize(std::vector< std::string > &tokens, std::string const &str, char delim= ',', char sep= ':')
Tokenizes a comma-delimited list of string pairs delimited by ':'. 
Definition: command_line.h:239
bool check_cmd_line_flag(const char *arg_name) const 
Definition: command_line.h:81
std::vector< std::string > keys
Definition: command_line.h:45
CUTLASS_HOST_DEVICE T arg(complex< T > const &z)
Returns the magnitude of the complex number. 
Definition: complex.h:319
static void tokenize(std::vector< std::pair< std::string, std::string > > &tokens, std::string const &str, char delim= ',', char sep= ':')
Tokenizes a comma-delimited list of string pairs delimited by ':'. 
Definition: command_line.h:211
void get_cmd_line_argument(int index, value_t &val) const 
Definition: command_line.h:102
void get_cmd_line_argument(const char *arg_name, bool &val, bool _default=true) const 
Definition: command_line.h:113
int num_naked_args() const 
Definition: command_line.h:94
void get_cmd_line_argument_ranges(const char *arg_name, std::vector< std::vector< std::string > > &vals, char delim= ',', char sep= ':') const 
Definition: command_line.h:185
std::vector< std::string > values
Definition: command_line.h:46
CommandLine(int argc, const char **argv)
Definition: command_line.h:52
std::vector< std::string > args
Definition: command_line.h:47
Definition: command_line.h:44
static void seperate_string(std::string const &str, std::vector< value_t > &vals, char sep= ',')
Definition: command_line.h:254
int parsed_argc() const 
Definition: command_line.h:204