deepspeed_aio_common.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) Microsoft Corporation.
  2. // SPDX-License-Identifier: Apache-2.0
  3. // DeepSpeed Team
  4. /*
  5. Functionality for swapping optimizer tensors to/from (NVMe) storage devices.
  6. */
  7. #include <deepspeed_aio_utils.h>
  8. #include <stdlib.h>
  9. #include <memory>
  10. #include <string>
  11. using namespace std;
  12. void do_aio_operation_sequential(const bool read_op,
  13. std::unique_ptr<aio_context>& aio_ctxt,
  14. std::unique_ptr<io_xfer_ctxt>& xfer_ctxt,
  15. deepspeed_aio_config_t* config,
  16. deepspeed_aio_perf_t* perf);
  17. void do_aio_operation_overlap(const bool read_op,
  18. std::unique_ptr<aio_context>& aio_ctxt,
  19. std::unique_ptr<io_xfer_ctxt>& xfer_ctxt,
  20. deepspeed_aio_config_t* config,
  21. deepspeed_aio_perf_t* perf);
  22. int open_file(const char* filename, const bool read_op);
  23. void report_file_error(const char* filename, const std::string file_op, const int error_code);
  24. int regular_read(const char* filename, std::vector<char>& buffer);
  25. bool validate_aio_operation(const bool read_op,
  26. const char* filename,
  27. void* aio_buffer,
  28. const long long int num_bytes);