Repository navigation
Open
Description
Following from #2 (comment), here's the full output. I'm using Apple's Accelerate BLAS (without fully understanding why, except 'it'll be faster')
> devtools::install_github("wrathematics/spm", force = TRUE)
Using GitHub PAT from envvar GITHUB_PAT
Downloading GitHub repo wrathematics/spm@master
from URL https://api.github.com/repos/wrathematics/spm/zipball/master
Installing spm
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file \
--no-environ --no-save --no-restore --quiet CMD INSTALL \
'/private/var/folders/f1/6pjy5xbn0_9_7xwq6l7fj2yc0000gn/T/RtmpKUmZrY/devtools452cfdf648/wrathematics-spm-a504dec' \
--library='/Library/Frameworks/R.framework/Versions/3.4/Resources/library' \
--install-tests
* installing *source* package ‘spm’ ...
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... none needed
BLAS_LIBS=-L/Library/Frameworks/R.framework/Resources/lib -lRblas
LAPACK_LIBS=-L/Library/Frameworks/R.framework/Resources/lib -lRlapack
checking for echo... yes
checking for grep... yes
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... gfortran
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether gfortran accepts -g... yes
Using internal single precision blas
Using internal single precision lapack
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gfortran -fPIC -g -O2 -c lapack/slapack1.f -o lapack/slapack1.o
lapack/slapack1.f:41212:2:
#if defined(_OPENMP)
1
Warning: Illegal preprocessor directive
lapack/slapack1.f:41214:2:
#endif
1
Warning: Illegal preprocessor directive
lapack/slapack1.f:41414:2:
#if defined(_OPENMP)
1
Warning: Illegal preprocessor directive
lapack/slapack1.f:41422:2:
#endif
1
Warning: Illegal preprocessor directive
lapack/slapack1.f:41463:2:
#if defined(_OPENMP)
1
Warning: Illegal preprocessor directive
lapack/slapack1.f:41486:2:
#else
1
Warning: Illegal preprocessor directive
lapack/slapack1.f:41492:2:
#endif
1
Warning: Illegal preprocessor directive
lapack/slapack1.f:41503:2:
#if defined(_OPENMP)
1
Warning: Illegal preprocessor directive
lapack/slapack1.f:41506:2:
#endif
1
Warning: Illegal preprocessor directive
gfortran -fPIC -g -O2 -c lapack/slapack2.f -o lapack/slapack2.o
gfortran -fPIC -g -O2 -c lapack/slapack3.f -o lapack/slapack3.o
gfortran -fPIC -g -O2 -c lapack/slapack4.f -o lapack/slapack4.o
gfortran -fPIC -g -O2 -c lapack/slamchf77.f -o lapack/slamchf77.o
gfortran -fPIC -g -O2 -c lapack/ilas.f -o lapack/ilas.o
gfortran -fPIC -g -O2 -c lapack/sblas.f -o lapack/sblas.o
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c bracket.c -o bracket.o
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c chol.c -o chol.o
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c converters.c -o converters.o
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c crossprod.c -o crossprod.o
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c diag.c -o diag.o
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c dims.c -o dims.o
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c isSymmetric.c -o isSymmetric.o
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c matmult.c -o matmult.o
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c numbytes.c -o numbytes.o
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c solve.c -o solve.o
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c xpose.c -o xpose.o
/usr/local/clang4/bin/clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/clang4/lib -o spm.so lapack/slapack1.o lapack/slapack2.o lapack/slapack3.o lapack/slapack4.o lapack/slamchf77.o lapack/ilas.o lapack/sblas.o bracket.o chol.o converters.o crossprod.o diag.o dims.o isSymmetric.o matmult.o numbytes.o solve.o xpose.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -fopenmp -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: could not create compact unwind for _spbtrf_: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _shseqr_: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _sgbtrf_: stack subq instruction is too different from dwarf stack size
installing to /Library/Frameworks/R.framework/Versions/3.4/Resources/library/spm/libs
** R
** tests
** byte-compile and prepare package for lazy loading
Creating a generic function for ‘crossprod’ from package ‘base’ in package ‘spm’
Creating a generic function for ‘tcrossprod’ from package ‘base’ in package ‘spm’
Creating a generic function for ‘diag’ from package ‘base’ in package ‘spm’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘spm’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘spm’
Creating a generic function for ‘object.size’ from package ‘utils’ in package ‘spm’
** help
No man pages found in package ‘spm’
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (spm)
Reloading installed spm
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] spm_0.1-0 lubridate_1.6.0 bindrcpp_0.2
[4] dplyr_0.7.2 readr_1.1.1 googlesheets_0.2.2
[7] colorout_1.1-2 repete_0.0.0.9008 devtools_1.13.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.12 git2r_0.19.0 compiler_3.4.0
[4] cellranger_1.1.0 pryr_0.1.2 plyr_1.8.4
[7] GenomeInfoDb_1.13.4 XVector_0.17.0 bindr_0.1
[10] bitops_1.0-6 tools_3.4.0 zlibbioc_1.23.0
[13] digest_0.6.12 evaluate_0.10.1 debugme_1.0.2
[16] memoise_1.1.0 tibble_1.3.3 pkgconfig_2.0.1
[19] rlang_0.1.1.9000 reprex_0.1.1 curl_2.8.1
[22] yaml_2.1.14 parallel_3.4.0 GenomeInfoDbData_0.99.1
[25] knitr_1.16 withr_2.0.0 stringr_1.2.0
[28] httr_1.2.1.9000 hms_0.3 S4Vectors_0.15.5
[31] IRanges_2.11.12 rprojroot_1.2 stats4_3.4.0
[34] glue_1.1.1 R6_2.2.2 processx_2.0.0.1
[37] rmarkdown_1.6 callr_1.0.0.9000 whisker_0.3-2
[40] clipr_0.3.3 purrr_0.2.2.2 magrittr_1.5
[43] backports_1.1.0 htmltools_0.3.6 scales_0.4.1
[46] codetools_0.2-15 fortunes_1.5-4 BiocGenerics_0.23.0
[49] GenomicRanges_1.29.12 assertthat_0.2.0 colorspace_1.3-2
[52] stringi_1.1.5 RCurl_1.95-4.8 munsell_0.4.3
[55] crayon_1.3.2 Metadata
Metadata
Assignees
Labels
No labels
Activity
wrathematics commentedon Jul 31, 2017
Thanks!
By chance, did you replace the files in
that shipped with R from CRAN with Apple's BLAS/LAPACK manually? I ask because that seems reasonable, but I otherwise can't explain the behavior.
PeteHaitch commentedon Jul 31, 2017
Yeah, I did it manually. I think I basically followed these instructions https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#Which-BLAS-is-used-and-how-can-it-be-changed_003f or these http://statistics.berkeley.edu/computing/blas
wrathematics commentedon Jul 31, 2017
I think it should be working now. Thanks again!
PeteHaitch commentedon Aug 1, 2017
Confirm that's tidied up almost all of them. A few of
ldwarnings remain (installing 23ebc19)wrathematics commentedon Aug 1, 2017
So it's not finding the single precision symbols in your libraries for some reason. These are the relevant lines:
This doesn't make sense to me. The BLAS/LAPACK libs it's detecting are:
Now I know for a fact that you have the necessary functions, because you were able to build the package before I added all of those fortran files as a backup (you shouldn't be building them, given your setup). I've tested something similar on a local Linux setup and things worked fine, so I'm not sure what the deal is. But I'd bet that if you run:
that you will get a match.
It's possible that Macs don't respect
LDFLAGS, like that weirdLD_LIBRARY_PATHvsDYLD_LIBRARY_PATHbusiness. I'll try to look into it, but I'm kind of stumped.PeteHaitch commentedon Aug 1, 2017
Turns out
/Library/Frameworks/R.framework/Resources/lib/libRblas.sodoesn't exist! Unsure if this is due to my manual BLAS switchwrathematics commentedon Aug 1, 2017
Ah no, that's my bad. I forgot macs use
.dylib. The configure script is agnostic to extensions, fortunately.So the thing to try would be:
If that doesn't have a match, then I'm going to be quite confused how you ever installed it in the first place 😅
PeteHaitch commentedon Aug 1, 2017
Ugh, turns out this is probably because I misremembered how I set up this machine.
I repeated the steps in http://statistics.berkeley.edu/computing/blas and now get:
So now it's actually using Accelerate's libBLAS whereas it wasn't before (99% sure, anyway). I misremembered the setup of this machine. And when installing spm (full output at end):
So yay, spm is picking up the Accelerate BLAS. But nothing for LAPACK?
Also, I can't find
sgemmin either BLAS dylib - in fact, I can't find anything?Sorry for the noise on this issue - it's almost certainly caused by the bizarro world set up on my Mac. Out of interest, have you been able to test on a bog-standard macOS set up?
wrathematics commentedon Aug 2, 2017
The internet seems to be suggesting using
nm -gu(or possiblynm -gU) instead ofnm -Dfor macs. Unfortunately I can't test this myself at the moment. One of these days I'm just going to break down and set up a permanent mac server...Apparently some BLAS vendors put the LAPACK symbols in the BLAS library itself (which is news to me!). OpenBLAS does this, and it's possible that Apple's Accelerate is doing this. This may explain how you were able to build the package before I added the ability to build them from source if they were missing (unless you also changed
libRlapack.dylibat some point). So you were getting the single precision LAPACK symbols resolved from linking with yourlibRblas.dylib. Maybe?So it might be interesting to test:
I think you will see s, d, c, z matches for the first one, but only d and z matches for the second. If not, then this really is a mystery 😅
This has been extremely helpful to me, so I really appreciate all the help and patience!
PeteHaitch commentedon Aug 2, 2017
So no hits in
libRblas.dylibbut the expected hits forlibRlapack.dylibI can post the full list of routines if that is helpful, but
I just noticed I have
/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Versions/Current/libLAPACK.dylib. I'm pretty certain I was not using this but it does contain the expected routinesI tried to explicitly use it via the same trick I used for switching out the BLAS dylib:
but bad things happened on starting R
dselivanov commentedon Oct 9, 2017
I have same issue with installation on OS X. Accelerate BLAS is simlinked to libRblas, Lapack is default R's lapack (because linkage of accelerate lapack produce "stats.so requires version 3.4.0 or later, but libLAPACK.dylib provides version 1.0.0")
Here is full log. Not sure why configure decided to use libRlapack:
wrathematics commentedon Oct 10, 2017
At the moment, the configure script looks for
sgetrf_()(Fortran symbolSGETRF()), which isn't detected in Accelerate. I don't have easy access to a Mac, so I can't test this. Looking into it is definitely on my radar though.What's stranger is that your compiler and libc are missing a bunch of C99 functions.
dselivanov commentedon Oct 10, 2017
I think in that sense configure works correctly - on my system
lRlapackis what was shipped with R binaries from CRAN (it is not replaced/simlinked by accelerate lapack).Does following string mean that package is trying use lapack from package lapack subdir?
For me this looks like it didn't find single precision system lapack, but still tries to link to it (but i'm noob in these configure things)..
Let me know if I can help somehow.
wrathematics commentedon Oct 10, 2017
Yes, the message means it's using the package's internal single precision LAPACK. It's not well worded. I'll try to fix it.
The package ships the float BLAS and LAPACK source since many will only have the double precision symbols. There's obviously a huge advantage in using optimized BLAS (not the ones in the package, which are the "reference" implementations from netlib). For LAPACK it may not matter much from a run time perspective. However, the compilation time will be significantly longer if it has to compile LAPACK, so it's still desirable to find those symbols if they're there.
So currently the configure script looks at the BLAS library linked with R for single precision BLAS symbols, and it looks at the LAPACK library and the BLAS library for single precision LAPACK symbols (since Accelerate and OpenBLAS include LAPACK symbols in the "BLAS" library). This works on my Linux box with OpenBLAS, but Accelerate is still a bit of a mystery to me.
dselivanov commentedon Nov 8, 2017
I just reinstalled R with brew:
brew install r. It installs it in a way R uses accelerate BLAS and LAPACK. So now package installation goes very smoothly.Installation also works with R from CRAN, but there are several warnings at the end:
Don't know what they are about.
Merge pull request #3 from wrathematics/master