Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/batched: Fix multiple definitions of singleton #1072

Merged
merged 1 commit into from
Aug 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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