Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/MPCRPublic

Multi-Precision R-package providing an interface for R developers to use multiple precisions for floating point number representation and arithmetic.

License

NotificationsYou must be signed in to change notification settings

stsds/MPCR

Repository files navigation

Overview

TheMPCR package provides new data-structure support for multi- and mixed-precision for R users, supporting 16-bit, 32-bit, and 64-bit operations.This enables optimized memory allocation based on the desired precision, offering significant advantages in-memory optimization and computational efficiency.In addition,MPCR leverages GPU acceleration through CUDA, allowing for high-performance computations on the GPU.This capability includes seamless memory transfers between CPU and GPU, managed automatically by the package, simplifying the setup and usage for end users.

Key Features

1. Multi-Precision Support

MPCR introduces a new data structure that supports three different precisions:

  • 16-bit - Supported on GPU only, with half-precision support for the Matrix-Matrix Multiplication only ( crossprod () ).
  • 32-bit
  • 64-bit

This flexibility allows for optimized memory allocation and performance tuning based on the specific needs of your application.

2. Comprehensive Linear Algebra Support

The package extends support to all basic linear algebra methods across different precisions. You can perform operations like matrix multiplication, inversion, and eigenvalue decomposition with ease, regardless of the chosen precision.

3. Seamless Integration

MPCR maintains a consistent interface with normal R functions, allowing for seamless code integration. You can use MPCR data structures and functions without having to significantly alter your existing codebase, ensuring a user-friendly experience.

4. GPU Acceleration with CUDA

The package now supports CUDA, enabling the allocation of memory and performance of operations on the GPU using CuSolver and CuBLAS. This includes:

  • Automatic handling of data transfers between CPU and GPU.
  • Simple selection mechanism for performing operations on either CPU or GPU, with MPCR managing the complexities behind the scenes.

5. Installation

To install theMPCR package, you can use the following command:

  • Clone the MPCR package fromhere.
  • Checkout to tagv2.0.0 (Latest stable release).
  • RunR CMD INSTALL . from the project root directory.

General Note: The package will automatically be built with CUDA support if CUDA ToolKit is detected, if not, the packagewill be build with CPU support only.


6. Requirements

  • Rcpp (needs to be installed before trying to install the package), useinstall.packages("Rcpp") in R to install it.
  • For optimal performance,MKL is recommended for building the package,in case MKL is not found on the system, the package will automatically downloadOpenBLAS.
  • Blaspp will be installed automatically.
  • Lapackpp will be installed automatically.
  • CUDA ToolKit > 11.4 in case CUDA toolkit is not available on the system, the package will be installed with CPU support only.

7. Getting Started

Example showcasing how MPCR can be used to allocate and perform operations on CPU/GPU. More examples are availablein the followingdirectory.

library("MPCR")values<- c(3.12393,-1.16854,-0.304408,-2.15901,-1.16854,1.86968,1.04094,1.35925,-0.304408,1.04094,4.43374,1.21072,-2.15901,1.35925,1.21072,5.57265)# placement will indicate on which device the allocation should be made.# default option : CPUA<- as.MPCR(values,nrow=4,ncol=4,precision="float",placement="GPU")B<- as.MPCR(values,nrow=4,ncol=4,precision="float",placement="GPU")# Set operation placement is the function used to decide whether the up-coming# operation should be executed on CPU or GPU# All the up-coming operation will be executed on GPU# default option : CPUMPCR.SetOperationPlacement("GPU")cat("----------------------- CrossProduct C=XY --------------------\n")crossproduct<- crossprod(x,y)# Print is a CPU only function, so the data will automatically be transferred to CPU,# resulting in having a copy on CPU and a copy on GPU for future GPU operationcrossproduct$PrintValues()

Handout

handout2025.jpg

About

Multi-Precision R-package providing an interface for R developers to use multiple precisions for floating point number representation and arithmetic.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp