You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.h 3.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /**
  2. * Copyright 2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_CONFIG_H
  17. #define MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_CONFIG_H
  18. #include <cstdint>
  19. #include <string>
  20. #include "minddata/dataset/util/log_adapter.h"
  21. namespace mindspore {
  22. namespace dataset {
  23. // Config operations for setting and getting the configuration.
  24. namespace config {
  25. /// \brief Function to set the seed to be used in any random generator. This is used to produce deterministic results.
  26. /// \param[in] seed the default seed to use.
  27. bool set_seed(int32_t seed);
  28. /// \brief Function to get the seed.
  29. /// \return the seed set in the configuration.
  30. uint32_t get_seed();
  31. /// \brief Function to set the number of rows to be prefetched.
  32. /// \param[in] prefetch_size total number of rows to be prefetched.
  33. bool set_prefetch_size(int32_t prefetch_size);
  34. /// \brief Function to get the prefetch size in number of rows.
  35. /// \return total number of rows to be prefetched.
  36. int32_t get_prefetch_size();
  37. /// \brief Function to set the default number of parallel workers.
  38. /// \param[in] num_parallel_workers number of parallel workers to be used as a default for each operation.
  39. bool set_num_parallel_workers(int32_t num_parallel_workers);
  40. /// \brief Function to get the default number of parallel workers.
  41. /// \return number of parallel workers to be used as a default for each operation.
  42. int32_t get_num_parallel_workers();
  43. /// \brief Function to set the default interval (in milliseconds) for monitor sampling.
  44. /// \param[in] interval interval (in milliseconds) to be used for performance monitor sampling.
  45. bool set_monitor_sampling_interval(int32_t interval);
  46. /// \brief Function to get the default interval of performance monitor sampling.
  47. /// \return interval (in milliseconds) for performance monitor sampling.
  48. int32_t get_monitor_sampling_interval();
  49. /// \brief Function to set the default timeout (in seconds) for DSWaitedCallback. In case of a deadlock, the wait
  50. /// function will exit after the timeout period.
  51. /// \param[in] timeout timeout (in seconds) to be used to end the wait in DSWaitedCallback in case of a deadlock.
  52. bool set_callback_timeout(int32_t timeout);
  53. /// \brief Function to get the default timeout for DSWaitedCallback. In case of a deadback, the wait function will exit
  54. /// after the timeout period.
  55. /// \return the duration in seconds.
  56. int32_t get_callback_timeout();
  57. /// \brief Function to load configuration from a file.
  58. /// \param[in] file path of the configuration file to be loaded.
  59. bool load(std::string file);
  60. } // namespace config
  61. } // namespace dataset
  62. } // namespace mindspore
  63. #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_CONFIG_H