supportsAVX {RcppXsimd}R Documentation

Determine if CPU supports AVX SIMD instructions

Description

Determine if CPU supports AVX SIMD instructions

Usage

supportsAVX()

Value

Boolean

Examples

## Not run: 

if (supportsAVX()) {
  Sys.setenv(PKG_CPPFLAGS = getAVXFlags())
  Rcpp::sourceCpp(verbose = TRUE, code='
    // [[Rcpp::plugins(cpp14)]]
    // [[Rcpp::depends(RcppXsimd)]]
               
    #include <Rcpp.h>
    #include "xsimd/xsimd.hpp"
               
    // [[Rcpp::export]] 
    void demoAVX() {
      xsimd::batch<double, 4> a(1.0);
      xsimd::batch<double, 4> b(1.0);
      Rcpp::Rcout << a << " + " << b << " = " << (a + b) << std::endl;
    }')
  demoAVX()
} else {
  message("AVX is not supported")
}

## End(Not run)


[Package RcppXsimd version 7.1.6 Index]