Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Apple M1 arch64 #1375

Closed
akhst7 opened this issue Jul 11, 2021 · 8 comments
Closed

Support for Apple M1 arch64 #1375

akhst7 opened this issue Jul 11, 2021 · 8 comments

Comments

@akhst7
Copy link

akhst7 commented Jul 11, 2021

Hi,

I tried to install dada2 from a source in GitHub or Bioc in the M1 MacMini running Big Sur as follows;

install_github("benjjneb/dada2") or install("dada2")

but installation failed with compilation error;

install("dada2")
'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details

replacement repositories:
   CRAN: https://cran.rstudio.com/

Bioconductor version 3.13 (BiocManager 1.30.16), R 4.1.0 (2021-05-18)
Installing package(s) 'dada2'
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘dada2’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source package ‘dada2’

trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/dada2_1.20.0.tar.gz'
Content type 'application/x-gzip' length 2871808 bytes (2.7 MB)
==================================================
downloaded 2.7 MB

* installing *source* package ‘dada2’ ...
** using staged installation
** libs
/opt/homebrew/opt/llvm/bin/clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Volumes/Data/R_lib/Rcpp/include' -I'/Volumes/Data/R_lib/RcppParallel/include' -I"/opt/homebrew/opt/gettext/include" -I"/opt/homebrew/opt/llvm/include"  -I"/opt/homebrew/opt/libomp/include" -isysroot "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" -Xclang -fopenmp   -fPIC  -falign-functions=64 -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/dada2.h:7:
./../inst/include/dada2_RcppExports.h:14:14: warning: unused function 'validateSignature' [-Wunused-function]
       void validateSignature(const char* sig) {
            ^
1 warning generated.
/opt/homebrew/opt/llvm/bin/clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Volumes/Data/R_lib/Rcpp/include' -I'/Volumes/Data/R_lib/RcppParallel/include' -I"/opt/homebrew/opt/gettext/include" -I"/opt/homebrew/opt/llvm/include"  -I"/opt/homebrew/opt/libomp/include" -isysroot "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" -Xclang -fopenmp   -fPIC  -falign-functions=64 -Wall -g -O2  -c Rmain.cpp -o Rmain.o
In file included from Rmain.cpp:7:
/opt/homebrew/Cellar/llvm/12.0.1/lib/clang/12.0.1/include/cpuid.h:14:2: `error: this header is for x86 only`
#error this header is for x86 only

Some of headers much be covered for aarch64 or universal.

Thanks.

> R.version
               _                           
platform       aarch64-apple-darwin20      
arch           aarch64                     
os             darwin20                    
system         aarch64, darwin20           
status                                     
major          4                           
minor          1.0                         
year           2021                        
month          05                          
day            18                          
svn rev        80317                       
language       R                           
version.string R version 4.1.0 (2021-05-18)
nickname       Camp Pontanezen             
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] BiocManager_1.30.16 remotes_2.4.0      

loaded via a namespace (and not attached):
  [1] nlme_3.1-152            matrixStats_0.59.0-9000 spatstat.sparse_2.0-0   RcppAnnoy_0.0.18        RColorBrewer_1.1-2     
  [6] httr_1.4.2              sctransform_0.3.2       tools_4.1.0             utf8_1.2.1              R6_2.5.0               
 [11] irlba_2.3.3             rpart_4.1-15            KernSmooth_2.23-20      uwot_0.1.10             mgcv_1.8-36            
 [16] lazyeval_0.2.2          colorspace_2.0-2        tidyselect_1.1.1        gridExtra_2.3           curl_4.3.2             
 [21] compiler_4.1.0          plotly_4.9.4.1          Seurat_4.0.3.9005       scales_1.1.1            lmtest_0.9-38          
 [26] spatstat.data_2.1-0     ggridges_0.5.3          pbapply_1.4-3           goftest_1.2-2           stringr_1.4.0          
 [31] digest_0.6.27           spatstat.utils_2.2-0    pkgconfig_2.0.3         htmltools_0.5.1.1       parallelly_1.26.1      
 [36] fastmap_1.1.0           htmlwidgets_1.5.3       rlang_0.4.11            shiny_1.6.0             generics_0.1.0         
 [41] zoo_1.8-9               jsonlite_1.7.2          ica_1.0-2               dplyr_1.0.7             magrittr_2.0.1         
 [46] patchwork_1.1.1         Matrix_1.3-4            Rcpp_1.0.7              munsell_0.5.0           fansi_0.5.0            
 [51] abind_1.4-5             reticulate_1.20-9001    lifecycle_1.0.0         stringi_1.6.2           MASS_7.3-54            
 [56] Rtsne_0.15              plyr_1.8.6              grid_4.1.0              parallel_4.1.0          listenv_0.8.0          
 [61] promises_1.2.0.1        ggrepel_0.9.1           crayon_1.4.1            miniUI_0.1.1.1          deldir_0.2-10          
 [66] lattice_0.20-44         cowplot_1.1.1           splines_4.1.0           tensor_1.5              pillar_1.6.1           
 [71] igraph_1.2.6            spatstat.geom_2.2-0     future.apply_1.7.0      reshape2_1.4.4          codetools_0.2-18       
 [76] leiden_0.3.8            glue_1.4.2              SeuratObject_4.0.2      data.table_1.14.0       png_0.1-7              
 [81] vctrs_0.3.8             httpuv_1.6.1            gtable_0.3.0            RANN_2.6.1              purrr_0.3.4            
 [86] spatstat.core_2.2-0     polyclip_1.10-0         tidyr_1.1.3             scattermore_0.7         future_1.21.0          
 [91] ggplot2_3.3.5           mime_0.11               xtable_1.8-4            later_1.2.0             survival_3.2-11        
 [96] viridisLite_0.4.0       tibble_3.1.2            cluster_2.1.2           globals_0.14.0          fitdistrplus_1.1-5     
