irlba
irlba copied to clipboard
Divergence of SVD algorithm on our new server
Hello We have a weird divergence observed on our brand new DELL server. There is some kind of a limit (n=26) to which the algorithm will diverge and the variance will go to infinity. On other server, there are absolutely no divergence.
Here is what happen using your vignette:
> x <- matrix(rnorm(10000), nrow=100)
> p1 <- prcomp_irlba(x, n=25)
> summary(p1)
Importance of components:
PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 PC12 PC13 PC14 PC15 PC16 PC17 PC18 PC19 PC20
Standard deviation 1.93072 1.88609 1.82468 1.77365 1.72143 1.71928 1.69578 1.69065 1.67437 1.61940 1.58791 1.57456 1.55391 1.54809 1.50762 1.46779 1.45936 1.44044 1.40632 1.39936
Proportion of Variance 0.03797 0.03623 0.03391 0.03204 0.03018 0.03011 0.02929 0.02911 0.02855 0.02671 0.02568 0.02525 0.02459 0.02441 0.02315 0.02194 0.02169 0.02113 0.02014 0.01994
Cumulative Proportion 0.03797 0.07420 0.10811 0.14015 0.17033 0.20044 0.22973 0.25884 0.28740 0.31411 0.33979 0.36504 0.38964 0.41405 0.43720 0.45914 0.48083 0.50196 0.52211 0.54205
PC21 PC22 PC23 PC24 PC25
Standard deviation 1.36338 1.33735 1.32909 1.28945 1.27619
Proportion of Variance 0.01893 0.01822 0.01799 0.01693 0.01659
Cumulative Proportion 0.56099 0.57920 0.59719 0.61413 0.63072
> p2 <- prcomp_irlba(x, n=26)
> summary(p2)
Importance of components:
PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 PC12 PC13 PC14 PC15 PC16
Standard deviation 1.614e+31 3.123e+30 2.309e+30 7.639e+29 1.065e+29 7.870e+28 6.062e+28 3.816e+28 2.392e+28 5.975e+26 4.781e+26 1.766e+26 2.024e+25 2.770e+24 2.320e+24 5.093e+23
Proportion of Variance 2.653e+60 9.937e+58 5.432e+58 5.944e+57 1.155e+56 6.309e+55 3.743e+55 1.483e+55 5.828e+54 3.637e+51 2.328e+51 3.177e+50 4.173e+48 7.815e+46 5.482e+46 2.642e+45
Cumulative Proportion 2.653e+60 2.753e+60 2.807e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60
PC17 PC18 PC19 PC20 PC21 PC22 PC23 PC24 PC25 PC26
Standard deviation 4.074e+23 1.989e+23 1.254e+22 5.543e+21 2.312e+21 1.253e+21 5.402e+19 9.981e+18 2.378e+18 2.180e+18
Proportion of Variance 1.691e+45 4.029e+44 1.601e+42 3.130e+41 5.443e+40 1.598e+40 2.972e+37 1.015e+36 5.758e+34 4.840e+34
Cumulative Proportion 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60 2.813e+60
> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 11 (bullseye)
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.13.so
locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8 LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] irlba_2.3.5.1 Matrix_1.5-3 patchwork_1.1.2 SeuratObject_4.1.3 Seurat_4.3.0 dplyr_1.0.10
loaded via a namespace (and not attached):
[1] nlme_3.1-152 matrixStats_0.63.0 spatstat.sparse_3.0-0 RcppAnnoy_0.0.20 RColorBrewer_1.1-3 httr_1.4.4 sctransform_0.3.5
[8] tools_4.2.1 utf8_1.2.2 R6_2.5.1 KernSmooth_2.23-18 uwot_0.1.14 lazyeval_0.2.2 colorspace_2.0-3
[15] withr_2.5.0 sp_1.5-1 tidyselect_1.2.0 gridExtra_2.3 compiler_4.2.1 progressr_0.12.0 cli_3.4.1
[22] spatstat.explore_3.0-5 plotly_4.10.1 labeling_0.4.2 scales_1.2.1 lmtest_0.9-40 spatstat.data_3.0-0 ggridges_0.5.4
[29] pbapply_1.6-0 goftest_1.2-3 stringr_1.5.0 digest_0.6.31 spatstat.utils_3.0-1 pkgconfig_2.0.3 htmltools_0.5.4
[36] parallelly_1.33.0 fastmap_1.1.0 htmlwidgets_1.6.0 rlang_1.0.6 shiny_1.7.4 farver_2.1.1 generics_0.1.3
[43] zoo_1.8-11 jsonlite_1.8.4 spatstat.random_3.0-1 ica_1.0-3 magrittr_2.0.3 Rcpp_1.0.9 munsell_0.5.0
[50] fansi_1.0.3 abind_1.4-5 reticulate_1.26 lifecycle_1.0.3 stringi_1.7.8 MASS_7.3-53.1 Rtsne_0.16
[57] plyr_1.8.8 grid_4.2.1 parallel_4.2.1 listenv_0.9.0 promises_1.2.0.1 ggrepel_0.9.2 crayon_1.5.2
[64] deldir_1.0-6 miniUI_0.1.1.1 lattice_0.20-41 cowplot_1.1.1 splines_4.2.1 tensor_1.5 pillar_1.8.1
[71] igraph_1.3.5 spatstat.geom_3.0-3 future.apply_1.10.0 reshape2_1.4.4 codetools_0.2-18 leiden_0.4.3 glue_1.6.2
[78] data.table_1.14.6 png_0.1-8 vctrs_0.5.1 httpuv_1.6.7 polyclip_1.10-4 gtable_0.3.1 RANN_2.6.1
[85] purrr_0.3.5 tidyr_1.2.1 scattermore_0.8 future_1.30.0 ggplot2_3.4.0 mime_0.12 xtable_1.8-4
[92] later_1.3.0 survival_3.2-7 viridisLite_0.4.1 tibble_3.1.8 cluster_2.1.1 globals_0.16.2 fitdistrplus_1.1-8
[99] ellipsis_0.3.2 ROCR_1.0-11
Our full CPU info:
Architecture : x86_64
Mode(s) opératoire(s) des processeurs : 32-bit, 64-bit
Boutisme : Little Endian
Tailles des adresses: 46 bits physical, 48 bits virtual
Processeur(s) : 80
Liste de processeur(s) en ligne : 0-79
Thread(s) par cœur : 2
Cœur(s) par socket : 20
Socket(s) : 2
Nœud(s) NUMA : 2
Identifiant constructeur : GenuineIntel
Famille de processeur : 6
Modèle : 85
Nom de modèle : Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz
Révision : 7
Vitesse du processeur en MHz : 1000.267
Vitesse maximale du processeur en MHz : 3900,0000
Vitesse minimale du processeur en MHz : 1000,0000
BogoMIPS : 5000.00
Virtualisation : VT-x
Cache L1d : 1,3 MiB
Cache L1i : 1,3 MiB
Cache L2 : 40 MiB
Cache L3 : 55 MiB
Nœud NUMA 0 de processeur(s) : 0-19,40-59
Nœud NUMA 1 de processeur(s) : 20-39,60-79
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed: Mitigation; Enhanced IBRS
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and
seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer san
itization
Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, P
BRSB-eIBRS SW sequence
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; TSX disabled
Drapeaux : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cm
ov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pb
e syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmo
n pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfm
perf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ss
se3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic m
ovbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand la
hf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpc
id_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced
tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_
adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx51
2f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512
cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc
cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat
pln pts hwp hwp_act_window hwp_pkg_req pku ospke avx512_vnn
i md_clear flush_l1d arch_capabilities
By checking the results on another server (with no divergence), I can see that the BLAS and LAPACK library are different. There might be a problem with openblas-pthread when the number of CPUs available is high : https://github.com/xianyi/OpenBLAS/issues
Here is the example with no divergence on another server :
> x <- matrix(rnorm(10000000), nrow=10000)
> p1 <- prcomp_irlba(x, n=25)
> summary(p1)
Importance of components:
PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 PC12 PC13 PC14 PC15 PC16 PC17
Standard deviation 1.31683 1.31246 1.30698 1.30556 1.30363 1.30132 1.29976 1.29890 1.29758 1.29569 1.29256 1.29110 1.29020 1.28811 1.28691 1.28593 1.28463
Proportion of Variance 0.00173 0.00172 0.00171 0.00170 0.00170 0.00169 0.00169 0.00169 0.00168 0.00168 0.00167 0.00167 0.00166 0.00166 0.00166 0.00165 0.00165
Cumulative Proportion 0.00173 0.00345 0.00516 0.00687 0.00856 0.01026 0.01195 0.01363 0.01532 0.01699 0.01866 0.02033 0.02199 0.02365 0.02531 0.02696 0.02861
PC18 PC19 PC20 PC21 PC22 PC23 PC24 PC25
Standard deviation 1.28428 1.28324 1.28054 1.27906 1.27868 1.27655 1.27589 1.27440
Proportion of Variance 0.00165 0.00165 0.00164 0.00164 0.00163 0.00163 0.00163 0.00162
Cumulative Proportion 0.03026 0.03190 0.03354 0.03518 0.03681 0.03844 0.04007 0.04169
> p2 <- prcomp_irlba(x, n=26)
> summary(p2)
Importance of components:
PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 PC12 PC13 PC14 PC15 PC16 PC17
Standard deviation 1.31683 1.31246 1.30698 1.30556 1.30363 1.30132 1.29976 1.29890 1.29758 1.29569 1.29256 1.29110 1.29020 1.28811 1.28691 1.28593 1.28463
Proportion of Variance 0.00173 0.00172 0.00171 0.00170 0.00170 0.00169 0.00169 0.00169 0.00168 0.00168 0.00167 0.00167 0.00166 0.00166 0.00166 0.00165 0.00165
Cumulative Proportion 0.00173 0.00345 0.00516 0.00687 0.00856 0.01026 0.01195 0.01363 0.01532 0.01699 0.01866 0.02033 0.02199 0.02365 0.02531 0.02696 0.02861
PC18 PC19 PC20 PC21 PC22 PC23 PC24 PC25 PC26
Standard deviation 1.28428 1.28324 1.28054 1.27906 1.27868 1.27655 1.27589 1.27440 1.27340
Proportion of Variance 0.00165 0.00165 0.00164 0.00164 0.00163 0.00163 0.00163 0.00162 0.00162
Cumulative Proportion 0.03026 0.03190 0.03354 0.03518 0.03681 0.03844 0.04007 0.04169 0.04331
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 10 (buster)
Matrix products: default
BLAS: /usr/lib/R/lib/libRblas.so
LAPACK: /usr/lib/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8 LC_MONETARY=fr_FR.UTF-8
[6] LC_MESSAGES=fr_FR.UTF-8 LC_PAPER=fr_FR.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] irlba_2.3.5 Matrix_1.3-4
loaded via a namespace (and not attached):
[1] compiler_4.0.2 tools_4.0.2 grid_4.0.2 lattice_0.20-44
That is indeed odd. The problem must be related to the change in BLAS/LAPACK libraries. However I routinely test with openblas, and have not seen this.
Temporarily you could try setting the environment variable OMP_NUM_THREADS=1 which may help, for instance by starting R with:
OMP_NUM_THREADS=1 R
Investigating...
On 12/16/22, drbecavin @.***> wrote:
By checking the results on another server (with no divergence), I can see that the BLAS and LAPACK library are different. There might be a problem with openblas-pthread when the number of CPUs available is high : https://github.com/xianyi/OpenBLAS/issues
Here is the example with no divergence on another server :
> x <- matrix(rnorm(10000000), nrow=10000) > p1 <- prcomp_irlba(x, n=25) > summary(p1) Importance of components: PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 PC12 PC13 PC14 PC15 PC16 PC17 Standard deviation 1.31683 1.31246 1.30698 1.30556 1.30363 1.30132 1.29976 1.29890 1.29758 1.29569 1.29256 1.29110 1.29020 1.28811 1.28691 1.28593 1.28463 Proportion of Variance 0.00173 0.00172 0.00171 0.00170 0.00170 0.00169 0.00169 0.00169 0.00168 0.00168 0.00167 0.00167 0.00166 0.00166 0.00166 0.00165 0.00165 Cumulative Proportion 0.00173 0.00345 0.00516 0.00687 0.00856 0.01026 0.01195 0.01363 0.01532 0.01699 0.01866 0.02033 0.02199 0.02365 0.02531 0.02696 0.02861 PC18 PC19 PC20 PC21 PC22 PC23 PC24 PC25 Standard deviation 1.28428 1.28324 1.28054 1.27906 1.27868 1.27655 1.27589 1.27440 Proportion of Variance 0.00165 0.00165 0.00164 0.00164 0.00163 0.00163 0.00163 0.00162 Cumulative Proportion 0.03026 0.03190 0.03354 0.03518 0.03681 0.03844 0.04007 0.04169 > p2 <- prcomp_irlba(x, n=26) > summary(p2) Importance of components: PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 PC12 PC13 PC14 PC15 PC16 PC17 Standard deviation 1.31683 1.31246 1.30698 1.30556 1.30363 1.30132 1.29976 1.29890 1.29758 1.29569 1.29256 1.29110 1.29020 1.28811 1.28691 1.28593 1.28463 Proportion of Variance 0.00173 0.00172 0.00171 0.00170 0.00170 0.00169 0.00169 0.00169 0.00168 0.00168 0.00167 0.00167 0.00166 0.00166 0.00166 0.00165 0.00165 Cumulative Proportion 0.00173 0.00345 0.00516 0.00687 0.00856 0.01026 0.01195 0.01363 0.01532 0.01699 0.01866 0.02033 0.02199 0.02365 0.02531 0.02696 0.02861 PC18 PC19 PC20 PC21 PC22 PC23 PC24 PC25 PC26 Standard deviation 1.28428 1.28324 1.28054 1.27906 1.27868 1.27655 1.27589 1.27440 1.27340 Proportion of Variance 0.00165 0.00165 0.00164 0.00164 0.00163 0.00163 0.00163 0.00162 0.00162 Cumulative Proportion 0.03026 0.03190 0.03354 0.03518 0.03681 0.03844 0.04007 0.04169 0.04331 > sessionInfo() R version 4.0.2 (2020-06-22) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 10 (buster) Matrix products: default BLAS: /usr/lib/R/lib/libRblas.so LAPACK: /usr/lib/R/lib/libRlapack.so locale: [1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8 LC_MONETARY=fr_FR.UTF-8 [6] LC_MESSAGES=fr_FR.UTF-8 LC_PAPER=fr_FR.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] irlba_2.3.5 Matrix_1.3-4 loaded via a namespace (and not attached): [1] compiler_4.0.2 tools_4.0.2 grid_4.0.2 lattice_0.20-44
-- Reply to this email directly or view it on GitHub: https://github.com/bwlewis/irlba/issues/66#issuecomment-1354584654 You are receiving this because you are subscribed to this thread.
Message ID: @.***>