From 4a979f75124e197a8dc6c65d39fec2fadfc2a4b5 Mon Sep 17 00:00:00 2001 From: Ghislain Antony Vaillant Date: Tue, 4 Aug 2015 18:49:07 +0100 Subject: [PATCH 1/7] fix install location of CMake configuration files lib/clSPARSE/cmake -> lib/cmake/clSPARSE --- src/library/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/library/CMakeLists.txt b/src/library/CMakeLists.txt index 8aea4e2..17c0cf6 100644 --- a/src/library/CMakeLists.txt +++ b/src/library/CMakeLists.txt @@ -282,7 +282,7 @@ include( CMakePackageConfigHelpers ) set( LIB_INSTALL_DIR lib${SUFFIX_LIB} ) set( INCLUDE_INSTALL_DIR include ) -set( ConfigPackageLocation ${LIB_INSTALL_DIR}/clSPARSE/cmake ) +set( ConfigPackageLocation ${LIB_INSTALL_DIR}/cmake/clSPARSE ) configure_package_config_file( clSPARSEConfig.cmake.in From 71c5385ae66f064f901fed77ae98c0cd7920ad76 Mon Sep 17 00:00:00 2001 From: Kent Knox Date: Sat, 8 Aug 2015 17:27:11 -0500 Subject: [PATCH 2/7] Adding basic .travis.yml file for container based multi-OS build --- .travis.yml | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e0a4346 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,68 @@ +# Ubuntu name decoder ring; https://en.wikipedia.org/wiki/List_of_Ubuntu_releases +# Ubuntu 12.04 LTS (Precise Pangolin) <== Travis CI VM image +# Ubuntu 12.10 (Quantal Quetzal) +# Ubuntu 13.04 (Raring Ringtail) +# Ubuntu 13.10 (Saucy Salamander) +# Ubuntu 14.04 LTS (Trusty Tahr) +# Ubuntu 14.10 (Utopic Unicorn) +# Ubuntu 15.04 (Vivid Vervet) +# Ubuntu 15.10 (Wily Werewolf) +# Ubuntu 16.04 LTS (Xenial Xantus) + +# language: instructs travis what compilers && environment to set up in build matrix +language: cpp + +# sudo: false instructs travis to build our project in a docker VM (faster) +sudo: false + +# os: expands the build matrix to include multiple os's +os: + - linux + - osx + +# compiler: expands the build matrix to include multiple compilers (per os) +compiler: + - gcc +# - clang + +# apt: needed by docker framework to install project dependencies without +# the sudo. Apt uses published Ubunto PPA's from https://launchpad.net/ +# https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json +addons: + apt: + sources: + # ubuntu-toolchain-r-test contains newer versions of gcc to install + - ubuntu-toolchain-r-test + # kubuntu-backports contains newer versions of cmake to install + - kubuntu-backports + packages: + - g++-4.8 + - cmake + - opencl-headers +# - fglrx=2:8.960-0ubuntu1 +# - fglrx=2:13.350.1-0ubuntu0.0.1 + +# env: specifies additional global variables to define per row in build matrix +# env: +# global: +# - CXX=g++-4.8 +# - CC=gcc-4.8 + +before_install: + - if [ ${TRAVIS_OS_NAME} == "osx" ]; then brew update && echo MacOSX detected && clang --version; fi + - if [ ${CXX} = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi + +install: + - cmake --version; + - ${CC} --version; + - ${CXX} --version; + +before_script: + - mkdir -p bin/make/release + - cd bin/make/release + - cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_Boost=ON -DBUILD_gMock=ON -DBUILD_clSPARSE=ON -DBUILD_SAMPLES=ON ../../.. + +script: + - make + - cd clSPARSE-samples-build + - export LD_LIBRARY_PATH=${TRAVIS_BUILD_DIR}/bin/make/release/clSPARSE-build/package/lib64:${LD_LIBRARY_PATH} From befb68700f2b45e2a2bba01ce80da36cd5c6a0da Mon Sep 17 00:00:00 2001 From: Kent Knox Date: Mon, 10 Aug 2015 01:02:36 -0500 Subject: [PATCH 3/7] downloading opencl 1.2 headers --- .travis.yml | 103 ++++++++++++++++++++++++++-------- CMakeLists.txt | 18 +++--- cmake/ExternalBoost.cmake | 18 ++++-- src/CMakeLists.txt | 4 +- src/benchmarks/CMakeLists.txt | 23 ++++++-- src/cmake/FindOpenCL.cmake | 13 ++++- src/tests/CMakeLists.txt | 19 +++++-- 7 files changed, 148 insertions(+), 50 deletions(-) diff --git a/.travis.yml b/.travis.yml index e0a4346..5843628 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,56 +13,113 @@ language: cpp # sudo: false instructs travis to build our project in a docker VM (faster) -sudo: false +# Can not yet install fglrx packages with 'false' +sudo: required # false # os: expands the build matrix to include multiple os's os: - linux - - osx +# - osx # compiler: expands the build matrix to include multiple compilers (per os) compiler: - gcc -# - clang + - clang -# apt: needed by docker framework to install project dependencies without -# the sudo. Apt uses published Ubunto PPA's from https://launchpad.net/ -# https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json addons: + # apt: is disabled on osx builds + # apt: needed by docker framework to install project dependencies without + # sudo. Apt uses published Ubunto PPA's from https://launchpad.net/ + # https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json apt: sources: # ubuntu-toolchain-r-test contains newer versions of gcc to install - ubuntu-toolchain-r-test + # llvm-toolchain-precise-3.6 contains newer versions of clang to install + - llvm-toolchain-precise-3.6 # kubuntu-backports contains newer versions of cmake to install - kubuntu-backports + # boost-latest contains boost v 1.55 + # - boost-latest packages: - - g++-4.8 + # g++-4.8 is minimum version considered to be the first good c++11 gnu compiler + - g++-4.9 + - clang-3.6 + # We require v2.8.12 minimum - cmake - - opencl-headers -# - fglrx=2:8.960-0ubuntu1 -# - fglrx=2:13.350.1-0ubuntu0.0.1 + # I'm finding problems using pre-compiled versions of boost, with our use of ublas & gtest + # - libboost-program-options1.55-dev + # - libboost-serialization1.55-dev + # - libboost-filesystem1.55-dev + # - libboost-system1.55-dev + # - libboost-regex1.55-dev + # The package opencl-headers on 'precise' only installs v1.1 cl headers; uncomment for 'trusty' or greater +# - opencl-headers + # Uncomment one of the following when fglrx modules are added to the apt whitelist +# - fglrx +# - fglrx=2:8.960-0ubuntu1 +# - fglrx=2:13.350.1-0ubuntu0.0.1 # env: specifies additional global variables to define per row in build matrix -# env: -# global: -# - CXX=g++-4.8 -# - CC=gcc-4.8 +env: + global: + - CLSPARSE_ROOT=${TRAVIS_BUILD_DIR}/bin/make/release -before_install: - - if [ ${TRAVIS_OS_NAME} == "osx" ]; then brew update && echo MacOSX detected && clang --version; fi - - if [ ${CXX} = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi +# The following filters our build matrix; we are interested in linux-gcc & osx-clang +matrix: + exclude: +# - os: linux +# compiler: gcc # clang + - os: osx + compiler: gcc -install: +before_install: + # Remove the following linux clause when fglrx can be installed with sudo: false + - if [ ${TRAVIS_OS_NAME} == "linux" ]; then + sudo apt-get update -qq && + sudo apt-get install -qq fglrx=2:13.350.1-0ubuntu0.0.1; + fi + - if [ ${TRAVIS_OS_NAME} == "linux" ]; then + export OPENCL_ROOT="${TRAVIS_BUILD_DIR}/opencl-headers"; + export BUILD_BOOST="ON"; + fi + - if [ ${TRAVIS_OS_NAME} == "osx" ]; then + brew update; + brew outdated boost || brew upgrade boost; + brew outdated cmake || brew upgrade cmake; + export BUILD_BOOST="OFF"; + fi + - if [ ${CXX} = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi - cmake --version; - ${CC} --version; - ${CXX} --version; +install: + # 'Precise' only distributes v1.1 opencl headers; download 1.2 headers from khronos website + # Remove when the travis VM upgrades to 'trusty' or beyond + - if [ ${TRAVIS_OS_NAME} == "linux" ]; then + mkdir -p ${OPENCL_ROOT}/include/CL; + pushd ${OPENCL_ROOT}/include/CL; + wget -w 1 -r -np -nd -nv -A h,hpp https://www.khronos.org/registry/cl/api/1.2/; + popd; + fi + # osx image does not contain cl.hpp file; download from Khronos + - if [ ${TRAVIS_OS_NAME} == "osx" ]; then + pushd /System/Library/Frameworks/OpenCL.framework/Versions/A/Headers/; + sudo wget -w 1 -np -nd -nv -A h,hpp https://www.khronos.org/registry/cl/api/1.2/cl.hpp; + popd; + fi + +# Use before_script: to run configure steps before_script: - - mkdir -p bin/make/release - - cd bin/make/release - - cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_Boost=ON -DBUILD_gMock=ON -DBUILD_clSPARSE=ON -DBUILD_SAMPLES=ON ../../.. + - mkdir -p ${CLSPARSE_ROOT} + - pushd ${CLSPARSE_ROOT} + # Our configure step can download and install the latest boost, but it adds significant compile time and creates + # extremely long travis log files. We use pre-compiled boost packages to save VM time and space. + - cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_Boost=${BUILD_BOOST} -DBUILD_gMock=ON -DBUILD_clSPARSE=ON -DBUILD_SAMPLES=ON ${TRAVIS_BUILD_DIR} +# use script: to execute build steps script: - make - - cd clSPARSE-samples-build - - export LD_LIBRARY_PATH=${TRAVIS_BUILD_DIR}/bin/make/release/clSPARSE-build/package/lib64:${LD_LIBRARY_PATH} + # - cd clSPARSE-samples-build + # - export LD_LIBRARY_PATH=${TRAVIS_BUILD_DIR}/bin/make/release/clSPARSE-build/package/lib64:${LD_LIBRARY_PATH} diff --git a/CMakeLists.txt b/CMakeLists.txt index bbb5b90..36cea1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ cmake_minimum_required( VERSION 2.8.10 ) if( POLICY CMP0048 ) cmake_policy( SET CMP0048 NEW ) - project( SuperBuild.clSPARSE VERSION 0.7.0.0 ) + project( SuperBuild.clSPARSE VERSION 0.7.1.0 ) else( ) project( SuperBuild.clSPARSE ) @@ -42,7 +42,7 @@ else( ) endif( ) if( NOT DEFINED SuperBuild.clSPARSE_VERSION_PATCH ) - set( SuperBuild.clSPARSE_VERSION_PATCH 0 ) + set( SuperBuild.clSPARSE_VERSION_PATCH 1 ) endif( ) if( NOT DEFINED SuperBuild.clSPARSE_VERSION_TWEAK ) @@ -100,13 +100,12 @@ if( BUILD_Boost ) list( APPEND clSPARSE.Dependencies Boost ) list( APPEND clSPARSE.Cmake.Args -DBOOST_ROOT=${BOOST_ROOT} ) else( ) - if( NOT DEFINED BOOST_ROOT AND NOT DEFINED ENV{BOOST_ROOT} ) - message( SEND_ERROR "BOOST_ROOT must be provided if BUILD_Boost is disabled" ) + if( WIN32 AND (NOT DEFINED BOOST_ROOT AND NOT DEFINED ENV{BOOST_ROOT}) ) + message( WARNING "BOOST_ROOT should be provided if Boost is not in a default location" ) else( ) - if( NOT DEFINED BOOST_ROOT ) - set( BOOST_ROOT "$ENV{BOOST_ROOT}" ) + if( DEFINED BOOST_ROOT ) + list( APPEND clSPARSE.Cmake.Args -DBOOST_ROOT=${BOOST_ROOT} ) endif( ) - list( APPEND clSPARSE.Cmake.Args -DBOOST_ROOT=${BOOST_ROOT} ) endif( ) endif( ) @@ -129,6 +128,11 @@ else( ) endif( ) endif( ) +# Pass OPENCL_ROOT along to subproject if users provides path +if( DEFINED OPENCL_ROOT ) + list( APPEND clSPARSE.Cmake.Args -DOPENCL_ROOT=${OPENCL_ROOT} ) +endif( ) + # If the user selects, download, uncompress, and setup clBLAS #if( BUILD_clBLAS ) # message( STATUS "Setting up clBLAS external..." ) diff --git a/cmake/ExternalBoost.cmake b/cmake/ExternalBoost.cmake index 659cad1..43b7bff 100644 --- a/cmake/ExternalBoost.cmake +++ b/cmake/ExternalBoost.cmake @@ -1,12 +1,12 @@ # ######################################################################## # Copyright 2015 Advanced Micro Devices, Inc. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,8 +44,8 @@ endif( ) set( Boost.Command ./b2 --prefix=/package ) if( CMAKE_COMPILER_IS_GNUCXX ) - list( APPEND Boost.Command cxxflags=-fPIC ) -elseif( XCODE_VERSION ) + list( APPEND Boost.Command cxxflags=-fPIC -std=c++11 ) +elseif( XCODE_VERSION OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang") ) list( APPEND Boost.Command cxxflags=-std=c++11 -stdlib=libc++ linkflags=-stdlib=libc++ ) endif( ) @@ -77,6 +77,12 @@ elseif( MSVC14 ) list( APPEND Boost.Command toolset=msvc-14.0 ) elseif( XCODE_VERSION ) list( APPEND Boost.Command toolset=clang ) +elseif( DEFINED ENV{CC} ) + # CMake apprarently puts the full path of the compiler into CC + # The user might specify a non-default gcc compiler through ENV + message( STATUS "ENV{CC}=$ENV{CC}" ) + get_filename_component( gccToolset $ENV{CC} NAME ) + list( APPEND Boost.Command toolset=${gccToolset} ) endif( ) if( WIN32 ) @@ -148,9 +154,11 @@ ExternalProject_Add( URL ${ext.Boost_URL} URL_MD5 ${ext.MD5_HASH} UPDATE_COMMAND ${Boost.Bootstrap} + LOG_UPDATE 1 CONFIGURE_COMMAND "" BUILD_COMMAND ${Boost.Command} BUILD_IN_SOURCE 1 + LOG_BUILD 1 INSTALL_COMMAND "" ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c95d9c6..cd89073 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,7 +31,7 @@ endif( ) # clSPARSE becomes the name of the project with a particular version if( POLICY CMP0048 ) cmake_policy( SET CMP0048 NEW ) - project( clSPARSE VERSION 0.7.0.0 LANGUAGES C CXX ) + project( clSPARSE VERSION 0.7.1.0 LANGUAGES C CXX ) else( ) project( clSPARSE C CXX ) # Define a version for the code @@ -44,7 +44,7 @@ else( ) endif( ) if( NOT DEFINED clSPARSE_VERSION_PATCH ) - set( clSPARSE_VERSION_PATCH 0 ) + set( clSPARSE_VERSION_PATCH 1 ) endif( ) if( NOT DEFINED clSPARSE_VERSION_TWEAK ) diff --git a/src/benchmarks/CMakeLists.txt b/src/benchmarks/CMakeLists.txt index 2654e1f..686d20c 100644 --- a/src/benchmarks/CMakeLists.txt +++ b/src/benchmarks/CMakeLists.txt @@ -1,12 +1,12 @@ # ######################################################################## # Copyright 2015 Advanced Micro Devices, Inc. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,11 +15,22 @@ # ######################################################################## +message( STATUS "Configuring benchmarks sub-dir" ) + +# If user provides a specific boost path through command line, make sure to +# use that +if( DEFINED BOOST_ROOT OR DEFINED ENV{BOOST_ROOT} ) + set( Boost_NO_SYSTEM_PATHS ON ) + set( Boost_NO_BOOST_CMAKE ON ) +endif( ) + +# Setting Boost_USE_STATIC_LIBS should only be required if the user has both +# flavors available to choose from. Ideally, user picks which one by setting +# -DBoost_USE_STATIC_LIBS on cmake configure line +# set( Boost_USE_STATIC_LIBS ON ) set( Boost_USE_MULTITHREADED ON ) -set( Boost_USE_STATIC_LIBS ON ) set( Boost_DETAILED_FAILURE_MSG ON ) -set( Boost_NO_SYSTEM_PATHS ON ) -set( Boost_ADDITIONAL_VERSIONS 1.57.0 1.57 ) +set( Boost_ADDITIONAL_VERSIONS 1.58.0 1.58 1.57.0 1.57 ) # set( Boost_DEBUG ON ) find_package( Boost COMPONENTS program_options filesystem regex system ) diff --git a/src/cmake/FindOpenCL.cmake b/src/cmake/FindOpenCL.cmake index d98f506..0046667 100644 --- a/src/cmake/FindOpenCL.cmake +++ b/src/cmake/FindOpenCL.cmake @@ -1,6 +1,6 @@ # ######################################################################## # Copyright 2015 Advanced Micro Devices, Inc. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -48,10 +48,15 @@ include( CheckSymbolExists ) include( CMakePushCheckState ) +if( DEFINED OPENCL_ROOT ) + message( STATUS "OPENCL_ROOT: ${OPENCL_ROOT}" ) +endif( ) + find_path(OPENCL_INCLUDE_DIRS NAMES OpenCL/cl.h CL/cl.h HINTS ${OPENCL_ROOT}/include + $ENV{OPENCL_ROOT}/include $ENV{AMDAPPSDKROOT}/include $ENV{CUDA_PATH}/include PATHS @@ -105,7 +110,8 @@ if( LIB64 ) find_library( OPENCL_LIBRARIES NAMES OpenCL HINTS - ${OPENCL_ROOT}/lib + ${OPENCL_ROOT}/include + $ENV{OPENCL_ROOT}/include $ENV{AMDAPPSDKROOT}/lib $ENV{CUDA_PATH}/lib DOC "OpenCL dynamic library path" @@ -117,7 +123,8 @@ else( ) find_library( OPENCL_LIBRARIES NAMES OpenCL HINTS - ${OPENCL_ROOT}/lib + ${OPENCL_ROOT}/include + $ENV{OPENCL_ROOT}/include $ENV{AMDAPPSDKROOT}/lib $ENV{CUDA_PATH}/lib DOC "OpenCL dynamic library path" diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 465ec3f..53d207e 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1,7 +1,7 @@ # ######################################################################## # Copyright 2015 Advanced Micro Devices, Inc. # Copyright 2015 Vratis, Ltd. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -15,17 +15,28 @@ # limitations under the License. # ######################################################################## +message( STATUS "Configuring tests subdir" ) find_package( GTest REQUIRED ) +# If user provides a specific boost path through command line, make sure to +# use that +if( DEFINED BOOST_ROOT OR DEFINED ENV{BOOST_ROOT} ) + set( Boost_NO_SYSTEM_PATHS ON ) + set( Boost_NO_BOOST_CMAKE ON ) +endif( ) + +# Setting Boost_USE_STATIC_LIBS should only be required if the user has both +# flavors available to choose from. Ideally, user picks which one by setting +# -DBoost_USE_STATIC_LIBS on cmake configure line +# set( Boost_USE_STATIC_LIBS ON ) set( Boost_USE_MULTITHREADED ON ) -set( Boost_USE_STATIC_LIBS ON ) set( Boost_DETAILED_FAILURE_MSG ON ) -set( Boost_NO_SYSTEM_PATHS ON ) -set( Boost_ADDITIONAL_VERSIONS 1.57.0 1.57 ) +set( Boost_ADDITIONAL_VERSIONS 1.58.0 1.58 1.57.0 1.57 ) # set( Boost_DEBUG ON ) find_package( Boost COMPONENTS program_options serialization ) + # Unit tests requires OpenCL # A standard FindOpenCL.cmake module ships with cmake 3.1, buy we supply our own until 3.1 becomes more prevalent find_package( OpenCL REQUIRED ) From c29b61e3fb3aa8dd7d58758325df95cd18200c86 Mon Sep 17 00:00:00 2001 From: Kent Knox Date: Thu, 13 Aug 2015 12:22:26 -0400 Subject: [PATCH 4/7] Resolves #117; adding explicit libdl dependency to clsparse --- .travis.yml | 13 +++++++------ CMakeLists.txt | 4 +++- samples/CMakeLists.txt | 7 ++++++- samples/cmake/FindOpenCL.cmake | 14 ++++++++++---- src/cmake/FindOpenCL.cmake | 12 ++++++------ src/library/CMakeLists.txt | 2 +- 6 files changed, 33 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5843628..3ba96b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,18 +36,19 @@ addons: # ubuntu-toolchain-r-test contains newer versions of gcc to install - ubuntu-toolchain-r-test # llvm-toolchain-precise-3.6 contains newer versions of clang to install - - llvm-toolchain-precise-3.6 + # - llvm-toolchain-precise-3.6 # kubuntu-backports contains newer versions of cmake to install - kubuntu-backports - # boost-latest contains boost v 1.55 + # boost-latest contains boost v1.55 # - boost-latest packages: # g++-4.8 is minimum version considered to be the first good c++11 gnu compiler - - g++-4.9 - - clang-3.6 + - g++-4.8 + # - clang-3.6 # We require v2.8.12 minimum - cmake - # I'm finding problems using pre-compiled versions of boost, with our use of ublas & gtest + # I'm finding problems between pre-compiled versions of boost ublas, with gtest + # stl_algobase.h: error: no matching function for call to swap() # - libboost-program-options1.55-dev # - libboost-serialization1.55-dev # - libboost-filesystem1.55-dev @@ -89,7 +90,7 @@ before_install: brew outdated cmake || brew upgrade cmake; export BUILD_BOOST="OFF"; fi - - if [ ${CXX} = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi + - if [ ${CXX} = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi - cmake --version; - ${CC} --version; - ${CXX} --version; diff --git a/CMakeLists.txt b/CMakeLists.txt index 36cea1f..66e102b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,6 +91,7 @@ set_property( CACHE BUILD_CLVERSION PROPERTY STRINGS 2.0 1.2 1.1 ) # Comment this out because this does not work yet set( clSPARSE.Dependencies ) set( clSPARSE.Cmake.Args ) +set( clSPARSE.Samples.Cmake.Args ) # If the user selects, download, uncompress, and setup Boost if( BUILD_Boost ) @@ -131,6 +132,7 @@ endif( ) # Pass OPENCL_ROOT along to subproject if users provides path if( DEFINED OPENCL_ROOT ) list( APPEND clSPARSE.Cmake.Args -DOPENCL_ROOT=${OPENCL_ROOT} ) + list( APPEND clSPARSE.Samples.Cmake.Args -DOPENCL_ROOT=${OPENCL_ROOT} ) endif( ) # If the user selects, download, uncompress, and setup clBLAS @@ -202,7 +204,7 @@ if( BUILD_clSPARSE OR BUILD_SAMPLES ) DEPENDS clSPARSE SOURCE_DIR ${PROJECT_SOURCE_DIR}/samples BINARY_DIR clSPARSE-samples-build - CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_CLVERSION=${BUILD_CLVERSION} -DBUILD64=${BUILD64} -DCMAKE_PREFIX_PATH=${install_dir} + CMAKE_ARGS ${clSPARSE.Samples.Cmake.Args} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_CLVERSION=${BUILD_CLVERSION} -DBUILD64=${BUILD64} -DCMAKE_PREFIX_PATH=${install_dir} EXCLUDE_FROM_ALL 1 INSTALL_COMMAND "" ) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 968d3a2..779d787 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -1,6 +1,6 @@ # ######################################################################## # Copyright 2015 Vratis, Ltd. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -32,6 +32,11 @@ list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) find_package( clSPARSE REQUIRED CONFIG ) message( STATUS "clSPARSE INCLUDES = ${clSPARSE_INCLUDE_DIR}") +# Query the user for which version of OpenCL they wish to build the library for +set( BUILD_CLVERSION "1.2" CACHE STRING "The version of OpenCL we wish to compile the samples against" ) +set_property( CACHE BUILD_CLVERSION PROPERTY STRINGS 2.0 1.2 1.1 ) +message( STATUS "clSPARSE samples are building using CL interface ='${BUILD_CLVERSION}'" ) + # Find OpenCL find_package( OpenCL ${BUILD_CLVERSION} REQUIRED ) message( STATUS "OPENCL_INCLUDE_DIRS = ${OPENCL_INCLUDE_DIRS}") diff --git a/samples/cmake/FindOpenCL.cmake b/samples/cmake/FindOpenCL.cmake index dfbff75..120f38a 100644 --- a/samples/cmake/FindOpenCL.cmake +++ b/samples/cmake/FindOpenCL.cmake @@ -1,12 +1,12 @@ # ######################################################################## # Copyright 2015 Advanced Micro Devices, Inc. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -14,7 +14,6 @@ # limitations under the License. # ######################################################################## - # Locate an OpenCL implementation. # Currently supports AMD APP SDK (http://developer.amd.com/sdks/AMDAPPSDK/Pages/default.aspx/) # @@ -49,10 +48,15 @@ include( CheckSymbolExists ) include( CMakePushCheckState ) +if( DEFINED OPENCL_ROOT OR DEFINED ENV{OPENCL_ROOT}) + message( STATUS "Defined OPENCL_ROOT: ${OPENCL_ROOT}, ENV{OPENCL_ROOT}: $ENV{OPENCL_ROOT}" ) +endif( ) + find_path(OPENCL_INCLUDE_DIRS NAMES OpenCL/cl.h CL/cl.h HINTS ${OPENCL_ROOT}/include + $ENV{OPENCL_ROOT}/include $ENV{AMDAPPSDKROOT}/include $ENV{CUDA_PATH}/include PATHS @@ -107,6 +111,7 @@ if( LIB64 ) NAMES OpenCL HINTS ${OPENCL_ROOT}/lib + $ENV{OPENCL_ROOT}/lib $ENV{AMDAPPSDKROOT}/lib $ENV{CUDA_PATH}/lib DOC "OpenCL dynamic library path" @@ -119,6 +124,7 @@ else( ) NAMES OpenCL HINTS ${OPENCL_ROOT}/lib + $ENV{OPENCL_ROOT}/lib $ENV{AMDAPPSDKROOT}/lib $ENV{CUDA_PATH}/lib DOC "OpenCL dynamic library path" diff --git a/src/cmake/FindOpenCL.cmake b/src/cmake/FindOpenCL.cmake index 0046667..120f38a 100644 --- a/src/cmake/FindOpenCL.cmake +++ b/src/cmake/FindOpenCL.cmake @@ -48,8 +48,8 @@ include( CheckSymbolExists ) include( CMakePushCheckState ) -if( DEFINED OPENCL_ROOT ) - message( STATUS "OPENCL_ROOT: ${OPENCL_ROOT}" ) +if( DEFINED OPENCL_ROOT OR DEFINED ENV{OPENCL_ROOT}) + message( STATUS "Defined OPENCL_ROOT: ${OPENCL_ROOT}, ENV{OPENCL_ROOT}: $ENV{OPENCL_ROOT}" ) endif( ) find_path(OPENCL_INCLUDE_DIRS @@ -110,8 +110,8 @@ if( LIB64 ) find_library( OPENCL_LIBRARIES NAMES OpenCL HINTS - ${OPENCL_ROOT}/include - $ENV{OPENCL_ROOT}/include + ${OPENCL_ROOT}/lib + $ENV{OPENCL_ROOT}/lib $ENV{AMDAPPSDKROOT}/lib $ENV{CUDA_PATH}/lib DOC "OpenCL dynamic library path" @@ -123,8 +123,8 @@ else( ) find_library( OPENCL_LIBRARIES NAMES OpenCL HINTS - ${OPENCL_ROOT}/include - $ENV{OPENCL_ROOT}/include + ${OPENCL_ROOT}/lib + $ENV{OPENCL_ROOT}/lib $ENV{AMDAPPSDKROOT}/lib $ENV{CUDA_PATH}/lib DOC "OpenCL dynamic library path" diff --git a/src/library/CMakeLists.txt b/src/library/CMakeLists.txt index a48d089..5e7e32e 100644 --- a/src/library/CMakeLists.txt +++ b/src/library/CMakeLists.txt @@ -251,7 +251,7 @@ add_library( clSPARSE ${clSPARSE_LIBRARY_TYPE} ) # PRIVATE linking prevents transitive library linking of the clBLAS libraries -target_link_libraries( clSPARSE PRIVATE ${OPENCL_LIBRARIES} ) #${clBLAS_LIBRARIES} ) +target_link_libraries( clSPARSE PRIVATE ${OPENCL_LIBRARIES} ${CMAKE_DL_LIBS} ) #${clBLAS_LIBRARIES} ) # Package that helps me set visibility for function names exported from shared library GENERATE_EXPORT_HEADER( clSPARSE ) From 5ccfb1b1eef96cceddf99629134b425b50b75a0c Mon Sep 17 00:00:00 2001 From: Kent Knox Date: Fri, 14 Aug 2015 16:58:19 -0500 Subject: [PATCH 5/7] Making packages. Adding readme badges for clmathlibraries --- .travis.yml | 12 +++++------- README.md | 5 +++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3ba96b4..25075d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ sudo: required # false # os: expands the build matrix to include multiple os's os: - linux -# - osx + - osx # compiler: expands the build matrix to include multiple compilers (per os) compiler: @@ -69,8 +69,8 @@ env: # The following filters our build matrix; we are interested in linux-gcc & osx-clang matrix: exclude: -# - os: linux -# compiler: gcc # clang + - os: linux + compiler: clang - os: osx compiler: gcc @@ -115,12 +115,10 @@ install: before_script: - mkdir -p ${CLSPARSE_ROOT} - pushd ${CLSPARSE_ROOT} - # Our configure step can download and install the latest boost, but it adds significant compile time and creates - # extremely long travis log files. We use pre-compiled boost packages to save VM time and space. - cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_Boost=${BUILD_BOOST} -DBUILD_gMock=ON -DBUILD_clSPARSE=ON -DBUILD_SAMPLES=ON ${TRAVIS_BUILD_DIR} # use script: to execute build steps script: - make - # - cd clSPARSE-samples-build - # - export LD_LIBRARY_PATH=${TRAVIS_BUILD_DIR}/bin/make/release/clSPARSE-build/package/lib64:${LD_LIBRARY_PATH} + - cd clSPARSE-build + - make package diff --git a/README.md b/README.md index b5b45a5..8574cb3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ +## Build Status Pre-built binaries are available on our [releases page](https://github.com/clMathLibraries/clSPARSE/releases) +| Build branch | master | develop | +|-----|-----|-----| +| Linux/OSX x64 | [![Build Status](https://travis-ci.org/clMathLibraries/clSPARSE.svg?branch=master)](https://travis-ci.org/clMathLibraries/clSPARSE) |[![Build Status](https://travis-ci.org/clMathLibraries/clSPARSE.svg?branch=develop)](https://travis-ci.org/clMathLibraries/clSPARSE) | + # clSPARSE an OpenCL© library implementing Sparse linear algebra. This project is a result of a collaboration between [AMD Inc.](http://www.amd.com/) and From 3df6743c265f5a9af0c71c9f73746fd9b38c04c2 Mon Sep 17 00:00:00 2001 From: Kent Knox Date: Tue, 18 Aug 2015 15:19:21 -0500 Subject: [PATCH 6/7] Fixes for Jakubs comments --- cmake/ExternalBoost.cmake | 6 ++ src/benchmarks/CMakeLists.txt | 21 +++++- src/tests/CMakeLists.txt | 22 +++++- src/tests/test-clsparse-utils.cpp | 117 +++++++++++++++--------------- src/tests/test-conversion.cpp | 16 ++-- 5 files changed, 108 insertions(+), 74 deletions(-) diff --git a/cmake/ExternalBoost.cmake b/cmake/ExternalBoost.cmake index 43b7bff..d207a9f 100644 --- a/cmake/ExternalBoost.cmake +++ b/cmake/ExternalBoost.cmake @@ -82,6 +82,12 @@ elseif( DEFINED ENV{CC} ) # The user might specify a non-default gcc compiler through ENV message( STATUS "ENV{CC}=$ENV{CC}" ) get_filename_component( gccToolset $ENV{CC} NAME ) + + # see: https://svn.boost.org/trac/boost/ticket/5917 + string( TOLOWER ${gccToolset} gccToolset ) + if( gccToolset STREQUAL "cc") + set( gccToolset "gcc" ) + endif( ) list( APPEND Boost.Command toolset=${gccToolset} ) endif( ) diff --git a/src/benchmarks/CMakeLists.txt b/src/benchmarks/CMakeLists.txt index 686d20c..8f12914 100644 --- a/src/benchmarks/CMakeLists.txt +++ b/src/benchmarks/CMakeLists.txt @@ -22,12 +22,25 @@ message( STATUS "Configuring benchmarks sub-dir" ) if( DEFINED BOOST_ROOT OR DEFINED ENV{BOOST_ROOT} ) set( Boost_NO_SYSTEM_PATHS ON ) set( Boost_NO_BOOST_CMAKE ON ) + + # Workaround for a somewhat limiting find_package( Boost ) on MSVC platforms. + # Boost uses the prefix 'lib' for static libraries on windows, but it will + # not search with that prefix unless Boost_USE_STATIC_LIBS is set. However, other + # than a priori knowledge, a user does not know to set Boost_USE_STATIC_LIBS. + # Attempt to do a basic check on windows, which may/may not work in all cases + if( MSVC ) + file( GLOB Boost.static.env.libs RELATIVE "$ENV{BOOST_ROOT}/lib" "$ENV{BOOST_ROOT}/lib/lib*.lib" ) + file( GLOB Boost.static.define.libs RELATIVE "${BOOST_ROOT}/lib" "${BOOST_ROOT}/lib/lib*.lib" ) + list( LENGTH Boost.static.env.libs num.static.env.libs ) + list( LENGTH Boost.static.define.libs num.static.define.libs ) + math( EXPR Boost.num.static.libs "${num.static.env.libs} + ${num.static.define.libs} " ) + if( Boost.num.static.libs ) + message( STATUS "Detected MSVC boost static libs" ) + set( Boost_USE_STATIC_LIBS ON ) + endif( ) + endif( ) endif( ) -# Setting Boost_USE_STATIC_LIBS should only be required if the user has both -# flavors available to choose from. Ideally, user picks which one by setting -# -DBoost_USE_STATIC_LIBS on cmake configure line -# set( Boost_USE_STATIC_LIBS ON ) set( Boost_USE_MULTITHREADED ON ) set( Boost_DETAILED_FAILURE_MSG ON ) set( Boost_ADDITIONAL_VERSIONS 1.58.0 1.58 1.57.0 1.57 ) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 53d207e..876910c 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -24,12 +24,25 @@ find_package( GTest REQUIRED ) if( DEFINED BOOST_ROOT OR DEFINED ENV{BOOST_ROOT} ) set( Boost_NO_SYSTEM_PATHS ON ) set( Boost_NO_BOOST_CMAKE ON ) + + # Workaround for a somewhat limiting find_package( Boost ) on MSVC platforms. + # Boost uses the prefix 'lib' for static libraries on windows, but it will + # not search with that prefix unless Boost_USE_STATIC_LIBS is set. However, other + # than a priori knowledge, a user does not know to set Boost_USE_STATIC_LIBS. + # Attempt to do a basic check on windows, which may/may not work in all cases + if( MSVC ) + file( GLOB Boost.static.env.libs RELATIVE "$ENV{BOOST_ROOT}/lib" "$ENV{BOOST_ROOT}/lib/lib*.lib" ) + file( GLOB Boost.static.define.libs RELATIVE "${BOOST_ROOT}/lib" "${BOOST_ROOT}/lib/lib*.lib" ) + list( LENGTH Boost.static.env.libs num.static.env.libs ) + list( LENGTH Boost.static.define.libs num.static.define.libs ) + math( EXPR Boost.num.static.libs "${num.static.env.libs} + ${num.static.define.libs} " ) + if( Boost.num.static.libs ) + message( STATUS "Detected MSVC boost static libs" ) + set( Boost_USE_STATIC_LIBS ON ) + endif( ) + endif( ) endif( ) -# Setting Boost_USE_STATIC_LIBS should only be required if the user has both -# flavors available to choose from. Ideally, user picks which one by setting -# -DBoost_USE_STATIC_LIBS on cmake configure line -# set( Boost_USE_STATIC_LIBS ON ) set( Boost_USE_MULTITHREADED ON ) set( Boost_DETAILED_FAILURE_MSG ON ) set( Boost_ADDITIONAL_VERSIONS 1.58.0 1.58 1.57.0 1.57 ) @@ -46,6 +59,7 @@ find_package( OpenCL REQUIRED ) include_directories( ${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/library + ${PROJECT_BINARY_DIR}/include resources #resources/uBLAS-linalg ${GTEST_INCLUDE_DIRS} diff --git a/src/tests/test-clsparse-utils.cpp b/src/tests/test-clsparse-utils.cpp index 588b474..13cafb7 100644 --- a/src/tests/test-clsparse-utils.cpp +++ b/src/tests/test-clsparse-utils.cpp @@ -19,48 +19,49 @@ #include "opencl_utils.h" #include "../library/internal/ocl-type-traits.hpp" +#include "clSPARSE-version.h" -TEST (clSparseTraits, cl_mem_type) +TEST( clSparseTraits, cl_mem_type ) { bool is_fundamental = is_pointer_fundamental::value; - ASSERT_EQ(false, is_fundamental); + ASSERT_EQ( false, is_fundamental ); } -TEST (clSparseTraits, non_cl_mem_type) +TEST( clSparseTraits, non_cl_mem_type ) { bool is_fundamental = is_pointer_fundamental::value; - ASSERT_EQ(true, is_fundamental); + ASSERT_EQ( true, is_fundamental ); } -TEST (clSparseInit, setup) +TEST( clSparseInit, setup ) { - clsparseStatus status = clsparseSetup(); + clsparseStatus status = clsparseSetup( ); - EXPECT_EQ(clsparseSuccess, status); + EXPECT_EQ( clsparseSuccess, status ); } -TEST (clSparseInit, teardown) +TEST( clSparseInit, teardown ) { - clsparseSetup(); - clsparseStatus status = clsparseTeardown(); + clsparseSetup( ); + clsparseStatus status = clsparseTeardown( ); - EXPECT_EQ (clsparseSuccess, status); + EXPECT_EQ( clsparseSuccess, status ); } -TEST (clSparseInit, version) +TEST( clSparseInit, version ) { cl_uint major = 3, minor = 3, patch = 3, tweak = 3; - clsparseGetVersion (&major, &minor, &patch, &tweak ); + clsparseGetVersion( &major, &minor, &patch, &tweak ); - EXPECT_EQ (0, major); - EXPECT_EQ (6, minor); - EXPECT_EQ (0, patch); - EXPECT_EQ( 0, tweak ); + EXPECT_EQ( clsparseVersionMajor, major ); + EXPECT_EQ( clsparseVersionMinor, minor ); + EXPECT_EQ( clsparseVersionPatch, patch ); + EXPECT_EQ( clsparseVersionTweak, tweak ); } -TEST (clsparseInit, control) +TEST( clsparseInit, control ) { // init cl environment @@ -68,23 +69,23 @@ TEST (clsparseInit, control) cl_platform_id* platforms = NULL; cl_uint num_platforms = 0; - status = getPlatforms(&platforms, &num_platforms); - ASSERT_EQ(CL_SUCCESS, status); + status = getPlatforms( &platforms, &num_platforms ); + ASSERT_EQ( CL_SUCCESS, status ); //printPlatforms(platforms, num_platforms); cl_device_id device = NULL; - status = getDevice(platforms[0], &device, CL_DEVICE_TYPE_GPU); - ASSERT_EQ(CL_SUCCESS, status); + status = getDevice( platforms[ 0 ], &device, CL_DEVICE_TYPE_GPU ); + ASSERT_EQ( CL_SUCCESS, status ); //printDeviceInfo(device); - auto context = clCreateContext(NULL, 1, &device, NULL, NULL, NULL); - auto queue = clCreateCommandQueue(context, device, 0, NULL); + auto context = clCreateContext( NULL, 1, &device, NULL, NULL, NULL ); + auto queue = clCreateCommandQueue( context, device, 0, NULL ); clsparseSetup( ); - auto control = clsparseCreateControl(queue, NULL); + auto control = clsparseCreateControl( queue, NULL ); clsparseReleaseControl( control ); clsparseTeardown( ); @@ -95,7 +96,7 @@ TEST (clsparseInit, control) } -TEST (clsparseInit, cpp_interface) +TEST( clsparseInit, cpp_interface ) { // Init OpenCL environment; cl_int cl_status; @@ -103,90 +104,90 @@ TEST (clsparseInit, cpp_interface) // Get OpenCL platforms std::vector platforms; - cl_status = cl::Platform::get(&platforms); + cl_status = cl::Platform::get( &platforms ); - if (cl_status != CL_SUCCESS) + if( cl_status != CL_SUCCESS ) { std::cout << "Problem with getting OpenCL platforms" - << " [" << cl_status << "]" << std::endl; - ASSERT_EQ(CL_SUCCESS, cl_status); + << " [" << cl_status << "]" << std::endl; + ASSERT_EQ( CL_SUCCESS, cl_status ); } int platform_id = 0; - for (const auto& p : platforms) + for( const auto& p : platforms ) { std::cout << "Platform ID " << platform_id++ << " : " - << p.getInfo() << std::endl; + << p.getInfo( ) << std::endl; } // Using first platform platform_id = 0; - cl::Platform platform = platforms[platform_id]; + cl::Platform platform = platforms[ platform_id ]; // Get device from platform std::vector devices; - cl_status = platform.getDevices(CL_DEVICE_TYPE_GPU, &devices); + cl_status = platform.getDevices( CL_DEVICE_TYPE_GPU, &devices ); - if (cl_status != CL_SUCCESS) + if( cl_status != CL_SUCCESS ) { std::cout << "Problem with getting devices from platform" - << " [" << platform_id << "] " << platform.getInfo() - << " error: [" << cl_status << "]" << std::endl; - ASSERT_EQ(CL_SUCCESS, cl_status); + << " [" << platform_id << "] " << platform.getInfo( ) + << " error: [" << cl_status << "]" << std::endl; + ASSERT_EQ( CL_SUCCESS, cl_status ); } std::cout << std::endl - << "Getting devices from platform " << platform_id << std::endl; + << "Getting devices from platform " << platform_id << std::endl; cl_int device_id = 0; - for (const auto& device : devices) + for( const auto& device : devices ) { std::cout << "Device ID " << device_id++ << " : " - << device.getInfo() << std::endl; + << device.getInfo( ) << std::endl; } // Using first device; device_id = 0; - cl::Device device = devices[device_id]; + cl::Device device = devices[ device_id ]; // Create OpenCL context; - cl::Context context (device); + cl::Context context( device ); // Create OpenCL queue; - cl::CommandQueue queue(context, device); + cl::CommandQueue queue( context, device ); - clsparseStatus status = clsparseSetup(); - if (status != clsparseSuccess) + clsparseStatus status = clsparseSetup( ); + if( status != clsparseSuccess ) { std::cout << "Problem with executing clsparseSetup()" << std::endl; - ASSERT_EQ(clsparseSuccess, status); + ASSERT_EQ( clsparseSuccess, status ); } // Create clsparseControl object - clsparseControl control = clsparseCreateControl(queue(), &status); - if (status != CL_SUCCESS) + clsparseControl control = clsparseCreateControl( queue( ), &status ); + if( status != CL_SUCCESS ) { std::cout << "Problem with creating clSPARSE control object" - <<" error [" << status << "]" << std::endl; - ASSERT_EQ(clsparseSuccess, status); + << " error [" << status << "]" << std::endl; + ASSERT_EQ( clsparseSuccess, status ); } //cleanup; - status = clsparseReleaseControl(control); - ASSERT_EQ(clsparseSuccess, status); + status = clsparseReleaseControl( control ); + ASSERT_EQ( clsparseSuccess, status ); - status = clsparseTeardown(); - ASSERT_EQ(clsparseSuccess, status); + status = clsparseTeardown( ); + ASSERT_EQ( clsparseSuccess, status ); } -int main(int argc, char* argv[]) +int main( int argc, char* argv[ ] ) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); + ::testing::InitGoogleTest( &argc, argv ); + return RUN_ALL_TESTS( ); } diff --git a/src/tests/test-conversion.cpp b/src/tests/test-conversion.cpp index 2e7623e..2ebcc7f 100644 --- a/src/tests/test-conversion.cpp +++ b/src/tests/test-conversion.cpp @@ -111,7 +111,7 @@ class MatrixConversion : public ::testing::Test for(int i = 0; i < ublas_dense.data().size(); i++) { // there should be exactly the same data - ASSERT_EQ(ublas_dense.data()[i], result[i]); + EXPECT_FLOAT_EQ(ublas_dense.data()[i], result[i]); } } @@ -136,7 +136,7 @@ class MatrixConversion : public ::testing::Test for(int i = 0; i < ublas_dense.data().size(); i++) { // there should be exactly the same data - ASSERT_EQ(ublas_dense.data()[i], result[i]); + EXPECT_DOUBLE_EQ(ublas_dense.data()[i], result[i]); } } } @@ -193,7 +193,7 @@ class MatrixConversion : public ::testing::Test ASSERT_EQ(CL_SUCCESS, cl_status); for (int i = 0; i < values.size(); i++) - ASSERT_EQ(CSRE::ublasSCsr.value_data()[i], values[i]); + EXPECT_FLOAT_EQ(CSRE::ublasSCsr.value_data()[i], values[i]); // Compare row_offsets @@ -272,7 +272,7 @@ class MatrixConversion : public ::testing::Test ASSERT_EQ(CL_SUCCESS, cl_status); for (int i = 0; i < values.size(); i++) - ASSERT_EQ(CSRE::ublasDCsr.value_data()[i], values[i]); + EXPECT_DOUBLE_EQ(CSRE::ublasDCsr.value_data()[i], values[i]); // Compare row_offsets @@ -369,7 +369,7 @@ class MatrixConversion : public ::testing::Test // Compare values; for (int i = 0; i < values.size(); i++) - ASSERT_EQ(values[i], CSRE::ublasSCsr.value_data()[i]); + EXPECT_FLOAT_EQ(values[i], CSRE::ublasSCsr.value_data()[i]); cl_status = ::clEnqueueReadBuffer(CLSE::queue, CSRE::csrSMatrix.colIndices, @@ -424,7 +424,7 @@ class MatrixConversion : public ::testing::Test // Compare values; for (int i = 0; i < values.size(); i++) - ASSERT_EQ(values[i], CSRE::ublasDCsr.value_data()[i]); + EXPECT_DOUBLE_EQ(values[i], CSRE::ublasDCsr.value_data()[i]); cl_status = ::clEnqueueReadBuffer(CLSE::queue, CSRE::csrDMatrix.colIndices, @@ -534,7 +534,7 @@ class MatrixConversion : public ::testing::Test ASSERT_EQ(CL_SUCCESS, cl_status); for (int i = 0; i < values.size(); i++) - ASSERT_EQ(ublas_coo.value_data()[i], values[i]); + EXPECT_FLOAT_EQ(ublas_coo.value_data()[i], values[i]); } @@ -590,7 +590,7 @@ class MatrixConversion : public ::testing::Test ASSERT_EQ(CL_SUCCESS, cl_status); for (int i = 0; i < values.size(); i++) - ASSERT_EQ(ublas_coo.value_data()[i], values[i]); + EXPECT_DOUBLE_EQ(ublas_coo.value_data()[i], values[i]); } From c02889189cfe4bfbaadc9c811a573bad2db45786 Mon Sep 17 00:00:00 2001 From: Kent Knox Date: Tue, 18 Aug 2015 15:53:47 -0500 Subject: [PATCH 7/7] Disable linux builds as Boost sporadically fails to build in Travis --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 25075d7..e1052e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,9 @@ language: cpp sudo: required # false # os: expands the build matrix to include multiple os's +# disable linux, as we get sporadic failures on building boost, needs investigation os: - - linux +# - linux - osx # compiler: expands the build matrix to include multiple compilers (per os)