Skip to content

Commit

Permalink
Cleaning up kokkos tuning verbosity, shortening simulated annealing m…
Browse files Browse the repository at this point in the history
…inimum iterations.
  • Loading branch information
khuck committed Feb 7, 2024
1 parent fe17e5e commit ef17533
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions src/apex/apex_kokkos_tuning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,9 @@ std::string hashContext(size_t numVars,
}
d = ",";
}
ss << ",tree_node:" << tree_node << "]";
if(tree_node.size() > 0) {
ss << ",tree_node:" << tree_node << "]";
}
std::string tmp{ss.str()};
return tmp;
}
Expand Down Expand Up @@ -816,12 +818,12 @@ void set_params(std::shared_ptr<apex_tuning_request> request,
if (var->info.type == kokkos_value_double) {
values[i].value.double_value = std::stod(param->get_value());
std::string tmp(request->get_name()+":"+var->name);
if (!request->has_converged())
//if (!request->has_converged())
apex::sample_value(tmp, values[i].value.double_value);
} else if (var->info.type == kokkos_value_int64) {
values[i].value.int_value = std::stol(param->get_value());
std::string tmp(request->get_name()+":"+var->name);
if (!request->has_converged())
//if (!request->has_converged())
apex::sample_value(tmp, values[i].value.int_value);
} else if (var->info.type == kokkos_value_string) {
strncpy(values[i].value.string_value, param->get_value().c_str(), KOKKOS_TOOLS_TUNING_STRING_LENGTH);
Expand All @@ -832,14 +834,14 @@ void set_params(std::shared_ptr<apex_tuning_request> request,
request->get_param(var->name));
values[i].value.double_value = param->get_value();
std::string tmp(request->get_name()+":"+var->name);
if (!request->has_converged())
//if (!request->has_converged())
apex::sample_value(tmp, values[i].value.double_value);
} else if (var->info.type == kokkos_value_int64) {
auto param = std::static_pointer_cast<apex_param_long>(
request->get_param(var->name));
values[i].value.int_value = param->get_value();
std::string tmp(request->get_name()+":"+var->name);
if (!request->has_converged())
//if (!request->has_converged())
apex::sample_value(tmp, values[i].value.int_value);
}
}
Expand Down Expand Up @@ -1089,11 +1091,11 @@ void kokkosp_request_values(
// throw away the time spent setting up tuning
//session.context_starts[contextId] = session.context_starts[contextId] + delta;
}
if (!converged) {
//if (!converged) {
// add this name to our map of active contexts
session.active_requests.insert(
std::pair<uint32_t, std::string>(contextId, name));
}
//}
}
if (session.verbose) {
std::cout << std::string(getDepth(), ' ');
Expand Down
2 changes: 1 addition & 1 deletion src/apex/simulated_annealing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class SimulatedAnnealing {
size_t kmax;
size_t k;
std::map<std::string, Variable> vars;
const size_t max_iterations{1000};
const size_t max_iterations{400};
const size_t min_iterations{100};
public:
void evaluate(double new_cost);
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/counter_scatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def shorten_name(name):
pl.yticks(fontsize=18)
print ("Rendering...")
pl.tight_layout()
name = name.replace(" ", "_")
name = key.replace(" ", "_")
name = ''.join([c for c in name if c in safechars])
pl.savefig(name+extension)
pl.close()

0 comments on commit ef17533

Please sign in to comment.