https://github.com/jianqoq/hpt

A high performance N-dimensional array library for Rust

https://github.com/jianqoq/hpt

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.4%) to scientific vocabulary

Keywords

cross-platform deep-learning high-performance-computing ndarray parallel-computing rust scientific-computing tensor
Last synced: 6 months ago · JSON representation

Repository

A high performance N-dimensional array library for Rust

Basic Info
Statistics
  • Stars: 41
  • Watchers: 0
  • Forks: 2
  • Open Issues: 18
  • Releases: 8
Topics
cross-platform deep-learning high-performance-computing ndarray parallel-computing rust scientific-computing tensor
Created over 1 year ago · Last pushed 8 months ago
Metadata Files
Readme License

README.md

HPT

Crates.io Discord

Hpt is a high performance N-dimensional array library. It is being highly optimized and is designed to be easy to use. Most of the operators are implemented based on Onnx operator list. Hence, you can use it to build most of the deep learning models.

Features

Memory Layout

  • Optimized memory layout with support for both contiguous and not contiguous tensors. #### SIMD Support
  • Leverages CPU SIMD instructions (SSE/AVX/NEON) for vectorized operations. #### Iterator API
  • Flexible iterator API for efficient element-wise/broadcast operations and custom implementations. #### Multi-Threading
  • Auto efficient parallel processing for CPU-intensive operations. #### Broadcasting
  • Automatic shape broadcasting for element-wise operations, similar to NumPy. #### Auto Type Promote
  • Allows auto type promote when compute with different types. #### Customizable
  • Allows user to define their own data type for calculation (CPU support only) and allocator for memory allocation (All Backends).

Note

Hpt is in early stage, bugs and wrong calculation results may happen, API may change.

Cargo Features

  • cuda: enable cuda support.
  • bound_check: enable bound check, this is experimental and will reduce performance.
  • normal_promote: auto type promote. There may be more type promote feature in the future.

Get Start

```rust use hpt::Tensor; use hpt::ops::FloatUnaryOps; fn main() -> anyhow::Result<()> { let x = Tensor::new(&[1f64, 2., 3.]); let y = Tensor::new(&[4i64, 5, 6]);

let result: Tensor<f64> = x + &y; // with `normal_promote` feature enabled, i64 + f64 will output f64
println!("{}", result); // [5. 7. 9.]

// All the available methods are listed in https://jianqoq.github.io/Hpt/user_guide/user_guide.html
let result: Tensor<f64> = y.sin()?;
println!("{}", result); // [-0.7568 -0.9589 -0.2794]
Ok(())

} ```

To use Cuda, enable feature cuda (Note that Cuda is in development and not tested) ```rust use hpt::{Tensor, backend::Cuda}; use hpt::ops::FloatUnaryOps;

fn main() -> anyhow::Result<()> { let x = Tensor::::new(&[1f64, 2., 3.]).tocuda::<0/*Cuda device id*/>()?; let y = Tensor::::new(&[4i64, 5, 6]).tocuda::<0/*Cuda device id*/>()?;

let result = x + &y; // with `normal_promote` feature enabled, i64 + f64 will output f64
println!("{}", result); // [5. 7. 9.]

// All the available methods are listed in https://jianqoq.github.io/Hpt/user_guide/user_guide.html
let result: Tensor<f64, Cuda, 0> = y.sin()?;
println!("{}", result); // [-0.7568 -0.9589 -0.2794]
Ok(())

} ```

For more examples, reference here and documentation

How To Get Highest Performance

  • Compile your program with the following configuration in Cargo.toml, note that lto is very important. cargo opt-level = 3 lto = "fat" codegen-units = 1
  • Ensure your Env variable RUSTFLAGS enabled the best features your CPU has, like -C target-feature=+avx2 -C target-feature=+fma.

Benchmarks

benchmarks

Backend Support

| Backend | Supported | |---------|-----------| | CPU | ✅ | | Cuda | 🚧 |

| CPU | Supported | |--------|-----------| | AVX2 | ✅ | | AVX512 | ❌ | | SSE | ✅ | | Neon | ✅ |

It is welcome to get contribution for supporting machines that is not supported in the list. Before contribute, please look at the dev guide.

Documentations

For more details, visit https://jianqoq.github.io/Hpt/

License

Licensed under either of

  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Contribution are wellcome, please check https://jianqoq.github.io/Hpt/devguide/devguide.html for more detail

Owner

  • Login: Jianqoq
  • Kind: user

GitHub Events

Total
  • Create event: 10
  • Release event: 8
  • Issues event: 31
  • Watch event: 33
  • Delete event: 5
  • Member event: 1
  • Push event: 483
  • Pull request event: 115
  • Fork event: 1
