Read arrays from files faster (#1330)

* read faster

* faster write as well

* set default permission for linux

* comment
This commit is contained in:
Awni Hannun
2024-08-14 20:09:56 -07:00
committed by GitHub
parent 99bb7d3a58
commit d0630ffe8c
4 changed files with 57 additions and 22 deletions

View File

@@ -2,6 +2,7 @@
#include <dlfcn.h>
#include <filesystem>
#include <fstream>
#include <list>
#include "mlx/backend/common/compiled.h"

View File

@@ -33,7 +33,7 @@ void Load::eval(const std::vector<array>& inputs, array& out) {
assert(inputs.size() == 0);
out.set_data(allocator::malloc_or_wait(out.nbytes()));
reader_->seek(offset_, std::ios_base::beg);
reader_->seek(offset_);
reader_->read(out.data<char>(), out.nbytes());
if (swap_endianness_) {