Skip to content

Commit

Permalink
Merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
landreman committed Jul 26, 2024
2 parents 123b263 + f4b943e commit 93a5a22
Show file tree
Hide file tree
Showing 53 changed files with 39,635 additions and 500 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-11]
platform: [ubuntu-latest, macos-12]
python-version: ["3.9"]

runs-on: ${{ matrix.platform }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/extensive_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
- name: Install python dependencies
run: |
sudo apt-get install graphviz graphviz-dev
pip install wheel numpy scipy f90nml h5py scikit-build cmake qsc sympy pyevtk matplotlib ninja plotly networkx pygraphviz ground bentley_ottmann
pip install wheel "numpy<2.0.0" scipy f90nml h5py scikit-build cmake qsc sympy pyevtk matplotlib ninja plotly networkx pygraphviz ground bentley_ottmann
- name: Install booz_xform
if: contains(matrix.packages, 'vmec') || contains(matrix.packages, 'all')
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/non_simd_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Install python dependencies
run: |
sudo apt-get install graphviz graphviz-dev
pip install wheel numpy scipy f90nml h5py scikit-build cmake qsc sympy pyevtk matplotlib ninja plotly networkx pygraphviz
pip install wheel "numpy<2.0.0" scipy f90nml h5py scikit-build cmake qsc sympy pyevtk matplotlib ninja plotly networkx pygraphviz ground bentley_ottmann
- name: Install booz_xform
run: pip install -v git+https://github.com/hiddenSymmetries/booz_xform
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/singularity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:

# Do the builds on all pull requests (to test them)
pull_request: []
workflow_dispatch:

jobs:
build-containers:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ 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 pyoculus h5py
pip install "numpy<2.0.0" cmake scikit-build f90nml ninja wheel setuptools sympy qsc pyevtk matplotlib plotly networkx pygraphviz mpi4py py_spec pyoculus h5py ground bentley_ottmann
- name: Install booz_xform
run: pip install -v git+https://github.com/hiddenSymmetries/booz_xform
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, ubuntu-20.04]
os: [macos-12, ubuntu-20.04]

steps:
- uses: actions/checkout@v4
Expand Down
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ else()
unset(COMPILER_SUPPORTS_MARCH_NATIVE CACHE)
CHECK_CXX_COMPILER_FLAG(-march=native COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
set(CMAKE_CXX_FLAGS "-O3 -march=native -mfma -ffp-contract=fast")
elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "arm64")
set(CMAKE_CXX_FLAGS "-O3 -mcpu=apple-a14 -mfma -ffp-contract=fast")
set(CMAKE_CXX_FLAGS "-O3 -march=native -ffp-contract=fast")
elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "arm64")
set(CMAKE_CXX_FLAGS "-O3 -mcpu=apple-a14 -ffp-contract=fast")
else()
set(CMAKE_CXX_FLAGS "-O3 -ffp-contract=fast")
set(CMAKE_CXX_FLAGS "-O3 -ffp-contract=fast")
endif()
endif()
# Ensure all code used from Eigen does not have LGPL license:
Expand Down Expand Up @@ -119,6 +119,7 @@ set(XTENSOR_USE_TBB 0)

