§2024-12-24

R 3.6.3 has install.packages("RcppCUDA") support

$ R --version
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)
alexlai@jetsonOrinNano:~$ export R_LIBS_USER=~/Rlibs
alexlai@jetsonOrinNano:~$ R

R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages("Rcpp")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages("Rcpp") :
  'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead? (yes/No/cancel) yes
Would you like to create a personal library
‘/home/alexlai/Rlibs’
to install packages into? (yes/No/cancel) yes
trying URL 'https://cloud.r-project.org/src/contrib/Rcpp_1.0.13-1.tar.gz'
Content type 'application/x-gzip' length 3435726 bytes (3.3 MB)
==================================================
downloaded 3.3 MB

* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-nNSpe3/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c api.cpp -o api.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-nNSpe3/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c attributes.cpp -o attributes.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-nNSpe3/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c barrier.cpp -o barrier.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-nNSpe3/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c date.cpp -o date.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-nNSpe3/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c module.cpp -o module.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-nNSpe3/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c rcpp_init.cpp -o rcpp_init.o
g++ -std=gnu++14 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o Rcpp.so api.o attributes.o barrier.o date.o module.o rcpp_init.o -L/usr/lib/R/lib -lR
installing to /home/alexlai/Rlibs/00LOCK-Rcpp/00new/Rcpp/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (Rcpp)

The downloaded source packages are in
	‘/tmp/RtmpgRKqhW/downloaded_packages’
    
> install.packages("RcppCUDA")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages("RcppCUDA") :
  'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead? (yes/No/cancel) yes
Would you like to create a personal library
‘/home/alexlai/Rlibs’
to install packages into? (yes/No/cancel) yes
Warning message:
package ‘RcppCUDA’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages 
Install gpuR:

r
Copy code
install.packages("gpuR")
Use it in your code:

r
Copy code
library(gpuR)
# Create a matrix on the GPU
mat <- gpuMatrix(1:9, nrow = 3, ncol = 3)

# Perform matrix multiplication
mat %*% mat