Skip to content

Commit

Permalink
Merge branch 'master' into ag/pr
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Giuliani committed Jan 6, 2024
2 parents fe31f7b + 6b203fd commit 580a8f6
Show file tree
Hide file tree
Showing 131 changed files with 2,706 additions and 1,571 deletions.
9 changes: 6 additions & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
[run]
parallel = true
source = simsopt
relative_files = true

[paths]
sources =
/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages
/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages
src/
/**/lib/python3.8/site-packages
/**/lib/python3.9/site-packages
/**/lib/python3.10/site-packages
/**/lib/python3.11/site-packages
4 changes: 2 additions & 2 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-11]
python-version: ["3.8"]
python-version: ["3.9"]

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

Expand All @@ -41,7 +41,7 @@ jobs:
channel-priority: strict

- name: Prepare
run: conda install -y conda-build conda-verify setuptools_scm anaconda-client
run: conda install -y conda-build conda-verify setuptools_scm anaconda-client scikit-build-core

- name: Build and upload
if: github.event_name == 'release' && github.event.action == 'published'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
matrix:
test-type: [unit, integrated]
packages: [all, vmec, spec, none]
python-version: [3.8.17, 3.9.17, 3.10.12] # To sync with coveragerc use 3 levels with python version
python-version: [3.8, 3.9, "3.10"]
include:
- python-version: 3.9.17
- python-version: 3.9
test-type: unit
packages: none
- python-version: 3.9.17
- python-version: 3.9
test-type: integrated
packages: none

Expand Down Expand Up @@ -165,15 +165,19 @@ jobs:

- name: Install simsopt package
if: contains(matrix.packages, 'spec') || contains(matrix.packages, 'all')
run: pip install -v .[MPI,SPEC]
run: |
pip install -v .
pip install mpi4py py_spec pyoculus h5py
- name: Install simsopt package
if: contains(matrix.packages, 'none')
run: pip install -v .

- name: Install simsopt package
if: contains(matrix.packages, 'vmec')
run: pip install -v .[MPI]
run: |
pip install -v .
pip install mpi4py
- name: Run serial examples as part of integrated tests
if: contains(matrix.test-type, 'integrated') && (contains(matrix.packages, 'none') || contains(matrix.packages, 'all'))
Expand Down Expand Up @@ -247,7 +251,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8.17
python-version: 3.9

- name: Install coverage
run: pip install coverage
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8]
python-version: [3.9]

steps:
- uses: actions/checkout@v3
Expand All @@ -19,13 +19,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install python dependencies
run: |
pip install flake8
- name: Run ruff
uses: chartboost/ruff-action@v1

- name: Run linting tests
run: |
export EXCLUDE="E226,E265,E266,E4,E5,E7,W,F"
flake8 --ignore $EXCLUDE src/
flake8 --ignore $EXCLUDE tests/
flake8 --ignore $EXCLUDE examples/
2 changes: 1 addition & 1 deletion .github/workflows/non_simd_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8.15] # To sync with coveragerc use 3 level
python-version: [3.9]

steps:
# First print out lots of information. We do this in separate
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8.17] # To sync with coveragerc use 3 level
python-version: [3.9]
test-type: [unit, integrated]

steps:
Expand All @@ -49,6 +49,11 @@ jobs:
set -ex
ls -l
- name: Print python location
run: |
set -ex
which python
- name: apt-get stuff needed for libstell and vmec
run: |
sudo apt-get update
Expand Down Expand Up @@ -88,7 +93,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 numpy cmake scikit-build f90nml ninja wheel setuptools sympy qsc pyevtk matplotlib plotly networkx pygraphviz mpi4py py_spec pyoculus h5py
- name: Install booz_xform
run: pip install -v git+https://github.com/hiddenSymmetries/booz_xform
Expand Down Expand Up @@ -130,8 +135,6 @@ jobs:
run: |
cd SPEC
pip install .
# python setup.py bdist_wheel
# pip install dist/*.whl
- name: Try import spec
run: python -c "import spec.spec_f90wrapped as spec; print(spec.constants.version)"
Expand Down Expand Up @@ -159,7 +162,8 @@ jobs:
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: 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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'

- name: Download all submodules
run: git submodule update --init
Expand Down
7 changes: 5 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Required
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.8"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py
Expand All @@ -11,9 +16,7 @@ sphinx:
# formats:
# - pdf

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
install:
- requirements: docs/requirements.txt
- requirements: requirements.txt
Expand Down
21 changes: 14 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
cmake_minimum_required(VERSION 3.15)
project(simsoptpp)
project(simsoptpp LANGUAGES CXX)
#set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(Python_FIND_STRATEGY LOCATION)
find_package(Python 3 COMPONENTS Interpreter Development.Module NumPy)
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module NumPy)
find_package(pybind11 CONFIG REQUIRED)

message(status "Python executable is ${Python_EXECUTABLE}")
message(status "Python Development Module found value is ${Python_Development.Module_FOUND}")
Expand Down Expand Up @@ -40,8 +41,12 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})

include(CheckCXXCompilerFlag)
IF(DEFINED ENV{CI})
message(STATUS "CI environment detected. Set compilation flags targetting Westmere microarch.")
set(CMAKE_CXX_FLAGS "-O3 -march=westmere")
if (APPLE)
set(CMAKE_CXX_FLAGS "-O3")
else()
message(STATUS "CI environment detected. Set compilation flags targetting Westmere microarch.")
set(CMAKE_CXX_FLAGS "-O3 -march=westmere")
endif()
elseif(DEFINED ENV{CONDA_BUILD})
message(STATUS "conda build environment detected. Let conda set compilation flags accordingly.")
# set(CMAKE_CXX_FLAGS "-O3 -march=ivybridge -mfma -ffp-contract=fast")
Expand All @@ -58,6 +63,8 @@ else()
set(CMAKE_CXX_FLAGS "-O3 -ffp-contract=fast")
endif()
endif()
# Ensure all code used from Eigen does not have LGPL license:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_MPL2_ONLY")
message(STATUS "CMAKE_CXX_FLAGS are ${CMAKE_CXX_FLAGS}")

if(DEFINED ENV{CONDA_PREFIX})
Expand Down Expand Up @@ -104,7 +111,7 @@ else()
message(STATUS "Boost include dirs are ${Boost_INCLUDE_DIRS}")
endif()

add_subdirectory(thirdparty/pybind11)
# add_subdirectory(thirdparty/pybind11)
add_subdirectory(thirdparty/fmt EXCLUDE_FROM_ALL)
set(XTENSOR_USE_OPENMP 0)
set(XTENSOR_USE_TBB 0)
Expand All @@ -117,7 +124,7 @@ pybind11_add_module(${PROJECT_NAME}
src/simsoptpp/biot_savart_py.cpp
src/simsoptpp/biot_savart_vjp_py.cpp
src/simsoptpp/regular_grid_interpolant_3d_py.cpp
src/simsoptpp/curve.cpp src/simsoptpp/curverzfourier.cpp src/simsoptpp/curvexyzfourier.cpp
src/simsoptpp/curve.cpp src/simsoptpp/curverzfourier.cpp src/simsoptpp/curvexyzfourier.cpp src/simsoptpp/curveplanarfourier.cpp
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
Expand Down Expand Up @@ -163,4 +170,4 @@ target_link_libraries(profiling PRIVATE fmt::fmt-header-only)
#install(TARGETS ${PROJECT_NAME}
# #LIBRARY
# DESTINATION src/${PROJECT_NAME})
#install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${PROJECT_NAME})
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION .)
Loading

0 comments on commit 580a8f6

Please sign in to comment.