Skip to content

Commit 04c50e7

Browse files
committed
Merge branch 'macos'
Fixes #14
2 parents 338e4d9 + 7a1e2ba commit 04c50e7

File tree

10 files changed

+224
-169
lines changed

10 files changed

+224
-169
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ opencl-beignet.df
55
^docs$
66
LICENSE
77
^\.travis\.yml$
8+
^\.travis$
89
^codecov\.yml$
910
^inst/libs$

.travis.yml

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,45 @@ sudo: required
55
cache: packages
66
latex: false
77
fortran: false
8-
r:
9-
- oldrel
10-
- release
11-
- devel
8+
9+
matrix:
10+
include:
11+
- r: oldrel
12+
- r: release
13+
r_packages:
14+
- covr
15+
- devtools
16+
- pkgdown
17+
r_github_packages:
18+
- metrumresearchgroup/covrpage
19+
after_success:
20+
- Rscript -e "covr::codecov()"
21+
deploy:
22+
provider: script
23+
script: Rscript -e 'devtools::install(); covrpage::covrpage_ci(); pkgdown::deploy_site_github()'
24+
skip_cleanup: true
25+
- r: devel
26+
- r: release
27+
os: osx
28+
1229
notifications:
1330
email:
1431
on_success: change
1532
on_failure: change
16-
r_packages:
17-
- devtools
18-
- knitr
19-
- rmarkdown
20-
- pkgKitten
21-
- Matrix
22-
- covr
23-
- pkgdown
2433
addons:
2534
apt:
2635
sources:
2736
- sourceline: 'ppa:keithw/glfw3'
2837
packages:
2938
- libglfw3
39+
brew_packages:
40+
- fontconfig
41+
- glfw
3042
before_install:
31-
- wget --quiet http://arrayfire.s3.amazonaws.com/3.6.2/ArrayFire-v3.6.2_Linux_x86_64.sh
32-
- sudo sh ArrayFire-v3.6.2_Linux_x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local
33-
- rm ArrayFire-v3.6.2_Linux_x86_64.sh
34-
- sudo ldconfig /usr/local/lib64
43+
- test "$TRAVIS_OS_NAME" == "linux" && sh .travis/before_install_linux.sh || true
44+
- test "$TRAVIS_OS_NAME" == "osx" && sh .travis/before_install_osx.sh || true
3545
script:
36-
- export LD_PRELOAD="/usr/local/lib64/libmkl_core.so:/usr/local/lib64/libtbb.so.2:/usr/local/lib64/libmkl_tbb_thread.so"
37-
- export PKG_TARBALL=RcppArrayFire_$(grep '^Version:' DESCRIPTION | grep -o '[0-9\.]*').tar.gz
38-
- R CMD build .
46+
- 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
47+
- export PKG_TARBALL=RcppArrayFire_$(grep '^Version:' DESCRIPTION | grep -oE '[0-9\.]+').tar.gz
48+
- R CMD build --no-manual .
3949
- R CMD check --no-manual $PKG_TARBALL
40-
after_success:
41-
- test "$TRAVIS_R_VERSION_STRING" = "release" && Rscript -e 'covr::codecov()' || true
42-
deploy:
43-
skip_cleanup: true
44-
provider: script
45-
script: Rscript -e 'pkgdown::deploy_site_github()'
46-
on:
47-
condition: $TRAVIS_R_VERSION_STRING = release

.travis/before_install_linux.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
wget --quiet http://arrayfire.s3.amazonaws.com/3.6.2/ArrayFire-v3.6.2_Linux_x86_64.sh
2+
sudo sh ArrayFire-v3.6.2_Linux_x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local
3+
rm ArrayFire-v3.6.2_Linux_x86_64.sh
4+
sudo ldconfig /usr/local/lib64

.travis/before_install_osx.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
brew install fontconfig glfw
2+
curl -SO https://arrayfire.s3.amazonaws.com/3.6.4/ArrayFire-v3.6.4_OSX_x86_64.pkg
3+
sudo installer -pkg ArrayFire-v3.6.4_OSX_x86_64.pkg -target /
4+
rm ArrayFire-v3.6.4_OSX_x86_64.pkg

R/RcppExports.R

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,6 @@
11
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
22
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
33

