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[]) : mpi_setup(argc, 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
46};
47} // ApplicationsLib
48#elif defined(USE_LIS)
49#include <lis.h>
50namespace ApplicationsLib
51{
52struct LinearSolverLibrarySetup final
53{
54 LinearSolverLibrarySetup(int argc, char* argv[])
55 {
56 lis_initialize(&argc, &argv);
57 }
58
60 {
62 lis_finalize();
63 }
64};
65} // ApplicationsLib
66#else
67namespace ApplicationsLib
68{
69struct LinearSolverLibrarySetup final
70{
71 LinearSolverLibrarySetup(int /*argc*/, char* /*argv*/[])
72 {
73#ifdef _OPENMP
74 const char* omp_num_threads_env = std::getenv("OMP_NUM_THREADS");
75 if (omp_num_threads_env)
76 {
77 INFO("OMP_NUM_THREADS is set to: {:s}", omp_num_threads_env);
78 }
79 else
80 {
81 WARN("OMP_NUM_THREADS is not set, falling back to: {:d}",
82 omp_get_max_threads());
83 }
84#endif
85 INFO("Eigen use {:d} threads", Eigen::nbThreads());
86 }
88 {
90 }
91};
92} // namespace ApplicationsLib
93#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()