[101] ellipsis_0.3.2          ROCR_1.0-11  
@benjjneb
Copy link
Owner

We've had reports of people successfully running dada2 on the new M1 Macs. I wonder if anyone can chime in here? I don't have one available at this point to test on.

This also related to an open PR #1147

@cwbeltz
Copy link

cwbeltz commented Jul 20, 2021

I was running dada2 successfully in May on my M1, but ran into issue when I went to re-run the same pipeline on the same data today after upgrading to R 4.1.0 specific to the ARM mac. It looks like there are compiler issues for: ‘Rhtslib’, ‘Rsamtools’, ‘GenomicAlignments’, ‘ShortRead’.

I was previously on R 4.0.4, BioCondunctor 3.11, and dada2 1.18

@cwbeltz
Copy link

cwbeltz commented Jul 20, 2021

@akhst7 I have been troubleshooting this compiler issue and it looks like it may relate the the use of an experimental version of GNU Fortran 11 for the M1 Mac. This is noted in some of the notes for the 4.1.0 release on CRAN. I quickly tried downloading the 4.1.0 x86/Intel version and everything seems to be running fine through the first filter-and-trim step.

I will report back once I've run my whole pipeline... but this seems like a potential workaround for arm Macs.

@akhst7
Copy link
Author

akhst7 commented Jul 20, 2021

@cwbeltz

I had some issues installing decencies but I overcame those and installed all the dependencies you mentioned. Now if I can compile dada2 in my MI Mac mini, it will be super

I was running dada2 successfully in May on my M1, but ran into issue when I went to re-run the same pipeline on the same data today after upgrading to R 4.1.0 specific to the ARM mac. It looks like there are compiler issues for: ‘Rhtslib’, ‘Rsamtools’, ‘GenomicAlignments’, ‘ShortRead’.

I was previously on R 4.0.4, BioCondunctor 3.11, and dada2 1.18

@akhst7
Copy link
Author

akhst7 commented Jul 20, 2021

@cwbeltz

Could you post the version of gfortran you are suing ?

Mines are as follows;

gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/11.1.0_1/libexec/gcc/aarch64-apple-darwin20/11.1.0/lto-wrapper
Target: aarch64-apple-darwin20
Configured with: ../configure --prefix=/opt/homebrew/Cellar/gcc/11.1.0_1 --libdir=/opt/homebrew/Cellar/gcc/11.1.0_1/lib/gcc/11 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-11 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 11.1.0_1' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --build=aarch64-apple-darwin20 --with-system-zlib --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (Homebrew GCC 11.1.0_1)

@cwbeltz

I had some issues installing decencies but I overcame those and installed all the dependencies you mentioned. Now if I can compile dada2 in my MI Mac mini, it will be super

I was running dada2 successfully in May on my M1, but ran into issue when I went to re-run the same pipeline on the same data today after upgrading to R 4.1.0 specific to the ARM mac. It looks like there are compiler issues for: ‘Rhtslib’, ‘Rsamtools’, ‘GenomicAlignments’, ‘ShortRead’.
I was previously on R 4.0.4, BioCondunctor 3.11, and dada2 1.18

@akhst7
Copy link
Author

akhst7 commented Jul 20, 2021

@benjjneb

One should be able to run dada2 in M1Mac under Rosetta2. At the moment I don't see how anybody could compile dada2 in aarch64 in M1 machines without further modifications noted in #1147. Using see2neo mentioned by terjekv could save your time and effort.

We've had reports of people successfully running dada2 on the new M1 Macs. I wonder if anyone can chime in here? I don't have one available at this point to test on.

This also related to an open PR #1147

@cwbeltz
Copy link

cwbeltz commented Sep 28, 2021

@akhst7 Sorry for lack of follow-up. I've now run the dada2 SOP for both 16S and ITS on an M1/arm Mac. As you state in your last post, it used using the x86 version under Rosetta 2.

@benjjneb
Copy link
Owner

The dada2 R package has full support for Apple M1/2/3 Arm architecture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants