Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Deprecate Python global configuration functions [Part 1] #5923
Conversation
…options to be set via EP-specific options and output deprecation warning from current global configuration functions.
|
/azp run orttraining-amd-gpu-ci-pipeline #Resolved |
|
Azure Pipelines successfully started running 1 pipeline(s). #Resolved |
| cuda_provider_options.cuda_mem_limit, | ||
| cuda_provider_options.arena_extend_strategy, | ||
| cuda_provider_options.do_copy_in_default_stream)); | ||
| sess, *onnxruntime::CreateExecutionProviderFactory_CUDA(info.device_id, |
pranavsharma
Dec 4, 2020
•
Contributor
I know this is not the objective of this PR. Can CUDAExecutionProviderInfo be stored in the factory obj as-is instead of re-create it in CreateProvider() later? This will also keep the signature of this factory function clean - no need to keep adding more parameters as more options are added. Similar comment applies to other EPs like ROCM. #Resolved
I know this is not the objective of this PR. Can CUDAExecutionProviderInfo be stored in the factory obj as-is instead of re-create it in CreateProvider() later? This will also keep the signature of this factory function clean - no need to keep adding more parameters as more options are added. Similar comment applies to other EPs like ROCM. #Resolved
edgchen1
Dec 4, 2020
Author
Contributor
ok, i can update the CUDA and ROCM EP factories for now
In reply to: 535833627 [](ancestors = 535833627)
ok, i can update the CUDA and ROCM EP factories for now
In reply to: 535833627 [](ancestors = 535833627)
| const auto nuphar_provider_options_it = provider_options_map.find(type); | ||
| if (nuphar_provider_options_it != provider_options_map.end()) { | ||
| const auto& nuphar_provider_options = nuphar_provider_options_it->second; | ||
| const auto nuphar_settings_it = nuphar_provider_options.find("nuphar_settings"); |
pranavsharma
Dec 4, 2020
•
Contributor
Can ReadProviderOption be used here? #Resolved
Can ReadProviderOption be used here? #Resolved
| const auto& nuphar_provider_options = nuphar_provider_options_it->second; | ||
| const auto nuphar_settings_it = nuphar_provider_options.find("nuphar_settings"); | ||
| if (nuphar_settings_it != nuphar_provider_options.end()) { | ||
| nuphar_settings = nuphar_settings_it->second; |
pranavsharma
Dec 4, 2020
•
Contributor
nit: can avoid the copy. #Resolved
nit: can avoid the copy. #Resolved
| * Returns true if the option is present, false otherwise. | ||
| */ | ||
| template <typename T> | ||
| bool ReadProviderOption(const ProviderOptions& options, const std::string& key, T& value) { |
pranavsharma
Dec 4, 2020
•
Contributor
Is using optional better instead of returning true/false? #Resolved
Is using optional better instead of returning true/false? #Resolved
edgchen1
Dec 4, 2020
Author
Contributor
actually this signature is useful for the existing usage:
CUDAExecutionProviderInfo info{};
ReadProviderOption(options, provider_option_names::kMemLimit, info.cuda_mem_limit);
but i can add another function that returns an optional
In reply to: 536446380 [](ancestors = 536446380,535835891)
actually this signature is useful for the existing usage:
CUDAExecutionProviderInfo info{};
ReadProviderOption(options, provider_option_names::kMemLimit, info.cuda_mem_limit);
but i can add another function that returns an optional
In reply to: 536446380 [](ancestors = 536446380,535835891)
pranavsharma
Dec 5, 2020
•
Contributor
Sure. One other thing I noticed is that we validate values returned by this function for only some of the keys. GetOrDefault might be better I guess instead of returning optional as the user will not have the burden to check for the value in optional. Also, it should satisfy all usages. #Resolved
Sure. One other thing I noticed is that we validate values returned by this function for only some of the keys. GetOrDefault might be better I guess instead of returning optional as the user will not have the burden to check for the value in optional. Also, it should satisfy all usages. #Resolved
edgchen1
Dec 5, 2020
Author
Contributor
Ah ok, i can change it to ReadProviderOptionOrDefault()
In reply to: 536454011 [](ancestors = 536454011)
Ah ok, i can change it to ReadProviderOptionOrDefault()
In reply to: 536454011 [](ancestors = 536454011)
| * Tries to parse a value from an entire string. | ||
| */ | ||
| template <typename T> | ||
| bool TryParse(const std::string& str, T& value) { |
pranavsharma
Dec 4, 2020
Contributor
Would using stol family of functions be simpler?
Would using stol family of functions be simpler?
edgchen1
Dec 4, 2020
Author
Contributor
not sure if it would. one nice thing about operator>> is that i don't need to call different functions explicitly. also can specify a particular locale without having to update the global one.
In reply to: 535837295 [](ancestors = 535837295)
not sure if it would. one nice thing about operator>> is that i don't need to call different functions explicitly. also can specify a particular locale without having to update the global one.
In reply to: 535837295 [](ancestors = 535837295)
|
No pipelines are associated with this pull request. #Resolved |
|
/azp run orttraining-amd-gpu-ci-pipeline |
|
No pipelines are associated with this pull request. |
| "Invalid ", provider_option_names::kDeviceId, " value: ", info.device_id, | ||
| ", must be between 0 (inclusive) and ", num_devices, " (exclusive)."); | ||
| } | ||
| ReadProviderOption(options, provider_option_names::kMemLimit, info.cuda_mem_limit); |
edgchen1
Dec 9, 2020
Author
Contributor
i think it is the maximum, looks like the value eventually goes to
In reply to: 538900994 [](ancestors = 538900994)
i think it is the maximum, looks like the value eventually goes to
In reply to: 538900994 [](ancestors = 538900994)
suffiank
Dec 9, 2020
Contributor
OK, makes sense then. It looks like an unset value defaults to the numeric limit.
OK, makes sense then. It looks like an unset value defaults to the numeric limit.
| constexpr const char* kMemLimit = "cuda_mem_limit"; | ||
| constexpr const char* kArenaExtendStrategy = "arena_extend_strategy"; | ||
| constexpr const char* kCudnnConvAlgo = "cudnn_conv_algo"; | ||
| constexpr const char* kDoCopyInDefaultStream = "do_copy_in_default_stream"; |
suffiank
Dec 9, 2020
Contributor
Are there descriptors for each of these?
Are there descriptors for each of these?
edgchen1
Dec 9, 2020
Author
Contributor
hm, not sure if there are. will add documentation if needed in part 2
In reply to: 538901750 [](ancestors = 538901750)
hm, not sure if there are. will add documentation if needed in part 2
In reply to: 538901750 [](ancestors = 538901750)
| m.def("set_cuda_device_id", [](const int id) { cuda_device_id = static_cast<OrtDevice::DeviceId>(id); }); | ||
| // TODO remove deprecated global config | ||
| m.def("set_cuda_device_id", [](const int id) { | ||
| LogDeprecationWarning("set_cuda_device_id", "CUDA/ROCM execution provider option \"device_id\""); |
suffiank
Dec 9, 2020
Contributor
What's the correct way to set these options? Is that for Part 2?
What's the correct way to set these options? Is that for Part 2?
edgchen1
Dec 9, 2020
Author
Contributor
through the EP specific options. part 2 will refine the existing way of setting EP specific options
In reply to: 538908003 [](ancestors = 538908003)
through the EP specific options. part 2 will refine the existing way of setting EP specific options
In reply to: 538908003 [](ancestors = 538908003)
|
/azp run Linux CPU CI Pipeline |
|
/azp run Linux CPU x64 NoContribops CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,MacOS NoContribops CI Pipeline,Windows CPU CI Pipeline,orttraining-linux-gpu-ci-pipeline |
|
/azp run Linux CPU x64 NoContribops CI Pipeline |
|
/azp run Linux GPU CI Pipeline |
|
/azp run Linux GPU TensorRT CI Pipeline |
|
/azp run MacOS NoContribops CI Pipeline |
|
/azp run Windows CPU CI Pipeline |
|
/azp run orttraining-linux-gpu-ci-pipeline |
Description
Enable options to be set via execution provider (EP)-specific options and log deprecation warning from current global configuration functions.
TODO: Come up with convenient way to set EP-specific options (possibly refine existing APIs), update documentation and tests with new usage.
Motivation and Context
Deprecate global configuration functions in favor of EP-specific options.