Skip to content

Kokkos build and numerics support #4451

Open
rochi00 wants to merge 93 commits into
libMesh:develfrom
rochi00:kokkos-build-numerics
Open

Kokkos build and numerics support #4451
rochi00 wants to merge 93 commits into
libMesh:develfrom
rochi00:kokkos-build-numerics

Conversation

@rochi00

@rochi00 rochi00 commented May 6, 2026

Copy link
Copy Markdown

This PR adds the first upstreamable slice of libMesh Kokkos support: build-system integration for .K translation units plus
standalone Kokkos numerics oracle tests.

The scope is intentionally limited to:

  • Kokkos-aware build support for libMesh tests
  • device-safe numerics support in core vector/tensor types
  • standalone Kokkos numerics oracle coverage
  • generated autotools updates as a separate final commit

@rochi00
rochi00 marked this pull request as draft May 6, 2026 22:27
@rochi00
rochi00 force-pushed the kokkos-build-numerics branch 2 times, most recently from e9a0948 to 63d0098 Compare May 8, 2026 21:05
@moosebuild

moosebuild commented May 9, 2026

Copy link
Copy Markdown

Job Coverage, step Generate coverage on 4263dfc wanted to post the following:

Coverage

cc8438 #4451 4263df
Total Total +/- New
Rate 65.60% 65.60% - 100.00%
Hits 78611 78611 - 6
Misses 41227 41227 - 0

Diff coverage report

Full coverage report

This comment will be updated on new commits.

@roystgnr roystgnr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're definitely getting there. I'd say the only thing that really ought to be fixed now is the error macro forwarding direction and (unless there's a good reason not to that I'm missing) the function redundancies.

Comment thread include/base/libmesh_common.h Outdated
Comment thread include/base/libmesh_device.h Outdated
Comment thread include/base/libmesh_exceptions.h
Comment thread m4/libmesh_optional_packages.m4 Outdated
Comment thread include/numerics/type_tensor.h Outdated
Comment thread contrib/bin/test_installed_headers.sh
Comment thread tests/Makefile.am Outdated
Comment thread include/gpu/kokkos_tensor_ops.h Outdated
Comment thread include/gpu/kokkos_tensor_ops.h Outdated
@rochi00
rochi00 marked this pull request as ready for review May 12, 2026 13:38
@rochi00
rochi00 requested a review from roystgnr May 12, 2026 19:36

@roystgnr roystgnr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make system and error handling look good to go now!

We've still got more duplication than we want in the math operators, though; not all of the "an operator which just shims a custom-named function that doesn't need to exist separately" cases are gone, and there's some more subtle "N operators shim a custom-named function" cases than could be turned into "N-1 operators call the one of them that now has the implementation in it".

Comment thread m4/libmesh_optional_packages.m4 Outdated
CXXFLAGS="$CXXFLAGS $KOKKOS_CXXFLAGS"
LDFLAGS="$LDFLAGS $KOKKOS_LDFLAGS"
LIBS="$LIBS $KOKKOS_LIBS"
AC_LANG_PUSH([C++])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split all commits like this in two in the future - the stuff we actually change in the first, and the stuff that bootstrap (or autoreconf, however you do it) changes in the second.

@rochi00
rochi00 force-pushed the kokkos-build-numerics branch 2 times, most recently from 4126ca2 to 3a78e39 Compare May 27, 2026 02:38
@rochi00
rochi00 force-pushed the kokkos-build-numerics branch from 716fbfe to abab836 Compare June 8, 2026 20:47
rochi00 and others added 30 commits June 11, 2026 13:54
With Kokkos we may have device compilers that can't handle them.
This is necessary for --enable-werror --enable-paranoid-warnings (and
possibly just the former?) configurations with Ubuntu 26.4 Kokkos for
me.
This looks like more of the sort of redundancy I want to get rid of, but
I want to get compiling first.
I can't actually trigger this directly yet, but I needed it in
MetaPhysicL for indirectly included Kokkos headers (at least for the
version in Ubuntu 26.4) there.
This fixes --enable-werror --enable-paranoid-warnings --enable-kokkos
builds for me.
"Should I add a layer of indirection to accomplish X" is one of the
hardest questions in software, unless X is "nothing".  Then it's easy.
This might become useful again depending on how we change things in the
backend, but for now it's redundant with operator().
operator() setters here lets us avoid an indirection layer
If we had to support arbitrary third-party classes directly this would
have been helpful, but we're writing our own shims here.
…s-roystgnr-merge-20260716

