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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ 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)
target_compile_definitions(${PROJECT_NAME} PUBLIC DEFAULT_RUNTIME=1)
elseif(RUNTIME_TYPE STREQUAL "PARSEC")
target_compile_definitions(${PROJECT_NAME} PRIVATE DEFAULT_RUNTIME=0)
target_compile_definitions(${PROJECT_NAME} PUBLIC DEFAULT_RUNTIME=0)
endif()

# Creates a new INTERFACE library target named ${PROJECT_NAME}_INTERFACE.
Expand Down
106 changes: 27 additions & 79 deletions examples/climate-emulator/ClimateEmulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,91 +5,39 @@

/**
* @file ClimateEmulator.cpp
* @brief
* @details
* @brief example of climate emulator.
* @version 2.0.0
* @author Mahmoud ElKarargy
* @author Sameh Abdulah
* @date 2024-09-23
**/

#include <hicma_parsec.h>

int main(int argc, char ** argv)
{
int iparam[IPARAM_SIZEOF] = {0};
double dparam[DPARAM_SIZEOF];
char *cparam[CPARAM_SIZEOF];
hicma_parsec_params_t params;
starsh_params_t params_kernel;
hicma_parsec_data_t data;
hicma_parsec_matrix_analysis_t analysis;

/* Init */
parsec_context_t* parsec = hicma_parsec_init( argc, argv, iparam, dparam, cparam, &params, &params_kernel, &data );

SYNC_TIME_START();
//gb24_init_serial(&gb);
SYNC_TIME_PRINT(params.rank, ("gb24_init\n"));

// Forward SHT
SYNC_TIME_START();

// Forward SHT reshape
SYNC_TIME_START();
SYNC_TIME_PRINT(params.rank, ("geqsht_forward_reshape\n"));

// Make sure it's dense and only off_band maters
if(params.band_size_dist != 0) {
if( 0 == params.rank ) {
fprintf(stderr, RED "Fatal error: band_size_dist= %d needs to be 0\n" RESET, params.band_size_dist);
}
params.band_size_dist = 0;
//return 1;
}

if(params.band_size_dense < ceil((double)params.N/params.NB)) {
if( 0 == params.rank ) {
fprintf(stderr, RED "Fatal error: the matrix needs to be all DENSE\n" RESET);
}
return 1;
}

/* Generate matrix */
SYNC_TIME_START();
SYNC_TIME_PRINT(params.rank, ("Matrix genneration Matrix norm: norm_global= %le\n", params.norm_global));

// SYRK
SYNC_TIME_START();
dplasma_dsyrk(parsec, dplasmaLower, dplasmaNoTrans,
1.0, (parsec_tiled_matrix_t *)&data.dcA,
0.0, (parsec_tiled_matrix_t *)&data.dcA);
SYNC_TIME_PRINT(params.rank, ("SYRK\n"));

// Calculate norm
SYNC_TIME_START();
SYNC_TIME_PRINT(params.rank, ("Matrix norm: norm_global= %le\n", params.norm_global));

/* Analyze matrix before Cholesky */
hicma_parsec_matrix_pre_analysis( parsec, &data, &params, &params_kernel, &analysis );

/* HiCMA Cholesky */
for( int i= 0; i < params.nruns; i++ ) {
hicma_parsec_potrf( parsec, &data, &params, &analysis );
}

if( 0 == params.rank && params.info != 0 && 1 == params.nruns ) {
fprintf(stderr, "-- Factorization is suspicious (info = %d) ! \n", params.info);
//exit(params.info);
}

/* Analyze matrix after Cholesky */
hicma_parsec_matrix_post_analysis( parsec, &data, &params, &params_kernel, &analysis );

SYNC_TIME_PRINT(params.rank, ("mse\n"));

/* Finalize */
hicma_parsec_fini( parsec, argc, argv, iparam, dparam, cparam, &params, &params_kernel, &data, &analysis );
#include <configurations/Configurations.hpp>
#include <hardware/ExaGeoStatHardware.hpp>
#include <api/ExaGeoStat.hpp>

using namespace exageostat::configurations;
using namespace exageostat::api;

int main(int argc, char **argv) {

// Create a new configurations object.
Configurations configurations;
// Initialize the arguments with the provided command line arguments
configurations.InitializeArguments(argc, argv);
// Initialize the ExaGeoStat Hardware
auto hardware = ExaGeoStatHardware(configurations);

// // Create a unique pointer to hold the data.
// std::unique_ptr<ExaGeoStatData<double>> data;
// // Transform and prepare the data.
// ExaGeoStat<double>::ExaGeoStatTransformData(configurations, data);
// // Load the data, either by reading from a file or generating synthetic data.
// ExaGeoStat<double>::ExaGeoStatLoadData(configurations, data);
// // Perform data modeling.
// ExaGeoStat<double>::ExaGeoStatDataModeling(configurations, data);
// // Analyze the data.
// ExaGeoStat<double>::ExaGeoStatDataAnalyzer(configurations, data);

return 0;
}
21 changes: 20 additions & 1 deletion inst/include/api/ExaGeoStat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace exageostat::api {
* @return double MLE results.
*
*/
static double ExaGeoStatMLETileAPI(const std::vector<double> &aTheta, std::vector<double> &aGrad, void *apInfo);
static double ModelingAPI(const std::vector<double> &aTheta, std::vector<double> &aGrad, void *apInfo);

/**
* @brief Predict missing measurements values.
Expand All @@ -76,6 +76,25 @@ namespace exageostat::api {
ExaGeoStatPrediction(configurations::Configurations &aConfigurations, std::unique_ptr<ExaGeoStatData<T>> &aData,
T *apMeasurementsMatrix = nullptr, dataunits::Locations<T> *apTrainLocations = nullptr,
dataunits::Locations<T> *apTestLocations = nullptr);
/**
* @brief Transform data into the required format for ExaGeoStat operations.
* @param[in] aConfigurations Reference to Configurations object containing user input data.
* @param[in, out] aData Reference to an ExaGeoStatData<T> object containing the descriptors and locations to be transformed.
* @return void
*
*/
static void
ExaGeoStatTransformData(configurations::Configurations &aConfigurations, std::unique_ptr<ExaGeoStatData<T>> &aData);

/**
* @brief Analyze the data to extract insights and patterns.
* @param[in] aConfigurations Reference to Configurations object containing user input data.
* @param[in, out] aData Reference to an ExaGeoStatData<T> object that contains the data to be analyzed.
* @return void
*
*/
static void
ExaGeoStatDataAnalyzer(configurations::Configurations &aConfigurations, std::unique_ptr<ExaGeoStatData<T>> &aData);

};

Expand Down
36 changes: 36 additions & 0 deletions inst/include/configurations/Configurations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,42 @@ namespace exageostat::configurations {
static void SetVerbosity(const common::Verbose &aVerbose);

/** END OF THE COMMON ARGUMENTS BETWEEN ALL MODULES. **/

/** START OF THE HICMA-PARSEC SPECIFIC ARGUEMNTS. **/

CREATE_SETTER_FUNCTION(DenseBandDP, int, aDenseBandDP, "DenseBandDoublePrecision")

CREATE_GETTER_FUNCTION(DenseBandDP, int, "DenseBandDoublePrecision")

CREATE_SETTER_FUNCTION(ObjectsNumber, int, aObjectsNumber, "ObjectsNumber")

CREATE_GETTER_FUNCTION(ObjectsNumber, int, "ObjectsNumber")

CREATE_SETTER_FUNCTION(AdaptiveDecision, int, aAdaptiveDecision, "AdaptiveDecision")

CREATE_GETTER_FUNCTION(AdaptiveDecision, int, "AdaptiveDecision")

CREATE_SETTER_FUNCTION(DiagonalAddition, int, aDiagonalAddition, "DiagonalAddition")

CREATE_GETTER_FUNCTION(DiagonalAddition, int, "DiagonalAddition")

CREATE_SETTER_FUNCTION(TimeSlotPerFile, int, aTimeSlotPerFile, "TimeSlotPerFile")

CREATE_GETTER_FUNCTION(TimeSlotPerFile, int, "TimeSlotPerFile")

CREATE_SETTER_FUNCTION(FileNumber, int, aFileNumber, "FileNumber")

CREATE_GETTER_FUNCTION(FileNumber, int, "FileNumber")

CREATE_SETTER_FUNCTION(EnableInverse, bool , aEnableInverse, "EnableInverse")

CREATE_GETTER_FUNCTION(EnableInverse, bool , "EnableInverse")

CREATE_SETTER_FUNCTION(MPIIO, bool, aMPIIO, "MPIIO")

CREATE_GETTER_FUNCTION(MPIIO, bool, "MPIIO")

/** END OF THE HICMA-PARSEC SPECIFIC ARGUEMNTS. **/
/** START OF THE DATA GENERATION MODULES. **/

CREATE_SETTER_FUNCTION(Dimension, exageostat::common::Dimension, aDimension, "Dimension")
Expand Down
61 changes: 61 additions & 0 deletions inst/include/data-analyzer/DataAnalyzer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

// 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 DataAnalyzer.hpp
* @brief Contains the definition of the DataAnalyzer class.
* @version 1.1.0
* @author Mahmoud ElKarargy
* @author Sameh Abdulah
* @date 2024-10-15
**/

#ifndef EXAGEOSTATCPP_DATAANALYZER_HPP
#define EXAGEOSTATCPP_DATAANALYZER_HPP

#include <configurations/Configurations.hpp>
#include <data-units/ExaGeoStatData.hpp>

namespace exageostat::analyzer{
/**
* @brief Class represents the data analyzer for the Climate Emulator.
* @tparam T Data Type: float or double
*/
template<typename T>
class DataAnalyzer {

public:
/**
* @brief Default constructor.
*/
DataAnalyzer();

/**
* @brief Default destructor.
*/
~DataAnalyzer();

/**
* @brief Analyzes the given matrix data.
* @param[in] aConfigurations Reference to Configurations object containing needed parameters.
* @param[in, out] aData Reference to an ExaGeoStatData object that contains matrix to be analyzed.
* @return void
*
*/
static void AnalyzeMatrix(configurations::Configurations &aConfigurations, std::unique_ptr<ExaGeoStatData<T>> &aData);

/**
* @brief Compares betweent two matrices by getting the difference.
* @param[in] aConfigurations Reference to Configurations object containing needed parameters.
* @param[in, out] aData Reference to an ExaGeoStatData object that contains matrix to be analyzed.
* @return the calculated MSE.
*
*/
static double CompareMatDifference(configurations::Configurations &aConfigurations, std::unique_ptr<ExaGeoStatData<T>> &aData);
};

}//namespace exageostat

#endif // EXAGEOSTATCPP_DATAANALYZER_HPP
52 changes: 52 additions & 0 deletions inst/include/data-transformer/DataTransformer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

// 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 DataTransformer.hpp
* @brief Contains the definition of the DataTransformer class.
* @version 1.1.0
* @author Mahmoud ElKarargy
* @author Sameh Abdulah
* @date 2024-10-15
**/

#ifndef EXAGEOSTATCPP_DATATRANSFORMER_HPP
#define EXAGEOSTATCPP_DATATRANSFORMER_HPP

#include <configurations/Configurations.hpp>
#include <data-units/ExaGeoStatData.hpp>

namespace exageostat::transformer{

/**
* @brief Class represents the data transformer for the Climate Emulator.
* @tparam T Data Type: float or double
*/
template<typename T>
class DataTransformer {

/**
* @brief Performs the forward spherical harmonics transform (SHT).
* @param[in] aConfigurations Configurations object containing relevant settings.
* @param[in,out] aData Descriptor Data object to be populated with descriptors and data.
*/
static void ForwardSHT(configurations::Configurations &aConfigurations, std::unique_ptr<ExaGeoStatData<T>> &aData);

/**
* @brief Reshapes data during the forward phase of the simulation.
* @param[in] aConfigurations Configurations object containing relevant settings.
* @param[in,out] aData Descriptor Data object to be populated with descriptors and data.
*/
static void ForwardReshape(configurations::Configurations &aConfigurations, std::unique_ptr<ExaGeoStatData<T>> &aData);

/**
* @brief Performs the inverse spherical harmonics transform (SHT).
* @param[in] aConfigurations Configurations object containing relevant settings.
* @param[in,out] aData Descriptor Data object to be populated with descriptors and data.
*/
static void InverseSHT(configurations::Configurations &aConfigurations, std::unique_ptr<ExaGeoStatData<T>> &aData);
};
}
#endif // EXAGEOSTATCPP_DATATRANSFORMER_HPP
4 changes: 4 additions & 0 deletions inst/include/data-units/DescriptorData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

#include <data-units/descriptor/ExaGeoStatDescriptor.hpp>
#include <hardware/ExaGeoStatHardware.hpp>
#if DEFAULT_RUNTIME
#include <linear-algebra-solvers/concrete/ChameleonHeaders.hpp>
#endif

namespace exageostat::dataunits {

Expand All @@ -29,9 +31,11 @@ namespace exageostat::dataunits {
*
*/
union BaseDescriptor {
#if DEFAULT_RUNTIME
CHAM_desc_t *chameleon_desc;
#ifdef USE_HICMA
HICMA_desc_t *hicma_desc;
#endif
#endif
};

Expand Down
18 changes: 18 additions & 0 deletions inst/include/hardware/ExaGeoStatHardware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define EXAGEOSTATCPP_EXAGEOSTATHARDWARE_HPP

#include <common/Definitions.hpp>
#include <configurations/Configurations.hpp>

/**
* @brief Class represents the hardware configuration for the ExaGeoStat solver.
Expand All @@ -24,6 +25,14 @@
class ExaGeoStatHardware {

public:

/**
* @brief Constructor for ExaGeoStatHardware.
* @param[in] aConfigurations The set of arguments from the configurations.
*
*/
explicit ExaGeoStatHardware(exageostat::configurations::Configurations &aConfigurations);

/**
* @brief Constructor for ExaGeoStatHardware.
* @param[in] aComputation The computation mode for the solver.
Expand Down Expand Up @@ -89,6 +98,13 @@ class ExaGeoStatHardware {
*/
[[nodiscard]] static void *GetHicmaContext();

/**
* @brief Get the PaRSEC hardware context.
* @return Pointer to the hardware context.
*
*/
[[nodiscard]] static void *GetParsecContext();

/**
* @brief Get the hardware context.
* @param[in] aComputation Used computation to decide whether to use Hicma or Chameleon context.
Expand Down Expand Up @@ -136,6 +152,8 @@ class ExaGeoStatHardware {
static void *mpChameleonContext;
//// Used Pointer to the Hicma hardware context.
static void *mpHicmaContext;
//// Used Pointer to the PaRSEC hardware context.
static void *mpParsecContext;
//// Used P-Grid
static int mPGrid;
//// Used Q-Grid
Expand Down
Loading