-
Notifications
You must be signed in to change notification settings - Fork 304
Kokkos build and numerics support #4451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rochi00
wants to merge
21
commits into
libMesh:devel
Choose a base branch
from
rochi00:kokkos-build-numerics
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
c9dab84
Add Kokkos configuration and device plumbing
rochi00 3d8327b
Make vector and tensor value types device-usable
rochi00 ad6101f
Add Kokkos numerics storage and operator headers
rochi00 de66cbd
Add Kokkos numerics oracle test infrastructure
rochi00 acb22ee
Add Kokkos vector and tensor oracle tests
rochi00 63d0098
Regenerate configure and Makefile.in files
rochi00 7daa2e6
Include method CXX flags in pkg-config cflags
rochi00 57b4840
Run tensor foundation oracle on device
rochi00 93fee21
Make Point constructors device-callable
rochi00 77d0333
Inline tensor equality into constrained operators
rochi00 d26c43a
Differentiate leading tensor determinant helper
rochi00 ac897f2
Inline vector equality and remove contract shim
rochi00 e83887c
Hide tensor helper API and share in-place Kokkos ops
rochi00 b4d1336
Make remaining tensor helpers internal-only
rochi00 ee53d8b
Reduce Kokkos algebra wrapper layers
rochi00 b93e873
Update vector oracle to use Kokkos ref operators
rochi00 c8427b1
Rename tensor combination kernel
rochi00 37230df
Forward libMesh error macros into device code
rochi00 1b773ea
Probe Kokkos toolchain configuration
rochi00 2ca983d
Regenerate configure and tests Makefile.in
rochi00 3a89c4c
Force C++ mode for Kokkos configure probe
rochi00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| // The libMesh Finite Element Library. | ||
| // Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner | ||
|
|
||
| // This library is free software; you can redistribute it and/or | ||
| // modify it under the terms of the GNU Lesser General Public | ||
| // License as published by the Free Software Foundation; either | ||
| // version 2.1 of the License, or (at your option) any later version. | ||
|
|
||
| // This library is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| // Lesser General Public License for more details. | ||
|
|
||
| // You should have received a copy of the GNU Lesser General Public | ||
| // License along with this library; if not, write to the Free Software | ||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
|
||
| #ifndef LIBMESH_LIBMESH_DEVICE_H | ||
| #define LIBMESH_LIBMESH_DEVICE_H | ||
|
|
||
| // Defines LIBMESH_DEVICE_INLINE, mirroring MetaPhysicL's METAPHYSICL_INLINE | ||
| // pattern (metaphysicl_device.h / METAPHYSICL_KOKKOS_COMPILATION). | ||
| // | ||
| // When compiling a .K translation unit (LIBMESH_KOKKOS_COMPILATION is defined | ||
| // by kokkos.mk), this expands to KOKKOS_INLINE_FUNCTION so that annotated | ||
| // methods are callable from both host and device code. In all other | ||
| // translation units it expands to plain `inline`. | ||
| #ifdef LIBMESH_KOKKOS_COMPILATION | ||
| # include <Kokkos_Macros.hpp> | ||
| # include <Kokkos_Abort.hpp> | ||
| # define LIBMESH_DEVICE_INLINE KOKKOS_INLINE_FUNCTION | ||
|
|
||
| // Backend-neutral device-code detection for Kokkos .K translation units. | ||
| // This lets error/exception plumbing share a single predicate instead of | ||
| // hardcoding per-backend checks in multiple headers. | ||
| # if defined(__CUDA_ARCH__) || defined(__HIP_DEVICE_COMPILE__) || defined(__SYCL_DEVICE_ONLY__) | ||
| # define LIBMESH_IN_DEVICE_CODE 1 | ||
| # else | ||
| # define LIBMESH_IN_DEVICE_CODE 0 | ||
| # endif | ||
|
|
||
| // Device-safe assert: uses printf (supported on CUDA/HIP) and | ||
| // Kokkos::abort() for backend-portable device termination. | ||
| // Defined here (not in libmesh_common.h) because Kokkos headers | ||
| // are only available in .K translation units. | ||
| # ifndef NDEBUG | ||
| # define LIBMESH_DEVICE_ASSERT(asserted) \ | ||
| do { if (!(asserted)) { \ | ||
| printf("libMesh assert failed: %s, file %s, line %d\n", \ | ||
| #asserted, __FILE__, __LINE__); \ | ||
| ::Kokkos::abort("libmesh_assert failed"); \ | ||
| } } while (0) | ||
| # else | ||
| # define LIBMESH_DEVICE_ASSERT(asserted) ((void) 0) | ||
| # endif | ||
|
|
||
| # define LIBMESH_DEVICE_ERROR_MSG(msg) \ | ||
| do { \ | ||
| printf("libMesh error: %s, file %s, line %d\n", \ | ||
| msg, __FILE__, __LINE__); \ | ||
| ::Kokkos::abort(msg); \ | ||
| } while (0) | ||
|
|
||
| # define LIBMESH_DEVICE_ERROR_MSG_IF(cond, msg) \ | ||
| do { if (cond) { LIBMESH_DEVICE_ERROR_MSG(msg); } } while (0) | ||
|
|
||
| #else | ||
| # define LIBMESH_DEVICE_INLINE inline | ||
| # define LIBMESH_IN_DEVICE_CODE 0 | ||
| # define LIBMESH_DEVICE_ERROR_MSG(msg) libmesh_error_msg(msg) | ||
|
roystgnr marked this conversation as resolved.
Outdated
|
||
| # define LIBMESH_DEVICE_ERROR_MSG_IF(cond, msg) libmesh_error_msg_if(cond, msg) | ||
| #endif | ||
|
|
||
| #endif // LIBMESH_LIBMESH_DEVICE_H | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.