Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable installation on MacOS #5

Merged
merged 48 commits into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
636a519
Enable installation on MacOS
Feb 1, 2018
30eae1e
Use Travis on OS X
Feb 1, 2018
dc1817d
Ignore failures from test(1) if different OS is in use
Feb 1, 2018
2b553c9
Skip tests on Travis Mac
Feb 1, 2018
78f14a2
Ignore .travis directory to get rid of a NOTE
Feb 1, 2018
fabad35
Install glfw on Travis Mac
Feb 2, 2018
e0e1237
Reeanble tests on Travis Mac
Feb 2, 2018
ac3d1aa
Revert "Reeanble tests on Travis Mac"
Feb 2, 2018
0076fdc
Revert "Install glfw on Travis Mac"
Feb 2, 2018
6b41520
Merge changes from v0.0.3
Mar 1, 2018
b0fa128
Add fontconfig in MacOS install
Mar 1, 2018
2ad4e01
Add fontconfig in MacOS install
Mar 1, 2018
0500fb2
Merge branch 'macos' of github.com:RInstitute/rcpparrayfire into macos
Mar 1, 2018
b426f85
Install fontconfig before installing ArrayFire
Mar 1, 2018
97b13a6
Do not use sudo for brew
Mar 1, 2018
fdb9aaf
Also install glfw via brew
Mar 1, 2018
e83a800
Also skip the new test on Travis Mac
Mar 1, 2018
6321103
Separate out rpath handling
Feb 8, 2018
2a3f67e
Allow building for different backends
Feb 8, 2018
a9e8694
Simplify configure(.ac)
Mar 1, 2018
18acac7
Correct handling of AF_BACKEND
Mar 1, 2018
6af3da8
Do codecov only on Linux since tests are disabled on Travis Mac
Mar 1, 2018
584b471
Test AF installation on Travis Mac
rstub Mar 12, 2018
2cc3a03
Remove test files for Travis on Mac
rstub Mar 12, 2018
e595a27
More tests for Travis on Mac
rstub Mar 12, 2018
78b41b0
Do even more tests for Travis on Mac
rstub Mar 14, 2018
c7dad29
Fix bug in tests for Travis on Mac
rstub Mar 14, 2018
3480eb0
Add RcppExport from current Rcpp
rstub Jun 27, 2019
f5707f0
Use current AF on Travis CI
rstub Jun 27, 2019
9423552
Use configure from master
rstub Jun 27, 2019
dc11f9d
Add /opt/arrayfire/lib to @rpath
rstub Jun 27, 2019
c2dc31d
Do not skip (some) tests on Mac OS
rstub Jun 27, 2019
965a4aa
Restructure searchin for AF in configure
rstub Jun 27, 2019
3c80f5e
Simplify Makevars.in
rstub Jun 27, 2019
088dbf0
Updat AF on Linux
rstub Jun 27, 2019
4d30c76
Combine Travis config from master and dqrng
rstub Jun 27, 2019
6a32e0e
Use /use/local/lib64 on Linux
rstub Jun 27, 2019
f86679a
Correct and clen-up AF installation on Mac OS
rstub Jun 27, 2019
d77c521
Remove BLAS/LAPACK also from inline plugin
rstub Jun 27, 2019
b182aef
REmove unnecessary custom code
rstub Jun 27, 2019
5384b99
Revert "REmove unnecessary custom code"
rstub Jun 27, 2019
dd8bc1c
Simplify LD_PRELOAD
rstub Jun 27, 2019
64f2314
Enable remaining tests on Travis MacOS
rstub Jun 27, 2019
cdbf5ef
Handle lib64 correctly
rstub Jun 27, 2019
4fad510
Download AF installer silently
rstub Jun 27, 2019
213e45d
Use AF 3.6.2 for which we have a tested LD_PRELOAD
rstub Jun 27, 2019
88bb87f
Correct AF_LIBS construction
rstub Jun 27, 2019
7a1e2ba
Merge changes from master
rstub Jun 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ opencl-beignet.df
^docs$
LICENSE
^\.travis\.yml$
^\.travis$
^codecov\.yml$
^inst/libs$
56 changes: 29 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,45 @@ sudo: required
cache: packages
latex: false
fortran: false
r:
- oldrel
- release
- devel

matrix:
include:
- r: oldrel
- r: release
r_packages:
- covr
- devtools
- pkgdown
r_github_packages:
- metrumresearchgroup/covrpage
after_success:
- Rscript -e "covr::codecov()"
deploy:
provider: script
script: Rscript -e 'devtools::install(); covrpage::covrpage_ci(); pkgdown::deploy_site_github()'
skip_cleanup: true
- r: devel
- r: release
os: osx

