Code:
library(anytime)
library(flipTime)
library(data.table)
set.seed(1)
system.time({
some_dates <- as.Date("2020-12-31") - sample(40000, 1e7, TRUE)
Code:
library(anytime)
library(flipTime)
library(data.table)
set.seed(1)
system.time({
some_dates <- as.Date("2020-12-31") - sample(40000, 1e7, TRUE)
Walk on thin ice in R for gcc-7/g++-7 + CUDA 10.0.130 | |
Note: OpenCL can run on Single Precision (gpu_use_dp = FALSE) or Double Precision (gpu_use_dp = TRUE) whereas CUDA is strictly Double Precision in LightGBM. | |
-- | |
STEP 1: HACK IN SOME FILES | |
Hack in the following: | |
``` |
library(xgboost) | |
library(lightgbm) | |
library(data.table) | |
setwd("/home/laurae/Documents/R/GBM-perf") | |
n_threads <- 16 | |
data <- fread("HIGGS.csv") | |
labels <- data$V1 |
library(xgboost) | |
set.seed(1) | |
N <- 1000000 | |
p <- 100 | |
pp <- 25 | |
X <- matrix(runif(N * p), ncol = p) | |
betas <- 2 * runif(pp) - 1 | |
sel <- sort(sample(p, pp)) | |
m <- X[, sel] %*% betas - 1 + rnorm(N) |
set.seed(1) | |
N <- 500000 | |
p <- 100 | |
pp <- 25 | |
X <- matrix(runif(N * p), ncol = p) | |
betas <- 2 * runif(pp) - 1 | |
sel <- sort(sample(p, pp)) | |
m <- X[, sel] %*% betas - 1 + rnorm(N) | |
y <- rbinom(N, 1, plogis(m)) |
library(xgboost) | |
set.seed(1) | |
N <- 10000000 | |
p <- 100 | |
pp <- 25 | |
X <- matrix(runif(N * p), ncol = p) | |
betas <- 2 * runif(pp) - 1 | |
sel <- sort(sample(p, pp)) | |
m <- X[, sel] %*% betas - 1 + rnorm(N) |
Step 1: download cplexAPI : Step 2: edit src/Makevars.win like the following, make sure cplex1280 is equal to your version you must change to the corresponding number you can find in C:/Program Files/IBM/ILOG/CPLEX_Studio128/cplex/bin/x64_win64:
PKG_CPPFLAGS=-g -D_R_=1 -DUSE_R=1 -I"C:/Program Files/IBM/ILOG/CPLEX_Studio128/cplex/include"
PKG_LIBS=-L"C:/Program Files/IBM/ILOG/CPLEX_Studio128/cplex/bin/x64_win64" -lm -lcplex1280
Step 3: in a R console, on the right folder:
library(Rcpp) | |
Sys.setenv(PKG_CXXFLAGS = "-fopenmp -std=c++11") | |
cppFunction(code = '#include <Rcpp.h> | |
#include <omp.h> | |
Rcpp::NumericVector streamer(Rcpp::NumericVector threads, int triad_size = 2147483647, int repeats = 10, int repeats_alloc = 3, bool simd = false) { | |
int i; |
# library(data.table) | |
# N=2e9; K=100 | |
# set.seed(1) | |
# DT <- data.table( | |
# id1 = sample(sprintf("id%03d",1:K), N, TRUE), # large groups (char) | |
# id2 = sample(sprintf("id%03d",1:K), N, TRUE), # large groups (char) | |
# id3 = sample(sprintf("id%010d",1:(N/K)), N, TRUE), # small groups (char) | |
# id4 = sample(K, N, TRUE), # large groups (int) | |
# id5 = sample(K, N, TRUE), # large groups (int) | |
# id6 = sample(N/K, N, TRUE), # small groups (int) |
# List all possible power config GUIDs in Windows | |
# Run: this-script.ps1 | Out-File powercfg.ps1 | |
# Then edit and run powercfg.ps1 | |
# (c) Pekka "raspi" Järvinen 2017 | |
$powerSettingTable = Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSetting | |
$powerSettingInSubgroubTable = Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSettingInSubgroup | |
Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSettingCapabilities | ForEach-Object { | |
$tmp = $_.ManagedElement |