Skip to content
Snippets Groups Projects
main.rs 793 B
extern crate async_std;
extern crate clap;
extern crate hercules_rt;

// To compile currently, run from the Hercules project root directory:
// cargo run --bin hercules_driver hercules_samples/matmul/matmul.hir "Codegen(\"matmul.hbin\")"
// Then, you can execute this example with:
// cargo run --bin hercules_matmul
hercules_rt::use_hbin!("matmul.hbin");

fn main() {
    async_std::task::block_on(async {
        let mut a = vec![1.0, 2.0, 3.0, 4.0];
        let mut b = vec![5.0, 6.0, 7.0, 8.0];
        let c = matmul(a.as_mut_ptr(), b.as_mut_ptr(), 2, 2, 2).await;
        unsafe {
            println!(
                "[[{}, {}], [{}, {}]]",
                *c,
                *c.offset(1),
                *c.offset(2),
                *c.offset(3)
            );
        }
    });
}