Skip to content

Single core#1061

Open
mattfidler wants to merge 10 commits into
mainfrom
single-core
Open

Single core#1061
mattfidler wants to merge 10 commits into
mainfrom
single-core

Conversation

@mattfidler

Copy link
Copy Markdown
Member

No description provided.

mattfidler and others added 10 commits May 26, 2026 22:38
Adds Rxc_single (index 115) to rxode2_control.h and regenerates
rxode2parse_control.h to match.  Adds four fields to rx_globals:
singleMode flag, singleDataFrame SEXP (for R_PreserveObject), and
owned buffer pointers gidose_own/gdbl_own used by the no-copy path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Exposes the no-copy solve path via single=FALSE (default).  When TRUE
the parameter is validated, passed through the rxControl list, and
incompatibility with serializeFile is enforced with an early stop().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When single=TRUE, skip the large calloc+memcpy for evid, time, amt,
dv, ii, cens, and limit by pointing the C globals directly into the
R SEXP memory via INTEGER()/REAL().  R_PreserveObject keeps the data
frame alive until gFree() calls R_ReleaseObject.

Only the small computed arrays (gidose, gpar_cov, gpar_covInterp,
glhs_str, and optional zero-fill buffers for absent columns) are still
allocated and owned by gidose_own/gdbl_own.  Scan-loop writes to gamt
and gii are guarded with !singleMode to avoid mutating R objects.
gFree() releases the preserved SEXP and frees only the owned buffers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… path

Three new ALTREP classes in rxode2_altrep.c/h:
- rx_col_view_int/real: Dataptr() returns original column pointer (no copy)
- rx_cmt_trans: lazy CMT name/int -> solver compartment translation;
  Elt() translates one element on demand, Dataptr() materialises on first call

Also adds RxTrans_addlAdd (31) and RxTrans_ssAdd (32) constants plus
RxTransNamesSingle macro (33-slot list) to rxode2parse_control.h.
Updates build.R genDefine() to regenerate both RxTransNames variants
and fixes attribute name bug (.rxode2 -> .rxode2.lst).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
etTransSingle wraps original data frame columns via ALTREP (rx_col_view_int/real)
for zero allocation on passthrough columns (ID, TIME, EVID, AMT, II, DV,
covariates). CMT translation uses the lazy rx_cmt_trans ALTREP. ADDL and SS
columns are kept as views for per-record handler dispatch (not pre-expanded).

Output is a valid rxEtTran data frame with the 33-slot metadata list including
the new addlAdd and ssAdd flags. Supports iCov, keep= columns, and named CMT.

Also fixes DATAPTR -> DATAPTR_RW in col-view ALTREP classes for R >= 4.6.
Registers etTransSingle in init.c for .Call lookup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add rxcAddl and rxcSs global column index variables
- Update rxEtTran detection (rxIs and rxSolve_ev1Update setup) to scan
  column names for ADDL/SS/CMT and handle 33-slot etTransSingle metadata
- Route plain data.frame inputs through etTransSingle when single=TRUE,
  falling back to etTrans for single=FALSE

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests cover: simple bolus, ADDL dosing, SS dosing, time-varying covariates,
iCov, named CMT column, and keep= columns. All 7 test cases verify that
the zero-copy etTransSingle path produces identical results to the full
etTrans path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
#1061 added single=FALSE to rxSolve()'s formals but not its roxygen, which
produced a codoc mismatch WARNING (argument in code not in docs). Add the
@param single description and the matching rxSolve.Rd usage/arguments entry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant