Skip to content

Climate Emulator v0.0.1 #14

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

Open
wants to merge 6 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
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
26 changes: 26 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
stages:
- compile

variables:
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: normal
ARTIFACTS_NAME: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
ARTIFACTS_PATH: bin.tar

.compile-job: &compile-job
stage: compile
artifacts:
when: on_success
name: $ARTIFACTS_NAME
expire_in: 1h
paths:
- bin.tar
script:
- echo -e "Script Arguments:\t $CONFIG_ARGS"

compile:cpp:
<<: *compile-job
image: acai-oneapi
tags:
- acai-cpu

99 changes: 71 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,41 @@ cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
cmake_policy(SET CMP0048 NEW)

# Set project options
option(USE_CUDA "Use Cuda, if available" false)
option(USE_MPI "Use MPI, if available" false)
option(USE_CUDA "Use CUDA, if available" OFF)
option(USE_MPI "Use MPI, if available" OFF)
option(BUILD_TESTS "Option to enable building tests" OFF)
option(BUILD_HEAVY_TESTS "Option to enable building heavy tests, This may take a lot of time" OFF)
option(BUILD_EXAMPLES "Option to enable building examples" ON)
option(BUILD_DOCS "Build documentation in docs directory" ON)
option(USE_R "Enable the use of R and Rcpp in the project" OFF)
option(CREATE_PACKAGE "Enable a packaging system for distribution" OFF)

# Declare the RUNTIME_TYPE variable with a default value
set(RUNTIME_TYPE "starpu" CACHE STRING "Specify the runtime type (e.g., starpu or parsec)")
# Cmake Module Paths
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")

if (${BUILD_SHARED_LIBS})
set(BLA_STATIC OFF)
else ()
set(BLA_STATIC ON)
endif ()

# Project Name and Version
project(ExaGeoStatCPP VERSION 2.0.0 DESCRIPTION "ExaGeoStatCPP is a parallel high performance unified framework for geostatistics on manycore systems.")
set(CMAKE_CXX_EXTENSIONS OFF)
string(TOUPPER ${RUNTIME_TYPE} RUNTIME_TYPE)

# Default path for default configuration json file
add_definitions(
-DDEFAULT_CONFIGURATION_PATH="${PROJECT_SOURCE_DIR}/configurations/config.json"
)

if(RUNTIME_TYPE STREQUAL "PARSEC")
message(STATUS "MPI is required to be enabled in order to use PaRSEC")
set(USE_MPI ON)
set(USE_HICMA OFF)
endif()

# Select toolchain based on whether CUDA is enabled or not
if (USE_CUDA)
message("")
Expand All @@ -53,9 +70,6 @@ else ()
include(toolchains/GccToolchain)
endif ()

# Project Name and Version
project(ExaGeoStatCPP VERSION 1.0.0 DESCRIPTION "ExaGeoStatCPP is a parallel high performance unified framework for geostatistics on manycore systems.")

# Show the current version of CMake.
message(STATUS "CMAKE VERSION: ${CMAKE_VERSION}")
# Enable C++ language
Expand Down Expand Up @@ -115,30 +129,46 @@ include(ImportHwloc)
list(APPEND STARPU_COMPONENT_LIST "HWLOC")
string(REPLACE ";" " " STARPU_COMPONENT_STRING "${STARPU_COMPONENT_LIST}")

# ExaGeoStatCPP depends on StarPU runtime
# ExaGeoStatCPP depends on NLOHMANN
# -------------------------------
include(ImportStarPu)

# ExaGeoStatCPP depends on GSL
# -------------------------------
include(ImportGSL)
include(ImportNlohmannJSON)

# ExaGeoStatCPP depends on NLOPT
# -------------------------------
include(ImportNLOPT)

# ExaGeoStatCPP depends on HiCMA
# ExaGeoStatCPP depends on GSL
# -------------------------------
if (USE_HICMA)
add_definitions(-DUSE_HICMA=TRUE)
include(ImportHCore)
include(ImportStarsH)
include(ImportHiCMA)
endif ()
include(ImportGSL)

