This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Cross-compiling Eigen BLAS and Benchmarks

Tags: None
(comma "," separated)
damien_d
Registered Member
Posts
15
Karma
0
Hello all,

I am attempting to cross-compile the benchamrks for Eigen (ARM target; x64 host).

Ultimately, I get a build failure for the benchmarker:
Code: Select all
[  0%] Building CXX object bench/btl/libs/eigen3/CMakeFiles/btl_eigen3_adv.dir/main_adv.cpp.o
arm-g++: error: unrecognized command line option '-msse2'
make[2]: *** [bench/btl/libs/eigen3/CMakeFiles/btl_eigen3_adv.dir/main_adv.cpp.o] Error 1
make[1]: *** [bench/btl/libs/eigen3/CMakeFiles/btl_eigen3_adv.dir/all] Error 2
make: *** [all] Error 2


After cmake .. you can see it:
Code: Select all
-- ************************************************************
-- ***    Eigen's unit tests configuration summary          ***
-- ************************************************************
--
-- Build type:        Release
-- Build site:        damien-desktop
-- Build string:      linux-g++-1.18.0-32bit
-- Enabled backends: 
-- Disabled backends: Cholmod,  UmfPack,  SuperLU,  PaStiX,  Qt4 support,  GoogleHash,  Adolc,  MPFR C++,  fftw,  OpenGL,
-- Default order:     Column-major
-- Maximal matrix/vector size: 320
-- SSE2:              Using architecture defaults
-- SSE3:              Using architecture defaults
-- SSSE3:             Using architecture defaults
-- SSE4.1:            Using architecture defaults
-- SSE4.2:            Using architecture defaults
-- Altivec:           Using architecture defaults
-- ARM NEON:          Using architecture defaults
--
CXX:               /opt/hmccore-mx53/bin/arm-g++
 CXX_VERSION:       arm-g++ (crosstool-NG 1.18.0) 4.7.4 20130626 (prerelease)
 CXX_FLAGS:          -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fexceptions -fno-check-new -fno-common -fstrict-aliasing -Wno-variadic-macros -Wextra -pedantic  -g2
 Sparse lib flags:   

-- ************************************************************
--
-- Configured Eigen 3.1.1
--
-- Some things you can do now:
-- --------------+--------------------------------------------------------------
-- Command       |   Description
-- --------------+--------------------------------------------------------------
-- make install  | Install to /home/damien/builds/rusa_binary_collection/_arm/build. To change that:
--               |     cmake . -DCMAKE_INSTALL_PREFIX=yourpath
--               |   Eigen headers will then be installed to:
--               |     /home/damien/builds/rusa_binary_collection/_arm/build/include
--               |   To install Eigen headers to a separate location, do:
--               |     cmake . -DEIGEN_INCLUDE_INSTALL_DIR=yourpath
-- make doc      | Generate the API documentation, requires Doxygen & LaTeX
-- make check    | Build and run the unit-tests. Read this page:
--               |   http://eigen.tuxfamily.org/index.php?title=Tests
-- make blas     | Build BLAS library (not the same thing as Eigen)
-- --------------+--------------------------------------------------------------
--
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    ATLAS_INCLUDES


So, even though it has successuly detected my compiler from the supplied toolchain file, it seems to have difficulty detecting that it is an ARM platform:
Code: Select all
-- The CXX compiler identification is GNU
-- Check for working C compiler: /opt/hmccore-mx53/bin/arm-gcc
-- Check for working C compiler: /opt/hmccore-mx53/bin/arm-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /opt/hmccore-mx53/bin/arm-g++
-- Check for working CXX compiler: /opt/hmccore-mx53/bin/arm-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
abort: repository /home/damien/builds/rusa_binary_collection/src/eigen/src not found!
abort: repository /home/damien/builds/rusa_binary_collection/src/eigen/src not found!
-- Performing Test standard_math_library_linked_to_automatically
-- Performing Test standard_math_library_linked_to_automatically - Success
-- Standard libraries to link to explicitly: none
-- Performing Test COMPILER_SUPPORT_WNOVARIADICMACRO
-- Performing Test COMPILER_SUPPORT_WNOVARIADICMACRO - Success
-- Performing Test COMPILER_SUPPORT_WEXTRA
-- Performing Test COMPILER_SUPPORT_WEXTRA - Success
-- Performing Test COMPILER_SUPPORT_OPENMP
-- Performing Test COMPILER_SUPPORT_OPENMP - Success


I had to supply a cache file to see if it was 32-bit or 64-bit pointers:
Code: Select all
SET( run_res
     "OFF"
     CACHE STRING "Result from TRY_RUN" FORCE)

SET( run_res__TRYRUN_OUTPUT
     "PLEASE_FILL_OUT-NOTFOUND"
     CACHE STRING "Output from TRY_RUN" FORCE)


Is there a way I can force the arcitecture and/or explicitly disable the SSE and enable NEON? Are there any other factors I should be aware of when cross-compiling. My build script looks like:

Code: Select all
            # Configure
            cmake   -C "$CACHE_FILE"                                     \
                    -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE"             \
                    -DCMAKE_INSTALL_PREFIX=${LBUILD_BUILD}               \
                    -DCMAKE_BUILD_TYPE=Release                           \
                    -DEIGEN_INCLUDE_INSTALL_DIR=${LBUILD_BUILD}/include  \
                    -DEIGEN_BUILD_BTL=ON                                 \
                    -DEIGEN3_INCLUDE_DIR=$EIGEN3_BENCHMARK_INCLUDE_DIR   \
                    -DATLAS_CBLAS=$ATLAS_CBLAS                           \
                    -DATLAS_F77BLAS=$ATLAS_F77BLAS                       \
                    -DATLAS_INCLUDES=$ATLAS_INCLUDES                     \
                    -DATLAS_LAPACK=$ATLAS_LAPACK                         \
                    -DATLAS_LIB=$ATLAS_LIB                               \
                    --clean-first                                        \
                    "$EIGEN_SOURCE_DIR"                                  \
                   

            # Make the BLAS libraries
            make blas

            # Build the benchmarker
            pushd .
            cd bench/btl
            make
            popd


With the toolchain file being:
Code: Select all

# this one is important
SET(CMAKE_SYSTEM_NAME Linux)

# This one not so much
# SET(CMAKE_SYSTEM_VERSION 1)

# specify the cross compilers
SET(CMAKE_C_COMPILER         /opt/hmccore-mx53/bin/arm-gcc)
SET(CMAKE_CXX_COMPILER       /opt/hmccore-mx53/bin/arm-g++)
SET(CMAKE_CXX_COMPILER       /opt/hmccore-mx53/bin/arm-g++)
SET(CMAKE_Fortran_COMPILER   /opt/hmccore-mx53/bin/arm-gfortran)

# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /opt/hmccore-mx53/arm-cortex_a8-linux-gnueabi/sysroot)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
The problem is in the file bench/btl/CMakeLists.txt foir which sse2 has been hardcoded. Feel free to update it to automatically detect the proper vectorization options, for instance using check_cxx_compiler_flag("-msse2" COMPILER_SUPPORT_MSSE2)... I'd be glad to push upstream any improvement you could made on this file.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]