diff --git a/src/ndarray/ndarray.jl b/src/ndarray/ndarray.jl index d58f6572..082c6b1c 100644 --- a/src/ndarray/ndarray.jl +++ b/src/ndarray/ndarray.jl @@ -763,3 +763,18 @@ end function Base.isapprox(arr::NDArray{T}, arr2::NDArray{T}; atol=0, rtol=0) where {T} return compare(arr, arr2, atol, rtol) end + +function h5write(path::String, dataset::String, arr::NDArray{T,N}) where {T,N} + st_handle = get_store(arr) + la = Legate.LogicalArray{T,N}(st_handle[], size(arr)) + Legate.write_hdf5(la, path, dataset) +end + +function h5read(path::String, dataset::String) + la = Legate.read_hdf5(path, dataset) + T = eltype(la) + N = Int(Legate.dim(la)) + st = Legate.data(la.handle) # call data on the raw impl + ptr = nda_store_to_ndarray(st) # pass directly + return NDArray(ptr, T, Val(N), nothing) +end \ No newline at end of file