LCOV - code coverage report
Current view: top level - src/base - Capabilities.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 225 230 97.8 %
Date: 2026-05-29 20:35:17 Functions: 18 18 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : // Needs to be included before Capabilities.h, which
      11             : // includes nlohmann/json_fwd.h
      12             : #include "nlohmann/json.h"
      13             : 
      14             : #include "Capabilities.h"
      15             : #include "CapabilityException.h"
      16             : #include "MooseUtils.h"
      17             : #include "Conversion.h"
      18             : 
      19             : #include <vector>
      20             : 
      21             : #include "libmesh/libmesh_config.h"
      22             : #include "petscconf.h"
      23             : #include "petscpkg_version.h"
      24             : 
      25             : #ifdef MOOSE_LIBTORCH_ENABLED
      26             : #include <torch/version.h>
      27             : #endif
      28             : 
      29             : #if __has_include(<torch/xpu.h>)
      30             : #include <torch/xpu.h>
      31             : #define MOOSE_HAVE_XPU 1
      32             : #endif
      33             : 
      34             : #ifdef MOOSE_MFEM_ENABLED
      35             : #include "mfem/config/config.hpp"
      36             : #endif
      37             : 
      38             : #ifdef LIBMESH_HAVE_NETGEN
      39             : #include "netgen/netgen_version.hpp"
      40             : #endif
      41             : 
      42             : namespace Moose::internal
      43             : {
      44             : 
      45       54389 : Capabilities::Capabilities() : CapabilityRegistry()
      46             : {
      47             :   // Register the moose capabilities, just once
      48       54389 :   registerMooseCapabilities();
      49       54389 : }
      50             : 
      51             : Capabilities &
      52      636506 : Capabilities::getCapabilities(const Capabilities::GetCapabilitiesPassKey)
      53             : {
      54             :   // We need a naked new here (_not_ a smart pointer or object instance) due to what seems like a
      55             :   // bug in clang's static object destruction when using dynamic library loading.
      56             :   static Capabilities * capability_registry = nullptr;
      57      636506 :   if (!capability_registry)
      58       54389 :     capability_registry = new Capabilities();
      59      636506 :   return *capability_registry;
      60             : }
      61             : 
      62             : std::string
      63          34 : Capabilities::dump() const
      64             : {
      65          34 :   nlohmann::json root;
      66        1841 :   for (const auto & [name, capability] : _registry)
      67             :   {
      68        1807 :     auto & entry = root[name];
      69        3614 :     std::visit([&entry](const auto & v) { entry["value"] = v; }, capability.getValue());
      70        1807 :     entry["doc"] = capability.getDoc();
      71        1807 :     if (const auto enumeration_ptr = capability.queryEnumeration())
      72        1807 :       entry["enumeration"] = *enumeration_ptr;
      73        1807 :     if (!capability.hasBoolValue())
      74         909 :       entry["explicit"] = capability.getExplicit();
      75             :   }
      76          68 :   return root.dump(2);
      77          34 : }
      78             : 
      79             : void
      80         389 : Capabilities::augment(const nlohmann::json & input, const Capabilities::AugmentPassKey)
      81             : {
      82         828 :   for (const auto & [name_json, entry] : input.items())
      83             :   {
      84         445 :     const std::string name = name_json;
      85             : 
      86           6 :     const auto error = [&name](const std::string & message)
      87           6 :     { throw CapabilityException("Capabilities::augment: Capability '" + name + "' " + message); };
      88             : 
      89         445 :     std::string doc;
      90         445 :     if (const auto it = entry.find("doc"); it != entry.end())
      91         441 :       doc = *it;
      92             :     else
      93           8 :       error("missing 'doc' entry");
      94             : 
      95         441 :     Moose::Capability::Value value;
      96         441 :     if (const auto it = entry.find("value"); it != entry.end())
      97             :     {
      98         439 :       if (it->is_boolean())
      99         124 :         value = it->get<bool>();
     100         315 :       else if (it->is_number_integer())
     101          16 :         value = it->get<int>();
     102             :       else
     103         299 :         value = it->get<std::string>();
     104             :     }
     105             :     else
     106           4 :       error("missing 'value' entry");
     107             : 
     108         439 :     auto & capability = add(name, value, doc);
     109             : 
     110         439 :     if (const auto it = entry.find("explicit"); it != entry.end() && it->get<bool>())
     111         291 :       capability.setExplicit();
     112             : 
     113         439 :     if (const auto it = entry.find("enumeration"); it != entry.end())
     114         283 :       capability.setEnumeration(it->get<std::set<std::string>>());
     115         848 :   }
     116         383 : }
     117             : 
     118             : bool
     119          24 : Capabilities::isInstallationType(const std::string & installation_type) const
     120             : {
     121          48 :   const auto & capability = get("installation_type");
     122             :   mooseAssert(capability.getEnumeration().count(installation_type), "Not a valid enumeration");
     123          24 :   return capability.getStringValue() == installation_type;
     124             : }
     125             : 
     126             : void
     127       54395 : Capabilities::registerMooseCapabilities()
     128             : {
     129             :   // helper lambdas for explicitly adding typed capabilities
     130     1330297 :   const auto add_bool = [&](const std::string_view capability,
     131             :                             const bool value,
     132             :                             const std::string_view doc) -> Capability &
     133     1330297 :   { return add(capability, value, doc); };
     134      108790 :   const auto add_int = [&](const std::string_view capability,
     135             :                            const int value,
     136             :                            const std::string_view doc) -> Capability &
     137      108790 :   { return add(capability, value, doc); };
     138     1117478 :   const auto add_string = [&](const std::string_view capability,
     139             :                               const std::string_view value,
     140             :                               const std::string_view doc) -> Capability &
     141     3352434 :   { return add(capability, std::string(value), doc); };
     142             : 
     143             :   // helper lambdas for adding capabilities
     144      440010 :   const auto have = [&](const std::string & capability, const std::string & doc) -> Capability &
     145      440010 :   { return add_bool(capability, true, doc + " is available."); };
     146      295140 :   const auto missing = [&](const std::string & capability,
     147             :                            const std::string & doc,
     148             :                            const std::string & help = "") -> Capability &
     149      295140 :   { return add_bool(capability, false, doc + " is not available. " + help); };
     150             : 
     151      163185 :   const auto have_version = [&](const std::string & capability,
     152             :                                 const std::string & doc,
     153             :                                 const std::string & version) -> Capability &
     154      163185 :   { return add_string(capability, version, doc + " version " + version + " is available."); };
     155      108790 :   const auto petsc_missing = [&](const std::string & capability,
     156             :                                  const std::string & doc) -> Capability &
     157             :   {
     158      108790 :     return add_bool(
     159      217580 :         capability, false, doc + " is not available. Check your PETSc configure options.");
     160       54395 :   };
     161      377567 :   const auto libmesh_missing = [&](const std::string & capability,
     162             :                                    const std::string & doc,
     163             :                                    const std::string & config_option) -> Capability &
     164             :   {
     165      377567 :     return add_bool(capability,
     166             :                     false,
     167      755134 :                     doc + " is not available. It is controlled by the `" + config_option +
     168      755134 :                         "` libMesh configure option.");
     169       54395 :   };
     170             : 
     171             :   {
     172       54395 :     const auto doc = "LibTorch machine learning and parallel tensor algebra library";
     173             : #ifdef MOOSE_LIBTORCH_ENABLED
     174        1652 :     add_string("libtorch", TORCH_VERSION, doc);
     175             : #else
     176      263715 :     missing("libtorch",
     177             :             doc,
     178             :             "Check "
     179             :             "https://mooseframework.inl.gov/moose/getting_started/installation/"
     180             :             "install_libtorch.html for "
     181             :             "instructions on how to configure and build moose with libTorch.");
     182             : #endif
     183             :   }
     184             : 
     185             :   {
     186       54395 :     const auto doc = "MFEM finite element library";
     187             : #ifdef MOOSE_MFEM_ENABLED
     188       40361 :     add_string("mfem", MFEM_VERSION_STRING, doc);
     189             : #else
     190       70170 :     missing("mfem",
     191             :             doc,
     192             :             "Install mfem using the scripts/update_and_rebuild_mfem.sh script after "
     193             :             "first running scripts/update_and_rebuild_conduit.sh. Finally, configure "
     194             :             "moose with ./configure --with-mfem");
     195             : #endif
     196             :   }
     197             : 
     198             :   {
     199       54395 :     const auto doc = "New Engineering Material model Library, version 2";
     200             : #ifdef NEML2_ENABLED
     201        4956 :     have("neml2", doc);
     202             : #else
     203      263715 :     missing("neml2",
     204             :             doc,
     205             :             "Install neml2 using the scripts/update_and_rebuild_neml2.sh script, then "
     206             :             "configure moose with ./configure --with-neml2 --with-libtorch");
     207             : #endif
     208             :   }
     209             : 
     210             :   {
     211       54395 :     const auto doc = "gperftools code performance analysis and profiling library";
     212             : #ifdef HAVE_GPERFTOOLS
     213             :     have("gperftools", doc);
     214             : #else
     215      271975 :     missing("gperftools",
     216             :             doc,
     217             :             "Check https://mooseframework.inl.gov/application_development/profiling.html "
     218             :             "for instructions on profiling MOOSE based applications.");
     219             : #endif
     220             :   }
     221             : 
     222             :   {
     223       54395 :     const auto doc = "libPNG portable network graphics format library";
     224             : #ifdef MOOSE_HAVE_LIBPNG
     225      163185 :     have("libpng", doc);
     226             : #else
     227             :     missing("libpng",
     228             :             doc,
     229             :             "Install libpng through conda or your distribution and check that it gets "
     230             :             "detected through pkg-config, then reconfigure and rebuild MOOSE.");
     231             : #endif
     232             :   }
     233             : 
     234             :   {
     235       54395 :     const auto doc = "NVIDIA GPU parallel computing platform";
     236             : #ifdef PETSC_HAVE_CUDA
     237             :     const std::string version = QUOTE(PETSC_PKG_CUDA_VERSION_MAJOR) "." QUOTE(
     238        1599 :         PETSC_PKG_CUDA_VERSION_MINOR) "." QUOTE(PETSC_PKG_CUDA_VERSION_SUBMINOR);
     239        1599 :     add_string("cuda", version, doc);
     240             : #else
     241      263980 :     missing("cuda", doc, "Add the CUDA bin directory to your path and rebuild PETSc.");
     242             : #endif
     243        1599 :   }
     244             : 
     245             :   {
     246       54395 :     const auto doc = "Kokkos performance portability programming ecosystem";
     247             : #ifdef MOOSE_KOKKOS_ENABLED
     248             :     const std::string version = QUOTE(PETSC_PKG_KOKKOS_VERSION_MAJOR) "." QUOTE(
     249       40361 :         PETSC_PKG_KOKKOS_VERSION_MINOR) "." QUOTE(PETSC_PKG_KOKKOS_VERSION_SUBMINOR);
     250       40361 :     add_string("kokkos", version, doc);
     251             : #else
     252       70170 :     missing("kokkos",
     253             :             doc,
     254             :             "Rebuild PETSc with Kokkos support and libMesh. Then, reconfigure MOOSE with "
     255             :             "--with-kokkos.");
     256             : #endif
     257       40361 :   }
     258             : 
     259             :   {
     260       54395 :     const auto doc = "Kokkos support for PETSc";
     261             : #ifdef PETSC_HAVE_KOKKOS
     262             :     const std::string version = QUOTE(PETSC_PKG_KOKKOS_VERSION_MAJOR) "." QUOTE(
     263       54395 :         PETSC_PKG_KOKKOS_VERSION_MINOR) "." QUOTE(PETSC_PKG_KOKKOS_VERSION_SUBMINOR);
     264       54395 :     add_string("petsc_kokkos", version, doc);
     265             : #else
     266             :     missing(
     267             :         "petsc_kokkos", doc, "Rebuild PETSc with Kokkos support, then rebuild libMesh and MOOSE.");
     268             : #endif
     269       54395 :   }
     270             : 
     271             :   {
     272       54395 :     const auto doc = "Intel OneAPI XPU accelerator support";
     273             : #ifdef MOOSE_HAVE_XPU
     274        1652 :     if (torch::xpu::is_available())
     275           0 :       have("xpu", doc);
     276             :     else
     277        9912 :       missing("xpu", doc, "No usable XPU devices have been found.");
     278             : #else
     279      263715 :     missing("xpu", doc, "The torch version used to build this app has no XPU support.");
     280             : #endif
     281             :   }
     282             : 
     283       54395 :   add_int(
     284             :       "ad_size",
     285             :       MOOSE_AD_MAX_DOFS_PER_ELEM,
     286      108790 :       "MOOSE was configured and built with a dual number backing store size of " +
     287      217580 :           Moose::stringify(MOOSE_AD_MAX_DOFS_PER_ELEM) +
     288             :           ". Complex simulations with many variables or contact problems may require larger "
     289             :           "values. Reconfigure MOOSE with the --with-derivative-size=<n> option in the root of the "
     290             :           "repository.")
     291       54395 :       .setExplicit();
     292             : 
     293             :   {
     294       54395 :     const std::string method = QUOTE(METHOD);
     295      108790 :     add_string("method", method, "The executable was built with METHOD=\"" + method + "\"")
     296       54395 :         .setExplicit()
     297       54395 :         .setEnumeration({"dbg", "devel", "oprof", "opt"});
     298       54395 :   }
     299             : 
     300             :   {
     301             :     const std::string version = QUOTE(LIBMESH_DETECTED_PETSC_VERSION_MAJOR) "." QUOTE(
     302       54395 :         LIBMESH_DETECTED_PETSC_VERSION_MINOR) "." QUOTE(LIBMESH_DETECTED_PETSC_VERSION_SUBMINOR);
     303       54395 :     add_string("petsc", version, "Using PETSc version " + version + ".");
     304       54395 :   }
     305             : 
     306             : #ifdef LIBMESH_PETSC_USE_DEBUG
     307       54395 :   add_bool("petsc_debug", true, "PETSc was built with debugging options.");
     308             : #else
     309             :   add_bool("petsc_debug", false, "PETSc was built without debugging options.");
     310             : #endif
     311             : 
     312             :   {
     313       54395 :     const auto doc = "SuperLU direct solver";
     314             : #ifdef LIBMESH_PETSC_HAVE_SUPERLU_DIST
     315             :     const std::string version = QUOTE(PETSC_PKG_SUPERLU_DIST_VERSION_MAJOR) "." QUOTE(
     316       54395 :         PETSC_PKG_SUPERLU_DIST_VERSION_MINOR) "." QUOTE(PETSC_PKG_SUPERLU_DIST_VERSION_SUBMINOR);
     317       54395 :     add_string("superlu", version, doc);
     318             : #else
     319             :     petsc_missing("superlu", doc);
     320             : #endif
     321       54395 :   }
     322             : 
     323             :   {
     324       54395 :     const auto doc = "MUltifrontal Massively Parallel sparse direct Solver (MUMPS)";
     325             : #ifdef LIBMESH_PETSC_HAVE_MUMPS
     326             :     const std::string version = QUOTE(PETSC_PKG_MUMPS_VERSION_MAJOR) "." QUOTE(
     327       54395 :         PETSC_PKG_MUMPS_VERSION_MINOR) "." QUOTE(PETSC_PKG_MUMPS_VERSION_SUBMINOR);
     328       54395 :     add_string("mumps", version, doc);
     329             : #else
     330             :     petsc_missing("mumps", doc);
     331             : #endif
     332       54395 :   }
     333             : 
     334             :   {
     335       54395 :     const auto doc = "STRUMPACK - STRUctured Matrix PACKage solver library";
     336             : #ifdef LIBMESH_PETSC_HAVE_STRUMPACK
     337             :     const std::string version = QUOTE(PETSC_PKG_STRUMPACK_VERSION_MAJOR) "." QUOTE(
     338       54395 :         PETSC_PKG_STRUMPACK_VERSION_MINOR) "." QUOTE(PETSC_PKG_STRUMPACK_VERSION_SUBMINOR);
     339       54395 :     add_string("strumpack", version, doc);
     340             : #else
     341             :     petsc_missing("strumpack", doc);
     342             : #endif
     343       54395 :   }
     344             : 
     345             :   {
     346       54395 :     const auto doc = "Parmetis partitioning library";
     347             : #if defined(LIBMESH_PETSC_HAVE_PARMETIS)
     348             :     const std::string version = QUOTE(PETSC_PKG_PARMETIS_VERSION_MAJOR) "." QUOTE(
     349       54395 :         PETSC_PKG_PARMETIS_VERSION_MINOR) "." QUOTE(PETSC_PKG_PARMETIS_VERSION_SUBMINOR);
     350       54395 :     add_string("parmetis", version, doc);
     351             : #elif defined(LIBMESH_HAVE_PARMETIS)
     352             :     have("parmetis", doc);
     353             : #else
     354             :     petsc_missing("parmetis", doc);
     355             : #endif
     356       54395 :   }
     357             : 
     358             :   {
     359       54395 :     const auto doc = "Chaco graph partitioning library";
     360             : #ifdef LIBMESH_PETSC_HAVE_CHACO
     361             :     have("chaco", doc);
     362             : #else
     363      163185 :     petsc_missing("chaco", doc);
     364             : #endif
     365             :   }
     366             : 
     367             :   {
     368       54395 :     const auto doc = "Party matrix or graph partitioning library";
     369             : #ifdef LIBMESH_PETSC_HAVE_PARTY
     370             :     have("party", doc);
     371             : #else
     372      163185 :     petsc_missing("party", doc);
     373             : #endif
     374             :   }
     375             : 
     376             :   {
     377       54395 :     const auto doc = "PT-Scotch graph partitioning library";
     378             : #ifdef LIBMESH_PETSC_HAVE_PTSCOTCH
     379             :     const std::string version = QUOTE(PETSC_PKG_PTSCOTCH_VERSION_MAJOR) "." QUOTE(
     380       54395 :         PETSC_PKG_PTSCOTCH_VERSION_MINOR) "." QUOTE(PETSC_PKG_PTSCOTCH_VERSION_SUBMINOR);
     381       54395 :     add_string("ptscotch", version, doc);
     382             : #else
     383             :     petsc_missing("ptscotch", doc);
     384             : #endif
     385       54395 :   }
     386             : 
     387             :   {
     388       54395 :     const auto doc = "Optimized BLAS library";
     389             : #ifdef PETSC_HAVE_OPENBLAS
     390             :     const std::string version = QUOTE(PETSC_PKG_OPENBLAS_VERSION_MAJOR) "." QUOTE(
     391       54395 :         PETSC_PKG_OPENBLAS_VERSION_MINOR) "." QUOTE(PETSC_PKG_OPENBLAS_VERSION_SUBMINOR);
     392       54395 :     add_string("openblas", version, doc);
     393             : #else
     394             :     petsc_missing("openblas", doc);
     395             : #endif
     396       54395 :   }
     397             : 
     398             :   {
     399       54395 :     const auto doc = "Umpire resource management library";
     400             : #ifdef PETSC_HAVE_UMPIRE
     401      163185 :     have("umpire", doc);
     402             : #else
     403             :     petsc_missing("umpire", doc);
     404             : #endif
     405             :   }
     406             : 
     407             :   {
     408       54395 :     const auto doc = "Scalable Library for Eigenvalue Problem Computations (SLEPc)";
     409             : #ifdef LIBMESH_HAVE_SLEPC
     410       54395 :     const auto version = QUOTE(LIBMESH_DETECTED_SLEPC_VERSION_MAJOR) "." QUOTE(
     411             :         LIBMESH_DETECTED_SLEPC_VERSION_MINOR) "." QUOTE(LIBMESH_DETECTED_SLEPC_VERSION_SUBMINOR);
     412      271975 :     have_version("slepc", doc, version);
     413             : #else
     414             :     petsc_missing("slepc", doc);
     415             : #endif
     416             :   }
     417             : 
     418             :   {
     419       54395 :     const auto doc = "Exodus mesh file format library";
     420             : #ifdef LIBMESH_HAVE_EXODUS_API
     421      108790 :     const std::string version = QUOTE(LIBMESH_DETECTED_EXODUS_VERSION_MAJOR) "." QUOTE(
     422             :         LIBMESH_DETECTED_EXODUS_VERSION_MINOR);
     423      163185 :     have_version("exodus", doc, version);
     424             : #else
     425             :     libmesh_missing("exodus", doc, "--enable-exodus");
     426             : #endif
     427       54395 :   }
     428             : 
     429             :   {
     430       54395 :     const auto doc = "Netgen meshing library";
     431             : #ifdef LIBMESH_HAVE_NETGEN
     432             :     const std::string version =
     433       54395 :         QUOTE(NETGEN_VERSION_MAJOR) "." QUOTE(NETGEN_VERSION_MINOR) "." QUOTE(NETGEN_VERSION_PATCH);
     434       54395 :     add_string("netgen", version, doc);
     435             : #else
     436             :     libmesh_missing("netgen", doc, "--enable-netgen");
     437             : #endif
     438       54395 :   }
     439             : 
     440             :   {
     441       54395 :     const auto doc = "Visualization Toolkit (VTK)";
     442             : #ifdef LIBMESH_HAVE_VTK
     443             :     const std::string version = QUOTE(LIBMESH_DETECTED_VTK_VERSION_MAJOR) "." QUOTE(
     444      108790 :         LIBMESH_DETECTED_VTK_VERSION_MINOR) "." QUOTE(LIBMESH_DETECTED_VTK_VERSION_SUBMINOR);
     445      163185 :     have_version("vtk", doc, version);
     446             : #else
     447             :     libmesh_missing("vtk", doc, "--disable-vtk and --enable-vtk-required");
     448             : #endif
     449       54395 :   }
     450             : 
     451             :   {
     452       54395 :     const auto doc = "libcurl - the multiprotocol file transfer library";
     453             : #ifdef LIBMESH_HAVE_CURL
     454             :     have("curl", doc);
     455             : #else
     456      271975 :     libmesh_missing("curl", doc, "--enable-curl");
     457             : #endif
     458             :   }
     459             : 
     460             :   {
     461       54395 :     const auto doc = "Tecplot post-processing tools API";
     462             : #ifdef LIBMESH_HAVE_TECPLOT_API
     463             :     have("tecplot", doc);
     464             : #else
     465      271975 :     libmesh_missing("tecplot", doc, "--enable-tecplot");
     466             : #endif
     467             :   }
     468             : 
     469             :   {
     470       54395 :     const auto doc = "NVIDIA Tools Extension Library API";
     471             : #ifdef LIBMESH_HAVE_NVTX_API
     472        4797 :     have("nvtx_api", doc);
     473             : #else
     474      263980 :     libmesh_missing("nvtx_api", doc, "--with-nvtx");
     475             : #endif
     476             :   }
     477             : 
     478             :   {
     479       54395 :     const auto doc = "libMesh performance logging";
     480             : #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
     481        4797 :     have("libmesh_perflog", doc);
     482             : #else
     483      263980 :     libmesh_missing("libmesh_perflog", doc, "--enable-perflog");
     484             : #endif
     485             :   }
     486             : 
     487             :   {
     488       54395 :     const auto doc = "Boost C++ library";
     489             : #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
     490             :     have("boost", doc);
     491             : #else
     492      271975 :     libmesh_missing("boost", doc, "--with-boost");
     493             : #endif
     494             :   }
     495             : 
     496             :   // libmesh stuff
     497             :   {
     498       54395 :     const auto doc = "Adaptive mesh refinement";
     499             : #ifdef LIBMESH_ENABLE_AMR
     500      163185 :     have("amr", doc);
     501             : #else
     502             :     libmesh_missing("amr", doc, "--disable-amr");
     503             : #endif
     504             :   }
     505             : 
     506             :   {
     507       54395 :     const auto doc = "nanoflann library for Nearest Neighbor (NN) search with KD-trees";
     508             : #ifdef LIBMESH_HAVE_NANOFLANN
     509      163185 :     have("nanoflann", doc);
     510             : #else
     511             :     libmesh_missing("nanoflann", doc, "--disable-nanoflann");
     512             : #endif
     513             :   }
     514             : 
     515             :   {
     516       54395 :     const auto doc = "sfcurves library for space filling curves (required by geometric "
     517             :                      "partitioners such as SFCurves, Hilbert and Morton -  not LGPL compatible)";
     518             : #ifdef LIBMESH_HAVE_SFCURVES
     519             :     have("sfcurves", doc);
     520             : #else
     521      271975 :     libmesh_missing("sfcurves", doc, "--disable-sfc");
     522             : #endif
     523             :   }
     524             : 
     525             :   {
     526             : #ifdef LIBMESH_HAVE_FPARSER
     527             : #ifdef LIBMESH_HAVE_FPARSER_JIT
     528       54395 :     const auto value = "jit";
     529       54395 :     const auto doc = "FParser enabled with just in time compilation support.";
     530             : #else
     531             :     const auto value = "byte_code";
     532             :     const auto doc = "FParser enabled.";
     533             : #endif
     534       54395 :     add_string("fparser", value, doc);
     535             : #else
     536             :     add_bool("fparser",
     537             :              false,
     538             :              "FParser is disabled, libMesh was likely configured with --disable-fparser.");
     539             : #endif
     540             :   }
     541             : 
     542             : #ifdef LIBMESH_HAVE_DLOPEN
     543       54395 :   add_bool("dlopen", true, "The dlopen() system call is available to dynamically load libraries.");
     544             : #else
     545             :   add_bool("dlopen",
     546             :            false,
     547             :            "The dlopen() system call is not available. Dynamic library loading is "
     548             :            "not supported on this system.");
     549             : #endif
     550             : 
     551             :   {
     552       54395 :     const auto doc = "LibMesh support for threaded execution";
     553             : #ifdef LIBMESH_USING_THREADS
     554      163185 :     have("threads", doc);
     555             : #else
     556             :     libmesh_missing("threads", doc, "--with-thread-model=tbb,pthread,openmp,auto,none");
     557             : #endif
     558             :   }
     559             : 
     560             :   {
     561       54395 :     const auto doc = "OpenMP multi-platform shared-memory parallel programming API";
     562             : #ifdef LIBMESH_HAVE_OPENMP
     563      163185 :     have("openmp", doc);
     564             : #else
     565             :     libmesh_missing("openmp", doc, "--with-thread-model=tbb,pthread,openmp,auto,none");
     566             : #endif
     567             :   }
     568             :   {
     569       54395 :     const auto doc = "POSIX Threads API";
     570             : #ifdef LIBMESH_HAVE_PTHREAD
     571      163185 :     have("pthread", doc);
     572             : #else
     573             :     libmesh_missing("pthread", doc, "--with-thread-model=tbb,pthread,openmp,auto,none");
     574             : #endif
     575             :   }
     576             :   {
     577       54395 :     const auto doc = "oneAPI Threading Building Blocks (TBB) API";
     578             : #ifdef LIBMESH_HAVE_TBB_API
     579             :     have("tbb", doc);
     580             : #else
     581      271975 :     libmesh_missing("tbb", doc, "--with-thread-model=tbb,pthread,openmp,auto,none");
     582             : #endif
     583             :   }
     584             : 
     585             :   {
     586       54395 :     const auto doc = "libMesh unique ID support";
     587             : #ifdef LIBMESH_ENABLE_UNIQUE_ID
     588      163185 :     have("unique_id", doc);
     589             : #else
     590             :     libmesh_missing("unique_id", doc, "--enable-unique-id");
     591             : #endif
     592             :   }
     593             : 
     594             :   {
     595             : #ifdef LIBMESH_ENABLE_PARMESH
     596             :     const auto value = "distributed";
     597             : #else
     598       54395 :     const auto value = "replicated";
     599             : #endif
     600       54395 :     add_string("mesh_mode", value, "libMesh default mesh mode")
     601       54395 :         .setExplicit()
     602       54395 :         .setEnumeration({"distributed", "replicated"});
     603             :   }
     604             : 
     605       54395 :   add_int("dof_id_bytes",
     606             :           static_cast<int>(sizeof(dof_id_type)),
     607      108790 :           "Degree of freedom (DOF) identifiers use " + Moose::stringify(sizeof(dof_id_type)) +
     608             :               " bytes for storage. This is controlled by the "
     609             :               "--with-dof-id-bytes=<1|2|4|8> libMesh configure option.")
     610       54395 :       .setExplicit();
     611             : 
     612             :   {
     613             : #ifdef LIBMESH_HAVE_STATIC_LIBS
     614             :     const auto value = "static";
     615             : #else
     616       54395 :     const auto value = "dynamic";
     617             : #endif
     618       54395 :     add_string("library_mode",
     619             :                value,
     620             :                "The libMesh library mode. This is controlled by the --enable-static libMesh "
     621             :                "configure option.")
     622       54395 :         .setExplicit()
     623       54395 :         .setEnumeration({"dynamic", "static"});
     624             :   }
     625             : 
     626             :   // compiler
     627             :   {
     628       54395 :     const auto doc = "Compiler used to build the MOOSE framework.";
     629             : #if defined(__INTEL_LLVM_COMPILER)
     630             :     const auto value = "intel";
     631             : #elif defined(__clang__)
     632             :     const auto value = "clang";
     633             : #elif defined(__GNUC__) || defined(__GNUG__)
     634       54395 :     const auto value = "gcc";
     635             : #elif defined(_MSC_VER)
     636             :     const auto value = "msvc";
     637             : #else
     638             :     mooseDoOnce(mooseWarning("Failed to determine compiler; setting capability compiler=unknown"));
     639             :     const auto value = "unknown";
     640             : #endif
     641       54395 :     add_string("compiler", value, doc)
     642       54395 :         .setExplicit()
     643       54395 :         .setEnumeration({"clang", "gcc", "intel", "msvc", "unknown"});
     644             :   }
     645             : 
     646             :   // OS related
     647             :   {
     648             : #ifdef __APPLE__
     649             :     const auto value = "darwin";
     650             : #elif __WIN32__
     651             :     const auto value = "win32";
     652             : #elif __linux__
     653       54395 :     const auto value = "linux";
     654             : #elif __unix__
     655             :     const auto value = "unix";
     656             : #else
     657             :     mooseDoOnce(mooseWarning("Failed to determine platform; setting capability platform=unknown"));
     658             :     const auto value = "unknown";
     659             : #endif
     660       54395 :     add_string("platform", value, "Operating system this executable is running on.")
     661       54395 :         .setExplicit()
     662       54395 :         .setEnumeration({"darwin", "linux", "unix", "unknown", "win32"});
     663             :   }
     664             : 
     665             :   // Installation type (in tree or installed)
     666             :   {
     667             :     // Try to find the path to the running executable
     668       54395 :     std::optional<std::string> executable_path;
     669             :     {
     670       54395 :       Moose::ScopedThrowOnError scoped_throw_on_error;
     671             :       try
     672             :       {
     673       54395 :         executable_path = Moose::getExec();
     674             :       }
     675           0 :       catch (const MooseException &)
     676             :       {
     677           0 :       }
     678       54395 :     }
     679             : 
     680       54395 :     std::string value = "unknown";
     681             : 
     682       54395 :     if (executable_path)
     683             :     {
     684             :       // Try to follow all symlinks to get the real path
     685       54395 :       std::error_code ec;
     686             :       const auto resolved_path =
     687       54395 :           std::filesystem::weakly_canonical(std::filesystem::path(*executable_path), ec);
     688       54395 :       if (ec)
     689           0 :         mooseDoOnce(mooseWarning("Failed to resolve executable path '",
     690             :                                  *executable_path,
     691             :                                  "':\n",
     692             :                                  ec.message(),
     693             :                                  "\n\nSetting capability installation_type=unknown"));
     694             :       else
     695             :       {
     696             :         // If the binary is in a folder "bin", we'll consider it installed.
     697             :         // This isn't the best check, but it works with how we currently
     698             :         // install applications in app.mk
     699       54395 :         value = resolved_path.parent_path().filename() == "bin" ? "relocated" : "in_tree";
     700             :       }
     701       54395 :     }
     702             :     else
     703           0 :       mooseDoOnce(mooseWarning(
     704             :           "Failed to determine executable path; setting capability installation_type=unknown"));
     705             : 
     706       54395 :     add_string("installation_type", value, "The installation type of the application.")
     707       54395 :         .setExplicit()
     708       54395 :         .setEnumeration({"in_tree", "relocated", "unknown"});
     709             : 
     710             :     mooseAssert(isInstallationType(value), "Value mismatch");
     711       54395 :   }
     712       54395 : }
     713             : 
     714             : } // namespace Moose

Generated by: LCOV version 1.14