Intel daal错误-Windows

时间:2018-07-20 13:06:48

标签: c++ r visual-c++ intel

我正在努力使daal在我的项目中工作,现在遇到了以下错误-我正在努力理解它,甚至不确定从哪里开始调试。

我正在尝试复制此网站的代码:https://www.codeproject.com/Articles/1151606/Lightning-Fast-R-Machine-Learning-Algorithms,但在Windows 10中,并且具有以下软件(完全按照该网站的规定):

  • 英特尔DAAL 2017 Beta更新1
  • R版本3.3.1(变硬)
  • Rcpp软件包版本0.12.5
  • 内联软件包版本0.3.14
  • e1071软件包版本1.6-7

我已经执行以下操作:

以下是我遇到的错误-我在挣扎中请帮助我!

        file473877c213b9.cpp: In function 'SEXPREC* file473877c213b9(SEXP, SEXP)':
        file473877c213b9.cpp:37:49: error: incomplete universal character name \U
              std::string fname = Rcpp::as<std::string>(-"C:\Users\Documents\BAJAJ.csv");
                                                     ^
    file473877c213b9.cpp:37:49: warning: unknown escape sequence: '\D'
    file473877c213b9.cpp:37:49: warning: unknown escape sequence: '\B'
    file473877c213b9.cpp:37:49: error: wrong type argument to unary minus
    file473877c213b9.cpp:38:29: error: no matching function for call to 'as(int)'
          int k = Rcpp::as<int>(7);
---------------------------------------------------------------------------------

        make: *** [file473877c213b9.o] Error 1
    Warning message:
    running command 'make -f "C:/R/R-33~1.1/etc/x64/Makeconf" -f "C:/R/R-33~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file473877c213b9.dll" WIN=64 TCLBIN=64 OBJECTS="file473877c213b9.o"' had status 2 
---------------------------------------------------------------------------------

    Error in compileCode(f, code, language = language, verbose = verbose) : 
      Compilation ERROR, function(s)/method(s) not created! In file included from file3f9022477144.cpp:3:0:
    C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:25:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
     #pragma warning(disable:809)
     ^
    C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:38:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
         #pragma comment(lib, "tbb.lib" )
     ^
    C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:39:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
         #pragma comment(lib, "tbbmalloc.lib" )
     ^
    In file included from C:/R/R-33~1.1/include/data_management/data/data_dictionary.h:35:0,
                     from C:/R/R-33~1.1/include/data_management/data_source/data_source.h:33,
                     from C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\in
    In addition: Warning message:
    running command 'C:/R/R-33~1.1/bin/x64/R CMD SHLIB file3f9022477144.cpp 2> file3f9022477144.cpp.err.txt' had status 1 

在此先感谢任何人都可以提供的帮助(我不是编码人员,所以很努力!)

Keyur


编辑2018年7月21日-我的代码节选以提供更多详细信息

library(Rcpp)
library(inline)

# Create and register a Rcpp plugin
plug <- Rcpp:::Rcpp.plugin.maker(
     include.before = "#include <C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2017.1.143\\windows\\daal\\include\\daal.h> ",
     libs = paste("/Qdaal[-C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2017.1.143\\windows\\daal\\lib\\intel64_win\\daal_core.lib]",
         "/Qdaal[-C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2017.1.143\\windows\\daal\\lib\\intel64_win\\daal_thread.lib]", sep=""))
registerPlugin("daalNB", plug)


# load data
readCSV <- '
     using namespace daal;
     using namespace daal::data_management;

     // Inputs:
     // file - file name
     // ncols - number of columns in file
     std::string fname = Rcpp::as<std::string>("C://Users//Documents//BAJAJ.csv");
     int k = Rcpp::as<int>(7);......***rest of the code as per the website referenced above, ie same code for the readCSV, train and predict functions***

实际调用函数的函数:

# R function for loading data and labels
loadData <- cxxfunction(signature(file="character", ncols="integer"),readCSV, plugin="daalNB")

# R function for training a model
nbTrain <- cxxfunction(signature(X="raw", y="raw", nclasses="integer"),
                       train, plugin="daalNB")

# R function for scoring
nbPredict <- cxxfunction(signature(model="raw", X="raw", nclasses="integer"),
                         predict, plugin="daalNB")

与readCSV <-函数有关的错误:

C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/as.h:151:29: note:   template argument deduction/substitution failed:
file40e81ac24329.cpp:36:89: note:   cannot convert '"C://Users//Documents//BAJAJ.csv"' (type 'const char [40]') to type 'SEXP'
      std::string fname = Rcpp::as<std::string>("C://Users//Documents//BAJAJ.csv");
                                                                                         ^
file40e81ac24329.cpp:37:29: error: no matching function for call to 'as(int)'
      int k = Rcpp::as<int>(7);

make: *** [file40e81ac24329.o] Error 1
Warning message:
running command 'make -f "C:/R/R-33~1.1/etc/x64/Makeconf" -f "C:/R/R-33~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file40e81ac24329.dll" WIN=64 TCLBIN=64 OBJECTS="file40e81ac24329.o"' had status 2 

ERROR(s) during compilation: source code errors or compiler configuration errors!

