Skip to content

Commit

Permalink
Rename times global to avoid conflict
Browse files Browse the repository at this point in the history
Summary:
A global named `times` already exists in glibc headers so, related to
T35368090, this causes conflicts in modular builds.

Reviewed By: modocache

Differential Revision: D20600916

fbshipit-source-id: a5ff63b8bf86251dcba71362aa3eeae8b085df79
  • Loading branch information
andrewjcg authored and facebook-github-bot committed Mar 27, 2020
1 parent 60b734a commit a6e81fb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bench/EmbeddingSpMDM8BitBenchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static vector<vector<int>> GetInputs_() {
return input_dims;
}

vector<double> times;
vector<double> benchmarkTimes;

int run_benchmark(
int batch_size,
Expand Down Expand Up @@ -190,7 +190,7 @@ int run_benchmark(
#pragma omp barrier
#endif
for (bool flush_cache : flush_cache_options) {
times[fbgemm_get_thread_num()] = measureWithWarmup(
benchmarkTimes[fbgemm_get_thread_num()] = measureWithWarmup(
[&]() {
if (use_32_bit_indices) {
success = kernel_32(
Expand Down Expand Up @@ -279,10 +279,10 @@ int run_benchmark(
}

double max_time = *std::max_element(
times.begin(), times.begin() + fbgemm_get_num_threads());
benchmarkTimes.begin(), benchmarkTimes.begin() + fbgemm_get_num_threads());
double avg_time = std::accumulate(
times.begin(),
times.begin() + fbgemm_get_num_threads(),
benchmarkTimes.begin(),
benchmarkTimes.begin() + fbgemm_get_num_threads(),
0.0) /
fbgemm_get_num_threads();
double load_imbalance = (max_time - avg_time) / avg_time;
Expand All @@ -307,7 +307,7 @@ int main() {
bool stress_multi_threading = false;

vector<vector<int>> inputs(GetInputs_());
times.resize(fbgemm_get_max_threads());
benchmarkTimes.resize(fbgemm_get_max_threads());

for (auto& input : inputs) {
assert(input.size() > 3);
Expand Down

0 comments on commit a6e81fb

Please sign in to comment.