Skip to content

Commit

Permalink
Merge pull request #1072 from e10harvey/issue1071
Browse files Browse the repository at this point in the history
src/batched: Fix multiple definitions of singleton
  • Loading branch information
e10harvey committed Aug 4, 2021
2 parents 760115c + d2146e9 commit c7939ba
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/batched/KokkosBatched_Kernel_Handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,17 @@ class BatchedKernelHandle {
/// constructor overload
// clang-format on
protected:
int _kernelAlgoType = BaseHeuristicAlgos::SQUARE;
static TplParams &_tplParamsSingleton;
bool _tplParamsSet = false;
};
// Define TPL params singleton as static class method variable
// Only one instance of tplParamsGlobalStorage may exist per process.
static TplParams &_get_tpl_params_singleton() {
static TplParams tplParamsGlobalStorage;
return tplParamsGlobalStorage;
}

// Define TPL params singleton
TplParams tplParamsGlobalStorage;
TplParams &BatchedKernelHandle::_tplParamsSingleton = tplParamsGlobalStorage;
int _kernelAlgoType = BaseHeuristicAlgos::SQUARE;
TplParams &_tplParamsSingleton = _get_tpl_params_singleton();
bool _tplParamsSet = false;
};

} // namespace KokkosBatched

Expand Down

0 comments on commit c7939ba

Please sign in to comment.