Intel® oneAPI Data Analytics Library
Learn from community members on how to build compute-intensive applications that run efficiently on Intel® architecture.

Issues running DAAL example on Linux

Daniel_W_
Innovator
1,677 Views

Hello everyone,

I'm trying to run the cholesky example from here: https://software.intel.com/en-us/get-started-with-daal-for-linux on Linux, but having some issues.  I installed DAAL via the shell script, ran the script to set the env vars, and copied the provided code into `cholesky.cpp`.  However, I'm getting a host on errors on compile.

My environment is:

  • gcc version 5.4.0
  • Ubuntu 16.04

Here is the output:

➔ ls
cholesky.cpp
➔ 
➔ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

➔ 
➔ 
➔ gcc cholesky.cpp -daal=parallel -o cholesky
cc1plus: warning: unrecognized gcc debugging option: l
cc1plus: warning: unrecognized gcc debugging option: =
cc1plus: warning: unrecognized gcc debugging option: r
cc1plus: warning: unrecognized gcc debugging option: l
cc1plus: warning: unrecognized gcc debugging option: l
cc1plus: warning: unrecognized gcc debugging option: e
cc1plus: warning: unrecognized gcc debugging option: l
cholesky.cpp:29:18: fatal error: daal.h: No such file or directory
compilation terminated.
➔ 
➔ 
➔ gcc cholesky.cpp -daal=parallel -I/opt/intel/daal/include -o cholesky
cc1plus: warning: unrecognized gcc debugging option: l
cc1plus: warning: unrecognized gcc debugging option: =
cc1plus: warning: unrecognized gcc debugging option: r
cc1plus: warning: unrecognized gcc debugging option: l
cc1plus: warning: unrecognized gcc debugging option: l
cc1plus: warning: unrecognized gcc debugging option: e
cc1plus: warning: unrecognized gcc debugging option: l
/tmp/cca4X9iJ.o: In function `main':
cholesky.cpp:(.text+0x8d): undefined reference to `daal::algorithms::cholesky::interface1::Input::set(daal::algorithms::cholesky::InputId, daal::services::interface1::SharedPtr<daal::data_management::interface1::NumericTable> const&)'
cholesky.cpp:(.text+0xde): undefined reference to `daal::algorithms::cholesky::interface1::Result::get(daal::algorithms::cholesky::ResultId) const'
cholesky.cpp:(.text+0x13e): undefined reference to `std::cout'
cholesky.cpp:(.text+0x143): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
cholesky.cpp:(.text+0x15a): undefined reference to `std::ostream::operator<<(double)'
/tmp/cca4X9iJ.o: In function `__static_initialization_and_destruction_0(int, int)':
cholesky.cpp:(.text+0x28e): undefined reference to `std::ios_base::Init::Init()'
cholesky.cpp:(.text+0x29d): undefined reference to `std::ios_base::Init::~Init()'
/tmp/cca4X9iJ.o: In function `daal::Base::operator new(unsigned long)':
cholesky.cpp:(.text._ZN4daal4BasenwEm[_ZN4daal4BasenwEm]+0x19): undefined reference to `daal::services::daal_malloc(unsigned long, unsigned long)'
/tmp/cca4X9iJ.o: In function `daal::Base::operator new[](unsigned long)':
cholesky.cpp:(.text._ZN4daal4BasenaEm[_ZN4daal4BasenaEm]+0x19): undefined reference to `daal::services::daal_malloc(unsigned long, unsigned long)'
/tmp/cca4X9iJ.o: In function `daal::Base::operator delete(void*, unsigned long)':
cholesky.cpp:(.text._ZN4daal4BasedlEPvm[_ZN4daal4BasedlEPvm]+0x18): undefined reference to `daal::services::daal_free(void*)'
/tmp/cca4X9iJ.o: In function `daal::Base::operator delete[](void*, unsigned long)':
cholesky.cpp:(.text._ZN4daal4BasedaEPvm[_ZN4daal4BasedaEPvm]+0x18): undefined reference to `daal::services::daal_free(void*)'
/tmp/cca4X9iJ.o: In function `std::exception::exception()':
cholesky.cpp:(.text._ZNSt9exceptionC2Ev[_ZNSt9exceptionC5Ev]+0x9): undefined reference to `vtable for std::exception'
/tmp/cca4X9iJ.o: In function `daal::services::interface1::DeleterIface::~DeleterIface()':
cholesky.cpp:(.text._ZN4daal8services10interface112DeleterIfaceD2Ev[_ZN4daal8services10interface112DeleterIfaceD5Ev]+0x29): undefined reference to `operator delete(void*)'
/tmp/cca4X9iJ.o: In function `daal::services::interface1::DeleterIface::~DeleterIface()':
cholesky.cpp:(.text._ZN4daal8services10interface112DeleterIfaceD0Ev[_ZN4daal8services10interface112DeleterIfaceD5Ev]+0x20): undefined reference to `operator delete(void*)'
/tmp/cca4X9iJ.o: In function `daal::services::interface1::RefCounter::RefCounter()':

etc...

 

0 Kudos
4 Replies
Gennady_F_Intel
Moderator
1,677 Views

Daniel, could you check if you set all needed environment variables properly!

source daalvars.sh intel64      and try to build this example again.

 

0 Kudos
Daniel_W_
Innovator
1,677 Views

Thanks for the help.  Hmmm... looks like running the env var script as specified in the "getting started" guide doesn't actually result in defining the variables for me.  However, it does work if I run with source:

➔ ls
daalvars.csh  daalvars.sh
➔ ./daalvars.sh intel64
➔ env | grep "DAAL"
➔ source daalvars.sh intel64
➔ env | grep "DAAL"
DAALROOT=/opt/intel/compilers_and_libraries_2017.2.174/linux/daal
➔ 

But unfortunately, I still get the same issue on compile (I just don't have to manually include daal):

➔ gcc cholesky.cpp -daal=parallel -o cholesky
cc1plus: warning: unrecognized gcc debugging option: l
cc1plus: warning: unrecognized gcc debugging option: =
cc1plus: warning: unrecognized gcc debugging option: r
cc1plus: warning: unrecognized gcc debugging option: l
cc1plus: warning: unrecognized gcc debugging option: l
cc1plus: warning: unrecognized gcc debugging option: e
cc1plus: warning: unrecognized gcc debugging option: l
/tmp/cc6SUNII.o: In function `main':
cholesky.cpp:(.text+0x8d): undefined reference to `daal::algorithms::cholesky::interface1::Input::set(daal::algorithms::cholesky::InputId, daal::services::interface1::SharedPtr<daal::data_management::interface1::NumericTable> const&)'
cholesky.cpp:(.text+0xde): undefined reference to `daal::algorithms::cholesky::interface1::Result::get(daal::algorithms::cholesky::ResultId) const'
cholesky.cpp:(.text+0x13e): undefined reference to `std::cout'
cholesky.cpp:(.text+0x143): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
cholesky.cpp:(.text+0x15a): undefined reference to `std::ostream::operator<<(double)'
/tmp/cc6SUNII.o: In function `__static_initialization_and_destruction_0(int, int)':
cholesky.cpp:(.text+0x28e): undefined reference to `std::ios_base::Init::Init()'
cholesky.cpp:(.text+0x29d): undefined reference to `std::ios_base::Init::~Init()'
/tmp/cc6SUNII.o: In function `daal::Base::operator new(unsigned long)':
cholesky.cpp:(.text._ZN4daal4BasenwEm[_ZN4daal4BasenwEm]+0x19): undefined reference to `daal::services::daal_malloc(unsigned long, unsigned long)'
/tmp/cc6SUNII.o: In function `daal::Base::operator new[](unsigned long)':
cholesky.cpp:(.text._ZN4daal4BasenaEm[_ZN4daal4BasenaEm]+0x19): undefined reference to `daal::services::daal_malloc(unsigned long, unsigned long)'
/tmp/cc6SUNII.o: In function `daal::Base::operator delete(void*, unsigned long)':
cholesky.cpp:(.text._ZN4daal4BasedlEPvm[_ZN4daal4BasedlEPvm]+0x18): undefined reference to `daal::services::daal_free(void*)'
/tmp/cc6SUNII.o: In function `daal::Base::operator delete[](void*, unsigned long)':
cholesky.cpp:(.text._ZN4daal4BasedaEPvm[_ZN4daal4BasedaEPvm]+0x18): undefined reference to `daal::services::daal_free(void*)'
/tmp/cc6SUNII.o: In function `std::exception::exception()':
cholesky.cpp:(.text._ZNSt9exceptionC2Ev[_ZNSt9exceptionC5Ev]+0x9): undefined reference to `vtable for std::exception'
/tmp/cc6SUNII.o: In function `daal::services::interface1::DeleterIface::~DeleterIface()':

