Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c047ad7
fix missing output rkeops options during tests
gdurif Jun 11, 2025
b82298f
minor: fix typo in benchmark script
gdurif Jun 11, 2025
0680f44
safely cast software version to character string
gdurif Jun 11, 2025
549cafc
add check to verify that formula is not missing or having too much pa…
gdurif Jun 11, 2025
d7f4677
load stringr package used in test + improve afterward cleaning
gdurif Jun 11, 2025
07452eb
fix issue in tests when switching from binary op +-/* to correspondin…
gdurif Jun 11, 2025
35cbc03
fix small typos
bcharlier Jun 18, 2025
addbf9b
switch to reticulate::py_require (wrapper around uv) for seamless Pyt…
gdurif Jun 11, 2025
29a820d
update metadata, especially regarding new Python setup management
gdurif Jul 4, 2025
e31a5af
use new Python setup based on reticulate::py_require()
gdurif Jul 4, 2025
0934f61
fix rkeops check and in particular calls to pykeops check
gdurif Jul 4, 2025
ccc4e3a
fix issue with cleaning after running tests
gdurif Jul 4, 2025
9a09a44
simplify reticulate usage
gdurif Jul 4, 2025
d6815b3
fix issue with vector being now a matrix
gdurif Jul 4, 2025
4a86e03
document and apply new Python requirement management in vignettes
gdurif Jul 4, 2025
ef492dd
automatic doc generation
gdurif Jul 4, 2025
3d05b08
fix missing import
gdurif Jul 10, 2025
f1d4a51
toy example (gaussian kernel) to run quick tests
gdurif Jul 10, 2025
53ce782
add rkeops check after loading the package (which triggers reticulate…
gdurif Jul 10, 2025
2e03a6f
fix url
gdurif Jul 10, 2025
c14f20d
automatic README generation
gdurif Jul 10, 2025
3ea6c90
remove direct link to page reproducing content in README
gdurif Jul 10, 2025
a03bc72
remove useless helloWorld function
gdurif Jul 11, 2025
ebd59da
fix doc issues (@noRd tag for internal functions, switch dontrun to d…
gdurif Jul 11, 2025
d9f7edb
replace dontrun by clean donttest in examples + avoid internal functi…
gdurif Jul 15, 2025
0afd814
replace dontrun by clean donttest in examples + minor code refactoring
gdurif Jul 15, 2025
44c16fa
minor comment update in \dontshow chunk in examples
gdurif Jul 15, 2025
ced7dde
fix issue after example refacotring
gdurif Jul 15, 2025
da78196
forgot to remove test for helloWorld function
gdurif Jul 15, 2025
8a1ecdf
minor
gdurif Jul 15, 2025
64b722f
fix typo in some example (was using undefinied variable) + reindent c…
gdurif Jul 15, 2025
29eee37
fix multiple bug in function example codes
gdurif Jul 15, 2025
49ff77c
add missing value section in documentation for specific functions (im…
gdurif Jul 16, 2025
a3d8598
add donttest tag for rkeops check because it takes more than 5seconds…
gdurif Jul 16, 2025
4c0de8d
avoid leaving on empty cache directory after package check
gdurif Jul 16, 2025
b1a482a
install if necessary withr package that is silently used for after cl…
gdurif Jul 16, 2025
6256ea0
better management of specific test cache dir setup to reset to previo…
gdurif Jul 16, 2025
1a1a946
minor (reindent code)
gdurif Jul 16, 2025
d57ee49
ignore pdf generated (by plots) during example run
gdurif Jul 16, 2025
afef566
automatic namespace update
gdurif Jul 16, 2025
b225a7e
automatic doc generation (particularly fixing issue raised during las…
gdurif Jul 16, 2025
489f5da
add 'remotes' to suggested packages
gdurif Jul 16, 2025
f95c5ef
clean after running this toy example
gdurif Jul 16, 2025
ad33abe
update version number and publication date for rkeops
gdurif Jul 16, 2025
d602e85
remove useless dontrun tag in internal function example (thanks to @n…
gdurif Jul 17, 2025
a0c8f2d
manage the case when the cache directory is removed, allow current or…
gdurif Jul 17, 2025
5411039
test new case of non existing cache directory
gdurif Jul 17, 2025
c5e9907
better management of clean running environment for tests (including s…
gdurif Jul 17, 2025
96cbf2e
new import
gdurif Jul 17, 2025
3490893
add information for developper and rename file with explicit name
gdurif Jul 17, 2025
1576541
time tests and checks + manage specific tags to enable specific test …
gdurif Jul 17, 2025
70c4eb8
automatic doc generation
gdurif Jul 17, 2025
8c3f041
enable rkeops CI run in github actions (self-hosted runner with GPU/c…
gdurif Aug 18, 2025
d66d497
debugging rkeops testing in github actions
gdurif Aug 18, 2025
caa4274
use bash to run rkeops CI script
gdurif Aug 18, 2025
c07d587
use new reticulate setup in rkeops CI scripts
gdurif Aug 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/cuda_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ jobs:
uses: actions/checkout@v2
- name: Test with pytest
run: |
sh ./pytest.sh
#sh ./pytest.sh
echo "BYPASS Python tests"
- name: Test rkeops
run: |
cd rkeops/ci
pwd
ls
export TEST_GPU=1
bash ./run_ci.sh
3 changes: 2 additions & 1 deletion rkeops/.Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
\.gitkeep
\.gitignore
^prebuild\.R$
^recipe\.md$
^README_dev\.md$
^benchmarks$
^ci$
^dev$
Expand All @@ -16,3 +16,4 @@ TODOs.md
^_pkgdown\.yml$
^docs$
^pkgdown$
^Rplots\.pdf$
6 changes: 3 additions & 3 deletions rkeops/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rkeops
Title: Kernel Operations on GPU or CPU, with Autodiff, without Memory
Overflows
Version: 2.2.3
Version: 2.3.0
Authors@R: c(
person("Ghislain", "Durif", , "gd.dev@libertymail.net", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2567-1401", website = "<https://gdurif.perso.math.cnrs.fr/>")),
Expand Down Expand Up @@ -59,10 +59,10 @@ VignetteBuilder:
RdMacros:
Rdpack
Config/testthat/edition: 3
Date/Publication: 2024/04/16
Date/Publication: 2025/07/16
Encoding: UTF-8
OS_type: unix
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
SystemRequirements: Python (>= 3.5.0), C++ compiler (gcc/clang), CUDA
(optional but recommended)
9 changes: 6 additions & 3 deletions rkeops/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ export(clampint)
export(clean_rkeops)
export(concat)
export(cos)
export(def_rkeops_options)
export(default_rkeops_cache_dir)
export(elem)
export(elemT)
export(exp)
Expand All @@ -135,10 +137,8 @@ export(extractT)
export(get_rkeops_cache_dir)
export(get_rkeops_options)
export(grad)
export(helloWorld)
export(ifelse)
export(imag2complex)
export(install_rkeops)
export(inv)
export(is.ComplexLazyParameter)
export(is.ComplexLazyTensor)
Expand Down Expand Up @@ -213,6 +213,7 @@ importFrom(checkmate,assert_subset)
importFrom(checkmate,assert_true)
importFrom(checkmate,qassert)
importFrom(checkmate,qtest)
importFrom(checkmate,test_directory)
importFrom(checkmate,test_null)
importFrom(data.table,address)
importFrom(fs,as_fs_bytes)
Expand All @@ -228,7 +229,7 @@ importFrom(reticulate,np_array)
importFrom(reticulate,py_available)
importFrom(reticulate,py_capture_output)
importFrom(reticulate,py_config)
importFrom(reticulate,py_install)
importFrom(reticulate,py_require)
importFrom(reticulate,source_python)
importFrom(stringi,stri_rand_strings)
importFrom(stringr,"str_sub<-")
Expand All @@ -238,6 +239,7 @@ importFrom(stringr,str_count)
importFrom(stringr,str_detect)
importFrom(stringr,str_extract)
importFrom(stringr,str_extract_all)
importFrom(stringr,str_glue)
importFrom(stringr,str_length)
importFrom(stringr,str_locate_all)
importFrom(stringr,str_match)
Expand All @@ -251,3 +253,4 @@ importFrom(stringr,str_trim)
importFrom(tibble,lst)
importFrom(utils,head)
importFrom(utils,packageVersion)
importFrom(utils,tail)
16 changes: 9 additions & 7 deletions rkeops/R/formula_args.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
#' understood by the C++ code.
#'
#' @details
#' Mathematical formula: `sum_i e^(lambda*||x_i - y_j||^2)` where `x_i`, `y_j`
#' are 3d vectors, and `lambda` is a scaler parameter.
#' Mathematical formula: `sum_i e^(sigma*||x_i - y_j||^2)` where `x_i`, `y_j`
#' are 3d vectors, and `sigma` is a scaler parameter.
#'
#' Corresponding KeOps formula and input parameters:
#' ```
#' formula = "Sum_Reduction(Exp(lambda * SqNorm2(x-y)), 0)"
#' args = c("x=Vi(3)", "y=Vj(3)", "lambda=Pm(1)")
#' formula = "Sum_Reduction(Exp(sigma * SqNorm2(x-y)), 0)"
#' args = c("x=Vi(3)", "y=Vj(3)", "sigma=Pm(1)")
#' ```
#'
#' Input arguments can be of different types:
Expand All @@ -35,9 +35,9 @@
#' variable or none, if not specify the natural order in the vector `args` is
#' used.
#'
#' For the formula `"Sum_Reduction(Exp(lambda * SqNorm2(x-y)), 0)"`, both
#' `args = c("x=Vi(3)", "y=Vj(3)", "lambda=Pm(1)")` and
#' `args <- c("x=Vi(0,3)", "y=Vj(1,3)", "beta=Vj(2,3)", "lambda=Pm(3,1)")` are
#' For the formula `"Sum_Reduction(Exp(sigma * SqNorm2(x-y)), 0)"`, both
#' `args = c("x=Vi(3)", "y=Vj(3)", "sigma=Pm(1)")` and
#' `args <- c("x=Vi(0,3)", "y=Vj(1,3)", "beta=Vj(2,3)", "sigma=Pm(3,1)")` are
#' equivalent. When specifying the `pos` parameter, the natural order in the
#' vector `args` may not correspond to the order of the formula input arguments.
#'
Expand Down Expand Up @@ -65,6 +65,7 @@
#' str_replace_all fixed
#'
#' @importFrom checkmate assert_character assert_string
#' @noRd
parse_args <- function(formula, args) {

# check input type
Expand Down Expand Up @@ -205,6 +206,7 @@ parse_args <- function(formula, args) {
#' @return a boolean value indicating if extra args were found in the formula.
#'
#' @importFrom stringr str_match_all str_replace
#' @noRd
parse_extra_args <- function(formula) {

## remove space
Expand Down
66 changes: 0 additions & 66 deletions rkeops/R/install.R

This file was deleted.

14 changes: 12 additions & 2 deletions rkeops/R/keops_grad.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#' @importFrom tibble lst
#'
#' @author Ghislain Durif
#' @noRd
get_gradient_formula <- function(formula, args, var, args_info) {
# check input
assert_string(formula)
Expand Down Expand Up @@ -137,9 +138,14 @@ get_gradient_formula <- function(formula, args, var, args_info) {
#' @seealso [rkeops::keops_kernel()]
#'
#' @examples
#' \dontrun{
#' \donttest{
#' \dontshow{
#' # Specific setup for example runs (not necessary for standard use)
#' reticulate::py_available(initialize = TRUE)
#' set_rkeops_options()
#'
#' # For build on CRAN, use CPU computing with 2 cores max
#' rkeops_use_cpu(ncore = 2)
#' }
#' # defining an operator (reduction on squared distance)
#' formula <- "Sum_Reduction(SqNorm2(x-y), 0)"
#' args <- c("x=Vi(0,3)", "y=Vj(1,3)")
Expand Down Expand Up @@ -175,6 +181,10 @@ get_gradient_formula <- function(formula, args, var, args_info) {
#' # computation
#' input <- list(x, y, eta)
#' res <- op(input)
#' \dontshow{
#' # clean-up (for CRAN build)
#' clean_rkeops(remove_cache_dir = TRUE)
#' }
#' }
#' @export
keops_grad <- function(operator, var) {
Expand Down
32 changes: 22 additions & 10 deletions rkeops/R/keops_kernel.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,23 @@
#' @seealso [rkeops::keops_grad()]
#'
#' @examples
#' \dontrun{
#' \donttest{
#' \dontshow{
#' # Specific setup for example runs (not necessary for standard use)
#' reticulate::py_available(initialize = TRUE)
#' set_rkeops_options()
#'
#' # For build on CRAN, use CPU computing with 2 cores max
#' rkeops_use_cpu(ncore = 2)
#' }
#' ## Example 1
#' # Defining a function that computes for each j the sum over i
#' # of the scalar products between `x_i` and `y_j` (both 3d vectors),
#' # i.e. the sum over the rows of the result of the matrix product `X * t(Y)`
#' # where `x_i` and `y_j` are the respective rows of the matrices `X` and `Y`.
#' op <- keops_kernel(
#' formula = "Sum_Reduction((x|y), 1)", args = c("x=Vi(3)", "y=Vj(3)"))
#' formula = "Sum_Reduction((x|y), 1)",
#' args = c("x=Vi(3)", "y=Vj(3)")
#' )
#' # data
#' nx <- 10
#' ny <- 15
Expand Down Expand Up @@ -112,11 +119,12 @@
#'
#' ## Example 2
#' # Defining a function that computes the convolution with a Gaussian kernel
#' # i.e. the sum over i of `e^(lambda * ||x_i - y_j||^2) * beta_j` where `x_i`,
#' # `y_j` and `beta_j` are 3d vectors, and `lambda` is a scalar parameter.
#' op = keops_kernel(
#' formula = "Sum_Reduction(Exp(lambda*SqNorm2(x-y))*beta, 1)",
#' args = c("x=Vi(3)", "y=Vj(3)", "beta=Vj(3)", "lambda=Pm(1)"))
#' # i.e. the sum over i of `e^(sigma * ||x_i - y_j||^2) * beta_j` where `x_i`,
#' # `y_j` and `beta_j` are 3d vectors, and `sigma` is a scalar parameter.
#' op <- keops_kernel(
#' formula = "Sum_Reduction(Exp(sigma*SqNorm2(x-y))*beta, 1)",
#' args = c("x=Vi(3)", "y=Vj(3)", "beta=Vj(3)", "sigma=Pm(1)")
#' )
#'
#' # data
#' nx <- 10
Expand All @@ -130,10 +138,14 @@
#' # !! important !! y and beta should have the same dimension
#'
#' # parameter
#' lambda <- 0.25
#' sigma <- 0.25
#'
#' # compute the result
#' res <- op(list(X, Y, beta, lambda))
#' res <- op(list(X, Y, beta, sigma))
#' \dontshow{
#' # clean-up (for CRAN build)
#' clean_rkeops(remove_cache_dir = TRUE)
#' }
#' }
#' @export
keops_kernel <- function(formula, args, sum_scheme = "auto") {
Expand Down
18 changes: 5 additions & 13 deletions rkeops/R/keops_setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#' @importFrom fs dir_create
#' @importFrom reticulate py_config
#' @importFrom stringr str_c str_length
#' @noRd
def_pykeops_build_dir <- function() {

# system info
Expand All @@ -37,7 +38,7 @@ def_pykeops_build_dir <- function() {
str_c(
"keops_",
str_c("R", as.character(getRversion())),
str_c("Python", reticulate::py_config()$version),
str_c("Python", as.character(reticulate::py_config()$version)),
str_c("pykeops", pykeops[["__version__"]]),
str_c(
sys_info$sysname, sys_info$release,
Expand Down Expand Up @@ -73,10 +74,7 @@ def_pykeops_build_dir <- function() {
#'
#' @seealso [rkeops::setup_pykeops()]
#'
#' @examples
#' \dontrun{
#' set_pykeops_verbosity()
#' }
#' @noRd
set_pykeops_verbosity <- function() {
# current verbosity level
verbosity <- get_rkeops_options("verbosity")
Expand Down Expand Up @@ -112,10 +110,7 @@ set_pykeops_verbosity <- function() {
#'
#' @seealso [rkeops::def_pykeops_build_dir()], [rkeops::setup_pykeops()]
#'
#' @examples
#' \dontrun{
#' set_pykeops_build_dir()
#' }
#' @noRd
set_pykeops_build_dir <- function() {
# current cache dir
cache_dir <- get_rkeops_cache_dir()
Expand Down Expand Up @@ -154,10 +149,7 @@ set_pykeops_build_dir <- function() {
#'
#' @seealso [rkeops::set_pykeops_verbosity()], [rkeops::set_pykeops_build_dir()]
#'
#' @examples
#' \dontrun{
#' setup_pykeops()
#' }
#' @noRd
setup_pykeops <- function() {
set_pykeops_verbosity()
set_pykeops_build_dir()
Expand Down
Loading