From fbd8be760266b58c7bce60c58a3a9ad63de1682b Mon Sep 17 00:00:00 2001 From: Cora Prather Date: Tue, 27 Oct 2026 18:25:37 +0000 Subject: [PATCH 1/3] Make prints in rootfinds portable --- .../root-finding-1d/root_finding.hpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/singularity-utils/singularity-utils/root-finding-1d/root_finding.hpp b/singularity-utils/singularity-utils/root-finding-1d/root_finding.hpp index 1e052e102fb..0c4f925dfd3 100644 --- a/singularity-utils/singularity-utils/root-finding-1d/root_finding.hpp +++ b/singularity-utils/singularity-utils/root-finding-1d/root_finding.hpp @@ -25,11 +25,12 @@ // #include // debug // #include #include -#include #include #include #include +#include + #define SINGULARITY_ROOT_DEBUG (0) #define SINGULARITY_ROOT_VERBOSE (0) @@ -105,7 +106,7 @@ class RootCounts { } PORTABLE_INLINE_FUNCTION void print_counts() const { for (std::size_t i{0}; i < nbins_; ++i) - printf("%e\n", counts_[i]); + PortsOfCall::printf("%e\n", counts_[i]); } PORTABLE_INLINE_FUNCTION std::size_t nBins() const { return nbins_; } PORTABLE_INLINE_FUNCTION std::size_t more() const { return nbins_ - 1; } @@ -144,7 +145,7 @@ PORTABLE_INLINE_FUNCTION bool set_bracket(const T &f, Real &a, const Real guess, } // if we get here then we failed to bracket a root if (verbose) { - printf("set_bracket failed to bound a root! %.14e %.14e %.14e %.14e %.14e %.14e\n", a, + PortsOfCall::printf("set_bracket failed to bound a root! %.14e %.14e %.14e %.14e %.14e %.14e\n", a, guess, b, ya, yg, yb); } return false; @@ -176,7 +177,7 @@ PORTABLE_INLINE_FUNCTION Status regula_falsi(const T &f, const Real ytarget, // ya, yg, and yb have the same sign if (!set_bracket(func, a, guess, b, ya, yg, yb, verbose)) { if (verbose) { - printf("regula_falsi failed! %.14e %.14e %.14e %.14e\n", ytarget, guess, a, b); + PortsOfCall::printf("regula_falsi failed! %.14e %.14e %.14e %.14e\n", ytarget, guess, a, b); } return Status::FAIL; } @@ -223,7 +224,7 @@ PORTABLE_INLINE_FUNCTION Status regula_falsi(const T &f, const Real ytarget, auto status = Status::SUCCESS; if (iteration_count == max_iter) { if (verbose) { - printf("root finding reached the maximum number of iterations. likely not " + PortsOfCall::printf("root finding reached the maximum number of iterations. likely not " "converged\n"); } status = Status::FAIL; @@ -280,7 +281,7 @@ PORTABLE_INLINE_FUNCTION Status newton_raphson(const T &f, const Real ytarget, // fail_on_bound_root. if ((_x <= a && _xold <= a) || (_x >= b && _xold >= b)) { if (verbose) { - printf("newton_raphson out of bounds! %.14e %.14e %.14e %.14e\n", ytarget, guess, + PortsOfCall::printf("newton_raphson out of bounds! %.14e %.14e %.14e %.14e\n", ytarget, guess, a, b); } if (fail_on_bound_root) { @@ -292,7 +293,7 @@ PORTABLE_INLINE_FUNCTION Status newton_raphson(const T &f, const Real ytarget, } if (iter >= max_iter) { if (verbose) { - printf("root finding reached the maximum number of iterations. likely not " + PortsOfCall::printf("root finding reached the maximum number of iterations. likely not " "converged\n"); } status = Status::FAIL; From 8fd30d33aaa954d3b46c2b751d99da9c85fbd7fc Mon Sep 17 00:00:00 2001 From: Cora E Date: Wed, 28 Oct 2026 10:16:54 -0400 Subject: [PATCH 2/3] Format --- .../root-finding-1d/root_finding.hpp | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/singularity-utils/singularity-utils/root-finding-1d/root_finding.hpp b/singularity-utils/singularity-utils/root-finding-1d/root_finding.hpp index 0c4f925dfd3..a39a889fd11 100644 --- a/singularity-utils/singularity-utils/root-finding-1d/root_finding.hpp +++ b/singularity-utils/singularity-utils/root-finding-1d/root_finding.hpp @@ -145,8 +145,9 @@ PORTABLE_INLINE_FUNCTION bool set_bracket(const T &f, Real &a, const Real guess, } // if we get here then we failed to bracket a root if (verbose) { - PortsOfCall::printf("set_bracket failed to bound a root! %.14e %.14e %.14e %.14e %.14e %.14e\n", a, - guess, b, ya, yg, yb); + PortsOfCall::printf( + "set_bracket failed to bound a root! %.14e %.14e %.14e %.14e %.14e %.14e\n", a, + guess, b, ya, yg, yb); } return false; } @@ -177,7 +178,8 @@ PORTABLE_INLINE_FUNCTION Status regula_falsi(const T &f, const Real ytarget, // ya, yg, and yb have the same sign if (!set_bracket(func, a, guess, b, ya, yg, yb, verbose)) { if (verbose) { - PortsOfCall::printf("regula_falsi failed! %.14e %.14e %.14e %.14e\n", ytarget, guess, a, b); + PortsOfCall::printf("regula_falsi failed! %.14e %.14e %.14e %.14e\n", ytarget, + guess, a, b); } return Status::FAIL; } @@ -224,8 +226,9 @@ PORTABLE_INLINE_FUNCTION Status regula_falsi(const T &f, const Real ytarget, auto status = Status::SUCCESS; if (iteration_count == max_iter) { if (verbose) { - PortsOfCall::printf("root finding reached the maximum number of iterations. likely not " - "converged\n"); + PortsOfCall::printf( + "root finding reached the maximum number of iterations. likely not " + "converged\n"); } status = Status::FAIL; } @@ -281,8 +284,8 @@ PORTABLE_INLINE_FUNCTION Status newton_raphson(const T &f, const Real ytarget, // fail_on_bound_root. if ((_x <= a && _xold <= a) || (_x >= b && _xold >= b)) { if (verbose) { - PortsOfCall::printf("newton_raphson out of bounds! %.14e %.14e %.14e %.14e\n", ytarget, guess, - a, b); + PortsOfCall::printf("newton_raphson out of bounds! %.14e %.14e %.14e %.14e\n", + ytarget, guess, a, b); } if (fail_on_bound_root) { status = Status::FAIL; @@ -293,8 +296,9 @@ PORTABLE_INLINE_FUNCTION Status newton_raphson(const T &f, const Real ytarget, } if (iter >= max_iter) { if (verbose) { - PortsOfCall::printf("root finding reached the maximum number of iterations. likely not " - "converged\n"); + PortsOfCall::printf( + "root finding reached the maximum number of iterations. likely not " + "converged\n"); } status = Status::FAIL; } From b5b7835b561d85a9adab548d5f012187433d2905 Mon Sep 17 00:00:00 2001 From: Cora E Date: Wed, 28 Oct 2026 10:37:07 -0400 Subject: [PATCH 3/3] Bump ports-of-call for SYCL support --- utils/ports-of-call | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/ports-of-call b/utils/ports-of-call index b2434296696..02c77b66092 160000 --- a/utils/ports-of-call +++ b/utils/ports-of-call @@ -1 +1 @@ -Subproject commit b24342966968ee768de1bd825f4582aba61b2fde +Subproject commit 02c77b660925d91f9082aec08e8462243f18f499