etc...
0 Kudos
Daniel_W_
Innovator
1,677 Views

Ok, I was able to figure out my issues here.  There were two.  First, I needed to find this:

https://software.intel.com/en-us/articles/how-to-link-your-c-applications-with-intel-daal

Which told me I should be linking like:

g++ -I$DAALINCLUDE daal_test.cpp -L$DAALLIB -ldaal_core -ldaal_thread -liomp5 -ltbb -lpthread -lm
g++ -I$DAALINCLUDE daal_test.cpp -L$DAALLIB -ldaal_core -ldaal_sequential -lpthread -lm

It may be useful to include this link on the Linux getting started (or maybe I just missed it).  

The second problem was that the env var script provided didn't define DAALLIB or DAALINCLUDE for me, so just manually defined these.  Then everything is good:

➔ env | grep "DAAL"
DAALROOT=/opt/intel/compilers_and_libraries_2017.2.174/linux/daal
➔ env | grep "DAALLIB"
➔ DAALINCLUDE=$DAALROOT/include
➔ # For Intel64 architectures
➔ DAALLIB=$DAALROOT/lib/intel64
➔ 
➔ g++ -I$DAALINCLUDE cholesky.cpp -L$DAALLIB -ldaal_core -ldaal_sequential -lpthread -lm -o cholesky
➔ ls
cholesky  cholesky.cpp
➔ ./cholesky 
The first element of the Cholesky factor: 1

Thanks for the help!

0 Kudos
Andrey_G_Intel2
Employee
1,677 Views

Daniel W. wrote:

The second problem was that the env var script provided didn't define DAALLIB or DAALINCLUDE for me, so just manually defined these.

Env script do definition of common variables for:

  • finding DAAL includes CPATH
  • finding DAAL libraries at linking stage
  • finding DAAL at application running stage

So, after daalvars.sh call you will be able to application build like

  • g++ cholesky.cpp -ldaal_core -ldaal_sequential -lpthread -lm -o cholesky.a

and application run

  • ./cholesky.a
0 Kudos
Reply