parenchyma 0.0.33

A high-performance computing (HPC) framework
parenchyma-0.0.33 doesn't have any documentation.

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) and the fallback mechanism). 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.

Example

Parenchyma comes without any extension packages. The following example therefore assumes that you have add both parenchyma and the Parenchyma ExtensionPackage parenchyma-nn to your Cargo manifest.

extern crate parenchyma as pa;
extern crate parenchyma_nn as pann;

use pa::{Backend, BackendConfig, Native, OpenCL, SharedTensor};
use pa::HardwareKind::GPU;
use pann::NNPackage;

fn main() {
    let ref native: Backend = Backend::new::<Native>().unwrap();

    // Initialize an OpenCL or CUDA backend packaged with the NN extension.
    let ref backend = {
        let framework = OpenCL::new().unwrap();
        let hardware = framework.available_hardware.clone();
        let configuration = BackendConfig::<OpenCL, NNPackage>::new(framework, hardware, GPU);

        Backend::try_from(configuration).unwrap()
    };

    let data: Vec<f64> = vec![3.5, 12.4, 0.5, 6.5];
    let length = data.len();

    // Initialize two `SharedTensor`s.
    let ref x = SharedTensor::with(backend, length, data).unwrap();
    let ref mut result = SharedTensor::new(length);

    // Run the sigmoid operation, provided by the NN extension, on 
    // your OpenCL/CUDA enabled GPU (or CPU, which is possible through OpenCL)
    backend.sigmoid(x, result).unwrap();

    // Print the result: `[0.97068775, 0.9999959, 0.62245935, 0.9984988] shape=[4], strides=[1]`
    println!("{:?}", result.read(native).unwrap().as_native().unwrap());
}

License

Dual licensed under