A helper method to find the best multithreading configuration for your computer
optimizeCoreGx.Rd
A 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.frame
of 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.004809363
#> 2 { assay(sample_data, 1, withDimnames = TRUE) NA } 2 0.004651678
#> 3 { assays(sample_data) NA } 1 0.006402510
#> 4 { assays(sample_data) NA } 2 0.006333161
#> 5 { reindex(sample_data) NA } 1 0.007267264
#> 6 { reindex(sample_data) NA } 2 0.007330232
#> median_sec total_sec mem_alloc_mb itr/sec gc/sec
#> 1 0.005027693 0.4759264 3.318424 193.3072 4.202330
#> 2 0.004806819 0.4769783 2.181288 207.5566 4.193062
#> 3 0.006555127 0.4684473 2.738928 151.5645 4.269423
#> 4 0.006459779 0.2018707 2.738928 153.5636 4.953666
#> 5 0.007471156 0.5051070 1.845168 132.6452 0.000000
#> 6 0.007523981 0.5002275 1.537576 131.9400 0.000000
# }