A helper method to find the best multithreading configuration for your computer
optimizeCoreGx.RdA helper method to find the best multithreading configuration for your computer
Arguments
- sample_data
TreatmentResponseExperiment- set
logical(1)Should the function modify your R environment with the predicted optimal settings? This changes the global state of your R session!- report
logical(1)Should adata.frameof results be returned by number of threads and operation be returned? Defaults to!set.
Value
If set=TRUE, modifies data.table threads via setDTthreads(), otherwise
displays a message indicating the optimal number of threads.
If report=TRUE, also returns a data.frame of the benchmark results.
Examples
# \donttest{
data(merckLongTable)
optimizeCoreGx(merckLongTable)
#> Benchmarking assay(sample_data, withDimnames=TRUE)...
#> Running with:
#> nthread
#> 1 1
#> 2 2
#> Benchmarking assays(sample_data)...
#> Running with:
#> nthread
#> 1 1
#> 2 2
#> Benchmarking reindex(sample_data)...
#> Running with:
#> nthread
#> 1 1
#> 2 2
#> Optimal cores for your machine are: 2
#> expression nthread min_sec
#> 1 { assay(sample_data, 1, withDimnames = TRUE) NA } 1 0.004518845
#> 2 { assay(sample_data, 1, withDimnames = TRUE) NA } 2 0.004476709
#> 3 { assays(sample_data) NA } 1 0.006334118
#> 4 { assays(sample_data) NA } 2 0.006194861
#> 5 { reindex(sample_data) NA } 1 0.007517587
#> 6 { reindex(sample_data) NA } 2 0.007476082
#> median_sec total_sec mem_alloc_mb itr/sec gc/sec
#> 1 0.004668490 0.4762282 3.318424 203.6838 4.199667
#> 2 0.004569084 0.4772656 2.181288 215.8128 4.190539
#> 3 0.006472881 0.4745693 2.738928 153.8237 4.214347
#> 4 0.006334953 0.1917391 2.738928 156.4626 5.215419
#> 5 0.007677781 0.5007810 1.845168 129.7973 0.000000
#> 6 0.007619751 0.5067137 1.537576 130.2511 0.000000
# }