From 082c422e91f7a0f0528c66b70f5cf66b7e964758 Mon Sep 17 00:00:00 2001 From: Matt Landreman Date: Mon, 13 Jan 2025 17:26:59 -0500 Subject: [PATCH] Print out lots of debugging info for one specific test that is faling --- .github/workflows/tests.yml | 133 ++--------------------------- src/simsopt/geo/curveobjectives.py | 1 + 2 files changed, 9 insertions(+), 125 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b17d75970..24135d242 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,8 +26,8 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.9] - test-type: [unit, integrated] + python-version: [3.10] + test-type: [unit] steps: # First print out lots of information. We do this in separate @@ -64,10 +64,6 @@ jobs: - name: Fetch all history for all tags run: git fetch --all --tags --prune --unshallow - # We must run actions/checkout before downloading and building VMEC, since checkout deletes the contents of the directory. - - name: Download the VMEC2000 standalone repository - run: git clone --depth=1 https://github.com/hiddensymmetries/VMEC2000.git - - name: ls -l again run: | set -ex @@ -93,52 +89,13 @@ jobs: - name: Install python dependencies run: | sudo apt-get install graphviz graphviz-dev - pip install numpy cmake scikit-build f90nml ninja wheel setuptools sympy qsc pyevtk matplotlib plotly networkx pygraphviz mpi4py py_spec h5py ground bentley_ottmann f90wrap - - - name: Install pyoculus - run: pip install -v git+https://github.com/zhisong/pyoculus - - - name: Install booz_xform - run: pip install -v git+https://github.com/hiddenSymmetries/booz_xform - - - name: Install virtual_casing - run: pip install -v git+https://github.com/hiddenSymmetries/virtual-casing + pip install numpy cmake scikit-build f90nml ninja wheel setuptools sympy qsc pyevtk matplotlib plotly networkx pygraphviz mpi4py h5py ground bentley_ottmann f90wrap - # See https://github.community/t/best-way-to-clone-a-private-repo-during-script-run-of-private-github-action/16116/7 - # https://stackoverflow.com/questions/57612428/cloning-private-github-repository-within-organisation-in-actions - # https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token - - name: Check out SPEC - uses: actions/checkout@v4 - with: - repository: PrincetonUniversity/SPEC - path: SPEC - - name: ls -l again run: | ls -l pwd - - name: ls -l inside SPEC - run: | - cd SPEC - pwd - ls -l - - # For some reason, installing py_spec does not install the dependencies f90nml and h5py. Therefore I installed these manually above. - - name: Install py_spec - run: | - pip install -r SPEC/Utilities/pythontools/requirements.txt - pip install -e SPEC/Utilities/pythontools - python -c "import py_spec; print('success')" - - - name: Build SPEC python wrapper. - run: | - cd SPEC - pip install . - - - name: Try import spec - run: python -c "import spec.spec_f90wrapped as spec; print(spec.constants.version)" - - name: ls in /usr/lib/x86_64-linux-gnu run: ls -l /usr/lib/x86_64-linux-gnu @@ -148,89 +105,15 @@ jobs: - name: env after adding to LD_LIBRARY_PATH run: env - - name: ls in VMEC2000/python 1 - run: ls -l VMEC2000/python - - - name: Configure and install VMEC2000 module - run: | - cd VMEC2000 - cp cmake/machines/ubuntu.json cmake_config_file.json - cat cmake_config_file.json - pip install . - - - name: Try importing vmec module - run: python -c "print(dir()); import vmec; print(dir()); print(dir(vmec)); print('package:', vmec.__package__); print('spec:', vmec.__spec__); print('doc:', vmec.__doc__); print('file:', vmec.__file__); print('path:', vmec.__path__)" - - name: Install simsopt package # run: env CMAKE_BUILD_TYPE=Debug pip install -v .[MPI,SPEC] - run: pip install -v ".[MPI,SPEC,VIS]" - - - name: Verify that importing simsopt does not automatically initialize MPI - run: ./tests/verify_MPI_not_initialized.py - - - name: Run examples as part of integrated tests - if: contains(matrix.test-type, 'integrated') - run: | - cd examples - ./run_serial_examples - ./run_parallel_examples - ./run_vmec_examples - ./run_spec_examples - ./run_spec_vmec_examples - - - name: Install coverage dependencies - if: contains(matrix.test-type, 'unit') - run: pip install coverage + # run: pip install -v ".[MPI,SPEC,VIS]" + run: pip install -v "." - name: Run tests on 1 process using coverage if: contains(matrix.test-type, 'unit') run: | - coverage run --source=simsopt -m unittest discover -t tests -v -s tests/core - coverage run --source=simsopt -m unittest discover -t tests -v -s tests/field - coverage run --source=simsopt -m unittest discover -t tests -v -s tests/geo - coverage run --source=simsopt -m unittest discover -t tests -v -s tests/mhd - coverage run --source=simsopt -m unittest discover -t tests -v -s tests/objectives - coverage run --source=simsopt -m unittest discover -t tests -v -s tests/solve - coverage run --source=simsopt -m unittest discover -t tests -v -s tests/util - - - name: Run MPI tests using coverage - if: contains(matrix.test-type, 'unit') - run: | - mpiexec -n 1 coverage run -m unittest discover -k "mpi" -s tests -v - mpiexec -n 2 coverage run -m unittest discover -k "mpi" -s tests -v - mpiexec -n 3 --oversubscribe coverage run -m unittest discover -k "mpi" -s tests -v + cd tests + python -m unittest geo.test_curve_optimizable.Testing + python -m unittest geo.test_boozersurface.BoozerSurfaceTests.test_boozer_surface_optimisation_convergence - - name: ls to see coverage files that were produced - if: contains(matrix.test-type, 'unit') - run: ls -al - - - name: Combine coverage reports - if: contains(matrix.test-type, 'unit') - run: | - coverage combine - coverage report - coverage xml - - - name: Upload coverage to github - if: contains(matrix.test-type, 'unit') - uses: actions/upload-artifact@v4 - with: - name: tox-gh-actions-coverage - path: coverage.xml - if-no-files-found: error - - - name: Upload coverage to Codecov - # The last conditional on the next line prevents github from trying to upload to Codecov on forks of the repository, avoiding a permissions error - if: contains(matrix.test-type, 'unit') && github.repository_owner == 'hiddenSymmetries' - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./coverage.xml - #files: ./coverage1.xml,./coverage2.xml - #directory: ./coverage/reports/ - flags: unittests - env_vars: PYTHON - name: codecov-umbrella - fail_ci_if_error: true - #path_to_write_report: ./coverage/codecov_report.gz - verbose: true diff --git a/src/simsopt/geo/curveobjectives.py b/src/simsopt/geo/curveobjectives.py index 3f11e6dc3..73aec24fc 100644 --- a/src/simsopt/geo/curveobjectives.py +++ b/src/simsopt/geo/curveobjectives.py @@ -40,6 +40,7 @@ def J(self): """ This returns the value of the quantity. """ + print("CurveLength.J(): incremental_arclength = ", self.curve.incremental_arclength(), flush=True) return curve_length_pure(self.curve.incremental_arclength()) @derivative_dec