Skip to content
Merged
Changes from all commits
Commits
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
118 changes: 104 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ To build and run this software, you will need:
6. [R](https://cran.r-project.org/bin/windows/base/) (only if you plan on using the R functionality)

### C++ source code installation
To install the `ExaGeoStat` project locally, run the following commands in your terminal:
To install the `ExaGeoStatCPP` project locally (C++ version), run the following commands in your terminal:

1. Clone the project from the remote gitHub repository into your local machine using the following command
```bash
Expand All @@ -78,14 +78,14 @@ To install the `ExaGeoStat` project locally, run the following commands in your
cd ExaGeoStatCPP
```

3. Run `configure` script with the flag `-h` for help, to know the supported options and their corresponding flags.
3. Run `configure` script (use the `-h` flag for help, to know the supported options and their corresponding flags). This step is **not required** when using R.
```bash
./configure -h
./configure -e
```

4. Run `clean_build.sh` script with the flag `-h` for help, to know the needed arguments to run with your specific options.
4. Run `clean_build.sh` (use the `-h` flag for help, to know the needed arguments to run with your specific options). This step is **not required** when using R.
```bash
./clean_build.sh -h
./clean_build.sh
```

5. Export the installation paths of the dependencies to your `.bashrc` file, e.g.
Expand All @@ -99,18 +99,56 @@ ExaGeoStatCPP.
### R package installation
1. Open the R prompt window by simply running `R` command in the terminal, inside the prompt, we will install needed packages by running the following commands:
```R
install.packages(Rcpp)
install.packages("assert")
install.packages("Rcpp")
install.packages("assertthat")
```

2. close the R prompt and return to the terminal. Run the following command, make sure your current path is the ExaGeoStat project directory
2. close the R prompt and return to the terminal. Run the following command, make sure your current path is the ExaGeoStatCPP project directory

```commandline
R CMD INSTALL . --configure-args="-r"
```

> For more detailed information on installing ExaGeoStat with different configurations and enabling technologies such as CUDA, MPI, R, etc., please refer to the [User Manual](USER_MANUAL.md)

## Common Installation Errors and Solutions

### 1. Missing CMake
The installation requires **CMake** version 3.2 or higher. Ensure it is installed on your system before proceeding with the installation of **ExaGeoStatCPP**.

To install CMake, use:
```sh
sudo apt install cmake
```

### 2. Missing Libtool
If you encounter the following error during installation:
```
./autogen.sh: line 17: libtool: command not found
./autogen.sh: line 20: glibtool: command not found
```
This indicates that **Libtool** is missing. You can install it using:
```sh
sudo apt install libtool libtool-bin
```

Alternatively, you can install **Libtool** locally:
```sh
wget http://ftpmirror.gnu.org/libtool/libtool-2.4.7.tar.gz
tar -xvzf libtool-2.4.7.tar.gz
cd libtool-2.4.7
./configure --prefix=$HOME/local
make
make install
```
Then, update your environment variables:
```sh
export PATH=$HOME/local/bin:$PATH
export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig:$PKG_CONFIG_PATH
```
After this, restart your terminal or run `source ~/.bashrc` to apply the changes.


## Usage
#### C++ Example
Expand All @@ -135,14 +173,66 @@ int main(int argc, char **argv) {
return 0;
}
```
### R Example:
```R
## R Example
Here is an example demonstrating how to use **ExaGeoStatCPP** in R:

```r
# Load the ExaGeoStatCPP library
library(ExaGeoStatCPP)

# Set parameters for the simulation
ncores <- 30
ngpus <- 0
problem_size <- 1600
dts <- 320
lts <- 0
computation <- "exact"
dimension <- "2D"
kernel <- "univariate_matern_stationary"
initial_theta <- c(1,0.1,0.5)
lower_bound <- c(0.1,0.1,0.1)
upper_bound <- c(5,5,5)
p <- 1
q <- 1
opt_itrs <- 100

# Initialize hardware configuration
hardware <- new(Hardware, computation, ncores, ngpus, p, q)
exageostat_data <- simulate_data(kernel=kernel, initial_theta=initial_theta, problem_size=problem_size, dts=dts, dimension=dimension)
estimated_theta <- model_data(data=exageostat_data, kernel=kernel, dts=dts, dimension=dimension,lb=lower_bound, ub=upper_bound, mle_itr=10)
predict_data(train_data=list(x, y, z_measurement), test_data=list(test_x, test_y), kernel=kernel, dts=dts, estimated_theta=estimated_theta)

# Simulate spatial data based on the specified kernel and parameters
exageostat_data <- simulate_data(
kernel = kernel,
initial_theta = initial_theta,
problem_size = problem_size,
dts = dts,
dimension = dimension
)

# Estimate model parameters using MLE
estimated_theta <- model_data(
matrix=exageostat_data$m,
x=exageostat_data$x,
y=exageostat_data$y,
kernel=kernel, dts=dts,
dimension=dimension,
lb=lower_bound,
ub=upper_bound,
mle_itr=opt_itrs)

# Perform spatial prediction using the estimated parameters
test_x <- c(0.2, 0.330)
test_y <- c(0.104, 0.14)
predict_data(
train_data=list(x=exageostat_data$x, y=exageostat_data$y, exageostat_data$m),
test_data=list(test_x, test_y),
kernel=kernel,
dts=dts,
estimated_theta=estimated_theta)

```

This example walks through initializing hardware, simulating spatial data, estimating model parameters, and making predictions using **ExaGeoStatCPP** in R.

> Please take a look at the end-to-end examples as a reference for using all the operations.

## Contributing
Expand Down Expand Up @@ -196,4 +286,4 @@ Find detailed information on how to contribute to ExaGeoStatCPP [here](CONTRIBUT
[BSD 3-Clause](LICENSE)

## Handout
![ExaGeoStatCPP-handout.png](docs/ExaGeoStatCPP-handout.png)
![ExaGeoStatCPP-handout.png](docs/ExaGeoStatCPP-handout.png)