4-
#' Fast and simple linear model
5-
#' @details Single precision floats are used by default since not all devices support double precision.
6-
#' @param X a model matrix
7-
#' @param y a vector containing the explained variable
8-
#' @param useDouble use float or double internally
9-
#' @return \code{fastLmPure} returns a list with three components:
10-
#' \describe{
11-
#' \item{\code{coefficients}}{a vector of coefficients}
12-
#' \item{\code{residuals}}{the residuals, that is response minus fitted values}
13-
#' \item{\code{fitted.values}}{the fitted mean values}
14-
#' \item{\code{stderr}}{a vector of the (estimated) standard errors of the coefficient estimates}
15-
#' \item{\code{df.residual}}{a scalar denoting the degrees of freedom in the model}
16-
#' \item{\code{intercept}}{a boolean denoting if a model with intercept was fitted}
17-
#' }
18-
#' @export
19-
fastLmPure <- function(X, y, useDouble = FALSE) {
20-
.Call(`_RcppArrayFire_fastLmPure`, X, y, useDouble)
21-
}
22-
23-
#' Fast runif alternative
24-
#' @details Fast generation of uniformly distributed random values. The default is to use single precision,
25-
#' since not all devices support calculations using double precision.
26-
#' @param n number of observations
27-
#' @param min lower limit of the distribution
28-
#' @param max upper limit of the distribution
29-
#' @param useDouble use float or double internally
30-
#' @return A numeric vector of random values
31-
#' @seealso \code{\link{runif}} and \url{http://arrayfire.org/docs/group__random__func__randu.htm}
32-
#' @export
33-
fastRunif <- function(n, min = 0, max = 1, useDouble = FALSE) {
34-
.Call(`_RcppArrayFire_fastRunif`, n, min, max, useDouble)
35-
}
36-
37-
#' Fast rnorm alternative
38-
#' @details Fast generation of normaly distributed random values. The default is to use single precision,
39-
#' since not all devices support calculations using double precision.
40-
#' @param n number of observations
41-
#' @param mean mean value of the distribution
42-
#' @param sd standard deviation of the distribution
43-
#' @param useDouble use float or double internally
44-
#' @return A numeric vector of random values
45-
#' @seealso \code{\link{rnorm}} and \url{http://arrayfire.org/docs/group__random__func__randn.htm}
46-
#' @export
47-
fastRnorm <- function(n, mean = 0, sd = 1, useDouble = FALSE) {
48-
.Call(`_RcppArrayFire_fastRnorm`, n, mean, sd, useDouble)
49-
}
50-
514
#' Report the information about current device and platform
525
#' @details Return a list containing the information about current device and platform.
536
#' The list object includes device name, palatform information, toolkit information,
@@ -142,3 +95,50 @@ arrayfire_set_backend <- function(backend = "DEFAULT") {
14295
invisible(.Call(`_RcppArrayFire_arrayfire_set_backend`, backend))
14396
}
14497

98+
#' Fast and simple linear model
99+
#' @details Single precision floats are used by default since not all devices support double precision.
100+
#' @param X a model matrix
101+
#' @param y a vector containing the explained variable
102+
#' @param useDouble use float or double internally
103+
#' @return \code{fastLmPure} returns a list with three components:
104+
#' \describe{
105+
#' \item{\code{coefficients}}{a vector of coefficients}
106+
#' \item{\code{residuals}}{the residuals, that is response minus fitted values}
107+
#' \item{\code{fitted.values}}{the fitted mean values}
108+
#' \item{\code{stderr}}{a vector of the (estimated) standard errors of the coefficient estimates}
109+
#' \item{\code{df.residual}}{a scalar denoting the degrees of freedom in the model}
110+
#' \item{\code{intercept}}{a boolean denoting if a model with intercept was fitted}
111+
#' }
112+
#' @export
113+
fastLmPure <- function(X, y, useDouble = FALSE) {
114+
.Call(`_RcppArrayFire_fastLmPure`, X, y, useDouble)
115+
}
116+
117+
#' Fast runif alternative
118+
#' @details Fast generation of uniformly distributed random values. The default is to use single precision,
119+
#' since not all devices support calculations using double precision.
120+
#' @param n number of observations
121+
#' @param min lower limit of the distribution
122+
#' @param max upper limit of the distribution
123+
#' @param useDouble use float or double internally
124+
#' @return A numeric vector of random values
125+
#' @seealso \code{\link{runif}} and \url{http://arrayfire.org/docs/group__random__func__randu.htm}
126+
#' @export
127+
fastRunif <- function(n, min = 0, max = 1, useDouble = FALSE) {
128+
.Call(`_RcppArrayFire_fastRunif`, n, min, max, useDouble)
129+
}
130+
131+
#' Fast rnorm alternative
132+
#' @details Fast generation of normaly distributed random values. The default is to use single precision,
133+
#' since not all devices support calculations using double precision.
134+
#' @param n number of observations
135+
#' @param mean mean value of the distribution
136+
#' @param sd standard deviation of the distribution
137+
#' @param useDouble use float or double internally
138+
#' @return A numeric vector of random values
139+
#' @seealso \code{\link{rnorm}} and \url{http://arrayfire.org/docs/group__random__func__randn.htm}
140+
#' @export
141+
fastRnorm <- function(n, mean = 0, sd = 1, useDouble = FALSE) {
142+
.Call(`_RcppArrayFire_fastRnorm`, n, mean, sd, useDouble)
143+
}
144+

configure

