Title: | Xsimd C++ Header-Only Library Files |
---|---|
Description: | This header-only library provides modern, portable C++ wrappers for SIMD intrinsics and parallelized, optimized math implementations (SSE, AVX, NEON, AVX512). By placing this library in this package, we offer an efficient distribution system for Xsimd <https://github.com/xtensor-stack/xsimd> for R packages using CRAN. |
Authors: | Marc A. Suchard [aut, cre], Andrew J. Holbrook [aut], Observational Health Data Sciences and Informatics [cph], Johan Mabille [cph, ctb] (author and copyright holder of Xsimd library under a BSD-3 license), Sylvain Corlay [cph, ctb] (author and copyright holder of Xsimd library under a BSD-3 license), Alexander J. Lee [cph, ctb] (author and copyright holder of FeatureDetector library under a CC0 1.0 license) |
Maintainer: | Marc A. Suchard <[email protected]> |
License: | BSD_3_clause + file LICENSE |
Version: | 7.1.6 |
Built: | 2024-10-26 03:39:52 UTC |
Source: | https://github.com/cran/RcppXsimd |
Concatenate supported AVX512 compiler flags for system CPU
getAVX512Flags()
getAVX512Flags()
String for compiler flags
Concatenate supported AVX compiler flags for system CPU
getAVXFlags()
getAVXFlags()
String for compiler flags
Concatenate supported NEON compiler flags for system CPU
getNEONFlags()
getNEONFlags()
String for compiler flags
Execute CPUID to poll operating system and central processing unit for single instruction, multiple data feature support.
getSimdFeatures()
getSimdFeatures()
List of operating sytem (OS) and hardware (HW) feature support; see CPUID Wiki page for flag definitions
https://en.wikipedia.org/wiki/CPUID
Concatenate supported SSE compiler flags for system CPU
getSSEFlags()
getSSEFlags()
String for compiler flags
The RcppXsimd package wrappers the header-only C++ Xsimd library that provides parallelized math implementations using SIMD
Determine if CPU supports AVX SIMD instructions
supportsAVX()
supportsAVX()
Boolean
## 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)
## 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)
Determine if CPU supports AVX512 SIMD instructions
supportsAVX512()
supportsAVX512()
Boolean
## 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)
## 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)
Determine if CPU supports NEON SIMD instructions
supportsNEON()
supportsNEON()
Boolean
## Not run: if (supportsNEON()) { Sys.setenv(PKG_CPPFLAGS = getNEONFlags()) Rcpp::sourceCpp(verbose = TRUE, code=' // [[Rcpp::plugins(cpp14)]] // [[Rcpp::depends(RcppXsimd)]] #include <Rcpp.h> #include "xsimd/xsimd.hpp" // [[Rcpp::export]] void demoNEON() { xsimd::batch<double, 2> a(1.0); xsimd::batch<double, 2> b(1.0); Rcpp::Rcout << a << " + " << b << " = " << (a + b) << std::endl; }') demoNEON() } else { message("NEON is not supported") } ## End(Not run)
## Not run: if (supportsNEON()) { Sys.setenv(PKG_CPPFLAGS = getNEONFlags()) Rcpp::sourceCpp(verbose = TRUE, code=' // [[Rcpp::plugins(cpp14)]] // [[Rcpp::depends(RcppXsimd)]] #include <Rcpp.h> #include "xsimd/xsimd.hpp" // [[Rcpp::export]] void demoNEON() { xsimd::batch<double, 2> a(1.0); xsimd::batch<double, 2> b(1.0); Rcpp::Rcout << a << " + " << b << " = " << (a + b) << std::endl; }') demoNEON() } else { message("NEON is not supported") } ## End(Not run)
Determine if CPU supports SSE SIMD instructions
supportsSSE()
supportsSSE()
Boolean
## Not run: if (supportsSSE()) { Sys.setenv(PKG_CPPFLAGS = getSSEFlags()) Rcpp::sourceCpp(verbose = TRUE, code=' // [[Rcpp::plugins(cpp14)]] // [[Rcpp::depends(RcppXsimd)]] #include <Rcpp.h> #include "xsimd/xsimd.hpp" // [[Rcpp::export]] void demoSSE42() { xsimd::batch<double, 2> a(1.0); xsimd::batch<double, 2> b(1.0); Rcpp::Rcout << a << " + " << b << " = " << (a + b) << std::endl; }') demoSSE42() } else { message("SSE4.2 is not supported") } ## End(Not run)
## Not run: if (supportsSSE()) { Sys.setenv(PKG_CPPFLAGS = getSSEFlags()) Rcpp::sourceCpp(verbose = TRUE, code=' // [[Rcpp::plugins(cpp14)]] // [[Rcpp::depends(RcppXsimd)]] #include <Rcpp.h> #include "xsimd/xsimd.hpp" // [[Rcpp::export]] void demoSSE42() { xsimd::batch<double, 2> a(1.0); xsimd::batch<double, 2> b(1.0); Rcpp::Rcout << a << " + " << b << " = " << (a + b) << std::endl; }') demoSSE42() } else { message("SSE4.2 is not supported") } ## End(Not run)