feat(SpectralSolver): Spectral Solver now works in a limited fashion
Major work on spectral solver, can now evolve up to about a year. At that point we likely need to impliment repartitioning logic to stabalize the network or some other scheme based on the jacobian structure
This commit is contained in:
@@ -20,15 +20,7 @@
|
||||
#include <clocale>
|
||||
|
||||
#include "gridfire/reaction/reaclib.h"
|
||||
#include <omp.h>
|
||||
|
||||
unsigned long get_thread_id() {
|
||||
return static_cast<unsigned long>(omp_get_thread_num());
|
||||
}
|
||||
|
||||
bool in_parallel() {
|
||||
return omp_in_parallel() != 0;
|
||||
}
|
||||
|
||||
static std::terminate_handler g_previousHandler = nullptr;
|
||||
static std::vector<std::pair<double, std::unordered_map<std::string, std::pair<double, double>>>> g_callbackHistory;
|
||||
@@ -294,12 +286,6 @@ int main() {
|
||||
std::println("Total Time for {} runs: {:.6f} seconds", runs, elapsed.count());
|
||||
std::println("Final H-1 Abundances Serial: {}", serial_results[0].composition.getMolarAbundance(fourdst::atomic::H_1));
|
||||
|
||||
CppAD::thread_alloc::parallel_setup(
|
||||
static_cast<size_t>(omp_get_max_threads()), // Max threads
|
||||
[]() -> bool { return in_parallel(); }, // Function to get thread ID
|
||||
[]() -> size_t { return get_thread_id(); } // Function to check parallel state
|
||||
);
|
||||
|
||||
// OPTIONAL: Prevent CppAD from returning memory to the system
|
||||
// during execution to reduce overhead (can speed up tight loops)
|
||||
CppAD::thread_alloc::hold_memory(true);
|
||||
@@ -315,7 +301,6 @@ int main() {
|
||||
|
||||
// Parallel runs
|
||||
startTime = std::chrono::high_resolution_clock::now();
|
||||
#pragma omp parallel for
|
||||
for (size_t i = 0; i < runs; ++i) {
|
||||
auto start_setup_time = std::chrono::high_resolution_clock::now();
|
||||
solver::CVODESolverStrategy solver(construct.engine, *workspaces[i]);
|
||||
|
||||
Reference in New Issue
Block a user