diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fa4872e..33cd5e58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,13 @@ if (USE_CUDA) # Set BLA_VENDOR to NVHPC for CUDA-enabled builds set(BLA_VENDOR NVHPC) list(APPEND STARPU_COMPONENT_LIST "CUDA") + + # ---- Enforce CUDA version constraint ---- + if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0") + message(FATAL_ERROR + "CUDA ${CMAKE_CUDA_COMPILER_VERSION} detected. " + "This project only supports CUDA < 12. Please install an older CUDA toolkit.") + endif() else () message("-- Build x86 Support") # Include GccToolchain for non-CUDA builds - Gcc diff --git a/README.md b/README.md index a7a7d6d7..519af79a 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,14 @@ To build and run this software, you will need: 1. [CMake](https://cmake.org/download/) (version 3.2 or higher) 2. [wget](https://www.gnu.org/software/wget/) -3. **gcc** and **g++** compilers -4. **autoconf** and **automake** -5. [libtool](https://www.gnu.org/software/libtool/) -6. [R](https://cran.r-project.org/bin/windows/base/) (only if you plan on using the R functionality) +3. [curl](https://curl.se/) +4. **gcc** and **g++** compilers +5. **autoconf** and **automake** +6. [libtool](https://www.gnu.org/software/libtool/) +7. [R](https://cran.r-project.org/bin/windows/base/) (only if you plan on using the R functionality) + +> ⚠️ **Note on CUDA Support**: If you want to enable CUDA, you must use a CUDA version **strictly less than 12**. +> ExaGeoStatCPP is not compatible with CUDA 12 or newer due to dependency conflicts. ### C++ source code installation To install the `ExaGeoStatCPP` project locally (C++ version), run the following commands in your terminal: diff --git a/src/Rcpp-adapters/RcppModules.cpp b/src/Rcpp-adapters/RcppModules.cpp index 55eb19ff..776c34e5 100644 --- a/src/Rcpp-adapters/RcppModules.cpp +++ b/src/Rcpp-adapters/RcppModules.cpp @@ -10,7 +10,7 @@ * @author Mahmoud ElKarargy * @author David Helmy * @date 2023-01-20 -**/ + **/ #include @@ -32,38 +32,100 @@ RCPP_MODULE(ExaGeoStatCPP) { /** Hardware Class **/ class_("Hardware") - .constructor() - .method("finalize_hardware", &ExaGeoStatHardware::FinalizeHardware, "Manually finalize the hardware"); + .constructor() + .method("finalize_hardware", &ExaGeoStatHardware::FinalizeHardware, + "Manually finalize the hardware"); /** Data Class **/ class_>("Data") - .constructor(); + .constructor(); function("simulate_data", &exageostat::adapters::R_ExaGeoStatLoadData, - List::create(_["kernel"], _["initial_theta"], _["distance_matrix"] = "euclidean", _["problem_size"], - _["seed"] = 0, _["dts"], _["lts"] = 0, _["dimension"] = "2D", _["log_path"] = "", - _["data_path"] = "", _["observations_file"] = "", _["recovery_file"] = "")); + List::create( + _["kernel"], + _["initial_theta"], + _["distance_matrix"] = "euclidean", + _["problem_size"], + _["seed"] = static_cast(time(0)), + _["dts"], + _["lts"] = 0, + _["dimension"] = "2D", + _["log_path"] = "", + _["data_path"] = "", + _["observations_file"] = "", + _["recovery_file"] = "" + )); function("model_data", &exageostat::adapters::R_ExaGeoStatModelData, - List::create(_["computation"] = "exact", _["kernel"], _["distance_matrix"] = "euclidean", _["lb"], _["ub"], - _["tol"] = 4, _["mle_itr"], _["dts"], _["lts"] = 0, _["dimension"] = "2D", _["band"] = 0, - _["max_rank"] = 500, _["acc"] = 0, _["data"] = R_NilValue, _["matrix"] = R_NilValue, _["x"] = R_NilValue, - _["y"] = R_NilValue, _["z"] = R_NilValue)); + List::create( + _["computation"] = "exact", + _["kernel"], + _["distance_matrix"] = "euclidean", + _["lb"], + _["ub"], + _["tol"] = 4, + _["mle_itr"], + _["dts"], + _["lts"] = 0, + _["dimension"] = "2D", + _["band"] = 0, + _["max_rank"] = 500, + _["acc"] = 0, + _["data"] = R_NilValue, + _["matrix"] = R_NilValue, + _["x"] = R_NilValue, + _["y"] = R_NilValue, + _["z"] = R_NilValue + )); function("predict_data", &exageostat::adapters::R_ExaGeoStatPredictData, - List::create(_["kernel"], _["distance_matrix"] = "euclidean", _["estimated_theta"], _["dts"], _["lts"] = 0, - _["dimension"] = "2D", _["train_data"], _["test_data"])); + List::create( + _["kernel"], + _["distance_matrix"] = "euclidean", + _["estimated_theta"], + _["dts"], + _["lts"] = 0, + _["dimension"] = "2D", + _["train_data"], + _["test_data"] + )); function("mloe_mmom", &exageostat::adapters::R_ExaGeoStatMLOE_MMOM, - List::create(_["kernel"], _["distance_matrix"] = "euclidean", _["estimated_theta"], _["true_theta"], - _["dts"], _["lts"] = 0, _["dimension"] = "2D", _["train_data"], _["test_data"])); + List::create( + _["kernel"], + _["distance_matrix"] = "euclidean", + _["estimated_theta"], + _["true_theta"], + _["dts"], + _["lts"] = 0, + _["dimension"] = "2D", + _["train_data"], + _["test_data"] + )); function("fisher", &exageostat::adapters::R_ExaGeoStatFisher, - List::create(_["kernel"], _["distance_matrix"] = "euclidean", _["estimated_theta"], _["dts"], _["lts"] = 0, - _["dimension"] = "2D", _["train_data"], _["test_data"])); + List::create( + _["kernel"], + _["distance_matrix"] = "euclidean", + _["estimated_theta"], + _["dts"], + _["lts"] = 0, + _["dimension"] = "2D", + _["train_data"], + _["test_data"] + )); function("idw", &exageostat::adapters::R_ExaGeoStatIDW, - List::create(_["kernel"], _["distance_matrix"] = "euclidean", _["estimated_theta"], _["dts"], _["lts"] = 0, - _["dimension"] = "2D", _["train_data"], _["test_data"], _["test_measurements"])); + List::create( + _["kernel"], + _["distance_matrix"] = "euclidean", + _["estimated_theta"], + _["dts"], + _["lts"] = 0, + _["dimension"] = "2D", + _["train_data"], + _["test_data"], + _["test_measurements"] + )); } diff --git a/src/api/ExaGeoStat.cpp b/src/api/ExaGeoStat.cpp index 7abc2b46..254b9e42 100644 --- a/src/api/ExaGeoStat.cpp +++ b/src/api/ExaGeoStat.cpp @@ -27,7 +27,7 @@ using namespace exageostat::configurations; template void ExaGeoStat::ExaGeoStatLoadData(Configurations &aConfigurations, std::unique_ptr> &aData) { - int seed = 0; + int seed = aConfigurations.GetSeed(); std::srand(seed); aConfigurations.PrintSummary(); LOGGER("** ExaGeoStat data generation/loading **") @@ -78,6 +78,7 @@ T ExaGeoStat::ExaGeoStatDataModeling(Configurations &aConfigurations, std::un else { LOGGER("\t--> Modeling Using Tile Low Rank - HiCMA") } + // Optimize mle using nlopt. optimizing_function.optimize(aConfigurations.GetStartingTheta(), opt_f); aConfigurations.SetEstimatedTheta(aConfigurations.GetStartingTheta()); @@ -130,4 +131,4 @@ void ExaGeoStat::ExaGeoStatPrediction(Configurations &aConfigurations, std::u prediction::Prediction::PredictMissingData(aData, aConfigurations, apMeasurementsMatrix, *pKernel, apTrainLocations, apTestLocations); delete pKernel; -} \ No newline at end of file +} diff --git a/src/configurations/Configurations.cpp b/src/configurations/Configurations.cpp index 48493e13..7f99dc0a 100644 --- a/src/configurations/Configurations.cpp +++ b/src/configurations/Configurations.cpp @@ -13,6 +13,7 @@ **/ #include +#include #include #include @@ -52,7 +53,7 @@ Configurations::Configurations() { SetLowerBounds(theta); SetUpperBounds(theta); SetEstimatedTheta(theta); - SetSeed(0); + SetSeed(static_cast(time(0))); SetLogger(false); SetUnknownObservationsNb(0); SetApproximationMode(1); diff --git a/src/linear-algebra-solvers/concrete/tlr/HicmaImplementation.cpp b/src/linear-algebra-solvers/concrete/tlr/HicmaImplementation.cpp index da7e378e..897b77a6 100644 --- a/src/linear-algebra-solvers/concrete/tlr/HicmaImplementation.cpp +++ b/src/linear-algebra-solvers/concrete/tlr/HicmaImplementation.cpp @@ -7,23 +7,21 @@ * @file HicmaImplementation.cpp * @brief Sets up the HiCMA descriptors needed for the tile low rank computations in ExaGeoStat. * @version 1.1.0 + * @author Omar Marzouk * @author Mahmoud ElKarargy * @author Sameh Abdulah * @date 2024-02-04 -**/ + **/ #include #ifdef USE_MPI - #include - #endif #include using namespace std; - using namespace exageostat::linearAlgebra::tileLowRank; using namespace exageostat::common; using namespace exageostat::runtime; @@ -34,11 +32,12 @@ using namespace exageostat::results; int store_only_diagonal_tiles = 1; int use_scratch = 1; -int global_check = 0; //used to create dense matrix for accuracy check +int global_check = 0; // used to create dense matrix for accuracy check template void HicmaImplementation::SetModelingDescriptors(std::unique_ptr> &aData, - configurations::Configurations &aConfigurations, const int &aP) { + configurations::Configurations &aConfigurations, + const int &aP) { int full_problem_size = aConfigurations.GetProblemSize() * aP; int lts = aConfigurations.GetLowTileSize(); @@ -61,18 +60,23 @@ void HicmaImplementation::SetModelingDescriptors(std::unique_ptrGetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_CD, is_OOC, nullptr, float_point, - lts, lts, lts * lts, full_problem_size, 1, 0, 0, full_problem_size, 1, - p_grid, q_grid); + aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_CD, is_OOC, nullptr, + float_point, lts, lts, lts * lts, full_problem_size, 1, + 0, 0, full_problem_size, 1, p_grid, q_grid); #endif - aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_CD, is_OOC, nullptr, float_point, - MBD, NBD, MBD * NBD, MD, ND, 0, 0, MD, ND, p_grid, q_grid); + + aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_CD, is_OOC, nullptr, + float_point, MBD, NBD, MBD * NBD, MD, ND, + 0, 0, MD, ND, p_grid, q_grid); + int MBUV = lts; int NBUV = 2 * max_rank; int MUV; int N_over_lts_times_lts = full_problem_size / lts * lts; + if (N_over_lts_times_lts < full_problem_size) { MUV = N_over_lts_times_lts + lts; } else if (N_over_lts_times_lts == full_problem_size) { @@ -80,48 +84,60 @@ void HicmaImplementation::SetModelingDescriptors(std::unique_ptr= lts*lts"); } + int expr = MUV / lts; int NUV = 2 * expr * max_rank; - aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_CUV, is_OOC, nullptr, float_point, - MBUV, NBUV, MBUV * NBUV, MUV, NUV, 0, 0, MUV, NUV, p_grid, q_grid); + + aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_CUV, is_OOC, nullptr, + float_point, MBUV, NBUV, MBUV * NBUV, MUV, NUV, + 0, 0, MUV, NUV, p_grid, q_grid); + auto *HICMA_descCUV = aData->GetDescriptorData()->GetDescriptor(DescriptorType::HICMA_DESCRIPTOR, DescriptorName::DESCRIPTOR_CUV).hicma_desc; + int MBrk = 1; int NBrk = 1; int Mrk = HICMA_descCUV->mt; int Nrk = HICMA_descCUV->mt; - aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_CRK, is_OOC, nullptr, float_point, - MBrk, NBrk, MBrk * NBrk, Mrk, Nrk, 0, 0, Mrk, Nrk, p_grid, q_grid); + + aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_CRK, is_OOC, nullptr, + float_point, MBrk, NBrk, MBrk * NBrk, Mrk, Nrk, + 0, 0, Mrk, Nrk, p_grid, q_grid); + + aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_Z, is_OOC, nullptr, + float_point, lts, lts, lts * lts, full_problem_size, 1, + 0, 0, full_problem_size, 1, p_grid, q_grid); - aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_Z, is_OOC, nullptr, float_point, - lts, lts, lts * lts, full_problem_size, 1, 0, 0, full_problem_size, 1, - p_grid, q_grid); + aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_Z_COPY, is_OOC, nullptr, + float_point, lts, lts, lts * lts, full_problem_size, 1, + 0, 0, full_problem_size, 1, p_grid, q_grid); - aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_Z_COPY, is_OOC, nullptr, float_point, - lts, lts, lts * lts, full_problem_size, 1, 0, 0, full_problem_size, 1, - p_grid, q_grid); aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_DETERMINANT, is_OOC, nullptr, - float_point, lts, lts, lts * lts, 1, 1, 0, 0, 1, 1, p_grid, q_grid); + float_point, lts, lts, lts * lts, 1, 1, + 0, 0, 1, 1, p_grid, q_grid); if (aConfigurations.GetIsNonGaussian()) { aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_PRODUCT, is_OOC, nullptr, - float_point, - lts, lts, lts * lts, 1, 1, 0, 0, 1, 1, p_grid, q_grid); + float_point, lts, lts, lts * lts, 1, 1, + 0, 0, 1, 1, p_grid, q_grid); aData->GetDescriptorData()->SetDescriptor(common::HICMA_DESCRIPTOR, DESCRIPTOR_SUM, is_OOC, nullptr, - float_point, - lts, lts, lts * lts, 1, 1, 0, 0, 1, 1, p_grid, q_grid); + float_point, lts, lts, lts * lts, 1, 1, + 0, 0, 1, 1, p_grid, q_grid); } } template T HicmaImplementation::ExaGeoStatMLETile(std::unique_ptr> &aData, - configurations::Configurations &aConfigurations, const double *theta, - T *apMeasurementsMatrix, const Kernel &aKernel) { + configurations::Configurations &aConfigurations, + const double *theta, + T *apMeasurementsMatrix, + const Kernel &aKernel) { if (!aData->GetDescriptorData()->GetIsDescriptorInitiated()) { this->InitiateDescriptors(aConfigurations, *aData->GetDescriptorData(), aKernel.GetVariablesNumber(), apMeasurementsMatrix); } + // Create a Hicma sequence, if not initialized before through the same descriptors RUNTIME_request_t request_array[2] = {HICMA_REQUEST_INITIALIZER, HICMA_REQUEST_INITIALIZER}; if (!aData->GetDescriptorData()->GetSequence()) { @@ -132,8 +148,10 @@ T HicmaImplementation::ExaGeoStatMLETile(std::unique_ptr> & } auto pSequence = (HICMA_sequence_t *) aData->GetDescriptorData()->GetSequence(); - //Initialization - T loglik, logdet, test_time, variance, variance1 = 1, variance2 = 1, variance3, dot_product, dot_product1, dot_product2, dot_product3, dzcpy_time, time_facto, time_solve, logdet_calculate, matrix_gen_time; + // Initialization + T loglik, logdet, test_time, variance, variance1 = 1, variance2 = 1, variance3; + T dot_product, dot_product1, dot_product2, dot_product3; + T dzcpy_time, time_facto, time_solve, logdet_calculate, matrix_gen_time; double accumulated_executed_time, accumulated_flops; int NRHS, i; @@ -150,6 +168,8 @@ T HicmaImplementation::ExaGeoStatMLETile(std::unique_ptr> & if (iter_count == 0) { this->SetModelingDescriptors(aData, aConfigurations, aKernel.GetVariablesNumber()); } + + // Get descriptor pointers auto *HICMA_descCUV = aData->GetDescriptorData()->GetDescriptor(DescriptorType::HICMA_DESCRIPTOR, DescriptorName::DESCRIPTOR_CUV).hicma_desc; auto *HICMA_descC = aData->GetDescriptorData()->GetDescriptor(DescriptorType::HICMA_DESCRIPTOR, @@ -172,6 +192,7 @@ T HicmaImplementation::ExaGeoStatMLETile(std::unique_ptr> & DescriptorName::DESCRIPTOR_PRODUCT).chameleon_desc; auto *HICMA_desc_sum = aData->GetDescriptorData()->GetDescriptor(DescriptorType::HICMA_DESCRIPTOR, DescriptorName::DESCRIPTOR_SUM).chameleon_desc; + N = HICMA_descCUV->m; NRHS = HICMA_descZ->n; lts = HICMA_descZ->mb; @@ -194,7 +215,8 @@ T HicmaImplementation::ExaGeoStatMLETile(std::unique_ptr> & CHAMELEON_dlacpy_Tile(ChamUpperLower, CHAM_descZ, CHAM_descZcpy); } } - //Matrix generation part. + + // Matrix generation part. VERBOSE("LR:Generate New Covariance Matrix...") START_TIMING(matrix_gen_time); @@ -203,9 +225,10 @@ T HicmaImplementation::ExaGeoStatMLETile(std::unique_ptr> & hicma_problem.noise = 1e-4; hicma_problem.ndim = 2; - hicma_problem.kernel_type = - aConfigurations.GetDistanceMetric() == common::GREAT_CIRCLE_DISTANCE ? STARSH_SPATIAL_MATERN2_GCD - : STARSH_SPATIAL_MATERN2_SIMD; + hicma_problem.kernel_type = aConfigurations.GetDistanceMetric() == common::GREAT_CIRCLE_DISTANCE + ? STARSH_SPATIAL_MATERN2_GCD + : STARSH_SPATIAL_MATERN2_SIMD; + int hicma_data_type; if (aConfigurations.GetIsNonGaussian()) { hicma_data_type = HICMA_STARSH_PROB_GEOSTAT_NON_GAUSSIAN; @@ -216,31 +239,31 @@ T HicmaImplementation::ExaGeoStatMLETile(std::unique_ptr> & HICMA_zgenerate_problem(hicma_data_type, 'S', 0, N, lts, HICMA_descCUV->mt, HICMA_descCUV->nt, &hicma_problem); int compress_diag = 0; - HICMA_zgytlr_Tile(EXAGEOSTAT_LOWER, HICMA_descCUV, HICMA_descCD, HICMA_descCrk, 0, max_rank, pow(10, -1.0 * acc), - compress_diag, HICMA_descC); + HICMA_dgytlr_Tile(EXAGEOSTAT_LOWER, HICMA_descCUV, HICMA_descCD, HICMA_descCrk, 0, max_rank, + pow(10, -1.0 * acc), compress_diag, HICMA_descC); STOP_TIMING(matrix_gen_time); VERBOSE("Done.") - //****************************** + + // ****************************** VERBOSE("LR: re-Copy z...") START_TIMING(test_time); - //re-store old Z + // re-store old Z this->ExaGeoStatLapackCopyTile(EXAGEOSTAT_UPPER_LOWER, HICMA_descZcpy, HICMA_descZ); STOP_TIMING(test_time); VERBOSE("Done.") - //Calculate Cholesky Factorization (C=LL-1) + // Calculate Cholesky Factorization (C=LL-1) VERBOSE("LR: Cholesky factorization of Sigma...") START_TIMING(time_facto); - this->ExaGeoStatPotrfTile(EXAGEOSTAT_LOWER, HICMA_descCUV, 0, HICMA_descCD, HICMA_descCrk, max_rank, - pow(10, -1.0 * acc)); + this->ExaGeoStatPotrfTile(EXAGEOSTAT_LOWER, HICMA_descCUV, 0, HICMA_descCD, HICMA_descCrk, max_rank, acc); STOP_TIMING(time_facto); flops = flops + flops_dpotrf(N); VERBOSE("Done.") - //Calculate log(|C|) --> log(square(|L|)) + // Calculate log(|C|) --> log(square(|L|)) VERBOSE("LR:Calculating the log determinant ...") START_TIMING(logdet_calculate); RuntimeFunctions::ExaGeoStatMeasureDetTileAsync(aConfigurations.GetComputation(), HICMA_descCD, pSequence, @@ -276,10 +299,10 @@ T HicmaImplementation::ExaGeoStatMLETile(std::unique_ptr> & VERBOSE(" Done.") } - //Solving Linear System (L*X=Z)--->inv(L)*Z + // Solving Linear System (L*X=Z)--->inv(L)*Z VERBOSE("LR:Solving the linear system ...") START_TIMING(time_solve); - //Compute triangular solve LC*X = Z + // Compute triangular solve LC*X = Z this->ExaGeoStatTrsmTile(EXAGEOSTAT_LEFT, EXAGEOSTAT_LOWER, EXAGEOSTAT_NO_TRANS, EXAGEOSTAT_NON_UNIT, 1, HICMA_descCUV, HICMA_descCD, HICMA_descCrk, HICMA_descZ, max_rank); STOP_TIMING(time_solve); @@ -293,6 +316,7 @@ T HicmaImplementation::ExaGeoStatMLETile(std::unique_ptr> & CHAMELEON_dgemm_Tile(ChamTrans, ChamNoTrans, 1, CHAM_descZ, CHAM_descZ, 0, CHAM_desc_product); dot_product = *product; loglik = -0.5 * dot_product - 0.5 * logdet; + if (aConfigurations.GetIsNonGaussian()) { loglik = loglik - *sum - N * log(theta[3]) - (double) (N / 2.0) * log(2.0 * PI); } else { @@ -304,6 +328,7 @@ T HicmaImplementation::ExaGeoStatMLETile(std::unique_ptr> & if (aConfigurations.GetLogger()) { fprintf(aConfigurations.GetFileLogPath(), "\t %d- Model Parameters (", iter_count + 1); } + if ((aConfigurations.GetKernelName() == "bivariate_matern_parsimonious_profile") || (aConfigurations.GetKernelName() == "bivariate_matern_parsimonious2_profile")) { LOGGER(setprecision(8) << variance1 << setprecision(8) << variance2) @@ -340,12 +365,10 @@ T HicmaImplementation::ExaGeoStatMLETile(std::unique_ptr> & aData->SetMleIterations(aData->GetMleIterations() + 1); // for experiments and benchmarking - accumulated_executed_time = - Results::GetInstance()->GetTotalModelingExecutionTime() + time_facto + logdet_calculate + - time_solve; + accumulated_executed_time = Results::GetInstance()->GetTotalModelingExecutionTime() + time_facto + + logdet_calculate + time_solve; Results::GetInstance()->SetTotalModelingExecutionTime(accumulated_executed_time); - accumulated_flops = - Results::GetInstance()->GetTotalModelingFlops() + (flops / 1e9 / (time_facto + time_solve)); + accumulated_flops = Results::GetInstance()->GetTotalModelingFlops() + (flops / 1e9 / (time_facto + time_solve)); Results::GetInstance()->SetTotalModelingFlops(accumulated_flops); Results::GetInstance()->SetMLEIterations(iter_count + 1); @@ -359,7 +382,6 @@ T HicmaImplementation::ExaGeoStatMLETile(std::unique_ptr> & return loglik; } - template void HicmaImplementation::ExaGeoStatLapackCopyTile(const UpperLower &aUpperLower, void *apA, void *apB) { int status = HICMA_dlacpy_Tile(aUpperLower, (HICMA_desc_t *) apA, (HICMA_desc_t *) apB); @@ -389,7 +411,6 @@ void HicmaImplementation::ExaGeoStatPotrfTile(const common::UpperLower &aUppe if (status != HICMA_SUCCESS) { throw std::runtime_error("HICMA_dpotrf_Tile Failed, Matrix is not positive definite"); } - } template diff --git a/tests/cpp-tests/api/TestExaGeoStatApi.cpp b/tests/cpp-tests/api/TestExaGeoStatApi.cpp index 5edcf550..f017e638 100644 --- a/tests/cpp-tests/api/TestExaGeoStatApi.cpp +++ b/tests/cpp-tests/api/TestExaGeoStatApi.cpp @@ -24,12 +24,10 @@ using namespace exageostat::configurations; void TEST_GENERATE_DATA() { SECTION("Data generation - Observations") { - int seed = 0; - srand(seed); - // Create a new synthetic_data_configurations object with the provided command line arguments Configurations synthetic_data_configurations; int N = 16; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternStationary"); synthetic_data_configurations.SetDenseTileSize(9); @@ -67,12 +65,11 @@ void TEST_GENERATE_DATA() { } void TEST_MODEL_DATA(Computation aComputation) { - int seed = 0; - srand(seed); // Create a new configurations object with the provided command line arguments Configurations configurations; int N = 16; + configurations.SetSeed(0); configurations.SetProblemSize(N); configurations.SetKernelName("UnivariateMaternStationary"); int dts = 8; diff --git a/tests/cpp-tests/kernels/concrete/TestBivariateMaternFlexible.cpp b/tests/cpp-tests/kernels/concrete/TestBivariateMaternFlexible.cpp index 0189e7c5..1c77a492 100644 --- a/tests/cpp-tests/kernels/concrete/TestBivariateMaternFlexible.cpp +++ b/tests/cpp-tests/kernels/concrete/TestBivariateMaternFlexible.cpp @@ -31,6 +31,7 @@ void TEST_KERNEL_GENERATION_BivariateMaternFlexible() { Configurations synthetic_data_configurations; int N = 27; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("BivariateMaternFlexible"); synthetic_data_configurations.SetDimension(Dimension2D); @@ -46,8 +47,6 @@ void TEST_KERNEL_GENERATION_BivariateMaternFlexible() { // initialize ExaGeoStat Hardware. auto hardware = ExaGeoStatHardware(EXACT_DENSE, 3, 0); - int seed = 0; - srand(seed); std::unique_ptr> data; exageostat::api::ExaGeoStat::ExaGeoStatLoadData(synthetic_data_configurations, data); auto *CHAM_descriptorZ = data->GetDescriptorData()->GetDescriptor(exageostat::common::CHAMELEON_DESCRIPTOR, diff --git a/tests/cpp-tests/kernels/concrete/TestBivariateMaternParsimonious.cpp b/tests/cpp-tests/kernels/concrete/TestBivariateMaternParsimonious.cpp index fd951ab6..de07b9cd 100644 --- a/tests/cpp-tests/kernels/concrete/TestBivariateMaternParsimonious.cpp +++ b/tests/cpp-tests/kernels/concrete/TestBivariateMaternParsimonious.cpp @@ -32,7 +32,7 @@ void TEST_KERNEL_GENERATION_BivariateMaternParsimonious() { Configurations synthetic_data_configurations; int N = 16; - + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("BivariateMaternParsimonious"); @@ -47,8 +47,6 @@ void TEST_KERNEL_GENERATION_BivariateMaternParsimonious() { // initialize ExaGeoStat Hardware. auto hardware = ExaGeoStatHardware(EXACT_DENSE, 3, 0); - int seed = 0; - srand(seed); std::unique_ptr> data; exageostat::api::ExaGeoStat::ExaGeoStatLoadData(synthetic_data_configurations, data); auto *CHAM_descriptorZ = data->GetDescriptorData()->GetDescriptor(exageostat::common::CHAMELEON_DESCRIPTOR, diff --git a/tests/cpp-tests/kernels/concrete/TestBivariateSpacetimeMaternStationary.cpp b/tests/cpp-tests/kernels/concrete/TestBivariateSpacetimeMaternStationary.cpp index c03aa2ff..bba5210e 100644 --- a/tests/cpp-tests/kernels/concrete/TestBivariateSpacetimeMaternStationary.cpp +++ b/tests/cpp-tests/kernels/concrete/TestBivariateSpacetimeMaternStationary.cpp @@ -33,6 +33,7 @@ void TEST_KERNEL_GENERATION_BivariateSpacetimeMaternStationary() { Configurations synthetic_data_configurations; int N = 4; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("BivariateSpacetimeMaternStationary"); @@ -48,8 +49,6 @@ void TEST_KERNEL_GENERATION_BivariateSpacetimeMaternStationary() { // initialize ExaGeoStat Hardware. auto hardware = ExaGeoStatHardware(EXACT_DENSE, 3, 0); - int seed = 0; - srand(seed); std::unique_ptr> data; exageostat::api::ExaGeoStat::ExaGeoStatLoadData(synthetic_data_configurations, data); auto *CHAM_descriptorZ = data->GetDescriptorData()->GetDescriptor(exageostat::common::CHAMELEON_DESCRIPTOR, diff --git a/tests/cpp-tests/kernels/concrete/TestTrivariateMaternParsimonious.cpp b/tests/cpp-tests/kernels/concrete/TestTrivariateMaternParsimonious.cpp index c412e4db..9d517bca 100644 --- a/tests/cpp-tests/kernels/concrete/TestTrivariateMaternParsimonious.cpp +++ b/tests/cpp-tests/kernels/concrete/TestTrivariateMaternParsimonious.cpp @@ -33,6 +33,7 @@ void TEST_KERNEL_GENERATION_TrivariateMaternParsimonious() { Configurations synthetic_data_configurations; int N = 16; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("TrivariateMaternParsimonious"); @@ -45,8 +46,6 @@ void TEST_KERNEL_GENERATION_TrivariateMaternParsimonious() { // initialize ExaGeoStat Hardware. auto hardware = ExaGeoStatHardware(EXACT_DENSE, 3, 0); - int seed = 0; - srand(seed); std::unique_ptr> data; exageostat::api::ExaGeoStat::ExaGeoStatLoadData(synthetic_data_configurations, data); auto *CHAM_descriptorZ = data->GetDescriptorData()->GetDescriptor(exageostat::common::CHAMELEON_DESCRIPTOR, diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDbeta.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDbeta.cpp index 43fba252..2c0dc3bf 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDbeta.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDbeta.cpp @@ -29,6 +29,7 @@ void TEST_KERNEL_GENERATION_UnivariateMaternDbeta() { // Create a new synthetic_data_configurations object with the provided command line arguments Configurations synthetic_data_configurations; int N = 9; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternDbeta"); int dts = 5; diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdbetaBeta.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdbetaBeta.cpp index 76e5cdea..fd179604 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdbetaBeta.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdbetaBeta.cpp @@ -31,6 +31,7 @@ void TEST_KERNEL_GENERATION_UnivariateMaternDdbetaBeta() { // Create a new synthetic_data_configurations object with the provided command line arguments Configurations synthetic_data_configurations; int N = 16; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternDdbetaBeta"); diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdbetaNu.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdbetaNu.cpp index 3d7e03d4..10c869a4 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdbetaNu.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdbetaNu.cpp @@ -31,6 +31,7 @@ void TEST_KERNEL_GENERATION_UnivariateMaternDdbetaNu() { // Create a new synthetic_data_configurations object with the provided command line arguments Configurations synthetic_data_configurations; int N = 27; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternDdbetaNu"); diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdnuNu.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdnuNu.cpp index 762208e4..8d997ae2 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdnuNu.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdnuNu.cpp @@ -31,6 +31,7 @@ void TEST_KERNEL_GENERATION_UnivariateMaternDdnuNu() { // Create a new synthetic_data_configurations object with the provided command line arguments Configurations synthetic_data_configurations; int N = 9; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternDdnuNu"); diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdsigmaSquare.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdsigmaSquare.cpp index 775847ad..ad9cc6e9 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdsigmaSquare.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdsigmaSquare.cpp @@ -30,6 +30,7 @@ void TEST_KERNEL_GENERATION_UnivariateMaternDdsigmaSquare() { // Create a new synthetic_data_configurations object with the provided command line arguments Configurations synthetic_data_configurations; int N = 9; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternDdsigmaSquare"); synthetic_data_configurations.SetDimension(Dimension2D); diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdsigmaSquareBeta.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdsigmaSquareBeta.cpp index 657e1357..f6054c8e 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdsigmaSquareBeta.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdsigmaSquareBeta.cpp @@ -31,6 +31,7 @@ void TEST_KERNEL_GENERATION_UnivariateMaternDdsigmaSquareBeta() { // Create a new synthetic_data_configurations object with the provided command line arguments Configurations synthetic_data_configurations; int N = 32; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternDdsigmaSquareBeta"); diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdsigmaSquareNu.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdsigmaSquareNu.cpp index 785eb847..4826d937 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdsigmaSquareNu.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDdsigmaSquareNu.cpp @@ -31,6 +31,7 @@ void TEST_KERNEL_GENERATION_UnivariateMaternDdsigmaSquareNu() { // Create a new synthetic_data_configurations object with the provided command line arguments Configurations synthetic_data_configurations; int N = 27; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternDdsigmaSquareNu"); diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDnu.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDnu.cpp index cdfbbf2c..3d1c9036 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDnu.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDnu.cpp @@ -29,6 +29,7 @@ void TEST_KERNEL_GENERATION_UnivariateMaternDnu() { // Create a new synthetic_data_configurations object with the provided command line arguments Configurations synthetic_data_configurations; int N = 16; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternDnu"); int dts = 8; diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDsigmaSquare.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDsigmaSquare.cpp index bb44c9bc..5490085c 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDsigmaSquare.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternDsigmaSquare.cpp @@ -31,6 +31,7 @@ void TEST_KERNEL_GENERATION_UnivariateMaternDsigmaSquare() { // Create a new synthetic_data_configurations object with the provided command line arguments Configurations synthetic_data_configurations; int N = 27; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternDdsigmaSquare"); synthetic_data_configurations.SetDimension(Dimension2D); diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternNonGaussian.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternNonGaussian.cpp index 7252175e..95e04ee9 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternNonGaussian.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternNonGaussian.cpp @@ -32,6 +32,7 @@ void TEST_KERNEL_GENERATION_UnivariateMaternNonGaussian() { Configurations synthetic_data_configurations; int N = 16; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternNonGaussian"); @@ -49,8 +50,6 @@ void TEST_KERNEL_GENERATION_UnivariateMaternNonGaussian() { // initialize ExaGeoStat Hardware. auto hardware = ExaGeoStatHardware(EXACT_DENSE, 3, 0); - int seed = 0; - srand(seed); std::unique_ptr> data; exageostat::api::ExaGeoStat::ExaGeoStatLoadData(synthetic_data_configurations, data); auto *CHAM_descriptorZ = data->GetDescriptorData()->GetDescriptor(exageostat::common::CHAMELEON_DESCRIPTOR, diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternNuggetsStationary.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternNuggetsStationary.cpp index 28bc9221..036740fa 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternNuggetsStationary.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternNuggetsStationary.cpp @@ -32,6 +32,7 @@ void TEST_KERNEL_GENERATION_UnivariateMaternNuggetsStationary() { Configurations synthetic_data_configurations; int N = 8; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternNuggetsStationary"); synthetic_data_configurations.SetDimension(Dimension2D); @@ -45,8 +46,6 @@ void TEST_KERNEL_GENERATION_UnivariateMaternNuggetsStationary() { // initialize ExaGeoStat Hardware. auto hardware = ExaGeoStatHardware(EXACT_DENSE, 3, 0); - int seed = 0; - srand(seed); std::unique_ptr> data; exageostat::api::ExaGeoStat::ExaGeoStatLoadData(synthetic_data_configurations, data); auto *CHAM_descriptorZ = data->GetDescriptorData()->GetDescriptor(exageostat::common::CHAMELEON_DESCRIPTOR, diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternStationary.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternStationary.cpp index c74cc623..839f8287 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateMaternStationary.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateMaternStationary.cpp @@ -33,6 +33,7 @@ void TEST_KERNEL_GENERATION_UnivariateMaternStationary() { Configurations synthetic_data_configurations; int N = 9; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateMaternStationary"); synthetic_data_configurations.SetDimension(Dimension2D); @@ -46,8 +47,6 @@ void TEST_KERNEL_GENERATION_UnivariateMaternStationary() { // initialize ExaGeoStat Hardware. auto hardware = ExaGeoStatHardware(EXACT_DENSE, 3, 0); - int seed = 0; - srand(seed); std::unique_ptr> data; exageostat::api::ExaGeoStat::ExaGeoStatLoadData(synthetic_data_configurations, data); diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariatePowExpStationary.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariatePowExpStationary.cpp index e6c65c16..f65939fc 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariatePowExpStationary.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariatePowExpStationary.cpp @@ -33,6 +33,7 @@ void TEST_KERNEL_GENERATION_UnivariatePowExpStationary() { Configurations synthetic_data_configurations; int N = 9; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariatePowExpStationary"); synthetic_data_configurations.SetDimension(Dimension2D); @@ -46,8 +47,6 @@ void TEST_KERNEL_GENERATION_UnivariatePowExpStationary() { // initialize ExaGeoStat Hardware. auto hardware = ExaGeoStatHardware(EXACT_DENSE, 3, 0); - int seed = 0; - srand(seed); std::unique_ptr> data; exageostat::api::ExaGeoStat::ExaGeoStatLoadData(synthetic_data_configurations, data); diff --git a/tests/cpp-tests/kernels/concrete/TestUnivariateSpacetimeMaternStationary.cpp b/tests/cpp-tests/kernels/concrete/TestUnivariateSpacetimeMaternStationary.cpp index 132d726f..cd3bfe58 100644 --- a/tests/cpp-tests/kernels/concrete/TestUnivariateSpacetimeMaternStationary.cpp +++ b/tests/cpp-tests/kernels/concrete/TestUnivariateSpacetimeMaternStationary.cpp @@ -32,6 +32,7 @@ void TEST_KERNEL_GENERATION_UnivariateSpacetimeMaternStationary() { Configurations synthetic_data_configurations; int N = 4; + synthetic_data_configurations.SetSeed(0); synthetic_data_configurations.SetProblemSize(N); synthetic_data_configurations.SetKernelName("UnivariateSpacetimeMaternStationary"); synthetic_data_configurations.SetDimension(exageostat::common::DimensionST); @@ -47,8 +48,6 @@ void TEST_KERNEL_GENERATION_UnivariateSpacetimeMaternStationary() { // initialize ExaGeoStat Hardware. auto hardware = ExaGeoStatHardware(EXACT_DENSE, 3, 0); - int seed = 0; - srand(seed); std::unique_ptr> data; exageostat::api::ExaGeoStat::ExaGeoStatLoadData(synthetic_data_configurations, data); auto *CHAM_descriptorZ = data->GetDescriptorData()->GetDescriptor(exageostat::common::CHAMELEON_DESCRIPTOR,