# ExaGeoStatCPP depends on Chameleon
# -------------------------------
include(ImportChameleon)
message("---------------------------------------- ${RUNTIME_TYPE}")
if(RUNTIME_TYPE STREQUAL "STARPU")
message(STATUS "Using StarPU as the runtime")
# ExaGeoStatCPP depends on StarPU runtime
# -------------------------------
include(ImportStarPu)
# ExaGeoStatCPP depends on HiCMA
# -------------------------------
if (USE_HICMA)
add_definitions(-DUSE_HICMA=TRUE)
include(ImportHCore)
include(ImportStarsH)
include(ImportHiCMA)
endif ()
# ExaGeoStatCPP depends on Chameleon
# -------------------------------
include(ImportChameleon)

elseif(RUNTIME_TYPE STREQUAL "PARSEC")
message(STATUS "Using PaRSEC as the runtime")
# ExaGeoStatCPP depends on StarPU runtime
# -------------------------------
include(ImportStarsH)
include(ImportHCore)
include(ImportHiCMAX)
else()
message(FATAL_ERROR "Unknown RUNTIME_TYPE: ${RUNTIME_TYPE}. Supported values are 'STARPU' or 'PARSEC'.")
endif()

# ExaGeoStatCPP depends on LAPACK/BLASPP
# -------------------------------
Expand Down Expand Up @@ -173,10 +203,16 @@ if (USE_R)
endif ()
endif ()


# Add src Directory to expose added libraries
add_subdirectory(src)

# Define USE_STARPU or USE_RUNTIME based on the selected runtime
if(RUNTIME_TYPE STREQUAL "STARPU")
target_compile_definitions(${PROJECT_NAME} PUBLIC DEFAULT_RUNTIME=1)
elseif(RUNTIME_TYPE STREQUAL "PARSEC")
target_compile_definitions(${PROJECT_NAME} PUBLIC DEFAULT_RUNTIME=0)
endif()

# Creates a new INTERFACE library target named ${PROJECT_NAME}_INTERFACE.
# The INTERFACE keyword specifies that this library will not be built, but instead will only be used for its properties.
add_library(${PROJECT_NAME}_INTERFACE INTERFACE)
Expand Down Expand Up @@ -218,15 +254,22 @@ endif ()
message(" \n \t ** Configurations of ExaGeoStatCPP and installation of dependence is done successfully ** ")
message("\t - Export the following line to avoid re-install dependencies each time. -")
message("\t ----------------------------------------------------------------------------------------------------------------------------------- ")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/CHAMELEON/lib/pkgconfig:$PKG_CONFIG_PATH")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/STARPU/lib/pkgconfig:$PKG_CONFIG_PATH")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/NLOHMANN_JSON/share/pkgconfig:$PKG_CONFIG_PATH")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/HWLOC/lib/pkgconfig:$PKG_CONFIG_PATH")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/GSL/lib/pkgconfig:$PKG_CONFIG_PATH")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/NLOPT/lib/pkgconfig:${CMAKE_INSTALL_PREFIX}/NLOPT/lib64/pkgconfig:$PKG_CONFIG_PATH")
if(USE_HICMA)
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/GSL/lib/pkgconfig:$PKG_CONFIG_PATH")
if(RUNTIME_TYPE STREQUAL "STARPU")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/STARPU/lib/pkgconfig:$PKG_CONFIG_PATH")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/CHAMELEON/lib/pkgconfig:$PKG_CONFIG_PATH")
if(USE_HICMA)
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/STARSH/lib/pkgconfig:$PKG_CONFIG_PATH")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/HCORE/lib/pkgconfig:$PKG_CONFIG_PATH")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/HICMA/lib/pkgconfig:$PKG_CONFIG_PATH")
endif()
elseif(RUNTIME_TYPE STREQUAL "PARSEC")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/STARSH/lib/pkgconfig:$PKG_CONFIG_PATH")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/HCORE/lib/pkgconfig:$PKG_CONFIG_PATH")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/HICMA/lib/pkgconfig:$PKG_CONFIG_PATH")
message("\t export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/HICMA-X/lib/pkgconfig:${CMAKE_INSTALL_PREFIX}/HICMA-X/lib64/pkgconfig:${CMAKE_INSTALL_PREFIX}/HICMA-X/lib64:$PKG_CONFIG_PATH")
endif()
message("\t ----------------------------------------------------------------------------------------------------------------------------------- \n")

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ To build and run this software, you will need:
### C++ source code installation
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
1. Clone the project repository to your local machine:
```bash
git clone https://github.com/ecrc/ExaGeoStatCPP.git
```

