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.
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 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)?;
Dual licensed under
- 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)