Hello R-package-devel,

I recently got inspired by the rcppsimdjson package to try out simd
registers. It works fantastic on my computer but I struggle to find
information on how to make it portable. It doesn't help in this case
that R and Rcpp make including Cpp code so easy that I have never had
to learn about cmake and compiler flags. I would appreciate any help,
including of the type: "go read instructions at ...".

I use RcppArmadillo and Rcpp. I currenlty include the following header:

#include <immintrin.h>

The functions in immintrin that I use are:


and I define up to four __m256d registers. From information found
online (not sure where anymore) I constructed the following makevars


PKG_CPPFLAGS = -I../inst/include -mfma -msse4.2 -mavx


(I also use openmp, that has always worked fine, I just included all
lines for completeness) Rcheck gives me two notes:

─  using R version 4.3.2 (2023-10-31 ucrt)
─  using platform: x86_64-w64-mingw32 (64-bit)
─  R was compiled by
       gcc.exe (GCC) 12.3.0
       GNU Fortran (GCC) 12.3.0

❯ checking compilation flags used ... NOTE
  Compilation used the following non-portable flag(s):
    '-mavx' '-mfma' '-msse4.2'

❯ checking C++ specification ... NOTE
    Specified C++14: please drop specification unless essential

But as far as I understand, the flags are necessary, at least in GCC.
How can I make this portable and CRAN-acceptable?

kind regards,

R-package-devel@r-project.org mailing list

Reply via email to