Skip to content

Commit

Permalink
Merge branch 'fastsim-3' of github.com:NREL/fastsim into f3/thermal
Browse files Browse the repository at this point in the history
  • Loading branch information
calbaker committed Dec 16, 2024
2 parents 249cf7e + fcde5a1 commit 12b4ea6
Show file tree
Hide file tree
Showing 29 changed files with 1,592 additions and 171 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Build and Test

on: [push]

jobs:
build-and-test:
name: build py3.${{ matrix.python-version }} on ${{ matrix.platform || matrix.os.base }}-${{ matrix.os.version }}
strategy:
fail-fast: true
# NOTE: In the matrix below, we call out macos 13 and latest (> 13) explicitly. This is to enable running on both Intel and Apple Silicon for Mac.
# As of this writing, MacOS 13 is Intel and MacOS 14 and above is Apple Silicon. Ideally, the Apple transition to their new chip occurs fast and
# we can drop macos-13 checks and then just use 'latest'.
matrix:
os:
- base: ubuntu
version: latest
- base: macos
version: '13'
arch: 'x86_64'
- base: macos
version: 'latest'
arch: 'arm64'
- base: windows
version: latest
arch: 'amd64'
python-version:
- "10"
- "11"
include:
- os:
base: ubuntu
version: latest
platform: linux
- os:
base: windows
version: latest
ls: dir
runs-on: ${{ format('{0}-{1}', matrix.os.base, matrix.os.version) }}
steps:
- uses: actions/checkout@v4

- name: set up rust
uses: dtolnay/rust-toolchain@stable

- name: install rust target for MacOS 14 (Apple Silicon)
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
if: matrix.os.base == 'macos' && matrix.os.version == '14'

- name: install rust target for MacOS 13 (Intel Mac)
run: rustup target add x86_64-apple-darwin aarch64-apple-darwin
if: matrix.os.base == 'macos' && matrix.os.version == '13'

- name: Update minimum supported MacOS for Wheels for MacOS 13 (Intel Mac)
run: echo "MACOSX_DEPLOYMENT_TARGET=10.12" >> $GITHUB_ENV
if: matrix.os.base == 'macos' && matrix.os.version == '13'

- name: run cargo tests
run: cargo test

- name: set up python
uses: actions/setup-python@v4
# uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: install python dependencies
run: python -m pip install --upgrade pip setuptools wheel twine cibuildwheel pytest

- name: build source distribution
if: matrix.os.base == 'ubuntu' && matrix.python-version == '10'
run: |
python -m pip install -U setuptools-rust
python -c "import setuptools; setuptools.setup()" sdist
- name: install FASTSim python
run: python -m pip install -e .[dev]

- name: run pytest
run: pytest -v

- name: build ${{ matrix.platform || matrix.os.base }} binaries
run: cibuildwheel --output-dir dist
env:
CIBW_BUILD: "cp3${{ matrix.python-version }}-*"
CIBW_SKIP: "*-win32 *-musllinux* *i686 *ppc64le *s390x *aarch64"
CIBW_PLATFORM: ${{ matrix.platform || matrix.os.base }}
# TODO: why doesn't pytest work with cibuildwheel?
# CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests"
CIBW_TEST_COMMAND: "python -m unittest discover {project}/python/fastsim/tests"
CIBW_ARCHS_MACOS: "${{ matrix.os.arch }}"
# see https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2
CIBW_TEST_SKIP: "*_universal2:arm64"
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH"'
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"'
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
CIBW_MANYLINUX_I686_IMAGE: "manylinux2014"
CIBW_BEFORE_BUILD: >
pip install -U setuptools-rust &&
rustup default stable &&
rustup show
CIBW_BEFORE_BUILD_LINUX: >
yum -y install openssl openssl-devel &&
pip install -U setuptools-rust &&
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y &&
rustup show
- name: list dist files
run: ${{ matrix.ls || 'ls -lh' }} dist/