2. Change your current directory by getting into the `ExaGeoStatCPP` project directory
2. Navigate to the cloned directory:
```bash
cd ExaGeoStatCPP
```
Expand All @@ -92,6 +92,7 @@ To install the `ExaGeoStatCPP` project locally (C++ version), run the following
```bash
export PKG_CONFIG_PATH=$PWD/installdir/_deps/DEPENDENCY_NAME/lib/pkgconfig:$PKG_CONFIG_PATH
```
or copy/paste the output pkg-config paths from the configure step

Now, you can use the pkg-config executable to collect compiler and linker flags for
ExaGeoStatCPP.
Expand Down
16 changes: 11 additions & 5 deletions USER_MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
* To enable packaging system for distribution, add `-p` disabled by default.
* To enable showing code warnings, add `-w` disabled by default.
* To manually set mkl as blas vendor, add `--use-mkl`. MKL is required as blas vendor and it's automatically detected but in some environments it need to be manually set.
* To enable PaRSEC as a runtime system, add `--use=parsec`, StarPU by default.

## Building

Expand All @@ -98,7 +99,10 @@


## Arguments
These are the arguments that you can specify when running any C++ example.
These are the arguments that you can specify when running any C++ example.
**Please note that the arguments are not case-sensitive**, and you can use variations such as `-`, `_`, or capitalized forms for the same argument name.
For example, `MaxRank`, `max-rank`, `max_rank`, `Max_Rank` ,`Maxrank` , `MaxrAnk` and `Max-Rank` are all considered equivalent.

* {Mandatory} To set the problem size (N)

--N=<problem_size>
Expand Down Expand Up @@ -152,13 +156,13 @@ These are the arguments that you can specify when running any C++ example.
--oub=<value:value:....:value>
* {Optional} To set the initial theta

--itheta=<value:value:....:value>
--initial_theta=<value:value:....:value>
* {Optional} To set the target theta

--ttheta=<value:value:....:value>
* {Optional} To set the estimated theta

--etheta=<value:value:....:value>
--estimated_theta=<value:value:....:value>
* {Optional} To set the seed value, the default is 0

--seed=<value>
Expand Down Expand Up @@ -223,10 +227,12 @@ These are the arguments that you can specify when running any C++ example.
### Provide Arguments

To use any operations, you must initially supply the necessary arguments
to the operation via the Configurations module. There are two methods available
to the operation via the Configurations module.
This program is configured by default through a json file of default values. You can either change the configuration arguments
in the json file or provide them through command line. There are two methods available
for setting your arguments:

