Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

Running "Shark" machine learning library on Xeon Phi

Ali_J_1
Beginner
885 Views

Hello,

I am using Shark (http://image.diku.dk/shark/sphinx_pages/build/html/index.html) for NN simulation. After installing it, I managed to compile and run a simple NN using icpc and openmp on 12 cores on my system. Now, I am trying to compile and run it on Xeon Phi. This is the command line that I used:

icpc  -mmic -openmp -I/usr/local/include/ -I/root/Shark/include/ -Wall -DNDEBUG -DBOOST_UBLAS_NDEBUG  -O3 -L/usr/local/lib -lshark -lboost_serialization -lboost_system -lboost_filesystem -lboost_program_options NN_Shark.cpp -c

and I got these errors and warnnings:

In file included from /usr/local/include/boost/random/detail/large_arithmetic.hpp(19),
                 from /usr/local/include/boost/random/detail/const_mod.hpp(23),
                 from /usr/local/include/boost/random/detail/seed_impl.hpp(27),
                 from /usr/local/include/boost/random/mersenne_twister.hpp(29),
                 from /usr/local/include/shark/Rng/Rng.h(35),
                 from /usr/local/include/shark/Rng/GlobalRng.h(84),
                 from /usr/local/include/shark/Core/utility/functional.h(41),
                 from /usr/local/include/shark/Data/Dataset.h(54),
                 from /usr/local/include/shark/Data/DataDistribution.h(40),
                 from NN_Shark.cpp(1):
/usr/local/include/boost/random/detail/integer_log2.hpp(58): warning #3415: the "always_inline" attribute is ignored on non-inline functions
  BOOST_RANDOM_DETAIL_CONSTEXPR int integer_log2(T t)
  ^

icpc  NN_Shark.o -o hello -mmic -openmp -I/usr/local/include/ -I/root/Shark/include/ -Wall -DNDEBUG -DBOOST_UBLAS_NDEBUG  -O3 -L/usr/local/lib -lshark -lboost_serialization -lboost_system -lboost_filesystem -lboost_program_options
x86_64-k1om-linux-ld: skipping incompatible /usr/local/lib/libshark.a when searching for -lshark
x86_64-k1om-linux-ld: cannot find -lshark
x86_64-k1om-linux-ld: skipping incompatible /usr/local/lib/libboost_serialization.so when searching for -lboost_serialization
x86_64-k1om-linux-ld: skipping incompatible /usr/local/lib/libboost_serialization.a when searching for -lboost_serialization
x86_64-k1om-linux-ld: cannot find -lboost_serialization
x86_64-k1om-linux-ld: skipping incompatible /usr/local/lib/libboost_system.so when searching for -lboost_system
x86_64-k1om-linux-ld: skipping incompatible /usr/local/lib/libboost_system.a when searching for -lboost_system
x86_64-k1om-linux-ld: cannot find -lboost_system
x86_64-k1om-linux-ld: skipping incompatible /usr/local/lib/libboost_filesystem.so when searching for -lboost_filesystem
x86_64-k1om-linux-ld: skipping incompatible /usr/local/lib/libboost_filesystem.a when searching for -lboost_filesystem
x86_64-k1om-linux-ld: cannot find -lboost_filesystem
x86_64-k1om-linux-ld: skipping incompatible /usr/local/lib/libboost_program_options.so when searching for -lboost_program_options
x86_64-k1om-linux-ld: skipping incompatible /usr/local/lib/libboost_program_options.a when searching for -lboost_program_options
x86_64-k1om-linux-ld: cannot find -lboost_program_options
make: *** [hello] Error 1

 

Do I need to compile Shark with -mmic flag to be able to run it on Xeon Phi? Any help is appreciated.

Jooya

 

 

0 Kudos
2 Replies
TimP
Honored Contributor III
885 Views
Yes, mmic is correct if you intend to run local to Mic. Those other libraries would also have to be built for Mic target.
0 Kudos
KitturGanesh
Employee
885 Views

Ali, yes, the –mmic switch has to be used to build a native application. You'll have to then copy the executable and any dependencies such as runtime libs to the target to run the application. Or you can use the offload (heterogeneous) programming model to trigger the compiler to compile for both the host (Xeon) and Phi so that you can execute the program on the host and offload code sections to the co-processor as well.  Below are some useful links with valuable information to get started on programming for MIC. 

http://software.intel.com/en-us/articles/programming-and-compiling-for-intel-many-integrated-core-architecture
http://software.intel.com/en-us/articles/advanced-optimizations-for-intel-mic-architecture
http://software.intel.com/en-us/articles/optimization-and-performance-tuning-for-intel-xeon-phi-coprocessors-part-1-optimization
http://software.intel.com/en-us/articles/optimization-and-performance-tuning-for-intel-xeon-phi-coprocessors-part-2-understanding

_Kittur

0 Kudos
Reply