supportsAVX512: Determine if CPU supports AVX512 SIMD instructions

Description Usage Value Examples

View source: R/RcppXsimd.R

Description

Determine if CPU supports AVX512 SIMD instructions

Usage

1

Value

Boolean

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 

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

## End(Not run)

Example output

AVX512 is not supported

RcppXsimd documentation built on Jan. 22, 2021, 1:06 a.m.