1. Provide your arguments with the command line.
1. Provide your arguments with the command line, this overwrites the json configuration.
```c++
// Create a new configuration object.
Configurations configurations;
Expand Down
109 changes: 109 additions & 0 deletions cmake/FindHICMA-X.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

# Copyright (c) 2017-2024 King Abdullah University of Science and Technology,
# All rights reserved.
# ExaGeoStat is a software package, provided by King Abdullah University of Science and Technology (KAUST).

# @file FindHICMA-X.cmake
# @brief This is a CMakeLists file for finding HiCMA-X and link and include it's headers
# @version 2.0.0
# @author Mahmoud ElKarargy
# @date 2024-09-28

# Include pkg-config
find_package(PkgConfig QUIET)

# Try to find dplasma and parsec via pkg-config
if(PKG_CONFIG_FOUND)
pkg_check_modules(DPLASMA_PKG dplasma)
pkg_check_modules(PARSEC_PKG parsec)
if(DPLASMA_PKG_FOUND AND PARSEC_PKG_FOUND)
# Try to find the HICMA-X or hicma-x path in the library directories
string(FIND "${PARSEC_PKG_LIBRARY_DIRS}" "HICMA-X" HICMA_X_START)
if(HICMA_X_START EQUAL -1)
string(FIND "${PARSEC_PKG_LIBRARY_DIRS}" "hicma-x" HICMA_X_START)
endif()
if(HICMA_X_START GREATER -1)
# Extract the full path to HICMA-X or hicma-x and set the include directory
string(REGEX MATCH "([^;]*(HICMA-X|hicma-x)[^;]*/lib)" HICMA_X_LIB_PATH "${PARSEC_PKG_LIBRARY_DIRS}")
get_filename_component(HICMA_X_ROOT "${HICMA_X_LIB_PATH}" DIRECTORY) # Go one level up
set(HICMA-X_INCLUDE_DIRS "${HICMA_X_ROOT}/include") # Set the include path
endif()
# TODO: This is not generalized for the case of hicma installed manually
set(HICMA_X_SRC_DIR ${HICMA_X_ROOT}/hicma-x-src)
set(HICMA_X_BIN_DIR ${HICMA_X_ROOT}/bin)
set(HICMA-X_FOUND TRUE)
set(HICMA-X_LIBRARIES ${DPLASMA_PKG_LIBRARIES} ${PARSEC_PKG_LIBRARIES})
set(HICMA-X_LIBRARY_DIRS "${HICMA_X_LIB_PATH}")
# Add a search for lib64 directories and set HICMA-X_LIBRARY_DIRS_DEP
set(HICMA-X_LIBRARY_DIRS_DEP "${HICMA_X_LIB_PATH}64")

find_library(HICMA_PARSEC_LIB hicma_parsec PATHS ${HICMA-X_LIBRARY_DIRS_DEP})

if(HICMA_PARSEC_LIB)
list(APPEND HICMA-X_LIBRARIES ${HICMA_PARSEC_LIB})
else()
message(FATAL_ERROR "libhicma_parsec.so not found")
endif()

endif()
endif()

# Fallback: Manual search if pkg-config fails or HICMA-X path isn't set
if(NOT HICMA-X_FOUND)
# Improved search to handle multiple possible paths and fallback for include directories
find_path(HICMA-X_INCLUDE_DIR
NAMES hicma.h
PATHS
${CMAKE_CURRENT_LIST_DIR}/../hicma-x/include
/usr/local/include/hicma-x
/usr/local/include
/usr/include/hicma-x
/usr/include
DOC "Path to HICMA-X include directory"
)

# Search for the main HICMA-X library
find_library(HICMA-X_LIBRARY
NAMES hicma-x
PATHS
${CMAKE_CURRENT_LIST_DIR}/../hicma-x/lib
/usr/local/lib
/usr/lib
DOC "Path to HICMA-X library"
)

# Search for the hicma_parsec library in the lib64 directory if it's not found in the standard lib
find_library(HICMA_PARSEC_LIB
NAMES hicma_parsec
PATHS
${CMAKE_CURRENT_LIST_DIR}/../hicma-x/lib64
/usr/local/lib64
/usr/lib64
DOC "Path to HICMA-Parsec library"
)

# Check if both the include directory and libraries were found
if(HICMA-X_INCLUDE_DIR AND HICMA-X_LIBRARY AND HICMA_PARSEC_LIB)
set(HICMA-X_FOUND TRUE)
# Combine the found libraries
set(HICMA-X_LIBRARIES ${HICMA-X_LIBRARY} ${HICMA_PARSEC_LIB})
# Set the include directory
set(HICMA-X_INCLUDE_DIRS "${HICMA-X_INCLUDE_DIR}")
# Include both lib and lib64 directories
# TODO: This paths are not generalized, if the install is not with the same dir.
set(HICMA-X_LIBRARY_DIRS "${HICMA-X_LIBRARY}/lib")
set(HICMA-X_LIBRARY_DIRS_DEP "${HICMA-X_LIBRARY}/lib64")
else()
set(HICMA-X_FOUND FALSE)
endif()
endif()

# Mark the variables as advanced to keep the CMake GUI clean
mark_as_advanced(HICMA-X_INCLUDE_DIR HICMA-X_LIBRARY HICMA_PARSEC_LIB)

# Provide feedback on whether the library was found
if(HICMA-X_FOUND)
message(STATUS "Found HICMA-X")
else()
message("Could not find HICMA-X or its dependencies (dplasma, parsec)")
endif()
Loading