diff --git a/dash/examples/ex.07.locality-split/main.cpp b/dash/examples/ex.07.locality-split/main.cpp index 4cf6b6f30..8ab2cbd48 100644 --- a/dash/examples/ex.07.locality-split/main.cpp +++ b/dash/examples/ex.07.locality-split/main.cpp @@ -37,15 +37,19 @@ int main(int argc, char * argv[]) } else if (std::string(argv[1]) == "-ls") { locality_split = true; split_scope = DART_LOCALITY_SCOPE_NODE; - if (std::string(argv[2]) == "module") { - split_scope = DART_LOCALITY_SCOPE_MODULE; - } else if (std::string(argv[2]) == "numa") { - split_scope = DART_LOCALITY_SCOPE_NUMA; - } else if (std::string(argv[2]) == "core") { - split_scope = DART_LOCALITY_SCOPE_CORE; - } - if (argc >= 4) { - split_num_groups = static_cast(strtol(argv[3], NULL, 10)); + if (argc >= 3) { + if (std::string(argv[2]) == "node") { + split_scope = DART_LOCALITY_SCOPE_NODE; + } else if (std::string(argv[2]) == "module") { + split_scope = DART_LOCALITY_SCOPE_MODULE; + } else if (std::string(argv[2]) == "numa") { + split_scope = DART_LOCALITY_SCOPE_NUMA; + } else if (std::string(argv[2]) == "core") { + split_scope = DART_LOCALITY_SCOPE_CORE; + } + if (argc >= 4) { + split_num_groups = static_cast(strtol(argv[3], NULL, 10)); + } } } } @@ -76,7 +80,7 @@ int main(int argc, char * argv[]) << endl << " ex.07.locality "; if (locality_split) { - cout << "-ls " << argv[2] << " " << split_num_groups << ": " + cout << "-ls " << split_scope << " " << split_num_groups << ": " << "locality split into " << split_num_groups << " groups " << "at scope " << split_scope << endl; } else {