diff --git a/src/kokkos/ekat_team_policy_utils.hpp b/src/kokkos/ekat_team_policy_utils.hpp index f0aea1ae..e97f4407 100644 --- a/src/kokkos/ekat_team_policy_utils.hpp +++ b/src/kokkos/ekat_team_policy_utils.hpp @@ -258,6 +258,7 @@ class TeamUtils : public TeamUtilsCommonBase= 1.0, "Makes no sense to have an overprov < 1"); if (_need_ws_sharing) { _rand_pool = RandomGenerator(std::chrono::high_resolution_clock::now().time_since_epoch().count()); } diff --git a/src/kokkos/ekat_workspace.hpp b/src/kokkos/ekat_workspace.hpp index e59fb74c..8716e483 100644 --- a/src/kokkos/ekat_workspace.hpp +++ b/src/kokkos/ekat_workspace.hpp @@ -72,7 +72,9 @@ class WorkspaceManager // // Default overprov factor for large GPU problems, testing has shown 1.25 is optimal - static constexpr double GPU_DEFAULT_OVERPROVISION_FACTOR = 1.25; + // Some linkers were having trouble with the code below, so use a function + //static inline constexpr double GPU_DEFAULT_OVERPROVISION_FACTOR = 1.25; + static constexpr double GPU_DEFAULT_OVERPROVISION_FACTOR() { return 1.25; } // // ------- public API --------- @@ -87,7 +89,7 @@ class WorkspaceManager // policy: The team policy for Kokkos kernels using this WorkspaceManager // overprov_factor: How many workspace slots to overprovision (only applies to GPU for large problems) WorkspaceManager(int size, int max_used, TeamPolicy policy, - const double& overprov_factor=GPU_DEFAULT_OVERPROVISION_FACTOR); + const double& overprov_factor=GPU_DEFAULT_OVERPROVISION_FACTOR()); // Constructor, call from host // Same as above, but here the user initializes the data. @@ -97,14 +99,14 @@ class WorkspaceManager // data is available, for which the get_total_slots_to_be_used() // function can be helpful. WorkspaceManager(T* data, int size, int max_used, TeamPolicy policy, - const double& overprov_factor=GPU_DEFAULT_OVERPROVISION_FACTOR); + const double& overprov_factor=GPU_DEFAULT_OVERPROVISION_FACTOR()); // Helper functions which return the number of bytes that will be reserved for a given // set of constructor inputs. Note, this does not actually create an instance of the WSM, // but is useful for when memory needs to be reserved in a different scope than the // WSM is created. static int get_total_bytes_needed(int size, int max_used, TeamPolicy policy, - const double& overprov_factor=GPU_DEFAULT_OVERPROVISION_FACTOR); + const double& overprov_factor=GPU_DEFAULT_OVERPROVISION_FACTOR()); // call from host. // @@ -116,14 +118,14 @@ class WorkspaceManager // // Setup routine for the WSM if the user used the empty constructor void setup(int size, int max_used, TeamPolicy policy, - const double& overprov_factor=GPU_DEFAULT_OVERPROVISION_FACTOR); + const double& overprov_factor=GPU_DEFAULT_OVERPROVISION_FACTOR()); // call from host. // // Setup routine for the WSM if the user used the empty constructor. // Same as above, but here the user initializes the data. void setup(T* data, int size, int max_used, TeamPolicy policy, - const double& overprov_factor=GPU_DEFAULT_OVERPROVISION_FACTOR); + const double& overprov_factor=GPU_DEFAULT_OVERPROVISION_FACTOR()); // call from host. // @@ -377,9 +379,6 @@ class WorkspaceManager void operator() (const MemberType& team) const; }; // class WorkspaceManager -template -constexpr double WorkspaceManager::GPU_DEFAULT_OVERPROVISION_FACTOR; - } // namespace ekat #include "ekat_workspace_impl.hpp" diff --git a/tests/kokkos/workspace_mgr.cpp b/tests/kokkos/workspace_mgr.cpp index 21fe259e..9eaf5d56 100644 --- a/tests/kokkos/workspace_mgr.cpp +++ b/tests/kokkos/workspace_mgr.cpp @@ -39,7 +39,7 @@ static void unittest_workspace_overprovision() TeamUtils tu_temp(temp_policy); const int num_conc = tu_temp.get_max_concurrent_threads() / temp_policy.team_size(); - constexpr double op_fact = WSM::GPU_DEFAULT_OVERPROVISION_FACTOR; + constexpr double op_fact = WSM::GPU_DEFAULT_OVERPROVISION_FACTOR(); constexpr double explicit_op_fact = op_fact * 2.0; const int ni_under = (num_conc / 2) + 1;