# Conflicts:
#	Makefile.in
#	configure
#	contrib/Makefile.in
#	contrib/capnproto/Makefile.in
#	contrib/eigen/gitshim/Makefile.in
#	contrib/exodusii/5.22b/exodus/Makefile.in
#	contrib/exodusii/5.22b/nemesis/Makefile.in
#	contrib/exodusii/Lib/Makefile.in
#	contrib/exodusii/v8.11/exodus/Makefile.in
#	contrib/exodusii/v8.11/nemesis/Makefile.in
#	contrib/fparser/Makefile.in
#	contrib/fparser/extrasrc/Makefile.in
#	contrib/gmv/Makefile.in
#	contrib/gzstream/Makefile.in
#	contrib/laspack/Makefile.in
#	contrib/libHilbert/Makefile.in
#	contrib/metis/Makefile.in
#	contrib/nanoflann/Makefile.in
#	contrib/nemesis/Lib/Makefile.in
#	contrib/netgen/Makefile.in
#	contrib/parmetis/Makefile.in
#	contrib/poly2tri/modified/Makefile.in
#	contrib/qhull/Makefile.in
#	contrib/sfcurves/Makefile.in
#	contrib/tecplot/binary/Makefile.in
#	contrib/tecplot/tecio/Makefile.in
#	contrib/tetgen/Makefile.in
#	contrib/triangle/Makefile.in
#	doc/Makefile.in
#	doc/html/Makefile.in
#	examples/Makefile.in
#	examples/adaptivity/adaptivity_ex1/Makefile.in
#	examples/adaptivity/adaptivity_ex2/Makefile.in
#	examples/adaptivity/adaptivity_ex3/Makefile.in
#	examples/adaptivity/adaptivity_ex4/Makefile.in
#	examples/adaptivity/adaptivity_ex5/Makefile.in
#	examples/adjoints/adjoints_ex1/Makefile.in
#	examples/adjoints/adjoints_ex2/Makefile.in
#	examples/adjoints/adjoints_ex3/Makefile.in
#	examples/adjoints/adjoints_ex4/Makefile.in
#	examples/adjoints/adjoints_ex5/Makefile.in
#	examples/adjoints/adjoints_ex6/Makefile.in
#	examples/adjoints/adjoints_ex7/Makefile.in
#	examples/eigenproblems/eigenproblems_ex1/Makefile.in
#	examples/eigenproblems/eigenproblems_ex2/Makefile.in
#	examples/eigenproblems/eigenproblems_ex3/Makefile.in
#	examples/eigenproblems/eigenproblems_ex4/Makefile.in
#	examples/fem_system/fem_system_ex1/Makefile.in
#	examples/fem_system/fem_system_ex2/Makefile.in
#	examples/fem_system/fem_system_ex3/Makefile.in
#	examples/fem_system/fem_system_ex4/Makefile.in
#	examples/fem_system/fem_system_ex5/Makefile.in
#	examples/introduction/introduction_ex1/Makefile.in
#	examples/introduction/introduction_ex2/Makefile.in
#	examples/introduction/introduction_ex3/Makefile.in
#	examples/introduction/introduction_ex4/Makefile.in
#	examples/introduction/introduction_ex5/Makefile.in
#	examples/miscellaneous/miscellaneous_ex1/Makefile.in
#	examples/miscellaneous/miscellaneous_ex10/Makefile.in
#	examples/miscellaneous/miscellaneous_ex11/Makefile.in
#	examples/miscellaneous/miscellaneous_ex12/Makefile.in
#	examples/miscellaneous/miscellaneous_ex13/Makefile.in
#	examples/miscellaneous/miscellaneous_ex14/Makefile.in
#	examples/miscellaneous/miscellaneous_ex15/Makefile.in
#	examples/miscellaneous/miscellaneous_ex16/Makefile.in
#	examples/miscellaneous/miscellaneous_ex17/Makefile.in
#	examples/miscellaneous/miscellaneous_ex2/Makefile.in
#	examples/miscellaneous/miscellaneous_ex3/Makefile.in
#	examples/miscellaneous/miscellaneous_ex4/Makefile.in
#	examples/miscellaneous/miscellaneous_ex5/Makefile.in
#	examples/miscellaneous/miscellaneous_ex6/Makefile.in
#	examples/miscellaneous/miscellaneous_ex7/Makefile.in
#	examples/miscellaneous/miscellaneous_ex8/Makefile.in
#	examples/miscellaneous/miscellaneous_ex9/Makefile.in
#	examples/optimization/optimization_ex1/Makefile.in
#	examples/optimization/optimization_ex2/Makefile.in
#	examples/reduced_basis/reduced_basis_ex1/Makefile.in
#	examples/reduced_basis/reduced_basis_ex2/Makefile.in
#	examples/reduced_basis/reduced_basis_ex3/Makefile.in
#	examples/reduced_basis/reduced_basis_ex4/Makefile.in
#	examples/reduced_basis/reduced_basis_ex5/Makefile.in
#	examples/reduced_basis/reduced_basis_ex6/Makefile.in
#	examples/reduced_basis/reduced_basis_ex7/Makefile.in
#	examples/solution_transfer/solution_transfer_ex1/Makefile.in
#	examples/subdomains/subdomains_ex1/Makefile.in
#	examples/subdomains/subdomains_ex2/Makefile.in
#	examples/subdomains/subdomains_ex3/Makefile.in
#	examples/systems_of_equations/systems_of_equations_ex1/Makefile.in
#	examples/systems_of_equations/systems_of_equations_ex2/Makefile.in
#	examples/systems_of_equations/systems_of_equations_ex3/Makefile.in
#	examples/systems_of_equations/systems_of_equations_ex4/Makefile.in
#	examples/systems_of_equations/systems_of_equations_ex5/Makefile.in
#	examples/systems_of_equations/systems_of_equations_ex6/Makefile.in
#	examples/systems_of_equations/systems_of_equations_ex7/Makefile.in
#	examples/systems_of_equations/systems_of_equations_ex8/Makefile.in
#	examples/systems_of_equations/systems_of_equations_ex9/Makefile.in
#	examples/transient/transient_ex1/Makefile.in
#	examples/transient/transient_ex2/Makefile.in
#	examples/transient/transient_ex3/Makefile.in
#	examples/vector_fe/vector_fe_ex1/Makefile.in
#	examples/vector_fe/vector_fe_ex10/Makefile.in
#	examples/vector_fe/vector_fe_ex2/Makefile.in
#	examples/vector_fe/vector_fe_ex3/Makefile.in
#	examples/vector_fe/vector_fe_ex4/Makefile.in
#	examples/vector_fe/vector_fe_ex5/Makefile.in
#	examples/vector_fe/vector_fe_ex6/Makefile.in
#	examples/vector_fe/vector_fe_ex7/Makefile.in
#	examples/vector_fe/vector_fe_ex8/Makefile.in
#	examples/vector_fe/vector_fe_ex9/Makefile.in
#	include/Makefile.in
#	include/base/libmesh_device.h
#	include/gpu/kokkos_linalg_base.h
#	include/gpu/kokkos_storage.h
#	include/gpu/kokkos_storage_policy.h
#	include/gpu/kokkos_tensor_ops.h
#	include/gpu/kokkos_vector_ops.h
#	include/libmesh/Makefile.in
#	m4/config_summary.m4
#	m4/libmesh_optional_packages.m4
#	tests/Makefile.in
#	tests/numerics/kokkos_numerics_oracle_test_utils.h
#	tests/numerics/kokkos_tensor_ops_oracle_runners.h
#	tests/numerics/kokkos_vector_ops_oracle_fixtures.h
#	tests/numerics/kokkos_vector_ops_oracle_runners.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants