Repository navigation
Isolate AMS from PyTorch - #196
Merged
Merged
Conversation
lpottier
force-pushed
the
features/remove-torch
branch
from
August 21, 2026 21:41
94df04e to
1820329
Compare
lpottier
force-pushed
the
features/remove-torch
branch
2 times, most recently
from
September 10, 2026 23:21
7666df2 to
448f08d
Compare
Contributor
There was a problem hiding this comment.
Cpp-linter Review
Used clang-format v18.1.8
Click here for the full clang-format patch
diff --git a/src/AMSlib/wf/hdf5db.cpp b/src/AMSlib/wf/hdf5db.cpp
index c84bb01..d7425ba 100644
--- a/src/AMSlib/wf/hdf5db.cpp
+++ b/src/AMSlib/wf/hdf5db.cpp
@@ -12 +11,0 @@
-
@@ -14 +12,0 @@
-#include <stdexcept>
Have any feedback or feature suggestions? Share it here.
Contributor
There was a problem hiding this comment.
Cpp-linter Review
Used clang-format v18.1.8
Click here for the full clang-format patch
diff --git a/src/AMSlib/wf/hdf5db.cpp b/src/AMSlib/wf/hdf5db.cpp
index c84bb01..d7425ba 100644
--- a/src/AMSlib/wf/hdf5db.cpp
+++ b/src/AMSlib/wf/hdf5db.cpp
@@ -12 +11,0 @@
-
@@ -14 +12,0 @@
-#include <stdexcept>
Have any feedback or feature suggestions? Share it here.
Contributor
There was a problem hiding this comment.
Cpp-linter Review
Used clang-format v18.1.8
Click here for the full clang-format patch
diff --git a/src/AMSlib/wf/hdf5db.cpp b/src/AMSlib/wf/hdf5db.cpp
index 1d04a98..d7425ba 100644
--- a/src/AMSlib/wf/hdf5db.cpp
+++ b/src/AMSlib/wf/hdf5db.cpp
@@ -13 +12,0 @@
-#include <stdexcept>
@@ -14,0 +14 @@
+#include <stdexcept>
Have any feedback or feature suggestions? Share it here.
Contributor
There was a problem hiding this comment.
Cpp-linter Review
Used clang-format v18.1.8
Click here for the full clang-format patch
diff --git a/src/AMSlib/wf/hdf5db.cpp b/src/AMSlib/wf/hdf5db.cpp
index 1d04a98..d7425ba 100644
--- a/src/AMSlib/wf/hdf5db.cpp
+++ b/src/AMSlib/wf/hdf5db.cpp
@@ -13 +12,0 @@
-#include <stdexcept>
@@ -14,0 +14 @@
+#include <stdexcept>
Have any feedback or feature suggestions? Share it here.
Contributor
There was a problem hiding this comment.
Cpp-linter Review
Used clang-format v18.1.8
Click here for the full clang-format patch
diff --git a/src/AMSlib/AMSTensor.cpp b/src/AMSlib/AMSTensor.cpp
index e8575d7..ac45005 100644
--- a/src/AMSlib/AMSTensor.cpp
+++ b/src/AMSlib/AMSTensor.cpp
@@ -495,4 +495 @@ namespace ams
-bool isContiguous(const AMSTensor& tensor)
-{
- return tensor.contiguous();
-}
+bool isContiguous(const AMSTensor& tensor) { return tensor.contiguous(); }
@@ -566 +563,2 @@ AMSTensor makeContiguousCPU(const AMSTensor& tensor,
- throw std::invalid_argument("Unsupported AMSTensor dtype in makeContiguousCPU");
+ throw std::invalid_argument(
+ "Unsupported AMSTensor dtype in makeContiguousCPU");
diff --git a/src/AMSlib/wf/workflow.hpp b/src/AMSlib/wf/workflow.hpp
index fafbefe..76114cc 100644
--- a/src/AMSlib/wf/workflow.hpp
+++ b/src/AMSlib/wf/workflow.hpp
@@ -111 +111,2 @@ class AMSWorkflow
- bool needsConversion = !ams::isContiguous(Tensor) || !ams::onCPU(Tensor);
+ bool needsConversion =
+ !ams::isContiguous(Tensor) || !ams::onCPU(Tensor);
@@ -128 +129,2 @@ class AMSWorkflow
- bool needsConversion = !ams::isContiguous(Tensor) || !ams::onCPU(Tensor);
+ bool needsConversion =
+ !ams::isContiguous(Tensor) || !ams::onCPU(Tensor);
@@ -145 +147,2 @@ class AMSWorkflow
- bool needsConversion = !ams::isContiguous(Tensor) || !ams::onCPU(Tensor);
+ bool needsConversion =
+ !ams::isContiguous(Tensor) || !ams::onCPU(Tensor);
@@ -162 +165,2 @@ class AMSWorkflow
- bool needsConversion = !ams::isContiguous(Tensor) || !ams::onCPU(Tensor);
+ bool needsConversion =
+ !ams::isContiguous(Tensor) || !ams::onCPU(Tensor);
@@ -191 +195,3 @@ class AMSWorkflow
- AMS_DBG(Workflow, "RMQ: cleaned up {} temporary buffers", tempAllocations.size());
+ AMS_DBG(Workflow,
+ "RMQ: cleaned up {} temporary buffers",
+ tempAllocations.size());
diff --git a/tests/AMSlib/perf_regression/ams_bench_db.cpp b/tests/AMSlib/perf_regression/ams_bench_db.cpp
index c9b0c35..61248fa 100644
--- a/tests/AMSlib/perf_regression/ams_bench_db.cpp
+++ b/tests/AMSlib/perf_regression/ams_bench_db.cpp
@@ -184 +184 @@ int main(int argc, char** argv)
- false);
+ false);
@@ -189 +189 @@ int main(int argc, char** argv)
- false);
+ false);
@@ -200,3 +200,15 @@ int main(int argc, char** argv)
- args.AddOption(&num_inputs, "-di", "--dim-inputs", "Dimension of inputs, default: 8", false);
- args.AddOption(&num_outputs, "-do", "--dim-outputs", "Dimension of outputs, default: 9", false);
- args.AddOption(&num_iterations, "-i", "--num-iter", "Number of iterations, default: 1", false);
+ args.AddOption(&num_inputs,
+ "-di",
+ "--dim-inputs",
+ "Dimension of inputs, default: 8",
+ false);
+ args.AddOption(&num_outputs,
+ "-do",
+ "--dim-outputs",
+ "Dimension of outputs, default: 9",
+ false);
+ args.AddOption(&num_iterations,
+ "-i",
+ "--num-iter",
+ "Number of iterations, default: 1",
+ false);
Have any feedback or feature suggestions? Share it here.
Torch is not needed to compile and use AMS. When not using Torch AMS cannot perform inference but can be used to gather training data. Signed-off-by: Loic Pottier <pottier1@llnl.gov>
lpottier
force-pushed
the
features/remove-torch
branch
from
October 14, 2026 22:19
220d038 to
54abd64
Compare
This branch was successfully deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR aims at removing PyTorch from the critical path in AMS. The strict dependency on PyTorch prevents AMS from being used in some multi-physics codes and thus must be removed. This PR introduces the CMake flag
-DWITH_TORCH=[On|Off].This PR replaces Torch tensors with
AMSTensorwhen possible. By default,-DWITH_TORCH=On, when AMS is compiled with Torch we can perform inference but when we do not compile AMS with Torch we can still store physics and it acts as atraining onlymode.TODO:
evaluate()