以下错误摘要在R Studio控制台中以红色显示:

Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! In file included from file40e81ac24329.cpp:3:0:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:25:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(disable:809)
 ^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:38:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
     #pragma comment(lib, "tbb.lib" )
 ^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:39:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
     #pragma comment(lib, "tbbmalloc.lib" )
 ^
In file included from C:/R/R-33~1.1/include/data_management/data/data_dictionary.h:35:0,
                 from C:/R/R-33~1.1/include/data_management/data_source/data_source.h:33,
                 from C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\in
In addition: Warning message:
running command 'C:/R/R-33~1.1/bin/x64/R CMD SHLIB file40e81ac24329.cpp 2> file40e81ac24329.cpp.err.txt' had status 1

编辑-2018年7月23日

我按照Ralf的建议对csv路径进行了更改,并将以下内容插入了Makevars.win文件中:

CXX=C:/IntelSWTools2018/compilers_and_libraries_2018.3.210/windows/bin/intel64/icl.exe

CXXFLAGS=-I"C:/IntelSWTools2018/compilers_and_libraries_2018.3.210/windows/daal/include" -I"C:/IntelSWTools2018/compilers_and_libraries_2018.3.210/windows/compiler/include" -I"C:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt" -I"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include

现在出现以下错误:

Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.3.210 Build 20180410
Copyright (C) 1985-2018 Intel Corporation.  All rights reserved.

icl: NOTE: The evaluation period for this product ends on 4-aug-2018 UTC.
compilation aborted for file35d0134c2a9d.cpp (code 2)
make: *** [file35d0134c2a9d.o] Error 2
Warning message:
running command 'make -f "C:/R/R-33~1.1/etc/x64/Makeconf" -f "C:/R/R-33~1.1/share/make/winshlib.mk" -f "C:/Users/Documents/.R/Makevars.win" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file35d0134c2a9d.dll" WIN=64 TCLBIN=64 OBJECTS="file35d0134c2a9d.o"' had status 2 
In addition: Warning message:
running command 'C:/R/R-33~1.1/bin/x64/R CMD SHLIB file35d0134c2a9d.cpp 2> file35d0134c2a9d.cpp.err.txt' had status 1

我可以在代码中看到几行提示一些问题,但无法说明这些问题的头尾:

C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/xmmintrin.h(61): error #2277: invalid definition of __m128; use #include "xmmintrin.h" instead
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/xlocale(341): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/xlocale(367): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/internal/NAComparator.h(62): error: expected a ")"
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/r_cast.h(32): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/module/Module_generated_CppFunction.h(53): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/module/Module_generated_CppFunction.h(93): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/api/meat/module/Module.h(40): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/api/meat/module/Module.h(40): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/xstring(2195): warning #583: C++ exception handler found but /EHsc option was not specified

编辑2018年7月25日

现在已经回到网站上注明的daal版本的确切软件包(很旧!),并按照Ralf的建议更改了CSV路径,并遇到以下编译错误:

    Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! file2ddc1463da6.o:file2ddc1463da6.cpp:(.text+0x2e6): undefined reference to `daal::data_management::interface1::SerializationIface::serialize(daal::data_management::interface1::InputDataArchive&)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text+0x304): undefined reference to `daal::data_management::interface1::SerializationIface::serialize(daal::data_management::interface1::InputDataArchive&)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacenwEy[_ZN4daal15data_management10interface118SerializationIfacenwEy]+0x16): undefined reference to `daal::services::daal_malloc(unsigned long long, unsigned long long)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacenaEy[_ZN4daal15data_management10interface118SerializationIfacenaEy]+0x16): undefined reference to `daal::services::daal_malloc(unsigned long long, unsigned long long)'
fi

其中的来源是很多行,例如:

file2ddc1463da6.o:file2ddc1463da6.cpp:(.text+0x2e6): undefined reference to `daal::data_management::interface1::SerializationIface::serialize(daal::data_management::interface1::InputDataArchive&)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text+0x304): undefined reference to `daal::data_management::interface1::SerializationIface::serialize(daal::data_management::interface1::InputDataArchive&)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacenwEy[_ZN4daal15data_management10interface118SerializationIfacenwEy]+0x16): undefined reference to `daal::services::daal_malloc(unsigned long long, unsigned long long)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacenaEy[_ZN4daal15data_management10interface118SerializationIfacenaEy]+0x16): undefined reference to `daal::services::daal_malloc(unsigned long long, unsigned long long)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacedlEPvy[_ZN4daal15data_management10interface118SerializationIfacedlEPvy]+0x15): undefined reference to `daal::services::daal_free(void*)'

1 个答案:

答案 0 :(得分:0)

您需要使用Rcpp::as函数在R内部数据类型(SEXP)和普通C ++数据类型(intstring,...之间进行转换。 )。当您将参数从R传递到C ++函数时,这是必需的。由于您在C ++代码中指定了参数,因此不需要此函数。以下应该在您的readCsv函数中起作用:

std::string fname = "C:/Users/Documents/BAJAJ.csv";
int k = 7;

或者,您可以坚持使用教程中从R传递这些参数的版本。

顺便说一句,您不需要将/加倍。只有\具有特殊含义,必须加倍引用以引用原义版本。