Awesome Open Source
Awesome Open Source

parenchyma

Join the chat Project Status License parenchyma

Parenchyma started off as a hard fork of Collenchyma (hence the name), an extensible HPC framework developed by the Autumn team as well as an amazing group of contributors. Aside from the name and overall design, the two libraries are quite dissimilar to each other (e.g., auto-sync (thanks to @alexandermorozov), async transfers, the fallback mechanism, etc.). Therefore, before migrating over, one should go through the documentation carefully as to not make the mistake of misusing the framework. Not doing so may result in unintended behavior for which Parenchyma developers/contributors are not responsible.

Many of the original comments used for documentation purposes remain in the code base along with a few necessary additions/modifications.

Disclaimer: Parenchyma is currently undergoing extensive refactoring and improvement. Therefore, it is likely that many of the features available in the original Collenchyma project may not yet be available in the Parenchyma project. It is also likely that certain features may never be available in the Parenchyma project, as the different approaches that are currently being considered may prove to be better than the original approach.

Tensor creation

The easiest way to create a tensor is to use the array macro:

#[macro_use(array)]
extern crate parenchyma;

use parenchyma::prelude::*;

let t: SharedTensor<i32> = array![
    [
        [1,2,3],
        [4,5,6]
    ],
    [
        [11,22,33],
        [44,55,66]
    ],
    [
        [111,222,333],
        [444,555,666]
    ],
    [
        [1111,2222,3333],
        [4444,5555,6666]
    ]
].into();

println!("{:?}", t);

// shape=[4, 2, 3], strides=[6, 3, 1], layout=C (0x1), type=i32
//
// [[[1, 2, 3],
//   [4, 5, 6]],
//  [[11, 22, 33],
//   [44, 55, 66]],
//  [[111, 222, 333],
//   [444, 555, 666]],
//  [[1111, 2222, 3333],
//   [4444, 5555, 6666]]]

Synchronizing Data

Synchronizing data across multiple compute devices and backends is straightforward.

#[macro_use(array)]
extern crate parenchyma;

use parenchyma::prelude::*;

let ref cuda: Backend = Backend::new::<Cuda>()?;

let t = array![[1.5, 2.3, 3.7], [4.8, 5.2, 6.9]].into();

t.synchronize(cuda)?;

License

Dual licensed under


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
rust (4,308
gpu (341
cuda (330
nvidia (113
opencl (110
hpc (96
parallel-computing (84
gpgpu (60
intel (56
amd (46

Find Open Source By Browsing 7,000 Topics Across 59 Categories