Skip to content
Merged
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
90 changes: 62 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,36 @@ 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)

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 +65,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 @@ -110,30 +119,43 @@ include(ImportHwloc)
list(APPEND STARPU_COMPONENT_LIST "HWLOC")
string(REPLACE ";" " " STARPU_COMPONENT_STRING "${STARPU_COMPONENT_LIST}")

# ExaGeoStatCPP depends on StarPU runtime
# ExaGeoStatCPP depends on NLOPT
# -------------------------------
include(ImportStarPu)
include(ImportNLOPT)

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

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

# ExaGeoStatCPP depends on HiCMA
# -------------------------------
if (USE_HICMA)
add_definitions(-DUSE_HICMA=TRUE)
include(ImportHCore)
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(ImportHiCMA)
endif ()
include(ImportHCore)
include(ImportHiCMAX)
else()
message(FATAL_ERROR "Unknown RUNTIME_TYPE: ${RUNTIME_TYPE}. Supported values are 'STARPU' or 'PARSEC'.")
endif()

# ExaGeoStatCPP depends on Chameleon
# -------------------------------
include(ImportChameleon)

# ExaGeoStatCPP depends on LAPACK/BLASPP
# -------------------------------
Expand Down Expand Up @@ -168,10 +190,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} PRIVATE DEFAULT_RUNTIME=1)
elseif(RUNTIME_TYPE STREQUAL "PARSEC")
target_compile_definitions(${PROJECT_NAME} PRIVATE 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 @@ -213,15 +241,21 @@ 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}/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:$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 @@ -60,12 +60,12 @@ statisticians with modest computational resources.
### C++ source code installation
To install the `ExaGeoStat` project locally, 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 @@ -84,6 +84,7 @@ To install the `ExaGeoStat` project locally, run the following commands in your
```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
1 change: 1 addition & 0 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 Down
108 changes: 108 additions & 0 deletions cmake/FindHICMA-X.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@

# 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_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()
7 changes: 5 additions & 2 deletions cmake/FindHWLOC.cmake → cmake/FindHwloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# Hwloc_FOUND - True if hwloc was found
# Hwloc_INCLUDE_DIRS - include directories for hwloc
# Hwloc_LIBRARIES - link against these libraries to use hwloc
# Hwloc_LIBRARY_DIRS - directories where hwloc libraries are found
# Hwloc_VERSION - version
# Hwloc_CFLAGS - include directories as compiler flags
# Hwloc_LDLFAGS - link paths and libs as compiler flags
Expand Down Expand Up @@ -171,6 +172,9 @@ else()
list(GET Hwloc_VERSION_PARSED 1 Hwloc_VERSION_MINOR)
set(Hwloc_VERSION_MINOR "${Hwloc_VERSION_MINOR}" CACHE STRING "Minor version of Hwloc")

# Capture the library directories
set(Hwloc_LIBRARY_DIRS ${Hwloc_LIBRARY_DIRS} CACHE STRING "Directories where hwloc libraries are found")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Hwloc DEFAULT_MSG Hwloc_LIBRARIES)

Expand All @@ -184,5 +188,4 @@ else()
endif()
endif()


endif()
endif()
40 changes: 40 additions & 0 deletions cmake/ImportHiCMAX.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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 ImportHiCMAX.cmake
# @brief Find and include HiCMA-X library as a dependency.
# @version 2.0.0
# @author Mahmoud ElKarargy
# @author Sameh Abdulah
# @date 2024-09-21

# Configuration settings for integrating the HICMA-X library into the project
# 'name' sets the identifier for the HICMA-X library within this script to "HICMA-X".
set(name "HICMA-X")
# Set the version tag for HiCMA-X.
set(tag "FIX-package-installation-MK")
# Flags to configure the build for HiCMA-X, including precision settings for DPLASMA
# and disabling GPU support for both CUDA and HIP.
set(flags '-DDPLASMA_PRECISIONS="s;d"' \-DPARSEC_WITH_DEVEL_HEADERS=ON \-DCMAKE_Fortran_FLAGS="-Wno-main" \-DPARSEC_GPU_WITH_HIP=OFF \-DPARSEC_GPU_WITH_CUDA=OFF \-DPARSEC_HAVE_CUDA=OFF \-DPARSEC_DIST_SHORT_LIMIT=0 \-DPARSEC_DIST_COLLECTIVES=ON \-DPARSEC_HAVE_DEV_CUDA_SUPPORT=OFF \-DDPLASMA_HAVE_CUDA=OFF)
# Indicates that HiCMA-X uses CMake for its build system.
set(is_cmake ON)
# Indicates that HiCMA-X is hosted on a Git repository.
set(is_git ON)
# Indicates that autogen scripts are not required for HiCMA-X.
set(auto_gen OFF)
# Set the URL of the HiCMA-X GitHub repository.
set(url "https://github.com/SAbdulah/hicma-x-dev.git")
# Include the macro to import HiCMA-X as a dependency.
include(macros/ImportDependency)

# Use the ImportDependency macro to handle fetching, detecting, and setting up HiCMA-X.
ImportDependency(${name} ${tag} "" ${url} "${flags}" "" ${is_cmake} ${is_git} ${auto_gen})

# Include necessary directories for HiCMA-X and its dependencies.
include_directories(${HICMA_X_SRC_DIR})
include_directories(${HICMA_X_SRC_DIR}/dplasma/src)
include_directories(${HICMA_X_SRC_DIR}/hicma_parsec)
include_directories(${HICMA_X_SRC_DIR}/bin/dplasma/src)
# Display a status message indicating that HiCMA-X has been successfully included.
message(STATUS "HiCMA-X done")
2 changes: 1 addition & 1 deletion cmake/ImportHwloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Configuration settings for integrating the HWLOC library
# 'name' sets the identifier for the HWLOC library within this script to "HWLOC".
set(name "HWLOC")
set(name "Hwloc")
# 'tag' specifies "hwloc-2.10.0" as the version tag, identifying a specific release of HWLOC to be used.
set(tag "hwloc-2.10.0")
# 'version' defines "2.10.0" as the version of HWLOC, ensuring it meets project compatibility requirements.
Expand Down
Loading