eigencuda

Offload Eigen operations to GPUs

https://github.com/nlesc-jcer/eigencuda

Science Score: 49.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
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (3.9%) to scientific vocabulary

Keywords

cpp14 eigen3 gpu-computing matrix-multiplication
Last synced: 6 months ago · JSON representation

Repository

Offload Eigen operations to GPUs

Basic Info
  • Host: GitHub
  • Owner: NLESC-JCER
  • License: apache-2.0
  • Language: C++
  • Default Branch: master
  • Homepage:
  • Size: 236 KB
Statistics
  • Stars: 18
  • Watchers: 4
  • Forks: 6
  • Open Issues: 6
  • Releases: 3
Topics
cpp14 eigen3 gpu-computing matrix-multiplication
Created about 7 years ago · Last pushed about 4 years ago
Metadata Files
Readme Changelog License Code of conduct Citation Zenodo

README.md

DOI

EigenCuda

Offload the Eigen3 matrix matrix multiplication to an Nvidia GPU using cublas.

CMake Installation

To compile execute: cmake -H. -Bbuild && cmake --build build

To Debug compile as: cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug && cmake --build build

Dependencies

This packages assumes that you have installed the following packages:

Usage

Matrix Multiplication

```cpp

include "eigencuda.hpp"

include "cudapipeline.hpp"

using eigencuda::CudaPipeline; using eigencuda::CudaMatrix;

// Call the class to handle GPU resources CudaPipeline cuda_pip;

Eigen::MatrixXd A = Eigen::MatrixXd::Zero(2, 2); Eigen::MatrixXd B = Eigen::MatrixXd::Zero(3, 2); Eigen::MatrixXd C = Eigen::MatrixXd::Zero(3, 2); Eigen::MatrixXd D = Eigen::MatrixXd::Zero(3, 2); Eigen::MatrixXd X = Eigen::MatrixXd::Zero(3, 2); Eigen::MatrixXd Y = Eigen::MatrixXd::Zero(3, 2); Eigen::MatrixXd Z = Eigen::MatrixXd::Zero(3, 2);

// Define matrices A << 1., 2., 3., 4.; B << 5., 6., 7., 8., 9., 10.; C << 9., 10., 11., 12., 13., 14.; D << 13., 14., 15., 16., 17., 18.; X << 23., 34., 31., 46., 39., 58.; Y << 39., 58., 47., 70., 55., 82.; Z << 55., 82., 63., 94., 71., 106.;

std::vectorEigen::MatrixXd tensor{B, C, D}; std::vectorEigen::MatrixXd results(3, Eigen::MatrixXd::Zero(3, 2)); CudaMatrix cumaA{A, cudapip.getstream()}; CudaMatrix cumaB{3, 2, cudapip.getstream()}; CudaMatrix cumaC{3, 2, cudapip.get_stream()};

for (Index i = 0; i < 3; i++) { cumaB.copytogpu(tensor[i]); cudapip.gemm(cumaB, cumaA, cumaC); results[i] = cumaC; } // Expected results bool pred1 = X.isApprox(results[0]); bool pred2 = Y.isApprox(results[1]); bool pred_3 = Z.isApprox(results[2]); } ```

Owner

  • Name: NLESC-JCER
  • Login: NLESC-JCER
  • Kind: organization

GitHub Events

Total
  • Watch event: 2
  • Fork event: 1
Last Year
  • Watch event: 2
  • Fork event: 1