Register the MOOSE capabilities.
Called during the construction of the registry.
128{
129
130 const auto add_bool = [&](const std::string_view capability,
132 const std::string_view doc) -> Capability &
133 {
return add(capability, value, doc); };
134 const auto add_int = [&](const std::string_view capability,
136 const std::string_view doc) -> Capability &
137 {
return add(capability, value, doc); };
138 const auto add_string = [&](const std::string_view capability,
139 const std::string_view
value,
140 const std::string_view doc) -> Capability &
141 {
return add(capability, std::string(value), doc); };
142
143
144 const auto have = [&](const std::string & capability, const std::string & doc) -> Capability &
145 { return add_bool(capability, true, doc + " is available."); };
146 const auto missing = [&](const std::string & capability,
147 const std::string & doc,
148 const std::string &
help =
"") -> Capability &
149 {
return add_bool(capability,
false, doc +
" is not available. " +
help); };
150
151 const auto have_version = [&](const std::string & capability,
152 const std::string & doc,
153 const std::string & version) -> Capability &
154 { return add_string(capability, version, doc + " version " + version + " is available."); };
155 const auto petsc_missing = [&](const std::string & capability,
156 const std::string & doc) -> Capability &
157 {
158 return add_bool(
159 capability, false, doc + " is not available. Check your PETSc configure options.");
160 };
161 const auto libmesh_missing = [&](const std::string & capability,
162 const std::string & doc,
163 const std::string & config_option) -> Capability &
164 {
165 return add_bool(capability,
166 false,
167 doc + " is not available. It is controlled by the `" + config_option +
168 "` libMesh configure option.");
169 };
170
171 {
172 const auto doc = "LibTorch machine learning and parallel tensor algebra library";
173#ifdef MOOSE_LIBTORCH_ENABLED
174 add_string("libtorch", TORCH_VERSION, doc);
175#else
176 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 const auto doc = "MFEM finite element library";
187#ifdef MOOSE_MFEM_ENABLED
188 add_string("mfem", MFEM_VERSION_STRING, doc);
189#else
190 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 const auto doc = "New Engineering Material model Library, version 3";
200#ifdef NEML2_ENABLED
201 have("neml2", doc);
202#else
203 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 const auto doc = "Embedded CPython interpreter linked into the executable (host "
212 "libpython), enabling the NEML2 eager runtime and other "
213 "embedded-Python features";
214#ifdef NEML2_ENABLED
215 have("embedded_python", doc);
216#else
217 missing("embedded_python",
218 doc,
219 "Configure moose with ./configure --with-neml2 --with-libtorch, which links "
220 "libpython into the executable.");
221#endif
222 }
223
224 {
225 const auto doc = "gperftools code performance analysis and profiling library";
226#ifdef HAVE_GPERFTOOLS
227 have("gperftools", doc);
228#else
229 missing("gperftools",
230 doc,
231 "Check https://mooseframework.inl.gov/application_development/profiling.html "
232 "for instructions on profiling MOOSE based applications.");
233#endif
234 }
235
236 {
237 const auto doc = "libPNG portable network graphics format library";
238#ifdef MOOSE_HAVE_LIBPNG
239 have("libpng", doc);
240#else
241 missing("libpng",
242 doc,
243 "Install libpng through conda or your distribution and check that it gets "
244 "detected through pkg-config, then reconfigure and rebuild MOOSE.");
245#endif
246 }
247
248 {
249 const auto doc = "NVIDIA GPU parallel computing platform";
250#ifdef PETSC_HAVE_CUDA
251 const std::string version = QUOTE(PETSC_PKG_CUDA_VERSION_MAJOR) "." QUOTE(
252 PETSC_PKG_CUDA_VERSION_MINOR) "." QUOTE(PETSC_PKG_CUDA_VERSION_SUBMINOR);
253 add_string("cuda", version, doc);
254#else
255 missing("cuda", doc, "Add the CUDA bin directory to your path and rebuild PETSc.");
256#endif
257 }
258
259 {
260 const auto doc = "AMD GPU parallel computing platform";
261#ifdef PETSC_HAVE_HIPROCM
262 const std::string version = QUOTE(PETSC_PKG_HIP_VERSION_MAJOR) "." QUOTE(
263 PETSC_PKG_HIP_VERSION_MINOR) "." QUOTE(PETSC_PKG_HIP_VERSION_SUBMINOR);
264 add_string("hip", version, doc);
265#else
266 missing("hip", doc, "Add the HIP bin directory to your path and rebuild PETSc.");
267#endif
268 }
269
270 {
271 const auto doc = "Intel GPU parallel computing platform";
272#ifdef PETSC_HAVE_SYCL
273 const std::string version = QUOTE(PETSC_PKG_SYCL_VERSION_MAJOR) "." QUOTE(
274 PETSC_PKG_SYCL_VERSION_MINOR) "." QUOTE(PETSC_PKG_SYCL_VERSION_SUBMINOR);
275 add_string("sycl", version, doc);
276#else
277 missing("sycl", doc, "Add the SYCL bin directory to your path and rebuild PETSc.");
278#endif
279 }
280
281 {
282 const auto doc = "Kokkos performance portability programming ecosystem";
283#ifdef MOOSE_KOKKOS_ENABLED
284 const std::string version = QUOTE(PETSC_PKG_KOKKOS_VERSION_MAJOR) "." QUOTE(
285 PETSC_PKG_KOKKOS_VERSION_MINOR) "." QUOTE(PETSC_PKG_KOKKOS_VERSION_SUBMINOR);
286 add_string("kokkos", version, doc);
287#else
288 missing("kokkos",
289 doc,
290 "Rebuild PETSc with Kokkos support and libMesh. Then, reconfigure MOOSE with "
291 "--with-kokkos.");
292#endif
293 }
294
295 {
296 const auto doc = "Kokkos support for PETSc";
297#ifdef PETSC_HAVE_KOKKOS
298 const std::string version = QUOTE(PETSC_PKG_KOKKOS_VERSION_MAJOR) "." QUOTE(
299 PETSC_PKG_KOKKOS_VERSION_MINOR) "." QUOTE(PETSC_PKG_KOKKOS_VERSION_SUBMINOR);
300 add_string("petsc_kokkos", version, doc);
301#else
302 missing(
303 "petsc_kokkos", doc, "Rebuild PETSc with Kokkos support, then rebuild libMesh and MOOSE.");
304#endif
305 }
306
307 {
308 const auto doc = "Intel OneAPI XPU accelerator support";
309#ifdef MOOSE_HAVE_XPU
310 if (torch::xpu::is_available())
311 have("xpu", doc);
312 else
313 missing("xpu", doc, "No usable XPU devices have been found.");
314#else
315 missing("xpu", doc, "The torch version used to build this app has no XPU support.");
316#endif
317 }
318
319 add_int(
320 "ad_size",
321 MOOSE_AD_MAX_DOFS_PER_ELEM,
322 "MOOSE was configured and built with a dual number backing store size of " +
324 ". Complex simulations with many variables or contact problems may require larger "
325 "values. Reconfigure MOOSE with the --with-derivative-size=<n> option in the root of the "
326 "repository.")
327 .setExplicit();
328
329 {
330 const std::string method = QUOTE(METHOD);
331 add_string("method", method, "The executable was built with METHOD=\"" + method + "\"")
332 .setExplicit()
333 .setEnumeration({"dbg", "devel", "oprof", "opt"});
334 }
335
336 {
337 const std::string version = QUOTE(LIBMESH_DETECTED_PETSC_VERSION_MAJOR) "." QUOTE(
338 LIBMESH_DETECTED_PETSC_VERSION_MINOR) "." QUOTE(LIBMESH_DETECTED_PETSC_VERSION_SUBMINOR);
339 add_string("petsc", version, "Using PETSc version " + version + ".");
340 }
341
342#ifdef LIBMESH_PETSC_USE_DEBUG
343 add_bool("petsc_debug", true, "PETSc was built with debugging options.");
344#else
345 add_bool("petsc_debug", false, "PETSc was built without debugging options.");
346#endif
347
348 {
349 const auto doc = "SuperLU direct solver";
350#ifdef LIBMESH_PETSC_HAVE_SUPERLU_DIST
351 const std::string version = QUOTE(PETSC_PKG_SUPERLU_DIST_VERSION_MAJOR) "." QUOTE(
352 PETSC_PKG_SUPERLU_DIST_VERSION_MINOR) "." QUOTE(PETSC_PKG_SUPERLU_DIST_VERSION_SUBMINOR);
353 add_string("superlu", version, doc);
354#else
355 petsc_missing("superlu", doc);
356#endif
357 }
358
359 {
360 const auto doc = "MUltifrontal Massively Parallel sparse direct Solver (MUMPS)";
361#ifdef LIBMESH_PETSC_HAVE_MUMPS
362 const std::string version = QUOTE(PETSC_PKG_MUMPS_VERSION_MAJOR) "." QUOTE(
363 PETSC_PKG_MUMPS_VERSION_MINOR) "." QUOTE(PETSC_PKG_MUMPS_VERSION_SUBMINOR);
364 add_string("mumps", version, doc);
365#else
366 petsc_missing("mumps", doc);
367#endif
368 }
369
370 {
371 const auto doc = "STRUMPACK - STRUctured Matrix PACKage solver library";
372#ifdef LIBMESH_PETSC_HAVE_STRUMPACK
373 const std::string version = QUOTE(PETSC_PKG_STRUMPACK_VERSION_MAJOR) "." QUOTE(
374 PETSC_PKG_STRUMPACK_VERSION_MINOR) "." QUOTE(PETSC_PKG_STRUMPACK_VERSION_SUBMINOR);
375 add_string("strumpack", version, doc);
376#else
377 petsc_missing("strumpack", doc);
378#endif
379 }
380
381 {
382 const auto doc = "Parmetis partitioning library";
383#if defined(LIBMESH_PETSC_HAVE_PARMETIS)
384 const std::string version = QUOTE(PETSC_PKG_PARMETIS_VERSION_MAJOR) "." QUOTE(
385 PETSC_PKG_PARMETIS_VERSION_MINOR) "." QUOTE(PETSC_PKG_PARMETIS_VERSION_SUBMINOR);
386 add_string("parmetis", version, doc);
387#elif defined(LIBMESH_HAVE_PARMETIS)
388 have("parmetis", doc);
389#else
390 petsc_missing("parmetis", doc);
391#endif
392 }
393
394 {
395 const auto doc = "Chaco graph partitioning library";
396#ifdef LIBMESH_PETSC_HAVE_CHACO
397 have("chaco", doc);
398#else
399 petsc_missing("chaco", doc);
400#endif
401 }
402
403 {
404 const auto doc = "Party matrix or graph partitioning library";
405#ifdef LIBMESH_PETSC_HAVE_PARTY
406 have("party", doc);
407#else
408 petsc_missing("party", doc);
409#endif
410 }
411
412 {
413 const auto doc = "PT-Scotch graph partitioning library";
414#ifdef LIBMESH_PETSC_HAVE_PTSCOTCH
415 const std::string version = QUOTE(PETSC_PKG_PTSCOTCH_VERSION_MAJOR) "." QUOTE(
416 PETSC_PKG_PTSCOTCH_VERSION_MINOR) "." QUOTE(PETSC_PKG_PTSCOTCH_VERSION_SUBMINOR);
417 add_string("ptscotch", version, doc);
418#else
419 petsc_missing("ptscotch", doc);
420#endif
421 }
422
423 {
424 const auto doc = "Optimized BLAS library";
425#ifdef PETSC_HAVE_OPENBLAS
426 const std::string version = QUOTE(PETSC_PKG_OPENBLAS_VERSION_MAJOR) "." QUOTE(
427 PETSC_PKG_OPENBLAS_VERSION_MINOR) "." QUOTE(PETSC_PKG_OPENBLAS_VERSION_SUBMINOR);
428 add_string("openblas", version, doc);
429#else
430 petsc_missing("openblas", doc);
431#endif
432 }
433
434 {
435 const auto doc = "Umpire resource management library";
436#ifdef PETSC_HAVE_UMPIRE
437 have("umpire", doc);
438#else
439 petsc_missing("umpire", doc);
440#endif
441 }
442
443 {
444 const auto doc = "Scalable Library for Eigenvalue Problem Computations (SLEPc)";
445#ifdef LIBMESH_HAVE_SLEPC
446 const auto version = QUOTE(LIBMESH_DETECTED_SLEPC_VERSION_MAJOR) "." QUOTE(
447 LIBMESH_DETECTED_SLEPC_VERSION_MINOR) "." QUOTE(LIBMESH_DETECTED_SLEPC_VERSION_SUBMINOR);
448 have_version("slepc", doc, version);
449#else
450 petsc_missing("slepc", doc);
451#endif
452 }
453
454 {
455 const auto doc = "Exodus mesh file format library";
456#ifdef LIBMESH_HAVE_EXODUS_API
457 const std::string version = QUOTE(LIBMESH_DETECTED_EXODUS_VERSION_MAJOR) "." QUOTE(
458 LIBMESH_DETECTED_EXODUS_VERSION_MINOR);
459 have_version("exodus", doc, version);
460#else
461 libmesh_missing("exodus", doc, "--enable-exodus");
462#endif
463 }
464
465 {
466 const auto doc = "Netgen meshing library";
467#ifdef LIBMESH_HAVE_NETGEN
468 const std::string version =
469 QUOTE(NETGEN_VERSION_MAJOR) "." QUOTE(NETGEN_VERSION_MINOR) "." QUOTE(NETGEN_VERSION_PATCH);
470 add_string("netgen", version, doc);
471#else
472 libmesh_missing("netgen", doc, "--enable-netgen");
473#endif
474 }
475
476 {
477 const auto doc = "Visualization Toolkit (VTK)";
478#ifdef LIBMESH_HAVE_VTK
479 const std::string version = QUOTE(LIBMESH_DETECTED_VTK_VERSION_MAJOR) "." QUOTE(
480 LIBMESH_DETECTED_VTK_VERSION_MINOR) "." QUOTE(LIBMESH_DETECTED_VTK_VERSION_SUBMINOR);
481 have_version("vtk", doc, version);
482#else
483 libmesh_missing("vtk", doc, "--disable-vtk and --enable-vtk-required");
484#endif
485 }
486
487 {
488 const auto doc = "libcurl - the multiprotocol file transfer library";
489#ifdef LIBMESH_HAVE_CURL
490 have("curl", doc);
491#else
492 libmesh_missing("curl", doc, "--enable-curl");
493#endif
494 }
495
496 {
497 const auto doc = "Tecplot post-processing tools API";
498#ifdef LIBMESH_HAVE_TECPLOT_API
499 have("tecplot", doc);
500#else
501 libmesh_missing("tecplot", doc, "--enable-tecplot");
502#endif
503 }
504
505 {
506 const auto doc = "NVIDIA Tools Extension Library API";
507#ifdef LIBMESH_HAVE_NVTX_API
508 have("nvtx_api", doc);
509#else
510 libmesh_missing("nvtx_api", doc, "--with-nvtx");
511#endif
512 }
513
514 {
515 const auto doc = "libMesh performance logging";
516#ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
517 have("libmesh_perflog", doc);
518#else
519 libmesh_missing("libmesh_perflog", doc, "--enable-perflog");
520#endif
521 }
522
523 {
524 const auto doc = "Boost C++ library";
525#ifdef LIBMESH_HAVE_EXTERNAL_BOOST
526 have("boost", doc);
527#else
528 libmesh_missing("boost", doc, "--with-boost");
529#endif
530 }
531
532
533 {
534 const auto doc = "Adaptive mesh refinement";
535#ifdef LIBMESH_ENABLE_AMR
536 have("amr", doc);
537#else
538 libmesh_missing("amr", doc, "--disable-amr");
539#endif
540 }
541
542 {
543 const auto doc = "nanoflann library for Nearest Neighbor (NN) search with KD-trees";
544#ifdef LIBMESH_HAVE_NANOFLANN
545 have("nanoflann", doc);
546#else
547 libmesh_missing("nanoflann", doc, "--disable-nanoflann");
548#endif
549 }
550
551 {
552 const auto doc = "sfcurves library for space filling curves (required by geometric "
553 "partitioners such as SFCurves, Hilbert and Morton - not LGPL compatible)";
554#ifdef LIBMESH_HAVE_SFCURVES
555 have("sfcurves", doc);
556#else
557 libmesh_missing("sfcurves", doc, "--disable-sfc");
558#endif
559 }
560
561 {
562#ifdef LIBMESH_HAVE_FPARSER
563#ifdef LIBMESH_HAVE_FPARSER_JIT
564 const auto value =
"jit";
565 const auto doc = "FParser enabled with just in time compilation support.";
566#else
567 const auto value =
"byte_code";
568 const auto doc = "FParser enabled.";
569#endif
570 add_string("fparser", value, doc);
571#else
572 add_bool("fparser",
573 false,
574 "FParser is disabled, libMesh was likely configured with --disable-fparser.");
575#endif
576 }
577
578#ifdef LIBMESH_HAVE_DLOPEN
579 add_bool("dlopen", true, "The dlopen() system call is available to dynamically load libraries.");
580#else
581 add_bool("dlopen",
582 false,
583 "The dlopen() system call is not available. Dynamic library loading is "
584 "not supported on this system.");
585#endif
586
587 {
588 const auto doc = "LibMesh support for threaded execution";
589#ifdef LIBMESH_USING_THREADS
590 have("threads", doc);
591#else
592 libmesh_missing("threads", doc, "--with-thread-model=tbb,pthread,openmp,auto,none");
593#endif
594 }
595
596 {
597 const auto doc = "OpenMP multi-platform shared-memory parallel programming API";
598#ifdef LIBMESH_HAVE_OPENMP
599 have("openmp", doc);
600#else
601 libmesh_missing("openmp", doc, "--with-thread-model=tbb,pthread,openmp,auto,none");
602#endif
603 }
604 {
605 const auto doc = "POSIX Threads API";
606#ifdef LIBMESH_HAVE_PTHREAD
607 have("pthread", doc);
608#else
609 libmesh_missing("pthread", doc, "--with-thread-model=tbb,pthread,openmp,auto,none");
610#endif
611 }
612 {
613 const auto doc = "oneAPI Threading Building Blocks (TBB) API";
614#ifdef LIBMESH_HAVE_TBB_API
615 have("tbb", doc);
616#else
617 libmesh_missing("tbb", doc, "--with-thread-model=tbb,pthread,openmp,auto,none");
618#endif
619 }
620
621 {
622 const auto doc = "libMesh unique ID support";
623#ifdef LIBMESH_ENABLE_UNIQUE_ID
624 have("unique_id", doc);
625#else
626 libmesh_missing("unique_id", doc, "--enable-unique-id");
627#endif
628 }
629
630 {
631#ifdef LIBMESH_ENABLE_PARMESH
632 const auto value =
"distributed";
633#else
634 const auto value =
"replicated";
635#endif
636 add_string("mesh_mode", value, "libMesh default mesh mode")
637 .setExplicit()
638 .setEnumeration({"distributed", "replicated"});
639 }
640
641 add_int("dof_id_bytes",
642 static_cast<int>(sizeof(dof_id_type)),
643 "Degree of freedom (DOF) identifiers use " +
Moose::stringify(
sizeof(dof_id_type)) +
644 " bytes for storage. This is controlled by the "
645 "--with-dof-id-bytes=<1|2|4|8> libMesh configure option.")
646 .setExplicit();
647
648 {
649#ifdef LIBMESH_HAVE_STATIC_LIBS
650 const auto value =
"static";
651#else
652 const auto value =
"dynamic";
653#endif
654 add_string("library_mode",
655 value,
656 "The libMesh library mode. This is controlled by the --enable-static libMesh "
657 "configure option.")
658 .setExplicit()
659 .setEnumeration({"dynamic", "static"});
660 }
661
662
663 {
664 const auto doc = "Compiler used to build the MOOSE framework.";
665#if defined(__INTEL_LLVM_COMPILER)
666 const auto value =
"intel";
667#elif defined(__clang__)
668 const auto value =
"clang";
669#elif defined(__GNUC__) || defined(__GNUG__)
670 const auto value =
"gcc";
671#elif defined(_MSC_VER)
672 const auto value =
"msvc";
673#else
674 mooseDoOnce(
mooseWarning(
"Failed to determine compiler; setting capability compiler=unknown"));
675 const auto value =
"unknown";
676#endif
677 add_string("compiler", value, doc)
678 .setExplicit()
679 .setEnumeration({"clang", "gcc", "intel", "msvc", "unknown"});
680 }
681
682
683 {
684#ifdef __APPLE__
685 const auto value =
"darwin";
686#elif __WIN32__
687 const auto value =
"win32";
688#elif __linux__
689 const auto value =
"linux";
690#elif __unix__
691 const auto value =
"unix";
692#else
693 mooseDoOnce(
mooseWarning(
"Failed to determine platform; setting capability platform=unknown"));
694 const auto value =
"unknown";
695#endif
696 add_string("platform", value, "Operating system this executable is running on.")
697 .setExplicit()
698 .setEnumeration({"darwin", "linux", "unix", "unknown", "win32"});
699 }
700
701
702 {
703
704 std::optional<std::string> executable_path;
705 {
707 try
708 {
710 }
712 {
713 }
714 }
715
716 std::string
value =
"unknown";
717
718 if (executable_path)
719 {
720
721 std::error_code ec;
722 const auto resolved_path =
723 std::filesystem::weakly_canonical(std::filesystem::path(*executable_path), ec);
724 if (ec)
725 mooseDoOnce(
mooseWarning(
"Failed to resolve executable path '",
726 *executable_path,
727 "':\n",
728 ec.message(),
729 "\n\nSetting capability installation_type=unknown"));
730 else
731 {
732
733
734
735 value = resolved_path.parent_path().filename() ==
"bin" ?
"relocated" :
"in_tree";
736 }
737 }
738 else
740 "Failed to determine executable path; setting capability installation_type=unknown"));
741
742 add_string("installation_type", value, "The installation type of the application.")
743 .setExplicit()
744 .setEnumeration({"in_tree", "relocated", "unknown"});
745
747 }
748}
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Provides a way for users to bail out of the current solve.
Scoped helper for setting Moose::_throw_on_error during this scope.
std::string stringify(const T &t)
conversion to string
std::string getExec()
Gets the full path to the running executable on Mac OS X and linux.