Last Year
  • Create event: 10
  • Release event: 8
  • Issues event: 31
  • Watch event: 33
  • Delete event: 5
  • Member event: 1
  • Push event: 483
  • Pull request event: 115
  • Fork event: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 13
  • Total pull requests: 56
  • Average time to close issues: 23 days
  • Average time to close pull requests: 1 day
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 49
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 13
  • Pull requests: 56
  • Average time to close issues: 23 days
  • Average time to close pull requests: 1 day
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 49
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Jianqoq (13)
Pull Request Authors
  • Jianqoq (53)
  • Daboijeke (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 10
  • Total downloads:
    • cargo 62,074 total
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 113
  • Total maintainers: 1
crates.io: hpt-common

An internal library for common utilities for hpt

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 6,192 Total
Rankings
Dependent repos count: 23.2%
Dependent packages count: 30.8%
Average: 42.8%
Downloads: 74.5%
Maintainers (1)
Last synced: 6 months ago
crates.io: hpt-macros

An internal library for generating helper functions for hpt

  • Versions: 10
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 5,795 Total
Rankings
Dependent repos count: 23.2%
Dependent packages count: 30.8%
Average: 43.0%
Downloads: 74.9%
Maintainers (1)
Last synced: 6 months ago
crates.io: hpt-types

An internal library define primitive types functions for hpt

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 6,230 Total
Rankings
Dependent repos count: 23.2%
Dependent packages count: 30.8%
Average: 43.0%
Downloads: 75.1%
Maintainers (1)
Last synced: 6 months ago
crates.io: hpt-traits

An internal library defines tensor operator traits for hpt

  • Versions: 12
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 6,536 Total
Rankings
Dependent repos count: 23.2%
Dependent packages count: 30.8%
Average: 43.3%
Downloads: 76.0%
Maintainers (1)
Last synced: 6 months ago
crates.io: hpt-dataloader

An internal library for data loading for hpt

  • Versions: 12
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 6,422 Total
Rankings
Dependent repos count: 23.2%
Dependent packages count: 30.8%
Average: 43.6%
Downloads: 77.0%
Maintainers (1)
Last synced: 6 months ago
crates.io: hpt-display

An internal library for displaying tensors

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 6,012 Total
Rankings
Dependent repos count: 23.2%
Dependent packages count: 30.8%
Average: 43.7%
Downloads: 77.0%
Maintainers (1)
Last synced: 6 months ago
crates.io: hpt-allocator

An internal library for memory allocator for hpt

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 5,971 Total
Rankings
Dependent repos count: 23.2%
Dependent packages count: 30.8%
Average: 43.7%
Downloads: 77.1%
Maintainers (1)
Last synced: 6 months ago
crates.io: hpt-cudakernels

A library implements cuda kernels for hpt

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 5,840 Total
Rankings
Dependent repos count: 23.2%
Dependent packages count: 30.8%
Average: 43.9%
Downloads: 77.8%
Maintainers (1)
Last synced: 6 months ago
crates.io: hpt-iterator

An internal library implements iterator for hpt

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 5,929 Total
Rankings
Dependent repos count: 23.2%
Dependent packages count: 30.8%
Average: 44.0%
Downloads: 77.9%
Maintainers (1)
Last synced: 6 months ago
crates.io: hpt

High Performance Tensor (HPT) - A fast, efficient, and user-friendly tensor computation library for Rust

  • Documentation: https://docs.rs/hpt/
  • License: MIT OR Apache-2.0
  • Latest release: 0.1.3
    published 10 months ago
  • Versions: 13
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 7,147 Total
Rankings
Dependent repos count: 23.2%
Dependent packages count: 30.8%
Average: 45.8%
Downloads: 83.5%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/docs.yml actions
  • JamesIves/github-pages-deploy-action v4 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
.github/workflows/rust.yml actions
  • actions-rs/toolchain v1 composite
  • actions/cache v3 composite
  • actions/checkout v4 composite
Cargo.toml cargo
tensor-allocator/Cargo.toml cargo
tensor-bench/Cargo.toml cargo
tensor-codegen/Cargo.toml cargo
tensor-common/Cargo.toml cargo
tensor-cudakernels/Cargo.toml cargo
tensor-dataloader/Cargo.toml cargo
tensor-display/Cargo.toml cargo
tensor-dyn/Cargo.toml cargo
tensor-examples/Cargo.toml cargo
tensor-iterator/Cargo.toml cargo
tensor-macros/Cargo.toml cargo
tensor-tests/Cargo.toml cargo
tensor-traits/Cargo.toml cargo
tensor-types/Cargo.toml cargo
package-lock.json npm
  • 257 dependencies
package.json npm
  • @vuepress/client ^2.0.0-rc.0 development
  • vue ^3.4.0 development
  • vuepress ^2.0.0-rc.0 development