pybind11_add_module(${PROJECT_NAME}
src/simsoptpp/python.cpp src/simsoptpp/python_surfaces.cpp src/simsoptpp/python_curves.cpp
src/simsoptpp/boozerresidual_py.cpp
src/simsoptpp/python_magneticfield.cpp src/simsoptpp/python_tracing.cpp src/simsoptpp/python_distance.cpp
src/simsoptpp/biot_savart_py.cpp
src/simsoptpp/biot_savart_vjp_py.cpp
Expand All @@ -127,7 +128,7 @@ pybind11_add_module(${PROJECT_NAME}
src/simsoptpp/surface.cpp src/simsoptpp/surfacerzfourier.cpp src/simsoptpp/surfacexyzfourier.cpp
src/simsoptpp/integral_BdotN.cpp
src/simsoptpp/dipole_field.cpp src/simsoptpp/permanent_magnet_optimization.cpp
src/simsoptpp/dommaschk.cpp src/simsoptpp/reiman.cpp src/simsoptpp/tracing.cpp
src/simsoptpp/dommaschk.cpp src/simsoptpp/reiman.cpp src/simsoptpp/tracing.cpp
src/simsoptpp/magneticfield_biotsavart.cpp src/simsoptpp/python_boozermagneticfield.cpp
src/simsoptpp/boozerradialinterpolant.cpp
)
Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

12 changes: 7 additions & 5 deletions ci/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM --platform=linux/amd64 ubuntu:22.04 as intermediate
RUN apt update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential gfortran git m4 wget cmake ninja-build \
libopenblas-dev libfftw3-dev libhdf5-dev libhdf5-serial-dev libnetcdf-dev libnetcdff-dev libgl1-mesa-dev \
python3-dev python3-pip python3-venv
python3-dev python3-pip python3-venv libxrender1

# Install mpich manually
WORKDIR /src
Expand Down Expand Up @@ -40,20 +40,22 @@ RUN python3 -m pip install wheel
RUN python3 -m venv /venv/

RUN /venv/bin/pip install -U pip
RUN /venv/bin/python -m pip install numpy scipy jax jaxlib f90nml mpi4py jupyter notebook ipython qsc sympy scikit-build ninja "pybind11[global]" cmake desc-opt toml
RUN /venv/bin/pip install git+https://github.com/zhucaoxiang/f90wrap
RUN /venv/bin/python -m pip install numpy scipy jax jaxlib f90nml mpi4py jupyter notebook ipython qsc sympy scikit-build ninja "pybind11[global]" cmake f90wrap h5py desc-opt
ENV PATH="/venv/bin:${PATH}"

RUN git clone --depth 1 https://github.com/PrincetonUniversity/SPEC.git /src/SPEC && \
cd /src/SPEC && \
/venv/bin/pip install -v . 2>&1 | tee spec_build.log
/venv/bin/pip install -v . 2>&1 | tee spec_build.log && \
cd Utilities/pythontools && \
/venv/bin/pip install -r requirements.txt && \
/venv/bin/pip install -v .

RUN git clone --depth 1 https://github.com/hiddenSymmetries/VMEC2000.git /src/VMEC && \
cd /src/VMEC && \
cp cmake/machines/ubuntu.json cmake_config_file.json && \
/venv/bin/pip install -v . 2>&1 | tee vmec_build.log

RUN /venv/bin/pip install h5py pyoculus py_spec
RUN /venv/bin/pip install pyoculus
RUN /venv/bin/pip install vtk==9.2.6 pyqt5 matplotlib pyevtk plotly
# RUN /venv/bin/pip install mayavi
RUN /venv/bin/pip install git+https://github.com/hiddenSymmetries/booz_xform
Expand Down
12 changes: 7 additions & 5 deletions ci/singularity.def
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Stage: devel
libfabric-dev libfabric-bin \
libhwloc-dev libpmix-dev libevent-dev \
libopenblas-dev libfftw3-dev libhdf5-dev libhdf5-serial-dev libnetcdf-dev libnetcdff-dev libgl1-mesa-dev \
python3-dev python3-pip python3-venv
python3-dev python3-pip python3-venv libxrender1


%post
Expand Down Expand Up @@ -44,8 +44,7 @@ Stage: devel
python3 -m venv /venv/
. /venv/bin/activate
/venv/bin/pip install -U pip
/venv/bin/pip install numpy scipy jax jaxlib f90nml jupyter notebook ipython qsc sympy scikit-build ninja "pybind11[global]" cmake
/venv/bin/pip install git+https://github.com/zhucaoxiang/f90wrap
/venv/bin/pip install numpy scipy jax jaxlib f90nml jupyter notebook ipython qsc sympy scikit-build ninja "pybind11[global]" cmake f90wrap h5py
PATH="/usr/local/bin:/venv/bin:${PATH}"
LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"

Expand All @@ -60,7 +59,10 @@ Stage: devel
cd SPEC && \
/venv/bin/python setup.py bdist_wheel && \
/venv/bin/pip install -v dist/*.whl && \
cd .. && \
cd Utilities/pythontools && \
/venv/bin/pip install -r requirements.txt && \
/venv/bin/pip install . && \
cd ../../.. && \
rm -rf SPEC

git clone --depth 1 https://github.com/hiddenSymmetries/VMEC2000.git && \
Expand All @@ -70,7 +72,7 @@ Stage: devel
cd .. && \
rm -rf VMEC2000

/venv/bin/pip install h5py pyoculus py_spec
/venv/bin/pip install pyoculus
/venv/bin/pip install vtk==9.2.6 pyqt5 matplotlib pyevtk plotly
/venv/bin/pip install mayavi
/venv/bin/pip install git+https://github.com/hiddenSymmetries/booz_xform
Expand Down
2 changes: 1 addition & 1 deletion docs/source/containers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ issues associated with Docker containers. Shifter allows to you use
the simsopt Docker image files hosted on Docker Hub. Detailed
instructions for using Shifter can be found at the `NERSC page on the
simsopt wiki
<https://github.com/hiddenSymmetries/simsopt/wiki/NERSC-Cori>`_.
<https://github.com/hiddenSymmetries/simsopt/wiki/NERSC-Perlmutter>`_.


.. _singularity_doc:
Expand Down
8 changes: 8 additions & 0 deletions docs/source/simsopt.geo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ simsopt.geo.curvexyzfourier module
:undoc-members:
:show-inheritance:

simsopt.geo.curvexyzfouriersymmetries module
--------------------------------------------

.. automodule:: simsopt.geo.curvexyzfouriersymmetries
:members:
:undoc-members:
:show-inheritance:

simsopt.geo.finitebuild module
------------------------------

Expand Down
2 changes: 2 additions & 0 deletions examples/2_Intermediate/boozer.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
print(f"After LBFGS: iota={res['iota']:.3f}, tf={tf.J():.3f}, area={s.area():.3f}, ||residual||={np.linalg.norm(boozer_surface_residual(s, res['iota'], res['G'], bs, derivatives=0)):.3e}")
if "DISPLAY" in os.environ:
s.plot()

boozer_surface.need_to_run_code = True
# now drive the residual down using a specialised least squares algorithm
res = boozer_surface.minimize_boozer_penalty_constraints_ls(tol=1e-10, maxiter=100, constraint_weight=100., iota=res['iota'], G=res['G'], method='manual')
print(f"After Lev-Mar: iota={res['iota']:.3f}, tf={tf.J():.3f}, area={s.area():.3f}, ||residual||={np.linalg.norm(boozer_surface_residual(s, res['iota'], res['G'], bs, derivatives=0)):.3e}")
Expand Down
Loading

0 comments on commit 93a5a22

Please sign in to comment.