Skip to content

Commit

Permalink
Release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SAbdulah authored and Eduardo Gonzalez Fisher committed Nov 14, 2017
1 parent 95a5b3f commit d7c2190
Show file tree
Hide file tree
Showing 19 changed files with 889 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* linguist-vendored
*.R linguist-vendored=false
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src"]
path = src
url = https://github.com/ecrc/exageostat.git
19 changes: 19 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Package: exageostat
SystemRequirements: GNU make, libstarpu, libnlopt, libgsl, libstarpu-1.2, libchameleon, libchameleon_starpu, libmkl_intel_lp64, libmkl_sequential, libmkl_core, libpthread, libm
Version: 0.1.0
Date: 2017-11-14
Title: R package demonstrates the R / C Language interface for ExaGeoStat
Author: Sameh Abdulah <[email protected]>
Maintainer: Sameh Abdulah <[email protected]>
Depends: R (>= 2.0.1), RhpcBLASctl
Description: ExaGeoStat-R is an R-wrapper for ExaGeoStat: a parallel
high performance unified framework for geostatistics on
manycore systems. Its abbreviation stands for Exascale
Geostatistics. The framework aims at optimizing the
likelihood function for a given spatial data to provide
an efficient way to predict missing observations. The
framework targets many-core systems: clusters of CPUs
and GPUs.
License: GPL (version 2 or later)
Packaged: Tuesday Nov. 14 13:01:38 2017; sameh

29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2017, King Abdullah University of Science and Technology
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
useDynLib(exageostat)
export(TestWrapper)
export(exageostat_gen_zR)
export(exageostat_likelihoodR)
export(exageostat_initR)
export(exageostat_finalizeR)

3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
2017-11-14 version 0.1.0
* The first release of ExaGeoStat-R

125 changes: 125 additions & 0 deletions R/exageostat_test_wrapper.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#
#
# Copyright (c) 2017, King Abdullah University of Science and Technology
# All rights reserved.
#
# ExaGeoStat-R is a software package provided by KAUST
#
#
#
# @file exageostat_test_wrapper.R
# ExaGeoStat R wrapper functions
#
# @version 0.1.0
#
# @author Sameh Abdulah
# @date 2017-11-14


TestWrapper <- function()
{
library("exageostat") #Load ExaGeoStat-R lib.
theta1 = 1 #Initial variance.
theta2 = 0.1 #Initial smoothness.
theta3 = 0.5 #Initial range.
computation = 0 #0 --> exact computation, 1--> LR approx. computation.
dmetric = 0 #0 --> Euclidean distance, 1--> great circle distance.
n = 1600 #n*n locations grid.
ncores = 2 #Number of underlying CPUs.
gpus = 0 #Number of underlying GPUs.
ts = 320 #Tile_size: changing it can improve the performance. No fixed value can be given.
p_grid = 1 #More than 1 in the case of distributed systems
q_grid = 1 #More than 1 in the case of distributed systems ( usually equals to p_grid)
clb = vector(mode="numeric",length = 3) #Optimization function lower bounds values.
cub = vector(mode="numeric",length = 3) #Optimization function upper bounds values.
theta_out = vector(mode="numeric",length = 3) #Parameter vector output.
globalveclen = 3*n
vecs_out = vector(mode="numeric",length = globalveclen) #Z measurements of n locations
clb = as.numeric(c("0.01", "0.01", "0.01"))
cub = as.numeric(c("5.00", "5.00", "5.00"))
vecs_out[1:globalveclen] = -1.99
theta_out[1:3] = -1.99
#Initiate exageostat instance
rexageostat_initR(ncores, gpus, ts)
#Generate Z observation vector
vecs_out = rexageostat_gen_zR(n, ncores, gpus, ts, p_grid, q_grid, theta1, theta2, theta3, computation, dmetric, globalveclen)
#Estimate MLE parameters
theta_out = rexageostat_likelihoodR(n, ncores, gpus, ts, p_grid, q_grid, vecs_out[1:n], vecs_out[n+1:(2*n)], vecs_out[(2*n+1):(3*n)], clb, cub, computation, dmetric)
#finalize exageostat instance
rexageostat_finalizeR()
print("Back from exageostat_gen_z! hit key...")
browser()
}

exageostat_gen_zR <- function(n, ncores, gpus, ts, p_grid, q_grid, theta1, theta2, theta3, computation, dmetric, globalveclen)
{
globalvec= vector (mode="numeric", length = globalveclen)
globalvec2 = .C("rexageostat_gen_z",
as.integer(n),
as.integer(ncores),
as.integer(gpus),
as.integer(ts),
as.integer(p_grid),
as.integer(q_grid),
as.numeric(theta1),
as.numeric(theta2),
as.numeric(theta3),
as.integer(computation),
as.integer(dmetric),
as.integer(globalveclen),
globalvec = numeric(globalveclen))$globalvec

globalvec[1:globalveclen] <- globalvec2[1:globalveclen]
print("back from exageostat_gen_z C function call. Hit key....")
return(globalvec)
}