notifications:
email:
on_success: change
on_failure: change
r_packages:
- devtools
- knitr
- rmarkdown
- pkgKitten
- Matrix
- covr
- pkgdown
addons:
apt:
sources:
- sourceline: 'ppa:keithw/glfw3'
packages:
- libglfw3
brew_packages:
- fontconfig
- glfw
before_install:
- wget --quiet http://arrayfire.s3.amazonaws.com/3.6.2/ArrayFire-v3.6.2_Linux_x86_64.sh
- sudo sh ArrayFire-v3.6.2_Linux_x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local
- rm ArrayFire-v3.6.2_Linux_x86_64.sh
- sudo ldconfig /usr/local/lib64
- test "$TRAVIS_OS_NAME" == "linux" && sh .travis/before_install_linux.sh || true
- test "$TRAVIS_OS_NAME" == "osx" && sh .travis/before_install_osx.sh || true
script:
- export LD_PRELOAD="/usr/local/lib64/libmkl_core.so:/usr/local/lib64/libtbb.so.2:/usr/local/lib64/libmkl_tbb_thread.so"
- export PKG_TARBALL=RcppArrayFire_$(grep '^Version:' DESCRIPTION | grep -o '[0-9\.]*').tar.gz
- R CMD build .
- test "$TRAVIS_OS_NAME" == "linux" && export LD_PRELOAD="/usr/local/lib64/libmkl_core.so:/usr/local/lib64/libtbb.so.2:/usr/local/lib64/libmkl_tbb_thread.so" || true
- export PKG_TARBALL=RcppArrayFire_$(grep '^Version:' DESCRIPTION | grep -oE '[0-9\.]+').tar.gz
- R CMD build --no-manual .
- R CMD check --no-manual $PKG_TARBALL
after_success:
- test "$TRAVIS_R_VERSION_STRING" = "release" && Rscript -e 'covr::codecov()' || true
deploy:
skip_cleanup: true
provider: script
script: Rscript -e 'pkgdown::deploy_site_github()'
on:
condition: $TRAVIS_R_VERSION_STRING = release
4 changes: 4 additions & 0 deletions .travis/before_install_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wget --quiet http://arrayfire.s3.amazonaws.com/3.6.2/ArrayFire-v3.6.2_Linux_x86_64.sh
sudo sh ArrayFire-v3.6.2_Linux_x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local
rm ArrayFire-v3.6.2_Linux_x86_64.sh
sudo ldconfig /usr/local/lib64
4 changes: 4 additions & 0 deletions .travis/before_install_osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
brew install fontconfig glfw
curl -SO https://arrayfire.s3.amazonaws.com/3.6.4/ArrayFire-v3.6.4_OSX_x86_64.pkg
sudo installer -pkg ArrayFire-v3.6.4_OSX_x86_64.pkg -target /
rm ArrayFire-v3.6.4_OSX_x86_64.pkg
94 changes: 47 additions & 47 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,53 +1,6 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Fast and simple linear model
#' @details Single precision floats are used by default since not all devices support double precision.
#' @param X a model matrix
#' @param y a vector containing the explained variable
#' @param useDouble use float or double internally
#' @return \code{fastLmPure} returns a list with three components:
#' \describe{
#' \item{\code{coefficients}}{a vector of coefficients}
#' \item{\code{residuals}}{the residuals, that is response minus fitted values}
#' \item{\code{fitted.values}}{the fitted mean values}
#' \item{\code{stderr}}{a vector of the (estimated) standard errors of the coefficient estimates}
#' \item{\code{df.residual}}{a scalar denoting the degrees of freedom in the model}
#' \item{\code{intercept}}{a boolean denoting if a model with intercept was fitted}
#' }
#' @export
fastLmPure <- function(X, y, useDouble = FALSE) {
.Call(`_RcppArrayFire_fastLmPure`, X, y, useDouble)
}

#' Fast runif alternative
#' @details Fast generation of uniformly distributed random values. The default is to use single precision,
#' since not all devices support calculations using double precision.
#' @param n number of observations
#' @param min lower limit of the distribution
#' @param max upper limit of the distribution
#' @param useDouble use float or double internally
#' @return A numeric vector of random values
#' @seealso \code{\link{runif}} and \url{http://arrayfire.org/docs/group__random__func__randu.htm}
#' @export
fastRunif <- function(n, min = 0, max = 1, useDouble = FALSE) {
.Call(`_RcppArrayFire_fastRunif`, n, min, max, useDouble)
}

#' Fast rnorm alternative
#' @details Fast generation of normaly distributed random values. The default is to use single precision,
#' since not all devices support calculations using double precision.
#' @param n number of observations
#' @param mean mean value of the distribution
#' @param sd standard deviation of the distribution
#' @param useDouble use float or double internally
#' @return A numeric vector of random values
#' @seealso \code{\link{rnorm}} and \url{http://arrayfire.org/docs/group__random__func__randn.htm}
#' @export
fastRnorm <- function(n, mean = 0, sd = 1, useDouble = FALSE) {
.Call(`_RcppArrayFire_fastRnorm`, n, mean, sd, useDouble)
}

#' Report the information about current device and platform
#' @details Return a list containing the information about current device and platform.
#' The list object includes device name, palatform information, toolkit information,
Expand Down Expand Up @@ -142,3 +95,50 @@ arrayfire_set_backend <- function(backend = "DEFAULT") {
invisible(.Call(`_RcppArrayFire_arrayfire_set_backend`, backend))
}

