Repository: microsoft/DeepSpeed
File: csrc/aio/py_lib/py_ds_aio.cpp (C++)

Code before:

    m.def("aio_write", &deepspeed_py_aio_write, "DeepSpeed Asynchronous I/O Write");

    m.def("deepspeed_memcpy", &deepspeed_py_memcpy, "DeepSpeed Memory Copy");

    py::class_<deepspeed_aio_handle_t>(m, "aio_handle")
        .def(py::init<const int, const int, const bool, const bool, const int>(),
             "AIO handle constructor",
             "block_size"_a = 1024 * 1024,
             "queue_depth"_a = 128,
             "single_submit"_a = false,
             "overlap_events"_a = false,
             "intra_op_parallelism"_a = 1)

        .def("get_block_size", &deepspeed_aio_handle_t::get_block_size)
        .def("get_queue_depth", &deepspeed_aio_handle_t::get_queue_depth)
        .def("get_single_submit", &deepspeed_aio_handle_t::get_single_submit)
        .def("get_overlap_events", &deepspeed_aio_handle_t::get_overlap_events)
        .def("get_intra_op_parallelism", &deepspeed_aio_handle_t::get_intra_op_parallelism)

        .def("read",
             &deepspeed_aio_handle_t::read,
             "Synchronous and non-parallel file read. Returns count of completed read ops",
             "buffer"_a,
             "filename"_a,
             "file_offset"_a = 0,
             "validate"_a)

        .def("write",
             &deepspeed_aio_handle_t::write,
             "Synchronous and non-parallel file write. Returns count of completed write ops",
             "buffer"_a,
             "filename"_a,
             "file_offset"_a = 0,
             "validate"_a)

        .def("pread",
             &deepspeed_aio_handle_t::pread,
             "Parallel file read with option of parallelism. Returns count of completed read ops",
             "buffer"_a,
             "filename"_a,
             "validate"_a,
             "file_offset"_a = 0,
             "async"_a)

        .def("pwrite",
             &deepspeed_aio_handle_t::pwrite,
             "Parallel file write with option of parallelism. Returns count of completed write ops",
             "buffer"_a,
             "filename"_a,
             "validate"_a,

Review comment (suggestion):
Can you please flip this order so that `file_offset` is the last argument since it has a default value. 

Code after:

    m.def("aio_write", &deepspeed_py_aio_write, "DeepSpeed Asynchronous I/O Write");

    m.def("deepspeed_memcpy", &deepspeed_py_memcpy, "DeepSpeed Memory Copy");

    py::class_<deepspeed_aio_handle_t>(m, "aio_handle")
        .def(py::init<const int, const int, const bool, const bool, const int>(),
             "AIO handle constructor",
             "block_size"_a = 1024 * 1024,
             "queue_depth"_a = 128,
             "single_submit"_a = false,
             "overlap_events"_a = false,
             "intra_op_parallelism"_a = 1)

        .def("get_block_size", &deepspeed_aio_handle_t::get_block_size)
        .def("get_queue_depth", &deepspeed_aio_handle_t::get_queue_depth)
        .def("get_single_submit", &deepspeed_aio_handle_t::get_single_submit)
        .def("get_overlap_events", &deepspeed_aio_handle_t::get_overlap_events)
        .def("get_intra_op_parallelism", &deepspeed_aio_handle_t::get_intra_op_parallelism)

        .def("read",
             &deepspeed_aio_handle_t::read,
             "Synchronous and non-parallel file read. Returns count of completed read ops",
             "buffer"_a,
             "filename"_a,
             "validate"_a,
             "file_offset"_a = 0)

        .def("write",
             &deepspeed_aio_handle_t::write,
             "Synchronous and non-parallel file write. Returns count of completed write ops",
             "buffer"_a,
             "filename"_a,
             "validate"_a,
             "file_offset"_a = 0)

        .def("pread",
             &deepspeed_aio_handle_t::pread,
             "Parallel file read with option of parallelism. Returns count of completed read ops",
             "buffer"_a,
             "filename"_a,
             "validate"_a,
             "async"_a,
             "file_offset"_a = 0)

        .def("pwrite",
             &deepspeed_aio_handle_t::pwrite,
             "Parallel file write with option of parallelism. Returns count of completed write ops",
             "buffer"_a,
             "filename"_a,
             "validate"_a,