exageostat_likelihoodR <- function(n, ncores, gpus, ts, p_grid, q_grid, x, y, z, clb, cub, computation, dmetric)
{
theta_out2= .C("rexageostat_likelihood",
as.integer(n),
as.integer(ncores),
as.integer(gpus),
as.integer(ts),
as.integer(p_grid),
as.integer(q_grid),
as.numeric(x),
as.integer((n)),
as.numeric(y),
as.integer((n)),
as.numeric(z),
as.integer((n)) ,
as.numeric(clb),
as.integer((3)),
as.numeric(cub),
as.integer((3)),
as.integer(computation),
as.integer(dmetric),
theta_out=numeric(3))$theta_out
theta_out[1:3] <- theta_out2[1:3]
print("back from exageostat_likelihood C function call. Hit key....")
return(theta_out)
}

exageostat_initR <- function(ncores, gpus, ts)
{
#install.packages(repos="https://cran.r-project.org", "RhpcBLASctl")
library(RhpcBLASctl)
blas_get_num_procs()
blas_set_num_threads(1)
omp_set_num_threads(1)
.C("rexageostat_init",
as.integer(ncores),
as.integer(gpus),
as.integer(ts))
print("back from exageostat_init C function call. Hit key....")
}

exageostat_finalizeR <- function()
{
.C("rexageostat_finalize")
print("back from exageostat_finalize C function call. Hit key....")
}


86 changes: 85 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,85 @@
# exageostat-rwrapper-dev
ExaGeoStat-R
============

`ExaGeoStat-R` is an R-Wrapper for [ExaGeoStat framework]((https://github.com/ecrc/exageostat)), a parallel high performance unified framework for geostatistics on manycore systems.

Getting Started
===============

### Installation

#### Software dependencies
1. [Portable Hardware Locality (hwloc)](https://www.open-mpi.org/projects/hwloc/).
2. [NLopt](https://nlopt.readthedocs.io/en/latest/).
3. [GNU Scientific Library (GSL)](https://www.gnu.org/software/gsl/doc/html/index.html).
4. [StarPU](http://starpu.gforge.inria.fr/).
5. [Chameleon](https://project.inria.fr/chameleon/).

An easy installation of the above packages is available by using [build-deps.sh](https://github.com/ecrc/exageostatR/blob/master/build_deps.sh)


#### Install latest ExaGeoStat-R version hosted on GitHub
```r
install.packages("devtools")
library(devtools)
install_git(url="https://github.com/ecrc/exageostatR")
library(exageostat)
```


#### Get the latest ExaGeoStat-R release hosted on GitHub

1. Download exageostat_0.1.0.tar.gz from release
2. Use R to install exageostat_0.1.0.tar.gz
```r
install.packages(repos=NULL, "exageostat_0.1.0.tar.gz")
library(exageostat)
```


Features of ExaGeoStat-R
========================
Operations:

1. Generate synthetic spatial datasets (i.e., locations & environmental measurements).
2. Maximum likelihood evaluation using dense matrices.


More information
================

A more detailed description of the underlying ExaGeoStat software package can be found. [here](https://github.com/ecrc/exageostat)

R Example
================
```r
library("exageostat") #Load ExaGeoStat-R lib.
theta1 = 1 #Initial variance.
theta2 = 0.1 #Initial smoothness.
theta3 = 0.5 #Initial range.
computation = 0 #0 --> exact computation, 1--> LR approx. computation.
dmetric = 0 #0 --> Euclidean distance, 1--> great circle distance.
n = 1600 #n*n locations grid.
ncores = 2 #Number of underlying CPUs.
gpus = 0 #Number of underlying GPUs.
ts = 320 #Tile_size: changing it can improve the performance. No fixed value can be given.
p_grid = 1 #More than 1 in the case of distributed systems
q_grid = 1 #More than 1 in the case of distributed systems ( usually equals to p_grid)
clb = vector(mode="numeric",length = 3) #Optimization function lower bounds values.
cub = vector(mode="numeric",length = 3) #Optimization function upper bounds values.
theta_out = vector(mode="numeric",length = 3) #Parameter vector output.
globalveclen = 3*n
vecs_out = vector(mode="numeric",length = globalveclen) #Z measurements of n locations
clb = as.numeric(c("0.01", "0.01", "0.01"))
cub = as.numeric(c("5.00", "5.00", "5.00"))
vecs_out[1:globalveclen] = -1.99
theta_out[1:3] = -1.99
#Initiate ExaGeoStat instance
exageostat_initR(ncores, gpus, ts)
#Generate Z observation vector
vecs_out = exageostat_gen_zR(n, ncores, gpus, ts, p_grid, q_grid, theta1, theta2, theta3, computation, dmetric, globalveclen)
#Estimate MLE parameters
theta_out = exageostat_likelihoodR(n, ncores, gpus, ts, p_grid, q_grid, vecs_out[1:n], vecs_out[n+1:(2*n)], vecs_out[(2*n+1):(3*n)], clb, cub, computation, dmetric)
#Finalize ExaGeoStat instance
exageostat_finalizeR()
```
Loading

0 comments on commit d7c2190

Please sign in to comment.