Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
id: set-matrix
shell: bash
run: |
json=$(bash rcp/tests/list-tests.sh | tr ' ' '\n' | jq -R . | jq -sc '{"test": .}')
json=$(find rcp/tests -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort | jq -R . | jq -sc '{"test": .}')
echo "Discovered tests: $json"
echo "matrix=$json" >> "$GITHUB_OUTPUT"

Expand All @@ -112,7 +112,6 @@ jobs:
needs: build-images
strategy:
fail-fast: false
max-parallel: 1
matrix: ${{ fromJson(needs.build-images.outputs.test-matrix) }}
permissions:
contents: read
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ perf.data
/rcp/tests/perf/*.old
/rcp/tests/perf/*.data
/rcp/tests/perf/profile.json.gz
/rcp/.install-stamp
/rcp/.install-stamp.cfg
49 changes: 10 additions & 39 deletions rcp/Makefile
Original file line number Diff line number Diff line change
@@ -1,45 +1,23 @@
include common.mk

.PHONY: all
all: install

.PHONY: check-toolchain
check-toolchain:
@command -v $(CC) >/dev/null 2>&1 || (echo "Missing compiler: $(CC)"; exit 1)
@command -v $(CXX) >/dev/null 2>&1 || (echo "Missing compiler: $(CXX)"; exit 1)
@cc_ver=`$(CC) -dumpfullversion -dumpversion | cut -d. -f1`; \
if [ "$$cc_ver" != "14" ]; then \
echo "Expected GCC major version 14 for $(CC), got $$cc_ver"; \
exit 1; \
fi
@cxx_ver=`$(CXX) -dumpfullversion -dumpversion | cut -d. -f1`; \
if [ "$$cxx_ver" != "14" ]; then \
echo "Expected G++ major version 14 for $(CXX), got $$cxx_ver"; \
exit 1; \
fi
@printf 'int main(void){return 0;}\n' | $(CC) $(C_STD_FLAG) -x c -fsyntax-only -
@printf '#include <concepts>\nint main(){return 0;}\n' | $(CXX) $(CXX_STD_FLAG) -x c++ -fsyntax-only -

.PHONY: install
install: check-toolchain
MAKEFLAGS="$(MAKEFLAGS) CC=$(CC) CXX=$(CXX)" $(R) CMD INSTALL .
BEAR := $(shell command -v bear 2>/dev/null)
BEAR := $(if $(BEAR),$(BEAR) --)

install:
$(BEAR) $(R) CMD INSTALL .

.PHONY: clean
clean:
$(MAKE) -C src -f Makevars clean
rm -f compile_commands.json

.PHONY: test
test: check-toolchain
$(MAKE) clean && $(MAKE) install DEBUG=1 RCP_COMPILE_PROMISES=1
$(MAKE) -C tests test; \
status=$$?; \
$(MAKE) clean \
exit $$status

.PHONY: test-functional
test-functional: install
$(MAKE) -C tests/smoketest test
$(MAKE) -C tests/types test
$(MAKE) -C tests/gdb-jit test
test: install
$(MAKE) -C tests test

.PHONY: run
run: install
Expand All @@ -53,20 +31,13 @@ debug: install
format:
find src -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" \) -exec clang-format -i {} +

.PHONY: setup
setup: check-toolchain
$(R) --quiet -e 'install.packages("microbenchmark", repos="https://cloud.r-project.org")'

BENCH_ITER ?= 15
BENCH_PARALLEL ?= 1
BENCH_OUT_DIR ?=

.PHONY: benchmark
benchmark: check-toolchain
benchmark:
@$(call ensure_microbenchmark_installed)
@RSH_HOME=$(RSH_HOME) R_HOME=$(R_HOME) ./inst/benchmarks/run-benchmarks.sh \
--runs $(BENCH_ITER) --parallel $(BENCH_PARALLEL) \
$(if $(BENCH_OUT_DIR),--output $(BENCH_OUT_DIR))

compile_commands.json:
bear -- $(MAKE) clean install
19 changes: 18 additions & 1 deletion rcp/R/compile.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
.rcp_banner <- function() {
info <- .Call("C_rcp_build_info")
ver <- utils::packageVersion("rcp")
flags <- c(
if (info$compile_promises) "promises",
if (nzchar(Sys.getenv("RCP_DUMP_DIR"))) paste0("dump:", Sys.getenv("RCP_DUMP_DIR")),
if (nzchar(Sys.getenv("RCP_GDB_JIT"))) "gdb",
if (nzchar(Sys.getenv("RCP_PERF_JIT"))) "perf"
)
flag_str <- if (length(flags)) paste0(" [", paste(flags, collapse = ", "), "]") else ""
packageStartupMessage(sprintf("rcp %s (%s)%s", ver, info$git_commit, flag_str))
}

.onLoad <- function(libname, pkgname) {
.Call("rcp_init");
}

.onAttach <- function(libname, pkgname) {
.rcp_banner()
}

#' Compile a function
#'
#' This function compiles another function with optional settings.
Expand Down Expand Up @@ -46,7 +63,7 @@ rcp_jit_disable <- function() {
#' @return A list with counts of successfully compiled and failed functions
#' @export
rcp_cmppkg <- function(package) {
.Call(C_rcp_cmppkg, package)
invisible(.Call(C_rcp_cmppkg, package))
}

#' Get profiling data from RCP
Expand Down
84 changes: 0 additions & 84 deletions rcp/code.R

This file was deleted.

3 changes: 3 additions & 0 deletions rcp/src/Makevars
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
include ../common.mk

RCP_GIT_COMMIT := $(shell git -C $(ROOT_DIR) rev-parse --short HEAD 2>/dev/null || echo NA)
PKG_CFLAGS += -DRCP_GIT_COMMIT=\"$(RCP_GIT_COMMIT)\"

OPENMP ?= 0

ifneq ($(OPENMP),0)
Expand Down
Loading
Loading