Learn R Programming

rkeops (version 1.4.2.2)

compile_options: Define a list of user-defined options used for compilation in rkeops package

Description

To compile new user-defined operators, rkeops requires compilation options that control the compilation process and the way user-defined operators behave (precision, verbosity, use of GPU, storage order, debug flag, and path to different required files).

The function default_compile_options returns a list of class rkeops_compile_options with default values for the corresponding options (see Details).

Usage

compile_options(
  precision = "float",
  verbosity = FALSE,
  use_cuda_if_possible = TRUE,
  col_major = TRUE,
  debug = FALSE,
  rkeops_dir = NULL,
  build_dir = NULL,
  src_dir = NULL
)

Value

a list (of class rkeops_compile_options) with the following elements:

rkeops_dir

string, path to rkeops install directory on the system.

build_dir

string, path to the directory where new custom user-defined operators will be compiled.

src_dir

string, path to keops (C++) source files required for compilation of user-defined operators.

precision

string, precision for floating point computations (float or double).

verbosity

integer, 0-1 indicator (boolean) for verbosity.

use_cuda_if_possible

integer, 0-1 indicator (boolean) regarding use of GPU in computations (if possible).

col_major

integer, 0-1 indicator (boolean) for storage order.

debug

integer, 0-1 indicator (boolean) for debugging flag.

Arguments

precision

string, precision for floating point computations (float or double). Default value is float.

verbosity

boolean indicator regarding verbosity level. Default value is FALSE.

use_cuda_if_possible

boolean indicator regarding compilation of the user-defined operators to be GPU-compatible (if possible on the system, i.e. if CUDA is available). Default value is TRUE. If set to TRUE and CUDA is not available, user-defined operators are compiled for CPU computations.

col_major

boolean indicator regarding storage order (default is TRUE).

debug

boolean indicator regarding debuging flag for compilation. Default value is FALSE.

rkeops_dir

string, path to rkeops install directory on the system. If NULL, default path described in Details section is used. Default value is NULL.

build_dir

string, path to the directory where new custom user-defined operators will be compiled. If NULL, default path described in Details section is used. Default value is NULL.

src_dir

string, path to keops (C++) source files required for compilation of user-defined operators. If NULL, default path described in Details section is used. Default value is NULL.

Author

Ghislain Durif

Details

The aforementioned compile options are the following:

  • rkeops_dir: path to rkeops install directory on the system (e.g. /path/to/R_package_install/rkeops on Unix system).

  • build_dir: path to directory where new user-defined operators will be compiled and corresponding share objects (.so files) will be saved (so that they can be found upon reuse to avoid useless recompilation). Default value is the build sub-folder in rkeops install directory (e.g. /path/to/R_package_install/rkeops/build on Unix system).

  • src_dir: path to keops (C++) source files required for compilation of user-defined operators. Default value is the include sub-folder in rkeops install directory (e.g. /path/to/R_package_install/rkeops/include on Unix system).

  • precision: precision for floating point computations (float or double). Default value is float.

  • verbosity: 0-1 indicator (boolean) for verbosity level. Default value is 0.

  • use_cuda_if_possible: 0-1 indicator (boolean) regarding use of GPU in computations (if possible on the system). Default value is 1.

  • col_major: 0-1 indicator (boolean) regarding matrix storage order in C++ KeOps API. 1 is column-major storage (or f_contiguous) and 0 is row-major storage (or c_contiguous). Default value is 1. This is independent from the storage order in R. Always keep in mind that matrices are stored with column-major order in R.

  • debug: 0-1 indicator (boolean) regarding compilation debugging flag. 1 means that user-defined operators will be compiled with a debug flag, and 0 means no debug flag. Default value is 0

Note on storage order: Column-major storage means that elements of each column of a matrix are contiguous in memory (called Fortran-style). Row-major storage means that each row of a matrix are contiguous in memory (called C-style). In R, matrices are stored with column-major order in R, so we recommend to use column-major order in for KeOps compilation (to avoid useless matrix conversion).

Note: Default options are set up when loading rkeops. To reset rkeops options to default, you should use the function set_rkeops_options(). To set up a particular option, you should use the function set_rkeops_option().

Some wrappers are available to enable some compilation options, see compile4float32(), compile4float64(), compile4cpu(), compile4gpu().

See Also

default_compile_options(), set_rkeops_options(), set_rkeops_option(), compile4float32(), compile4float64(), compile4cpu(), compile4gpu()

Examples

Run this code
compile_options(
    precision = 'float', verbosity = FALSE, 
    use_cuda_if_possible = TRUE, 
    col_major = TRUE, debug = FALSE, 
    rkeops_dir = NULL, build_dir = NULL, 
    src_dir = NULL)

Run the code above in your browser using DataLab