- uses: actions/upload-artifact@v4
with:
name: fastsim-${{ matrix.platform || matrix.os.base }}-${{ matrix.os.version }}-py3.${{ matrix.python }}-${{ strategy.job-index }}
path: ./dist/*

28 changes: 28 additions & 0 deletions fastsim-core/resources/interpolators/res/default_1d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
Interp1D:
x:
- -5.0
- -3.0
- -1.0
- -0.5
- -0.1
- 0.1
- 0.5
- 1.0
- 2.0
- 3.0
- 5.0
f_x:
- 0.892085814015878
- 0.935630351894604
- 0.978612548997097
- 0.989309767361546
- 0.997862182940346
- 0.997883658588665
- 0.989234853052088
- 0.977987897893482
- 0.953873809588552
- 0.927243266086586
- 0.864025853742296
strategy: Linear
extrapolate: Error
150 changes: 150 additions & 0 deletions fastsim-core/resources/interpolators/res/default_2d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
---
Interp2D:
x:
- -5.0
- -3.0
- -1.0
- -0.5
- -0.1
- 0.1
- 0.5
- 1.0
- 2.0
- 3.0
- 5.0
y:
- 0.0
- 0.1
- 0.2
- 0.3
- 0.4
- 0.5
- 0.6
- 0.7
- 0.8
- 0.9
- 1.0
f_xy:
- - 0.7607187
- 0.81966529
- 0.8611263
- 0.87869186
- 0.88613198
- 0.89208581
- 0.89683263
- 0.89357529
- 0.90125565
- 0.91020575
- 0.91979128
- - 0.85965783
- 0.89333392
- 0.91743447
- 0.9277388
- 0.93211889
- 0.93563035
- 0.93843387
- 0.93650968
- 0.94104921
- 0.94635013
- 0.95203966
- - 0.95383795
- 0.96473403
- 0.9726188
- 0.97600916
- 0.97745343
- 0.97861255
- 0.97953876
- 0.97890298
- 0.9804034
- 0.98215759
- 0.98404277
- - 0.97695222
- 0.9823822
- 0.98631663
- 0.98800948
- 0.9887308
- 0.98930977
- 0.98977244
- 0.98945485
- 0.9902044
- 0.99108084
- 0.99202285
- - 0.99539269
- 0.99647745
- 0.9972638
- 0.99760222
- 0.99774643
- 0.99786218
- 0.99795469
- 0.99789119
- 0.99804106
- 0.9982163
- 0.99840467
- - 0.99619981
- 0.99686932
- 0.99736582
- 0.99764729
- 0.9977849
- 0.99788366
- 0.99797273
- 0.99800143
- 0.99818886
- 0.99830355
- 0.99835808
- - 0.98039606
- 0.98394049
- 0.98654322
- 0.98800913
- 0.98872331
- 0.98923485
- 0.98969547
- 0.98984376
- 0.99081042
- 0.99140046
- 0.99168058
- - 0.95914034
- 0.96678736
- 0.97232604
- 0.97541778
- 0.97691694
- 0.9779879
- 0.97895023
- 0.97925963
- 0.98127177
- 0.9824959
- 0.98307598
- - 0.91045761
- 0.92856982
- 0.94125462
- 0.94818756
- 0.95151271
- 0.95387381
- 0.95598541
- 0.95666232
- 0.96104109
- 0.96368544
- 0.96493344
- - 0.85049607
- 0.88369073
- 0.90589834
- 0.91771248
- 0.92330271
- 0.92724327
- 0.93074753
- 0.93186694
- 0.9390631
- 0.94337174
- 0.94539568
- - 0.66282253
- 0.76132337
- 0.81648094
- 0.84336438
- 0.85558664
- 0.86402585
- 0.87141433
- 0.8737522
- 0.88853401
- 0.89718896
- 0.90120638
strategy: Linear
extrapolate: Error
Loading

0 comments on commit 12b4ea6

Please sign in to comment.