尝试在RcppNT2包中使用“precompileRcppNT2”函数时出错

时间:2016-11-06 21:21:05

标签: rcpp

我想知道使用SIMD指令是否可以加快我的一些代码。我加载了RcppNT2包,他们建议使用“precompileRcppNT2()”函数来加速编译过程。在这样做时,我得到以下错误,并想知道是否有一些我错过的尝试使用该包:

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

The following object is masked from package:base:

    setwd

libraries: c:/R/r_libs-3.3.2 C:/R/R-3.3.2/library 
library & Java environment set from C:\Users\jh52822\Documents\.RProfile
> library(devtools)
> library(Rcpp)
> library(RcppNT2)
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] RcppNT2_0.1.0   Rcpp_0.12.7     devtools_1.12.0

loaded via a namespace (and not attached):
[1] withr_1.0.2   memoise_1.0.0 digest_0.6.10
> precompileRcppNT2()
Pre-compiling 'RcppNT2.h'...
In file included from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/include/functions/j0.hpp:5:0,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions.hpp:5,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/bessel.hpp:5,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h:15:
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/j0.hpp: In member function 'nt2::ext::impl_j0_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::result_type nt2::ext::impl_j0_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::operator()(const A0&) const':
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/j0.hpp:60:14: error: '::_j0' has not been declared
       return ::_j0(a0);
              ^
In file included from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/include/functions/j1.hpp:5:0,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions.hpp:6,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/bessel.hpp:5,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h:15:
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/j1.hpp: In member function 'nt2::ext::impl_j1_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::result_type nt2::ext::impl_j1_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::operator()(const A0&) const':
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/j1.hpp:74:14: error: '::_j1' has not been declared
       return ::_j1(a0);
              ^
In file included from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/include/functions/jni.hpp:5:0,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions.hpp:7,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/bessel.hpp:5,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h:15:
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/jni.hpp: In member function 'nt2::ext::impl_jni_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::integer_<T> >, boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<A1> >), boost::dispatch::tag::cpu_>::result_type nt2::ext::impl_jni_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::integer_<T> >, boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<A1> >), boost::dispatch::tag::cpu_>::operator()(const A0&, const A1&) const':
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/jni.hpp:63:14: error: '::_jn' has not been declared
       return ::_jn(a0, a1);
              ^
In file included from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/include/functions/y0.hpp:5:0,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions.hpp:8,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/bessel.hpp:5,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h:15:
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/y0.hpp: In member function 'nt2::ext::impl_y0_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::result_type nt2::ext::impl_y0_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::operator()(const A0&) const':
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/y0.hpp:69:14: error: '::_y0' has not been declared
       return ::_y0(a0);
              ^
In file included from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/include/functions/yni.hpp:5:0,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions.hpp:10,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/bessel.hpp:5,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h:15:
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/yni.hpp: In member function 'nt2::ext::impl_yni_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::integer_<T> >, boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<A1> >), boost::dispatch::tag::cpu_>::result_type nt2::ext::impl_yni_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::integer_<T> >, boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<A1> >), boost::dispatch::tag::cpu_>::operator()(const A0&, const A1&) const':
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/yni.hpp:69:14: error: '::_yn' has not been declared
       return ::_yn(a0, a1);
              ^
In file included from c:/R/r_libs-3.3.2/RcppNT2/include/boost/simd/ieee/include/functions/scalar/nextafter.hpp:5:0,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/boost/simd/include/functions/scalar/nextafter.hpp:4,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/boost/simd/ieee/functions/scalar/next.hpp:15,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/boost/simd/ieee/include/functions/next.hpp:5,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/ieee/functions/next.hpp:12,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/ieee/include/functions/next.hpp:4,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/ieee/functions.hpp:27,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/ieee/ieee.hpp:5,
                 from c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h:26:
c:/R/r_libs-3.3.2/RcppNT2/include/boost/simd/ieee/functions/scalar/nextafter.hpp: In member function 'boost::simd::ext::impl_nextafter_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >, boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::result_type boost::simd::ext::impl_nextafter_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >, boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::operator()(const A0&, const A0&) const':
c:/R/r_libs-3.3.2/RcppNT2/include/boost/simd/ieee/functions/scalar/nextafter.hpp:73:14: error: '::_nextafter' has not been declared
       return ::_nextafter(a0, a1);
              ^
Error: Failed to compile 'RcppNT2.h'
In addition: Warning message:
running command 'c:/Rtools/mingw_64/bin/g++ -x c++-header c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h -Ic:/R/r_libs-3.3.2/RcppNT2/include -I c:/R/r_libs-3.3.2/BH/include -IC:/R/R-3.3.2/include -std=c++11 -O2 -Wall -mtune=core2' had status 1 

任何帮助或建议都将不胜感激。

1 个答案:

答案 0 :(得分:3)

看起来你的MinGW版本不支持原始bessel和nextafter函数,或者RCpp使用的NT2版本没有打包应该处理的数学配置头。

不确定RCpp是如何预编译的,但是应该这样做,以便在MinGW BOOST_SIMD_HAS_YN是defiend并且BOOST_SIMD_HAS__YN未定义。