#' Fast and simple linear model
#' @details Single precision floats are used by default since not all devices support double precision.
#' @param X a model matrix
#' @param y a vector containing the explained variable
#' @param useDouble use float or double internally
#' @return \code{fastLmPure} returns a list with three components:
#' \describe{
#' \item{\code{coefficients}}{a vector of coefficients}
#' \item{\code{residuals}}{the residuals, that is response minus fitted values}
#' \item{\code{fitted.values}}{the fitted mean values}
#' \item{\code{stderr}}{a vector of the (estimated) standard errors of the coefficient estimates}
#' \item{\code{df.residual}}{a scalar denoting the degrees of freedom in the model}
#' \item{\code{intercept}}{a boolean denoting if a model with intercept was fitted}
#' }
#' @export
fastLmPure <- function(X, y, useDouble = FALSE) {
.Call(`_RcppArrayFire_fastLmPure`, X, y, useDouble)
}

#' Fast runif alternative
#' @details Fast generation of uniformly distributed random values. The default is to use single precision,
#' since not all devices support calculations using double precision.
#' @param n number of observations
#' @param min lower limit of the distribution
#' @param max upper limit of the distribution
#' @param useDouble use float or double internally
#' @return A numeric vector of random values
#' @seealso \code{\link{runif}} and \url{http://arrayfire.org/docs/group__random__func__randu.htm}
#' @export
fastRunif <- function(n, min = 0, max = 1, useDouble = FALSE) {
.Call(`_RcppArrayFire_fastRunif`, n, min, max, useDouble)
}

#' Fast rnorm alternative
#' @details Fast generation of normaly distributed random values. The default is to use single precision,
#' since not all devices support calculations using double precision.
#' @param n number of observations
#' @param mean mean value of the distribution
#' @param sd standard deviation of the distribution
#' @param useDouble use float or double internally
#' @return A numeric vector of random values
#' @seealso \code{\link{rnorm}} and \url{http://arrayfire.org/docs/group__random__func__randn.htm}
#' @export
fastRnorm <- function(n, mean = 0, sd = 1, useDouble = FALSE) {
.Call(`_RcppArrayFire_fastRnorm`, n, mean, sd, useDouble)
}

80 changes: 48 additions & 32 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -724,7 +723,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
Expand Down Expand Up @@ -977,15 +975,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;

-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;

-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1123,7 +1112,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1276,7 +1265,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand Down Expand Up @@ -2915,32 +2903,60 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu


# set path to root of arrayfire

# Check whether --with-arrayfire was given.
if test "${with_arrayfire+set}" = set; then :
withval=$with_arrayfire;
fi


AF_INCLUDE=""

AF_LIBS="-laf"


if test -e "${AF_PATH}"; then :

AF_INCLUDE="-I${AF_PATH}/include ${AF_INCLUDE}"
AF_LIBS="-L${AF_PATH}/lib ${AF_LIBS} -Wl,-rpath,${AF_PATH}/lib"
# set path to root of arrayfire

# Check whether --with-arrayfire was given.
if test "${with_arrayfire+set}" = set; then :
withval=$with_arrayfire; AF_PATH = ${with_arrayfire}
fi


if test -e "${with_arrayfire}"; then :

AF_INCLUDE="-I${with_arrayfire}/include ${AF_INCLUDE}"
AF_LIBS="-L${with_arrayfire}/lib ${AF_LIBS} -Wl,-rpath,${with_arrayfire}/lib"

if test -n "${AF_PATH}"
then
AF_INCLUDE="-I${AF_PATH}/include"
AF_LIBS="-L${AF_PATH}/lib -laf -Wl,-rpath,${AF_PATH}/lib"
else
# let's look around -- code inspiered by RPostgreSQL
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ArrayFire header" >&5
$as_echo "$as_me: checking for ArrayFire header" >&6;}
for dir in \
/usr/include \
/usr/local/include \
/opt/arrayfire/include
do
{ $as_echo "$as_me:${as_lineno-$LINENO}: Checking directory ${dir}." >&5
$as_echo "$as_me: Checking directory ${dir}." >&6;}
if test -f ${dir}/arrayfire.h
then
AF_INCLUDE="-I${dir}"
break
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ArrayFire library" >&5
$as_echo "$as_me: checking for ArrayFire library" >&6;}
for dir in \
/usr/lib \
/usr/lib64 \
/usr/local/lib \
/usr/local/lib64 \
/opt/arrayfire/lib \
/opt/arrayfire/lib64
do
{ $as_echo "$as_me:${as_lineno-$LINENO}: Checking directory ${dir}." >&5
$as_echo "$as_me: Checking directory ${dir}." >&6;}
if test -r ${dir}/libaf.so -o -r ${dir}/libaf.dylib
then
AF_LIBS="-L${dir} -laf -Wl,-rpath,${dir}"
break
fi
done
fi

if test -z "${AF_INCLUDE}" -o -z "${AF_LIBS}"; then :
as_fn_error $? "Cannot find ArrayFire installation." "$LINENO" 5
fi

CPPFLAGS="${CPPFLAGS} ${AF_INCLUDE}"
Expand Down
Loading