Skip to content

Commit

Permalink
Print extra debug info for failing boozersurface test. Try 2 versions…
Browse files Browse the repository at this point in the history
… of ubuntu os in CI
landreman committed Jan 17, 2025
1 parent 9b041e7 commit 06cee79
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -17,8 +17,6 @@ on:

jobs:
test:
runs-on: ubuntu-latest

env:
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
@@ -28,6 +26,9 @@ jobs:
matrix:
python-version: ["3.10"]
test-type: [unit]
os: ["ubuntu-22.04", "ubuntu-latest"]

runs-on: ${{ matrix.os }}

steps:
# First print out lots of information. We do this in separate
4 changes: 4 additions & 0 deletions src/simsopt/geo/boozersurface.py
Original file line number Diff line number Diff line change
@@ -525,6 +525,7 @@ def minimize_boozer_penalty_constraints_newton(self, tol=1e-12, maxiter=10, cons
self.res = res
self.need_to_run_code = False

print(f"minimize_boozer_penalty_constraints_newton norm: {norm} tol: {tol} success: {res['success']}", flush=True)
if verbose:
print(f"NEWTON solve - {res['success']} iter={res['iter']}, iota={res['iota']:.16f}, ||grad||_inf = {np.linalg.norm(res['jacobian'], ord=np.inf):.3e}", flush=True)

@@ -600,6 +601,7 @@ def minimize_boozer_penalty_constraints_ls(self, tol=1e-12, maxiter=10, constrai

self.res = resdict
self.need_to_run_code = False
print(f"minimize_boozer_penalty_constraints_ls: res.status {res.status} res.message {res.message} success: {resdict['success']}", flush=True)
return resdict

def minimize_boozer_exact_constraints_newton(self, tol=1e-12, maxiter=10, iota=0., G=None, lm=[0., 0.]):
@@ -672,6 +674,7 @@ def minimize_boozer_exact_constraints_newton(self, tol=1e-12, maxiter=10, iota=0

self.res = res
self.need_to_run_code = False
print(f"minimize_boozer_exact_constraints_newton norm: {norm} tol: {tol} success: {res['success']}", flush=True)
return res

def solve_residual_equation_exactly_newton(self, tol=1e-10, maxiter=10, iota=0., G=None, verbose=False):
@@ -815,6 +818,7 @@ def solve_residual_equation_exactly_newton(self, tol=1e-10, maxiter=10, iota=0.,
"mask": mask, 'type': 'exact', "vjp": boozer_surface_dexactresidual_dcoils_dcurrents_vjp
}

print(f"solve_residual_equation_exactly_newton norm: {norm} tol: {tol} success: {res['success']}", flush=True)
if verbose:
print(f"NEWTON solve - {res['success']} iter={res['iter']}, iota={res['iota']:.16f}, ||residual||_inf = {np.linalg.norm(res['residual'], ord=np.inf):.3e}", flush=True)

1 change: 1 addition & 0 deletions tests/geo/test_boozersurface.py
Original file line number Diff line number Diff line change
@@ -232,6 +232,7 @@ def test_boozer_surface_optimisation_convergence(self):
for surfacetype, stellsym, optimize_G, second_stage in configs:
for get_data in [get_hsx_data, get_ncsx_data, get_giuliani_data]:
for vectorize in [True, False]:
print(f"!!!!!! Testing surfacetype {surfacetype}, stellsym {stellsym}, optimize_G {optimize_G}, second_stage {second_stage}, get_data {get_data}, vectorize {vectorize}", flush=True)
with self.subTest(
surfacetype=surfacetype, stellsym=stellsym,
optimize_G=optimize_G, second_stage=second_stage, get_data=get_data, vectorize=vectorize):

0 comments on commit 06cee79

Please sign in to comment.