Skip to content

Commit

Permalink
version 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
angelip2303 committed Sep 30, 2023
1 parent 58ba32a commit b0457a6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 30 deletions.
11 changes: 2 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
[package]
name = "remote-hdt"
version = "0.1.0"
version = "0.0.1"
edition = "2021"

[dependencies]
zarr3 = { git = "https://github.com/clbarnes/zarr3-rs.git" }
rdf-rs = { path = "./rdf-rs" }
rio_api = "0.8.4"
ndarray = "0.15.6"

[dev-dependencies]
criterion = "0.5.1"

[[bench]]
name = "lubm"
harness = false
ndarray = "0.15.6"
20 changes: 0 additions & 20 deletions benches/lubm/main.rs

This file was deleted.

16 changes: 16 additions & 0 deletions examples/bench.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use remote_hdt::remote_hdt::RemoteHDTBuilder;
use std::time::Instant;

const BENCHMARKS: [&str; 1] = ["10-lubm"];

fn main() {
let before = Instant::now();

let _ = RemoteHDTBuilder::new(format!("{}.zarr", BENCHMARKS[0]).as_str())
.rdf_path(format!("../lubm-uba-improved/out/{}.ttl", BENCHMARKS[0]).as_str())
.array_name("array_name")
.build()
.serialize();

println!("Elapsed time: {:.2?}", before.elapsed())
}
8 changes: 7 additions & 1 deletion src/remote_hdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ impl ReferenceSystem {
// desired mechanism
let mut v = Vec::<(usize, usize, usize, u8)>::new();

// Could this be improved using a multithreading approach? If we use
// rayon the solution would be possibly faster and the implementation
// details wouldn't vary as much
for (i, outer) in array.outer_iter().enumerate() {
for j in 0..outer.shape()[0] {
for k in 0..outer.shape()[1] {
Expand All @@ -300,6 +303,7 @@ impl ReferenceSystem {

let mut reshaped_array = ArcArray3::zeros(other.shape(&domain));

// Same here... Using rayon would be desirable
for (s, p, o, value) in v {
match other {
ReferenceSystem::SPO => reshaped_array[[s, p, o]] = value,
Expand Down Expand Up @@ -425,6 +429,8 @@ impl<'a> RemoteHDT<'a> {
// the provided values (second vector). What's more, an offset can be set;
// that is, we can insert the created array with and X and Y shift. Lastly,
// the region is written provided the aforementioned data and offset
// TODO: use rayon for a multithreaded approach
// TODO: use a better method than nested loops
let data = match ArcArrayD::from_shape_vec(self.reference_system.shape(domain).to_vec(), {
let mut v = Vec::<u8>::new();
for subject in &subjects {
Expand Down Expand Up @@ -454,7 +460,7 @@ impl<'a> RemoteHDT<'a> {
return Err(String::from("Error writing to the Array"));
};

// Ok(())
// Ok(self)

// =========================================================================
// TODO: remove this because it's just for debug purposes
Expand Down

0 comments on commit b0457a6

Please sign in to comment.