OGS
LinearSolverLibrarySetup.h
Go to the documentation of this file.
1
11#pragma once
12
21
22#include "BaseLib/MPI.h"
24
25#if defined(USE_PETSC)
26#include <petsc.h>
27#include <mpi.h>
29{
31{
32 LinearSolverLibrarySetup(int argc, char* argv[])
33 {
34 char help[] = "ogs6 with PETSc \n";
35 PetscInitialize(&argc, &argv, nullptr, help);
36 MPI_Comm_set_errhandler(PETSC_COMM_WORLD, MPI_ERRORS_RETURN);
37 }
38
44};
45} // ApplicationsLib
46#elif defined(USE_LIS)
47#include <lis.h>
48namespace ApplicationsLib
49{
50struct LinearSolverLibrarySetup final
51{
52 LinearSolverLibrarySetup(int argc, char* argv[])
53 {
54 lis_initialize(&argc, &argv);
55 }
56
58 {
60 lis_finalize();
61 }
62};
63} // ApplicationsLib
64#else
65namespace ApplicationsLib
66{
67struct LinearSolverLibrarySetup final
68{
69 LinearSolverLibrarySetup(int /*argc*/, char* /*argv*/[])
70 {
71#ifdef _OPENMP
72 const char* omp_num_threads_env = std::getenv("OMP_NUM_THREADS");
73 if (omp_num_threads_env)
74 {
75 INFO("OMP_NUM_THREADS is set to: {:s}", omp_num_threads_env);
76 }
77 else
78 {
79 WARN("OMP_NUM_THREADS is not set, falling back to: {:d}",
80 omp_get_max_threads());
81 }
82#endif
83 INFO("Eigen use {:d} threads", Eigen::nbThreads());
84 }
86 {
88 }
89};
90} // namespace ApplicationsLib
91#endif
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
void cleanupGlobalMatrixProviders()