Lines changed: 48 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,6 @@ infodir
651651
docdir
652652
oldincludedir
653653
includedir
654-
runstatedir
655654
localstatedir
656655
sharedstatedir
657656
sysconfdir
@@ -724,7 +723,6 @@ datadir='${datarootdir}'
724723
sysconfdir='${prefix}/etc'
725724
sharedstatedir='${prefix}/com'
726725
localstatedir='${prefix}/var'
727-
runstatedir='${localstatedir}/run'
728726
includedir='${prefix}/include'
729727
oldincludedir='/usr/include'
730728
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -977,15 +975,6 @@ do
977975
| -silent | --silent | --silen | --sile | --sil)
978976
silent=yes ;;
979977

980-
-runstatedir | --runstatedir | --runstatedi | --runstated \
981-
| --runstate | --runstat | --runsta | --runst | --runs \
982-
| --run | --ru | --r)
983-
ac_prev=runstatedir ;;
984-
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
985-
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
986-
| --run=* | --ru=* | --r=*)
987-
runstatedir=$ac_optarg ;;
988-
989978
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
990979
ac_prev=sbindir ;;
991980
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1123,7 +1112,7 @@ fi
11231112
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
11241113
datadir sysconfdir sharedstatedir localstatedir includedir \
11251114
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1126-
libdir localedir mandir runstatedir
1115+
libdir localedir mandir
11271116
do
11281117
eval ac_val=\$$ac_var
11291118
# Remove trailing slashes.
@@ -1276,7 +1265,6 @@ Fine tuning of the installation directories:
12761265
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
12771266
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
12781267
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
1279-
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
12801268
--libdir=DIR object code libraries [EPREFIX/lib]
12811269
--includedir=DIR C header files [PREFIX/include]
12821270
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -2915,32 +2903,60 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
29152903
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
29162904
29172905
2918-
# set path to root of arrayfire
2919-
2920-
# Check whether --with-arrayfire was given.
2921-
if test "${with_arrayfire+set}" = set; then :
2922-
withval=$with_arrayfire;
2923-
fi
2924-
2925-
2926-
AF_INCLUDE=""
29272906
2928-
AF_LIBS="-laf"
29292907
29302908
2931-
if test -e "${AF_PATH}"; then :
2932-
2933-
AF_INCLUDE="-I${AF_PATH}/include ${AF_INCLUDE}"
2934-
AF_LIBS="-L${AF_PATH}/lib ${AF_LIBS} -Wl,-rpath,${AF_PATH}/lib"
2909+
# set path to root of arrayfire
29352910
2911+
# Check whether --with-arrayfire was given.
2912+
if test "${with_arrayfire+set}" = set; then :
2913+
withval=$with_arrayfire; AF_PATH = ${with_arrayfire}
29362914
fi
29372915
29382916
2939-
if test -e "${with_arrayfire}"; then :
2940-
2941-
AF_INCLUDE="-I${with_arrayfire}/include ${AF_INCLUDE}"
2942-
AF_LIBS="-L${with_arrayfire}/lib ${AF_LIBS} -Wl,-rpath,${with_arrayfire}/lib"
2943-
2917+
if test -n "${AF_PATH}"
2918+
then
2919+
AF_INCLUDE="-I${AF_PATH}/include"
2920+
AF_LIBS="-L${AF_PATH}/lib -laf -Wl,-rpath,${AF_PATH}/lib"
2921+
else
2922+
# let's look around -- code inspiered by RPostgreSQL
2923+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ArrayFire header" >&5
2924+
$as_echo "$as_me: checking for ArrayFire header" >&6;}
2925+
for dir in \
2926+
/usr/include \
2927+
/usr/local/include \
2928+
/opt/arrayfire/include
2929+
do
2930+
{ $as_echo "$as_me:${as_lineno-$LINENO}: Checking directory ${dir}." >&5
2931+
$as_echo "$as_me: Checking directory ${dir}." >&6;}
2932+
if test -f ${dir}/arrayfire.h
2933+
then
2934+
AF_INCLUDE="-I${dir}"
2935+
break
2936+
fi
2937+
done
2938+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ArrayFire library" >&5
2939+
$as_echo "$as_me: checking for ArrayFire library" >&6;}
2940+
for dir in \
2941+
/usr/lib \
2942+
/usr/lib64 \
2943+
/usr/local/lib \
2944+
/usr/local/lib64 \
2945+
/opt/arrayfire/lib \
2946+
/opt/arrayfire/lib64
2947+
do
2948+
{ $as_echo "$as_me:${as_lineno-$LINENO}: Checking directory ${dir}." >&5
2949+
$as_echo "$as_me: Checking directory ${dir}." >&6;}
2950+
if test -r ${dir}/libaf.so -o -r ${dir}/libaf.dylib
2951+
then
2952+
AF_LIBS="-L${dir} -laf -Wl,-rpath,${dir}"
2953+
break
2954+
fi
2955+
done
2956+
fi
2957+
2958+
if test -z "${AF_INCLUDE}" -o -z "${AF_LIBS}"; then :
2959+
as_fn_error $? "Cannot find ArrayFire installation." "$LINENO" 5
29442960
fi
29452961
29462962
CPPFLAGS="${CPPFLAGS} ${AF_INCLUDE}"

0 commit comments

Comments
 (0)