Skip to content

Commit

Permalink
Version bump to v0.6.2
Browse files Browse the repository at this point in the history
* Added Travis CI build automation
* OPENCL_ROOT can be passed through env var to help find OpenCL
* ExternalBoost can select compiler through ENV{CC}
* Linux/OSX builds will find boost either in static or dynamic forms
* Cmake config package now installs to ${LIB_INSTALL_DIR}/cmake/clSPARSE - #116
* Library links to ${CMAKE_DL_LIBS} - #117

Merge branch 'develop'

Conflicts:
	CMakeLists.txt
	src/CMakeLists.txt
  • Loading branch information
Kent Knox committed Aug 18, 2015
2 parents 4e34f70 + 7971327 commit a69553e
Show file tree
Hide file tree
Showing 13 changed files with 317 additions and 99 deletions.
125 changes: 125 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# 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)
# Can not yet install fglrx packages with 'false'
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
- osx

# compiler: expands the build matrix to include multiple compilers (per os)
compiler:
- gcc
- clang

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 v1.55
# - boost-latest
packages:
# g++-4.8 is minimum version considered to be the first good c++11 gnu compiler
- g++-4.8
# - clang-3.6
# We require v2.8.12 minimum
- cmake
# 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
# - 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:
- CLSPARSE_ROOT=${TRAVIS_BUILD_DIR}/bin/make/release

# The following filters our build matrix; we are interested in linux-gcc & osx-clang
matrix:
exclude:
- os: linux
compiler: clang
- os: osx
compiler: gcc

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.8" CC="gcc-4.8"; 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 ${CLSPARSE_ROOT}
- pushd ${CLSPARSE_ROOT}
- 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-build
- make package
22 changes: 14 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cmake_minimum_required( VERSION 2.8.10 )
if( POLICY CMP0048 )
cmake_policy( SET CMP0048 NEW )

project( SuperBuild.clSPARSE VERSION 0.6.1.0 )
project( SuperBuild.clSPARSE VERSION 0.6.2.0 )
else( )
project( SuperBuild.clSPARSE )

Expand All @@ -42,7 +42,7 @@ else( )
endif( )

if( NOT DEFINED SuperBuild.clSPARSE_VERSION_PATCH )
set( SuperBuild.clSPARSE_VERSION_PATCH 1 )
set( SuperBuild.clSPARSE_VERSION_PATCH 2 )
endif( )

if( NOT DEFINED SuperBuild.clSPARSE_VERSION_TWEAK )
Expand Down Expand Up @@ -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 )
Expand All @@ -100,13 +101,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( )

Expand All @@ -129,6 +129,12 @@ 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} )
list( APPEND clSPARSE.Samples.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..." )
Expand Down Expand Up @@ -198,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 ""
)
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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&copy; library implementing Sparse linear algebra. This project is a result of
a collaboration between [AMD Inc.](http://www.amd.com/) and
Expand Down
24 changes: 19 additions & 5 deletions cmake/ExternalBoost.cmake
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -44,8 +44,8 @@ endif( )
set( Boost.Command ./b2 --prefix=<INSTALL_DIR>/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( )

Expand Down Expand Up @@ -77,6 +77,18 @@ 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 )

# 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( )

if( WIN32 )
Expand Down Expand Up @@ -148,9 +160,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 ""
)

Expand Down
7 changes: 6 additions & 1 deletion samples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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}")
Expand Down
14 changes: 10 additions & 4 deletions samples/cmake/FindOpenCL.cmake
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# ########################################################################
# 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.
# See the License for the specific language governing permissions and
# limitations under the License.
# ########################################################################


# Locate an OpenCL implementation.
# Currently supports AMD APP SDK (http://developer.amd.com/sdks/AMDAPPSDK/Pages/default.aspx/)
#
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.1.0 LANGUAGES C CXX )
project( clSPARSE VERSION 0.6.2.0 LANGUAGES C CXX )
else( )
project( clSPARSE C CXX )
# Define a version for the code
Expand All @@ -44,7 +44,7 @@ else( )
endif( )

if( NOT DEFINED clSPARSE_VERSION_PATCH )
set( clSPARSE_VERSION_PATCH 1 )
set( clSPARSE_VERSION_PATCH 2 )
endif( )

if( NOT DEFINED clSPARSE_VERSION_TWEAK )
Expand Down
Loading

0 comments on commit a69553e

Please sign in to comment.