Remove NUMA regions option

This configuration option was only added because Kokkos has such a flag.
But this flag is now deprecated in Kokkos and has no effect, so remove
it from VTK-m.
This commit is contained in:
Kenneth Moreland 2023-01-25 11:46:01 -07:00
parent 4912d1d042
commit 89245c3df5
10 changed files with 17 additions and 108 deletions

@ -97,13 +97,6 @@ public:
throw vtkm::cont::ErrorBadDevice("Tried to set the number of threads on an invalid device"); throw vtkm::cont::ErrorBadDevice("Tried to set the number of threads on an invalid device");
} }
VTKM_CONT virtual vtkm::cont::internal::RuntimeDeviceConfigReturnCode SetNumaRegions(
const vtkm::Id&) override final
{
throw vtkm::cont::ErrorBadDevice(
"Tried to set the number of numa regions on an invalid device");
}
VTKM_CONT virtual vtkm::cont::internal::RuntimeDeviceConfigReturnCode SetDeviceInstance( VTKM_CONT virtual vtkm::cont::internal::RuntimeDeviceConfigReturnCode SetDeviceInstance(
const vtkm::Id&) override final const vtkm::Id&) override final
{ {
@ -116,13 +109,6 @@ public:
throw vtkm::cont::ErrorBadDevice("Tried to get the number of threads on an invalid device"); throw vtkm::cont::ErrorBadDevice("Tried to get the number of threads on an invalid device");
} }
VTKM_CONT virtual vtkm::cont::internal::RuntimeDeviceConfigReturnCode GetNumaRegions(
vtkm::Id&) const override final
{
throw vtkm::cont::ErrorBadDevice(
"Tried to get the number of numa regions on an invalid device");
}
VTKM_CONT virtual vtkm::cont::internal::RuntimeDeviceConfigReturnCode GetDeviceInstance( VTKM_CONT virtual vtkm::cont::internal::RuntimeDeviceConfigReturnCode GetDeviceInstance(
vtkm::Id&) const override final vtkm::Id&) const override final
{ {

@ -90,11 +90,6 @@ void RuntimeDeviceConfigurationBase::Initialize(
[&](const vtkm::Id& value) { return this->SetThreads(value); }, [&](const vtkm::Id& value) { return this->SetThreads(value); },
"SetThreads", "SetThreads",
this->GetDevice().GetName()); this->GetDevice().GetName());
InitializeOption(
configOptions.VTKmNumaRegions,
[&](const vtkm::Id& value) { return this->SetNumaRegions(value); },
"SetNumaRegions",
this->GetDevice().GetName());
InitializeOption( InitializeOption(
configOptions.VTKmDeviceInstance, configOptions.VTKmDeviceInstance,
[&](const vtkm::Id& value) { return this->SetDeviceInstance(value); }, [&](const vtkm::Id& value) { return this->SetDeviceInstance(value); },
@ -117,11 +112,6 @@ RuntimeDeviceConfigReturnCode RuntimeDeviceConfigurationBase::SetThreads(const v
return RuntimeDeviceConfigReturnCode::INVALID_FOR_DEVICE; return RuntimeDeviceConfigReturnCode::INVALID_FOR_DEVICE;
} }
RuntimeDeviceConfigReturnCode RuntimeDeviceConfigurationBase::SetNumaRegions(const vtkm::Id&)
{
return RuntimeDeviceConfigReturnCode::INVALID_FOR_DEVICE;
}
RuntimeDeviceConfigReturnCode RuntimeDeviceConfigurationBase::SetDeviceInstance(const vtkm::Id&) RuntimeDeviceConfigReturnCode RuntimeDeviceConfigurationBase::SetDeviceInstance(const vtkm::Id&)
{ {
return RuntimeDeviceConfigReturnCode::INVALID_FOR_DEVICE; return RuntimeDeviceConfigReturnCode::INVALID_FOR_DEVICE;
@ -132,11 +122,6 @@ RuntimeDeviceConfigReturnCode RuntimeDeviceConfigurationBase::GetThreads(vtkm::I
return RuntimeDeviceConfigReturnCode::INVALID_FOR_DEVICE; return RuntimeDeviceConfigReturnCode::INVALID_FOR_DEVICE;
} }
RuntimeDeviceConfigReturnCode RuntimeDeviceConfigurationBase::GetNumaRegions(vtkm::Id&) const
{
return RuntimeDeviceConfigReturnCode::INVALID_FOR_DEVICE;
}
RuntimeDeviceConfigReturnCode RuntimeDeviceConfigurationBase::GetDeviceInstance(vtkm::Id&) const RuntimeDeviceConfigReturnCode RuntimeDeviceConfigurationBase::GetDeviceInstance(vtkm::Id&) const
{ {
return RuntimeDeviceConfigReturnCode::INVALID_FOR_DEVICE; return RuntimeDeviceConfigReturnCode::INVALID_FOR_DEVICE;

@ -54,13 +54,11 @@ public:
/// A method should return INVALID_FOR_DEVICE if the overriden device does not /// A method should return INVALID_FOR_DEVICE if the overriden device does not
/// support the particular set method. /// support the particular set method.
VTKM_CONT virtual RuntimeDeviceConfigReturnCode SetThreads(const vtkm::Id& value); VTKM_CONT virtual RuntimeDeviceConfigReturnCode SetThreads(const vtkm::Id& value);
VTKM_CONT virtual RuntimeDeviceConfigReturnCode SetNumaRegions(const vtkm::Id& value);
VTKM_CONT virtual RuntimeDeviceConfigReturnCode SetDeviceInstance(const vtkm::Id& value); VTKM_CONT virtual RuntimeDeviceConfigReturnCode SetDeviceInstance(const vtkm::Id& value);
/// The following public methods are overriden in each individual device and store the /// The following public methods are overriden in each individual device and store the
/// values that were set via the above Set* methods for the given device. /// values that were set via the above Set* methods for the given device.
VTKM_CONT virtual RuntimeDeviceConfigReturnCode GetThreads(vtkm::Id& value) const; VTKM_CONT virtual RuntimeDeviceConfigReturnCode GetThreads(vtkm::Id& value) const;
VTKM_CONT virtual RuntimeDeviceConfigReturnCode GetNumaRegions(vtkm::Id& value) const;
VTKM_CONT virtual RuntimeDeviceConfigReturnCode GetDeviceInstance(vtkm::Id& value) const; VTKM_CONT virtual RuntimeDeviceConfigReturnCode GetDeviceInstance(vtkm::Id& value) const;
/// The following public methods should be overriden as needed for each individual device /// The following public methods should be overriden as needed for each individual device

@ -31,13 +31,13 @@ void AppendOptionDescriptors(std::vector<option::Descriptor>& usage,
"vtkm-num-threads", "vtkm-num-threads",
option::VtkmArg::Required, option::VtkmArg::Required,
" --vtkm-num-threads <dev> \tSets the number of threads to use for the selected device" }); " --vtkm-num-threads <dev> \tSets the number of threads to use for the selected device" });
usage.push_back( usage.push_back({ useOptionIndex ? static_cast<uint32_t>(option::OptionIndex::NUMA_REGIONS) : 1,
{ useOptionIndex ? static_cast<uint32_t>(option::OptionIndex::NUMA_REGIONS) : 1, 0,
0, "",
"", "vtkm-numa-regions",
"vtkm-numa-regions", option::VtkmArg::Required,
option::VtkmArg::Required, " --vtkm-numa-regions <dev> \tSets the number of numa regions when using "
" --vtkm-numa-regions <dev> \tSets the number of numa regions when using kokkos/OpenMP" }); "kokkos/OpenMP (deprecated, has no effect)" });
usage.push_back( usage.push_back(
{ useOptionIndex ? static_cast<uint32_t>(option::OptionIndex::DEVICE_INSTANCE) : 2, { useOptionIndex ? static_cast<uint32_t>(option::OptionIndex::DEVICE_INSTANCE) : 2,
0, 0,
@ -51,7 +51,6 @@ void AppendOptionDescriptors(std::vector<option::Descriptor>& usage,
RuntimeDeviceConfigurationOptions::RuntimeDeviceConfigurationOptions(const bool& useOptionIndex) RuntimeDeviceConfigurationOptions::RuntimeDeviceConfigurationOptions(const bool& useOptionIndex)
: VTKmNumThreads(useOptionIndex ? option::OptionIndex::NUM_THREADS : 0, "VTKM_NUM_THREADS") : VTKmNumThreads(useOptionIndex ? option::OptionIndex::NUM_THREADS : 0, "VTKM_NUM_THREADS")
, VTKmNumaRegions(useOptionIndex ? option::OptionIndex::NUMA_REGIONS : 1, "VTKM_NUMA_REGIONS")
, VTKmDeviceInstance(useOptionIndex ? option::OptionIndex::DEVICE_INSTANCE : 2, , VTKmDeviceInstance(useOptionIndex ? option::OptionIndex::DEVICE_INSTANCE : 2,
"VTKM_DEVICE_INSTANCE") "VTKM_DEVICE_INSTANCE")
, Initialized(false) , Initialized(false)
@ -100,7 +99,6 @@ RuntimeDeviceConfigurationOptions::~RuntimeDeviceConfigurationOptions() noexcept
void RuntimeDeviceConfigurationOptions::Initialize(const option::Option* options) void RuntimeDeviceConfigurationOptions::Initialize(const option::Option* options)
{ {
this->VTKmNumThreads.Initialize(options); this->VTKmNumThreads.Initialize(options);
this->VTKmNumaRegions.Initialize(options);
this->VTKmDeviceInstance.Initialize(options); this->VTKmDeviceInstance.Initialize(options);
this->Initialized = true; this->Initialized = true;
} }

@ -48,7 +48,6 @@ public:
VTKM_CONT bool IsInitialized() const; VTKM_CONT bool IsInitialized() const;
RuntimeDeviceOption VTKmNumThreads; RuntimeDeviceOption VTKmNumThreads;
RuntimeDeviceOption VTKmNumaRegions;
RuntimeDeviceOption VTKmDeviceInstance; RuntimeDeviceOption VTKmDeviceInstance;
protected: protected:

@ -99,21 +99,6 @@ public:
return RuntimeDeviceConfigReturnCode::SUCCESS; return RuntimeDeviceConfigReturnCode::SUCCESS;
} }
VTKM_CONT virtual RuntimeDeviceConfigReturnCode SetNumaRegions(
const vtkm::Id& value) override final
{
if (Kokkos::is_initialized())
{
VTKM_LOG_S(vtkm::cont::LogLevel::Warn,
"SetNumaRegions was called but Kokkos was already initailized! Updates will not "
"be applied.");
return RuntimeDeviceConfigReturnCode::NOT_APPLIED;
}
this->KokkosArguments.insert(this->KokkosArguments.begin(),
"--kokkos-numa=" + std::to_string(value));
return RuntimeDeviceConfigReturnCode::SUCCESS;
}
VTKM_CONT virtual RuntimeDeviceConfigReturnCode SetDeviceInstance( VTKM_CONT virtual RuntimeDeviceConfigReturnCode SetDeviceInstance(
const vtkm::Id& value) override final const vtkm::Id& value) override final
{ {
@ -134,12 +119,6 @@ public:
return GetArgFromList(this->KokkosArguments, "--kokkos-num-threads", value); return GetArgFromList(this->KokkosArguments, "--kokkos-num-threads", value);
} }
VTKM_CONT virtual RuntimeDeviceConfigReturnCode GetNumaRegions(
vtkm::Id& value) const override final
{
return GetArgFromList(this->KokkosArguments, "--kokkos-numa", value);
}
VTKM_CONT virtual RuntimeDeviceConfigReturnCode GetDeviceInstance( VTKM_CONT virtual RuntimeDeviceConfigReturnCode GetDeviceInstance(
vtkm::Id& value) const override final vtkm::Id& value) const override final
{ {

@ -40,28 +40,21 @@ TestingRuntimeDeviceConfiguration<vtkm::cont::DeviceAdapterTagKokkos>::TestRunti
"Failed to get set threads"); "Failed to get set threads");
VTKM_TEST_ASSERT(testValue == 8, VTKM_TEST_ASSERT(testValue == 8,
"Set threads does not match expected value: 8 != " + std::to_string(testValue)); "Set threads does not match expected value: 8 != " + std::to_string(testValue));
VTKM_TEST_ASSERT(config.GetNumaRegions(testValue) ==
internal::RuntimeDeviceConfigReturnCode::SUCCESS,
"Failed to get set numa regions");
VTKM_TEST_ASSERT(testValue == 4,
"Set numa regions does not match expected value: 4 != " +
std::to_string(testValue));
VTKM_TEST_ASSERT(config.GetDeviceInstance(testValue) == VTKM_TEST_ASSERT(config.GetDeviceInstance(testValue) ==
internal::RuntimeDeviceConfigReturnCode::SUCCESS, internal::RuntimeDeviceConfigReturnCode::SUCCESS,
"Failed to get set device instance"); "Failed to get set device instance");
VTKM_TEST_ASSERT(testValue == 0, VTKM_TEST_ASSERT(testValue == 0,
"Set device instance does not match expected value: 0 != " + "Set device instance does not match expected value: 0 != " +
std::to_string(testValue)); std::to_string(testValue));
// Ensure that with kokkos we can't re-initialize or set values after the first initialize std::cout
// Should pop up a few warnings in the test logs << "Ensure that with kokkos we can't re-initialize or set values after the first initialize"
<< std::endl;
std::cout << "This should pop up a few warnings in the test logs" << std::endl;
deviceOptions.VTKmNumThreads.SetOption(16); deviceOptions.VTKmNumThreads.SetOption(16);
deviceOptions.VTKmNumaRegions.SetOption(2);
deviceOptions.VTKmDeviceInstance.SetOption(5); deviceOptions.VTKmDeviceInstance.SetOption(5);
config.Initialize(deviceOptions); config.Initialize(deviceOptions);
VTKM_TEST_ASSERT(config.SetThreads(1) == internal::RuntimeDeviceConfigReturnCode::NOT_APPLIED, VTKM_TEST_ASSERT(config.SetThreads(1) == internal::RuntimeDeviceConfigReturnCode::NOT_APPLIED,
"Shouldn't be able to set threads after kokkos is initalized"); "Shouldn't be able to set threads after kokkos is initalized");
VTKM_TEST_ASSERT(config.SetNumaRegions(1) == internal::RuntimeDeviceConfigReturnCode::NOT_APPLIED,
"Shouldn't be able to set numa regions after kokkos is initalized");
VTKM_TEST_ASSERT(config.SetDeviceInstance(1) == VTKM_TEST_ASSERT(config.SetDeviceInstance(1) ==
internal::RuntimeDeviceConfigReturnCode::NOT_APPLIED, internal::RuntimeDeviceConfigReturnCode::NOT_APPLIED,
"Shouldn't be able to set device instnace after kokkos is initalized"); "Shouldn't be able to set device instnace after kokkos is initalized");
@ -71,12 +64,6 @@ TestingRuntimeDeviceConfiguration<vtkm::cont::DeviceAdapterTagKokkos>::TestRunti
"Failed to get set threads"); "Failed to get set threads");
VTKM_TEST_ASSERT(testValue == 8, VTKM_TEST_ASSERT(testValue == 8,
"Set threads does not match expected value: 8 != " + std::to_string(testValue)); "Set threads does not match expected value: 8 != " + std::to_string(testValue));
VTKM_TEST_ASSERT(config.GetNumaRegions(testValue) ==
internal::RuntimeDeviceConfigReturnCode::SUCCESS,
"Failed to get set numa regions");
VTKM_TEST_ASSERT(testValue == 4,
"Set numa regions does not match expected value: 4 != " +
std::to_string(testValue));
VTKM_TEST_ASSERT(config.GetDeviceInstance(testValue) == VTKM_TEST_ASSERT(config.GetDeviceInstance(testValue) ==
internal::RuntimeDeviceConfigReturnCode::SUCCESS, internal::RuntimeDeviceConfigReturnCode::SUCCESS,
"Failed to get set device instance"); "Failed to get set device instance");

@ -35,7 +35,6 @@ struct TestingRuntimeDeviceConfiguration
{ {
internal::RuntimeDeviceConfigurationOptions runtimeDeviceOptions{}; internal::RuntimeDeviceConfigurationOptions runtimeDeviceOptions{};
runtimeDeviceOptions.VTKmNumThreads.SetOption(8); runtimeDeviceOptions.VTKmNumThreads.SetOption(8);
runtimeDeviceOptions.VTKmNumaRegions.SetOption(0);
runtimeDeviceOptions.VTKmDeviceInstance.SetOption(2); runtimeDeviceOptions.VTKmDeviceInstance.SetOption(2);
runtimeDeviceOptions.Initialize(nullptr); runtimeDeviceOptions.Initialize(nullptr);
VTKM_TEST_ASSERT(runtimeDeviceOptions.IsInitialized(), VTKM_TEST_ASSERT(runtimeDeviceOptions.IsInitialized(),

@ -146,16 +146,8 @@ void InitializeRuntimeDeviceConfigurationWithArgs()
{ {
int argc; int argc;
char** argv; char** argv;
vtkm::cont::testing::Testing::MakeArgsAddProgramName(argc, vtkm::cont::testing::Testing::MakeArgsAddProgramName(
argv, argc, argv, "--vtkm-device", "Any", "--vtkm-num-threads", "100", "--vtkm-device-instance", "2");
"--vtkm-device",
"Any",
"--vtkm-num-threads",
"100",
"--vtkm-numa-regions",
"4",
"--vtkm-device-instance",
"2");
vtkm::cont::Initialize(argc, argv); vtkm::cont::Initialize(argc, argv);
CheckArgs(argc, argv); CheckArgs(argc, argv);
} }

@ -187,11 +187,9 @@ void TestConfigOptionValues(const internal::RuntimeDeviceConfigurationOptions& c
VTKM_TEST_ASSERT(configOptions.IsInitialized(), "runtime config options should be initialized"); VTKM_TEST_ASSERT(configOptions.IsInitialized(), "runtime config options should be initialized");
VTKM_TEST_ASSERT(configOptions.VTKmNumThreads.IsSet(), "num threads should be set"); VTKM_TEST_ASSERT(configOptions.VTKmNumThreads.IsSet(), "num threads should be set");
VTKM_TEST_ASSERT(configOptions.VTKmNumaRegions.IsSet(), "numa regions should be set");
VTKM_TEST_ASSERT(configOptions.VTKmDeviceInstance.IsSet(), "device instance should be set"); VTKM_TEST_ASSERT(configOptions.VTKmDeviceInstance.IsSet(), "device instance should be set");
VTKM_TEST_ASSERT(configOptions.VTKmNumThreads.GetValue() == 100, "num threads should == 100"); VTKM_TEST_ASSERT(configOptions.VTKmNumThreads.GetValue() == 100, "num threads should == 100");
VTKM_TEST_ASSERT(configOptions.VTKmNumaRegions.GetValue() == 2, "numa regions should == 2");
VTKM_TEST_ASSERT(configOptions.VTKmDeviceInstance.GetValue() == 1, "device instance should == 1"); VTKM_TEST_ASSERT(configOptions.VTKmDeviceInstance.GetValue() == 1, "device instance should == 1");
} }
@ -211,14 +209,8 @@ void TestRuntimeDeviceConfigurationOptions()
int argc; int argc;
char** argv; char** argv;
vtkm::cont::testing::Testing::MakeArgs(argc, vtkm::cont::testing::Testing::MakeArgs(
argv, argc, argv, "--vtkm-num-threads", "100", "--vtkm-device-instance", "1");
"--vtkm-num-threads",
"100",
"--vtkm-numa-regions",
"2",
"--vtkm-device-instance",
"1");
auto options = GetOptions(argc, argv, usage); auto options = GetOptions(argc, argv, usage);
VTKM_TEST_ASSERT(!configOptions.IsInitialized(), VTKM_TEST_ASSERT(!configOptions.IsInitialized(),
@ -230,14 +222,8 @@ void TestRuntimeDeviceConfigurationOptions()
{ {
int argc; int argc;
char** argv; char** argv;
vtkm::cont::testing::Testing::MakeArgs(argc, vtkm::cont::testing::Testing::MakeArgs(
argv, argc, argv, "--vtkm-num-threads", "100", "--vtkm-device-instance", "1");
"--vtkm-num-threads",
"100",
"--vtkm-numa-regions",
"2",
"--vtkm-device-instance",
"1");
internal::RuntimeDeviceConfigurationOptions configOptions(argc, argv); internal::RuntimeDeviceConfigurationOptions configOptions(argc, argv);
TestConfigOptionValues(configOptions); TestConfigOptionValues(configOptions);
} }