cuplyr 0.2.0
cuplyr 0.2.0 brings most of dplyr to the GPU. Nearly every dplyr verb now works on a tbl_gpu, cuplyr’s GPU table. Most run on the GPU, and the rest run in dplyr on the CPU with the same result. GPU tables are lazy by default, so an optimizer runs the whole pipeline at collect(). Also new: join_by() joins, window and rolling functions, across(), rowwise(), set operations, Parquet files on the GPU, exact integer64 columns and a conda package. cuplyr now needs RAPIDS libcudf 26.02 or later and a GPU with compute capability 7.5 or higher.
Breaking changes
GPU tables are lazy by default.
tbl_gpu()returns a lazy table, each verb records a step, andcollect(),compute()orprint()run the plan. Errors in a verb’s arguments are still raised by that verb, but dplyr’s warnings, such as integer overflow or a many-to-many join, come when the plan runs, at everyprint()too. For eager tables, setoptions(cuplyr.exec_mode = "eager")or passlazy = FALSE.On a lazy table with pending steps,
nrow()anddim()run the plan, whilegpu_object_info()andgpu_memory_usage()count the rows of the table it was made from andverify_gpu_data()can returnFALSE. Callcompute()first.cuplyr needs RAPIDS libcudf 26.02 or later and is tested on 26.10. RAPIDS 25.12 is no longer supported (#94).
The minimum GPU is compute capability 7.5 (Turing). The conda package and the pixi and conda install routes use a CUDA 13 build of RAPIDS, which has no code for Volta (#150).
-
Results that differed from dplyr now match it:
- Grouping follows dplyr.
summarise()drops only the last grouping column by default (.groups = "drop_last", with a message like dplyr’s),select()keeps the grouping columns, joins keepx’s groups,bind_rows()keeps the first input’s groups,collect()returns agrouped_df, andtbl_gpu()keeps the groups of agrouped_df. In 0.1.1 each of these dropped the groups.ungroup(x, col)removes onlycol; 0.1.1 removed every group. -
group_by()evaluates its arguments as dplyr does. A tidyselect helper needspick(), as ingroup_by(pick(all_of(cols))), and a string such asgroup_by("x")makes one constant group; 0.1.1 took both as column names.group_by()with no arguments removes the grouping; 0.1.1 kept it. -
select(new = old)renames the column; 0.1.1 kept the old name. -
summarise()aggregates follow R’sna.rm = FALSEdefault, so a group with anNAgivesNA. - An ungrouped
summarise()of zero rows, such as after afilter()that keeps none, returns one row, wheresum()gives 0; 0.1.1 returned no rows. -
arrange(desc(x))putsNAlast, andarrange(.by_group = TRUE)sorts the group columns ascending, as dplyr does. - Grouped
summarise()returns groups sorted by their keys, not in hash order, and keeps rows whose key isNAas a last group; 0.1.1 dropped those rows. -
full_join()fills the keys of rows found only iny; 0.1.1 left themNA. - Integer
+,-and*return integers, not doubles. An overflow givesNAwith R’s warning. - In
summarise(),sum()of integers or logicals, such assum(x > 0), and an ungroupedn()return integers, not doubles, andmin()andmax()of a logical column return integers, not logicals. Asum()too large for an integer is a double, as in R. -
NaNstaysNaN; it used to becomeNAon upload. -
integer64columns are exact and collect tobit64::integer64; they used to be uploaded as doubles, which corrupted them. -
POSIXctcolumns keep their time zone instead of coming back in UTC. - A GPU table made from a
data.framecollects to adata.frame, with its attributes. - Factor columns stay factors after
select(), joins,bind_rows(),bind_cols(), a lazymutate()and assummarise()group keys, and ordered factors stay ordered; 0.1.1 returned integer codes, or plain factors. Joins match factor keys by their labels; 0.1.1 matched the codes, which paired the wrong rows when the two tables’ levels differed.
- Grouping follows dplyr.
Uploading a column with no GPU type (
difftime,hms,ts,POSIXlt, a list, a matrix with several columns, …) raises an error that names the column, instead of losing its class. So does a verb that makes adifftimeon the CPU, such asend - starton dates. Returning such columns is an open issue (#65).print()uses a tibble-style# A tbl_gpu: n x mheader, R type labels and factor labels.show_query()is now a method for dplyr’s generic. Its argument isx, and it prints the plan as R code and returnsxinvisibly.$,[[andlength()of a GPU table give its columns, as for a data frame, andnames<-acceptsNAand empty names. In 0.1.1,$,[[andlength()gave the object’s internal fields, such asx$schemaandx$ptr, andnames<-refused those names (#4).split(),with(),subset(),t(),as.environment(),is.na()andanyNA()of a GPU table raise an error; they used to act on the internal fields.
Installation and requirements
cuplyr is available as a conda package,
r-cuplyr, on thebbtheochannel on anaconda.org. It is a binary for RAPIDS 26.10 and CUDA 13 that needs an NVIDIA driver for CUDA 13 but no CUDA toolkit or compiler. Install it with conda, mamba or pixi; the README has the commands (#135).install.shandinstall_cuplyr()build cuplyr against libcudf from pixi, conda or the system (--method=picks one). The conda route installs RAPIDS 26.10 for CUDA 13 with the CUDA compiler, and the pixi environments carry the CUDA 13 build tools, so neither needs a system toolkit (#157)../configurestops with a clear message when libcudf is older than 26.02, and prefers the CUDA toolkit of a conda or pixi environment (#38, #94).New
check_deps()checks the driver, CUDA toolkit, libcudf and R packages,verify_installation()runs a small GPU round trip, anddiagnostics()reports versions, the GPU, the memory resource and every option for a bug report, as text or JSON.diagnose_loader()shows how cuplyr’s shared library resolves libstdc++, libcudf and libcuda (#14, #49).
New features
Verbs
Anything with no GPU form runs in dplyr on the CPU instead of failing.
options(cuplyr.fallback = "warn")reports each fallback with its reason and the data moved;"error"forbids them.Newly on the GPU:
filter_out(),transmute(),rename(),rename_with(),relocate(),distinct(),pull(),count(),tally(),add_count(),add_tally(),reframe(), theslice()family,top_n(),sample_n(),group_split(),group_trim(),group_data()and the other grouping functions,rowwise(), therows_*()verbs and the_at(),_all()and_if()verbs.group_map(),group_modify(),group_nest(),nest_by(),nest_join()anddo()run on the CPU..byworks inmutate(),filter(),summarise(),reframe()and theslice()family, and grouped verbs run per group on the GPU.group_by()takes computed keys and.drop = FALSE.rowwise()runs elementwise expressions and row aggregates such assum(c_across(a:e))on the GPU. On 1e5 rows that takes milliseconds, where dplyr takes about twenty seconds.[,[<-for whole columns,as.data.frame(),as_tibble(),glimpse(),head(),rbind(),cbind(),vctrs::vec_slice(),vctrs::vec_size(),dplyr::bind_rows()andpurrr::map_dfr()work on GPU tables.
Lazy plans
The optimizer now also prunes unused columns below
summarise(),arrange()and other barriers.explain()andshow_query()print the plan as R code without running it, including the columns a Parquet scan reads and the reason for each CPU fallback (#10).Printing a lazy table runs the whole plan to show the first rows and keeps nothing; a plan over a Parquet file prints its schema unless it only selects or renames columns.
A step whose result type or error depends on the data (an integer
sum(), a join withunmatched = "error") runs at the verb, as in eager mode;options(cuplyr.plan_break = "warn")reports it.
Expressions
-
filter(),mutate()andsummarise()share one expression engine that runs on the GPU:- arithmetic, comparisons, logic,
%in%,is.na(),is.nan(),between(),near()and math functions,round()with R’s rule; -
if_else(),case_when(),case_match(),coalesce(),na_if(),recode()and dplyr 1.2’srecode_values(),replace_values(),replace_when(),when_any()andwhen_all(); - window functions:
lag(),lead(), the ranking and cumulative functions,consecutive_id(),first(),last(),nth(),order_by()and grouped aggregates such asx - mean(x); - summaries:
median(),quantile(),n_distinct(),any(),all()and the rest, of any expression and with arithmetic around them (#22); - base string functions:
paste(),substr(),nchar(),toupper(),trimws(),grepl(),sub(),gsub(),startsWith(), …; - factor comparisons with labels and
as.character(); -
DateandPOSIXctliterals, casts anddate + n, lubridate’s date parts (year(),hour(),wday(), …) and fixed-unitfloor_date(),ceiling_date()andround_date().
- arithmetic, comparisons, logic,
across(),if_any(),if_all(),cur_group_id()andcur_column()run on the GPU;pick()as a data frame andcur_group()run on the CPU.A function of your own named like one cuplyr runs on the GPU (
mean(),lag(), …) is the one called, as in dplyr.
Joins and set operations
The mutating joins,
semi_join(),anti_join()andcross_join()run on the GPU, withjoin_by()equality, inequality,between(),within(),overlaps()andclosest()conditions.multiple,unmatched,relationship,na_matches,keepandsuffixfollow dplyr, and keys of different types combine by vctrs’ rules, an all-NAkey included (#70).union(),union_all(),intersect(),setdiff(),symdiff()andsetequal()run on the GPU.bind_rows()follows vctrs’ type rules and binds factors to the union of their levels. Binds and set operations return a lazy table when any input is lazy (#20, #70).
Parquet
New
read_parquet_gpu()andwrite_parquet_gpu()read and write Parquet files on the GPU; only compressed bytes cross the PCIe bus.A lazy read reads only the columns the plan uses and skips row groups for simple filters on integer,
integer64,DateandPOSIXctcolumns.options(cuplyr.parquet_pushdown = FALSE)turns this off; use it for untrusted files, as malformed statistics can crash the session.
Types
integer64comparisons, sorting, grouping, joins and binds run exactly on the GPU; arithmetic and aggregates follow bit64 on the CPU.NaNcounts as missing inis.na(), comparisons,arrange()and thena.rm = TRUEreducers, as in R.An infinite or out-of-range
DateorPOSIXctvalue warns on upload and becomesNA; it used to giveNAor a wrong date silently.Columns keep their element names, attributes and one-column matrix shape by dplyr’s rules, and tables with rows but no columns work (#19, #21, #56).
Strings go to the GPU as UTF-8, and columns with more than 2 GiB of characters work.
Rolling windows
- New
roll_mean(),roll_sum(),roll_min(),roll_max()androll_sd()run on the GPU inmutate()andfilter(), grouped or not, in time that doesn’t depend on the window width.data.table::frollmean()and its siblings work as aliases. Newroll_median()matchesstats::median()exactly and runs on the CPU.
Options, errors and memory
New
cuplyr_options()lists every option with its value and where it came from;?"cuplyr-options"documents them. An invalid value warns once, with classcuplyr_warning_invalid_option, and the default is used.Errors and warnings have dplyr’s class, message and call for missing columns, calls dplyr rejects and the
min()andmax()warnings for empty groups. Errors inmutate()carry dplyr’s class and itsIn argument:context (#13, #20, #24, #28, #30, #69).cuplyr installs CUDA’s stream-ordered (
"async") memory resource when it loads. It reserves a quarter of the free GPU memory, at most 1 GiB, and keeps the memory of freed tables for reuse, so other processes see it as used untilgpu_gc()returns it to the device and reports it inreleased_bytes. Each call frees its temporary GPU tables when it returns. Before loading, setoptions(cuplyr.memory_resource = "pool")for RMM’s pool,cuplyr.pool_initialto reserve less, orcuplyr.release_thresholdto release memory automatically (vignette("memory")).gpu_memory_state()reports the memory resource,pool_bytesandpool_used_bytes.used_bytescounts the memory the resource holds, so it no longer falls when a table is freed, and thefreed_bytesofgpu_gc()counts memory freed inside the resource.New
gpu_sync()waits for queued GPU work, for timing. A step that runs out of GPU memory is retried once after garbage collection, and the final error says what helps (#13).Loading cuplyr sets the environment variable
LIBCUDF_USE_DEBUG_STREAM_POOLunless it is set, so that Parquet reads don’t slow later verbs (?read_parquet_gpu).New
vignette("performance")andvignette("memory"), andvignette("query-optimization")matches the optimizer. Help-page examples run (#39).
Performance
Recording a
mutate()on a lazy table no longer slows down as the plan grows, and a column passed through a verb is shared instead of copied.Each
filter()ormutate()call runs as one fused GPU kernel where it can, and computes a repeatedround(),%in%or string call once (#17).A lazy
arrange(x) |> head(n)on one numeric or date key, andslice_min()/slice_max()(grouped too), use a top-k selection instead of a full sort.
Minor improvements and bug fixes
right_join()works (it failed on every call) and returns dplyr’s row order and keys.summarise()acceptsdplyr::n()andstats::sd(), names an unnamed expression after its text, and works lazily withsd()andvar().Lazy plans with chained joins, or a
mutate()that overwrites a column, give the right result.The namespace loads with only its stated dependencies (it failed when utils was not attached, which
R CMD checkreports),rowwise()’s method takesdatalike the generic, and the C++ code no longer uses the APIs libcudf 26.10 deprecates (#166).?tbl_gpuexplains what a GPU table is and how to work with one: lazy by default,collect(),compute(),explain(), eager mode and the column types. The verbs’ help pages say what runs on the GPU, what runs in dplyr on the CPU and where the result differs from dplyr, without internal development notes (#159).
cuplyr 0.1.1
Bug fixes
collect()now correctly restores factor columns with their original levels. Previously, factor columns were returned as integer codes instead of factors (#3).names<-()now validates the replacement value before assignment. It errors if the new names have wrong length, containNAvalues, empty strings, or are not character (#4).
Build system
Fixed CCCL (CUDA Core Compute Libraries) header detection for RAPIDS 25.12+ in pixi/conda environments where headers are located in a
rapids/subdirectory. The configure script now automatically detects<cuda/stream_ref>and related headers.Reordered include paths so CUDF/RMM headers take precedence over system CUDA headers, ensuring consistent CCCL versions.
cuplyr 0.1.0
Lazy evaluation
tbl_gpu()gains alazyargument to enable deferred execution. Operations build an AST (Abstract Syntax Tree) that is optimized and executed only whencollect()orcompute()is called. Set globally withoptions(cuplyr.exec_mode = "lazy")orCUPLYR_EXEC_MODE=lazyenvironment variable.-
Added an AST optimizer that applies multiple optimization passes before execution:
- Projection pruning: push column selection close to data sources
- Mutate fusion: combine consecutive mutate operations
- Dead column pruning: remove unused intermediate columns
- Filter pushdown: move filters earlier in the pipeline, including across joins
- Filter reordering: execute cheaper filters first
- Filter fusion: combine multiple filters into single GPU kernel
compute()executes pending lazy operations and keeps the result on GPU.collapse()inserts an optimization barrier without executing.as_lazy()andas_eager()switch execution modes mid-pipeline.is_lazy()andhas_pending_ops()check the current execution state.show_query()displays the pending operation tree for debugging.
Join operations
- Added
inner_join(),left_join(),right_join(), andfull_join()for combining GPU tables (#2). Joins support automatic key detection (natural join), named vectors inbyfor different key names,suffixfor column name conflicts,keepfor retaining join keys, andcopyto auto-transfer data frames to GPU.
Bind operations
Added
bind_rows()for vertically combining GPU tables with automatic schema unification and type promotion.Added
bind_cols()for horizontally combining GPU tables with.name_repairfor duplicate column handling.Both bind functions automatically materialize lazy tables before binding.
cuplyr 0.0.1
Initial release of cuplyr, a GPU-accelerated dplyr backend using NVIDIA’s libcudf library.
Core functionality
tbl_gpu()transfers R data frames to GPU memory, returning atbl_gpuobject that works with dplyr verbs.collect()transfers GPU data back to R as a tibble.as_tbl_gpu()coerces data frames to GPU tables.is_tbl_gpu()tests if an object is a GPU table.
dplyr verbs
filter()supports scalar comparisons (x > 5,x == "a") and column-to-column comparisons (x > y). Supports boolean vectors as filter masks.select()supports column selection by name, position, and tidyselect helpers.mutate()supports arithmetic operations (+,-,*,/,^) with scalars and between columns. Supports left-associative chains (e.g.,a + b + c).arrange()sorts by one or more columns withdesc()support for descending order. Supports.by_group = TRUEfor grouped tables.group_by()sets grouping metadata for subsequent aggregation.ungroup()removes grouping.summarise()computes grouped aggregations with support forsum(),mean(),min(),max(),n(),sd(), andvar(). Supports expressions inside aggregation functions (e.g.,sum(x > 0)).
Type support
Supported R types: numeric (FLOAT64), integer (INT32), character (STRING), logical (BOOL8), Date (TIMESTAMP_DAYS), and POSIXct (TIMESTAMP_MICROSECONDS).
factor columns are converted to INT32 codes.
integer64 columns are converted to FLOAT64 with a warning about precision loss for values exceeding 2^53.
GPU memory utilities
gpu_memory_usage()estimates GPU memory footprint of atbl_gpuobject.gpu_memory_state()returns current GPU memory usage (total, free, used).gpu_gc()forces garbage collection to free GPU memory from unreferenced tables.gpu_object_info()returns detailed information about a GPU table.verify_gpu_data()confirms data resides on GPU, not in R memory.gpu_size_comparison()compares R object size vs GPU data size.
GPU information
has_gpu()checks if a compatible GPU is available.gpu_details()returns GPU device information (name, compute capability, memory).
