Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8f55e94
Remove parts of generator model from BusPV (#7)
pelesh Apr 10, 2024
753aecc
Working Example of Solving RLCircuit and Microgrid with Jacobians (#1)
reid-g May 3, 2024
31b6e18
Added Scalable Microgrid Example (#11)
reid-g Jun 4, 2024
118ffbd
Organize component models by model family (#12)
pelesh Jun 11, 2024
60647ed
Fix bug in issue #17
pelesh Aug 6, 2024
bbdd595
Forward compatibility with SUNDIALS (#35)
pelesh Dec 10, 2024
5bef9ca
BugFix: Scale Microgrid Error (#30)
reid-g Dec 11, 2024
9cdd63e
Add brief style guidelines. (#5)
pelesh Dec 16, 2024
aed675a
Github actions (#36)
nkoukpaizan Dec 17, 2024
6b15e29
Fixed IDA Interface Final Copy (#37)
reid-g Dec 18, 2024
fb88866
Enzyme support example (#29)
nkoukpaizan Jan 13, 2025
942654b
Fix clang+gfortran linking (#40)
pelesh Jan 17, 2025
46ddca6
Add phasor dynamics bus and branch models (#38)
pelesh Jan 21, 2025
2ce4dce
Fixes input file issue with parameter estimation example (#44)
pelesh Jan 21, 2025
3aa27dc
Fix lookup install and downgrade to LLVM 16 (#46)
nkoukpaizan Jan 22, 2025
129cac4
Reorganize GridKit directory structure (#45)
pelesh Jan 22, 2025
a589a0d
Fix figure paths in README files (#50)
pelesh Jan 29, 2025
9059a47
Install documentation update for Suitesparse and SUNDIALS (#52)
ianmtaylor1 Jan 29, 2025
88cecaa
Improve the way to find Enzyme. (#48)
nkoukpaizan Feb 10, 2025
f33d600
Rename namespace ModelLib -> GridKit. (#56)
pelesh Feb 11, 2025
bc3f969
Aligning the code with contributing guidelines (#42)
shakedregev Feb 17, 2025
1c09d11
Phasor dynamics components modeling framework (#55)
pelesh Feb 17, 2025
77f61bd
Add missing forward declaration (#58)
alexander-novo Feb 19, 2025
7bd2825
Reorganize model evaluator implementations (#61)
pelesh Feb 21, 2025
ee4c1f4
Add dependency-tracking variable data type. (#63)
pelesh Feb 27, 2025
c3d86e6
Additional Enzyme examples and use cases (e.g DistributedGenerator) (…
nkoukpaizan Feb 27, 2025
4421f70
Set up pre-commit hook for clang-format (#68)
pelesh Mar 5, 2025
a9033f3
Updated copyright info for v0.1 release.
pelesh Mar 14, 2025
36c0631
Use v0.23.1 Spack buildcache. (#76)
nkoukpaizan Apr 5, 2025
94663f9
Add GENROUwS model for a synchronous machine (#71)
pelesh Apr 8, 2025
f0b5b04
Fix CI for ClangEnzyme (#82)
nkoukpaizan Apr 14, 2025
c86f2d5
Prepare v0.1 release (#81)
pelesh Apr 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
72 changes: 72 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
Language: Cpp
BasedOnStyle: Microsoft

# Indentation
IndentWidth: 2 # 2 spaces per indent
AccessModifierOffset: -2
IndentAccessModifiers: false # Align access modifiers to braces
NamespaceIndentation: All # Indent namspace contents
ConstructorInitializerIndentWidth: 2

# Comments which match this regex will be unformatted (and therefore can be longer or have more whitespace than other comments)
CommentPragmas: '^\*\*'


# Alignment
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
AlignCompound: true
PadOperators: true
AlignConsecutiveBitFields:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
AlignConsecutiveDeclarations:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
# For future versions of clang-format
# AlignFunctionDeclarations: false
# AlignFunctionPointers: false
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true

# Newlines
ColumnLimit: 0
BreakBeforeBraces: Allman # Braces on their own lines
SeparateDefinitionBlocks: Always # Separate definitions (functions etc.) with an empty line
AlwaysBreakTemplateDeclarations: true # Put template on their own lines
AllowShortBlocksOnASingleLine: Never
# On a newer version of clang-format, replace with BinPackArguments: OnePerLine
BinPackArguments: false # Don't allow multiple function arguments on the same line unless they all fit
BinPackParameters: false # Same but for parameters
PackConstructorInitializers: NextLine
AllowShortFunctionsOnASingleLine: None
BreakBeforeBinaryOperators: NonAssignment # Put binary operators after a line break, rather than before
AllowShortIfStatementsOnASingleLine: Never

# Spaces
SpaceBeforeParens: ControlStatementsExceptControlMacros
SpaceAfterCStyleCast: true
PointerAlignment: Left

# Includes
IncludeBlocks: Regroup # Regroup includes based on config
IncludeCategories:
- Regex: '(^"|\.hpp)' # 'local' includes
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '\/' # Library includes
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '.*' # Everything else
Priority: 1
SortPriority: 0
CaseSensitive: false
22 changes: 22 additions & 0 deletions .github/workflows/pre_commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: gridkit-bot pre-commit

# Won't run on develop/main directly
on: [pull_request]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/setup-python@v5.4.0
- uses: pre-commit/action@v3.0.1
- uses: EndBug/add-and-commit@v9.1.4
# Only need to try and commit if the action failed
if: failure()
with:
fetch: false
committer_name: GitHub Actions
committer_email: actions@github.com
message: Apply pre-commmit fixes
32 changes: 32 additions & 0 deletions .github/workflows/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Description

_Please describe the issue that is addressed (bug, new feature,
documentation, enhancement, etc.). Please also include relevant motivation and
context. List any dependencies that are required for this change._

_Closes # (issue)_


## Proposed changes

_Describe how your changes here address the issue and why the proposed changes
should be accepted._

## Checklist

_Put an `x` in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask. We're here
to help! This is simply a reminder of what we are going to look for before
merging your code._

- [ ] I have read the [Contributing Guide](CONTRIBUTING.md)
- [ ] Functionality and unit tests pass locally with my changes
- [ ] The code builds with flags `-Wall -Wconversion -Wextra` without any
compiler warnings
- [ ] I have added regression tests that prove my fix is effective.
- [ ] I have updated the documentation (if appropriate)

## Further comments

_If this is a relatively large or complex change, kick off the discussion by explaining
why you chose the solution you did and what alternatives you considered, etc..._
175 changes: 175 additions & 0 deletions .github/workflows/spack_default_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# https://spack.readthedocs.io/en/latest/binary_caches.html#spack-build-cache-for-github-actions
name: Spack Ubunutu x86_64 Buildcache

env:
SPACK_COLOR: always
REGISTRY: ghcr.io/ornl
# Our repo name contains upper case characters, so we can't use ${{ github.repository }}
IMAGE_NAME: gridkit
USERNAME: gridkit-bot
BASE_VERSION: ubuntu-24.04-fortran-v0.2.11

# Until we remove the need to clone submodules to build, this should on be in PRs
on: [pull_request]

jobs:
base_image_build:
name: Build base image
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
# No GHCR base image with skopeo, so this will do...
- name: "Set up skopeo"
uses: warjiang/setup-skopeo@v0.1.3
with:
version: latest

# Use skopeo to check for image for convenience
- name: Check for existing base images
run: |
set -e
CONTAINER_TAG=${{ env.BASE_VERSION }}
OCI_URL="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BASE_VERSION }}"
echo Checking for CONTAINER_TAG $CONTAINER_TAG
skopeo inspect \
docker://$OCI_URL \
--raw \
--creds "${{ env.USERNAME }}:${{ secrets.GITHUB_TOKEN }}" \
> /dev/null && echo "Image already exists. Please bump version." && exit 0
echo "IMAGE_EXISTS=false" >> $GITHUB_ENV

# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}

# Need to build custom base image with gfortran
- name: Create Dockerfile heredoc
if: ${{ env.IMAGE_EXISTS == 'false' }}
run: |
cat << EOF > Dockerfile
FROM ubuntu:24.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
software-properties-common \
gpg-agent \
openssh-client \
openssh-server \
&& rm -rf /var/lib/apt/lists/*
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && \
apt-get install -y --no-install-recommends \
gcc \
libstdc++6 \
&& rm -rf /var/lib/apt/lists/*
EOF

- name: Extract metadata (tags, labels) for Docker
if: ${{ env.IMAGE_EXISTS == 'false' }}
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: org.opencontainers.image.version=${{ env.BASE_VERSION }}

- name: Build and push Docker base image
if: ${{ env.IMAGE_EXISTS == 'false' }}
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BASE_VERSION }}
labels: ${{ steps.meta.outputs.labels }}

gridkit_spack_builds:
name: Build gridkit with Spack
needs: base_image_build
runs-on: ubuntu-24.04
permissions:
packages: write
contents: read
timeout-minutes: 30

strategy:
matrix:
llvm: ["16"]
# Minimal Build(s) - GHCR mirror speeds these up a lot!
spack_spec:
- gridkit@develop +enzyme

steps:
- name: Add LLVM
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-get install -y libmpfr-dev
sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -c | cut -f2`/ llvm-toolchain-`lsb_release -c | cut -f2`-${{ matrix.llvm }} main" || true
sudo apt-get install -y cmake gcc g++ llvm-${{ matrix.llvm }}-dev libomp-${{ matrix.llvm }}-dev lld-${{ matrix.llvm }} clang-${{ matrix.llvm }} libclang-${{ matrix.llvm }}-dev libeigen3-dev libboost-dev libzstd-dev

- name: Checkout
uses: actions/checkout@v4
with:
# Once we move submodule deps into spack, we can do some more builds
# Also need to change build script to use spack from base image
submodules: true

- name: Setup Spack
run: echo "$PWD/buildsystem/spack/spack/bin" >> "$GITHUB_PATH"

- name: Create heredoc spack.yaml
run: |
cat << EOF > spack.yaml
spack:
specs:
- ${{ matrix.spack_spec }} target=x86_64_v2
concretizer:
reuse: dependencies
config:
install_tree:
root: /opt/spack
padded_length: 128
mirrors:
local-buildcache: oci://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
spack: https://binaries.spack.io/v0.23.1
packages:
llvm:
externals:
- spec: llvm@${{ matrix.llvm }}
prefix: /usr/lib/llvm-${{ matrix.llvm }}
EOF

- name: Configure GHCR mirror
run: spack -e . mirror set --oci-username ${{ env.USERNAME }} --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache

- name: Trust keys
run: spack -e . buildcache keys --install --trust

- name: Find external packages
run: spack -e . external find --all --exclude llvm

- name: Spack develop gridkit
run: spack -e . develop --path=$(pwd) gridkit@develop

- name: List working directory
run: ls -ltrh $(pwd)/*/*/

- name: Concretize
run: spack -e . concretize

- name: Install dependencies
run: spack -e . install --no-check-signature --only dependencies

- name: Install package
run: spack -e . install --keep-stage --no-check-signature --no-cache --fresh

- name: Test Build
run: cd $(spack -e . location --build-dir gridkit@develop) && ctest -VV

# Push with force to override existing binaries...
- name: Push to binaries to buildcache
run: |
spack -e . buildcache push --force --base-image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BASE_VERSION }} --unsigned --update-index local-buildcache
if: ${{ !cancelled() }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
.directory
*.orig
.vscode/

*.DS_Store
build/
*.DS_Store
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "buildsystem/spack/spack"]
path = buildsystem/spack/spack
url = https://github.com/nkoukpaizan/spack.git
branch = Gridkit-package-dev+enzyme
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.7
hooks:
- id: clang-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-toml
- id: forbid-new-submodules
- id: end-of-file-fixer
- id: check-yaml
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Release Changelog

## v0.1

- Refactored code to support adding different model families.
- Added PowerElectronics family of models.
- Prototype for sparse system matrix assembly (for PowerElectronics only).
- Added PhasorDynamics family of models.
- Unit testing framework.
- GridKit now depends on Sundials >= 7.0.

## v0.0.7

- Added parser for Matpower files.
Expand Down
Loading
Loading