Skip to content

Commit

Permalink
update non-GPU Makevars
Browse files Browse the repository at this point in the history
  • Loading branch information
jianxiaoyang committed Oct 24, 2023
1 parent 3549a9d commit 4e15b30
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 2 deletions.
77 changes: 77 additions & 0 deletions src/MakevarsCPU.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
## Use the R_HOME indirection to support installations of multiple R version
PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"`

## As an alternative, one can also add this code in a file 'configure'
##
## PKG_LIBS=`${R_HOME}/bin/Rscript -e "Rcpp:::LdFlags()"`
##
## sed -e "s|@PKG_LIBS@|${PKG_LIBS}|" \
## src/Makevars.in > src/Makevars
##
## which together with the following file 'src/Makevars.in'
##
## PKG_LIBS = @PKG_LIBS@
##
## can be used to create src/Makevars dynamically. This scheme is more
## powerful and can be expanded to also check for and link with other
## libraries. It should be complemented by a file 'cleanup'
##
## rm src/Makevars
##
## which removes the autogenerated file src/Makevars.
##
## Of course, autoconf can also be used to write configure files. This is
## done by a number of packages, but recommended only for more advanced users
## comfortable with autoconf and its related tools.

PKG_CPPFLAGS = -I. -Icyclops -DR_BUILD -DDOUBLE_PRECISION
PKG_CXXFLAGS = -g1

OBJECTS.cyclops = \
cyclops/CcdInterface.o \
cyclops/CompressedDataMatrix.o \
cyclops/CyclicCoordinateDescent.o \
cyclops/ModelData.o \
cyclops/Timer.o

OBJECTS.drivers = \
cyclops/drivers/AbstractCrossValidationDriver.o \
cyclops/drivers/AbstractDriver.o \
cyclops/drivers/AbstractSelector.o \
cyclops/drivers/AutoSearchCrossValidationDriver.o \
cyclops/drivers/BootstrapDriver.o \
cyclops/drivers/BootstrapSelector.o \
cyclops/drivers/CrossValidationSelector.o \
cyclops/drivers/WeightBasedSelector.o \
cyclops/drivers/GridSearchCrossValidationDriver.o \
cyclops/drivers/HierarchyAutoSearchCrossValidationDriver.o \
cyclops/drivers/HierarchyGridSearchCrossValidationDriver.o \
cyclops/drivers/ProportionSelector.o

OBJECTS.priors = \
cyclops/priors/CovariatePrior.o

OBJECTS.io = \
cyclops/io/InputReader.o

OBJECTS.engine = \
cyclops/engine/AbstractModelSpecifics.o

OBJECTS.utils = \
utils/HParSearch.o

OBJECTS.thread = \
tinythread/tinythread.o

OBJECTS.R = \
IsSorted.o \
RcppExports.o \
RcppModelData.o \
RcppCyclopsInterface.o \
RcppGpuInterface.o \
RcppIsSorted.o

OBJECTS = $(OBJECTS.cyclops) $(OBJECTS.drivers) \
$(OBJECTS.engine) $(OBJECTS.utils) \
$(OBJECTS.threads) $(OBJECTS.R) \
$(OBJECTS.priors) $(OBJECTS.io)
8 changes: 6 additions & 2 deletions tests/testthat/test-gpucox.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ library("testthat")
library("survival")


GpuDevice <- listOpenCLDevices()[1] # "TITAN V"
# GpuDevice <- listOpenCLDevices()[2] # "GeForce RTX 2080"
GpuDevice <- listOpenCLDevices()[1]
tolerance <- 1E-4


# small cox
test_that("Check small Cox on GPU", {
skip_if(length(listOpenCLDevices()) == 0, "GPU not available")
test <- read.table(header=T, sep = ",", text = "
start, length, event, x1, x2
0, 4, 1,0,0
Expand All @@ -34,6 +34,7 @@ test_that("Check small Cox on GPU", {
})

test_that("Check very small Cox example with time-ties", {
skip_if(length(listOpenCLDevices()) == 0, "GPU not available")
test <- read.table(header=T, sep = ",", text = "
start, length, event, x1, x2
0, 4, 1,0,0
Expand All @@ -59,6 +60,7 @@ start, length, event, x1, x2

# large cox
test_that("Check Cox on GPU", {
skip_if(length(listOpenCLDevices()) == 0, "GPU not available")
set.seed(123)
sim <- simulateCyclopsData(nstrata = 1,
nrows = 100000,
Expand All @@ -83,6 +85,7 @@ test_that("Check Cox on GPU", {

# lasso cv
test_that("Check cross-validation for lasso Cox on GPU", {
skip_if(length(listOpenCLDevices()) == 0, "GPU not available")
set.seed(123)
sim <- simulateCyclopsData(nstrata = 1,
nrows = 900,
Expand Down Expand Up @@ -112,6 +115,7 @@ test_that("Check cross-validation for lasso Cox on GPU", {

# multi-core
test_that("Check multi-core cross-validation for lasso Cox on GPU", {
skip_if(length(listOpenCLDevices()) == 0, "GPU not available")
set.seed(123)
sim <- simulateCyclopsData(nstrata = 1,
nrows = 900,
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-timevaryingCox.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ GpuDevice <- listOpenCLDevices()[1]
tolerance <- 1E-4

test_that("Check very small Cox example with time-varying coefficient as stratified model", {
skip_if(length(listOpenCLDevices()) == 0, "GPU not available")
test <- read.table(header=T, sep = ",", text = "
start, length, event, x1, x2
0, 4, 1,0,0
Expand Down

0 comments on commit 4e15b30

Please sign in to comment.