Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gr/parsing overhaul #95

Merged
merged 18 commits into from
Feb 21, 2023
Merged

Gr/parsing overhaul #95

merged 18 commits into from
Feb 21, 2023

Conversation

GeorgeR227
Copy link
Collaborator

This pull request is meant to improve the parsing and creation of Decapodes.

@lukem12345
Copy link
Member

Commit f4c5a1e fixes a hitherto unknown bug with a composed vector of functions applied to two variables, i.e. a chain of Op2s. The computational meaning of a chain of operators such as C == \circ(f,g)(A,B) is not yet decided. This could mean that the function g is an Op2 as we typically understand it, and f is an Op1, or it could mean that g is an Op2 as we typically understand it, and f is an Op2 that takes a copy of g(A,B) as its two arguments.

No Decapode use cases have run into this scenario before, so how to compile this is still unknown. The compile function should be amended to check if an :op2 is a vector, and raise a legible error if so.

@lukem12345
Copy link
Member

lukem12345 commented Jan 30, 2023

Currently, the following Decapode does not parse:

G = SummationDecapode(parse_decapode(quote
	(A,B,C,D,E)::infer{X}
	B == \circ(g)(f(A))
	E == \circ(i)(h(C,D))
end))

Interestingly, we note that the following does parse:

G = SummationDecapode(parse_decapode(quote
	(A,B,C,D,E)::infer{X}
	B == g(\circ(f)(A))
	E == i(\circ(h)(C,D))
end))

Both of these cases should be supported.

@GeorgeR227
Copy link
Collaborator Author

I believe that issue should be solved by commit a3b1d7f.

@lukem12345
Copy link
Member

lukem12345 commented Feb 6, 2023

New features that this branch allows are:

@GeorgeR227 GeorgeR227 marked this pull request as ready for review February 10, 2023 16:30
@lukem12345 lukem12345 merged commit 69d63b5 into main Feb 21, 2023
GeorgeR227 added a commit that referenced this pull request Mar 27, 2023
commit 9fc12f8
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 20 12:08:24 2023 -0400

    fix missing compat entries

commit 7533c9f
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 20 10:48:23 2023 -0400

    add more contributors

commit 71a015f
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 20 10:39:05 2023 -0400

    fix github action versionf for julia-actions

commit 1790e48
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Tue Mar 7 15:28:59 2023 -0500

    Import compile from Catlab.Programs (#104)

commit e7ffee9
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Wed Feb 22 00:53:43 2023 -0500

    Fix old tests and add compatibility specs (#103)

    * Explicitly give initial primal orientations

    * Fix MvNormal deprecation

    * Set some compatibilities

commit 69d63b5
Author: GeorgeR227 <78235421+GeorgeR227@users.noreply.github.com>
Date:   Tue Feb 21 17:46:08 2023 -0500

    Gr/parsing overhaul (#95)

    * Basic literal support

    * Added Lit data term

    * Fix composed op2s and add test

    * Replaced Var for term in \circ decomp

    * Quick patch for arbitrary multiplication support.

    * Fixed Tvar's unable to parse on rhs

    * Added inferred spaces for variables

    * Do not infer literals as states

    * Check types are in recognized set

    * Fixed strange TVar behavior

    * Fix cache invalidation error and add tests

    * Add new parsing features tests

    * Updated visualization for support new parsing.

    Also cleaned up the parsing code.

    * Support Literals in simulations

    * Do not namespace Literals, and do not vcat Nothing

    * Move CombinatorialSpaces using

    * Remove erroneous for loop

    ---------

    Co-authored-by: Luke Morris <lukelukemorrismorris@gmail.com>
    Co-authored-by: Luke Morris <70283489+lukem12345@users.noreply.github.com>

commit ead3181
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Sat Feb 18 13:07:37 2023 -0500

    Add Brusselator Example

    * Add Brusselator, type, and function resolve

    * Generate and run first phase of simulation

    * Change alpha and add gif

    * Perform second stage of simulation

    * Showcase using F as a time-varying parameter

    * Keep compatibility with old CombinatorialSpaces

    * Demonstrate brusselator on sphere

    * Clean and change gif frames

    * Add GLMakie back

commit 4027d3e
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Fri Feb 3 16:47:44 2023 -0500

    Check if name attribute is nothing (#96)
This was referenced Apr 24, 2023
GeorgeR227 added a commit that referenced this pull request Apr 28, 2023
commit 34ea660
Author: AlgebraicJulia Bot <129184742+algebraicjuliabot@users.noreply.github.com>
Date:   Mon Apr 24 10:39:01 2023 -0400

    Set version to 0.2.0

commit f80c513
Author: Micah Halter <micah@mehalter.com>
Date:   Fri Apr 21 09:49:04 2023 -0400

    Remove architecture specific integer types

commit 3b3ab55
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Mon Apr 10 14:55:55 2023 -0400

    Remove NamedDecapode constructor and compiler

commit d2d5cfb
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Mon Apr 10 14:44:44 2023 -0400

    Use @decapode macro

commit 28d6eb5
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 27 10:36:20 2023 -0400

    Move to organization level github actions

commit b3c2476
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Mon Mar 20 14:38:08 2023 -0400

    Remove Decapodes_v0.1 files

commit a40d7a1
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Tue Apr 18 14:46:50 2023 -0400

    Do not convert edge labels that are already Strings (#115)

commit 9fc12f8
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 20 12:08:24 2023 -0400

    fix missing compat entries

commit 7533c9f
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 20 10:48:23 2023 -0400

    add more contributors

commit 71a015f
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 20 10:39:05 2023 -0400

    fix github action versionf for julia-actions

commit 1790e48
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Tue Mar 7 15:28:59 2023 -0500

    Import compile from Catlab.Programs (#104)

commit e7ffee9
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Wed Feb 22 00:53:43 2023 -0500

    Fix old tests and add compatibility specs (#103)

    * Explicitly give initial primal orientations

    * Fix MvNormal deprecation

    * Set some compatibilities

commit 69d63b5
Author: GeorgeR227 <78235421+GeorgeR227@users.noreply.github.com>
Date:   Tue Feb 21 17:46:08 2023 -0500

    Gr/parsing overhaul (#95)

    * Basic literal support

    * Added Lit data term

    * Fix composed op2s and add test

    * Replaced Var for term in \circ decomp

    * Quick patch for arbitrary multiplication support.

    * Fixed Tvar's unable to parse on rhs

    * Added inferred spaces for variables

    * Do not infer literals as states

    * Check types are in recognized set

    * Fixed strange TVar behavior

    * Fix cache invalidation error and add tests

    * Add new parsing features tests

    * Updated visualization for support new parsing.

    Also cleaned up the parsing code.

    * Support Literals in simulations

    * Do not namespace Literals, and do not vcat Nothing

    * Move CombinatorialSpaces using

    * Remove erroneous for loop

    ---------

    Co-authored-by: Luke Morris <lukelukemorrismorris@gmail.com>
    Co-authored-by: Luke Morris <70283489+lukem12345@users.noreply.github.com>

commit ead3181
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Sat Feb 18 13:07:37 2023 -0500

    Add Brusselator Example

    * Add Brusselator, type, and function resolve

    * Generate and run first phase of simulation

    * Change alpha and add gif

    * Perform second stage of simulation

    * Showcase using F as a time-varying parameter

    * Keep compatibility with old CombinatorialSpaces

    * Demonstrate brusselator on sphere

    * Clean and change gif frames

    * Add GLMakie back

commit 4027d3e
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Fri Feb 3 16:47:44 2023 -0500

    Check if name attribute is nothing (#96)
lukem12345 added a commit that referenced this pull request May 2, 2023
* Contract operators

* Generate functions with composed ops

* Start chains from results of summations

* Define unpacked operators

* Added DEC matrix precomputation

Greatly reduces memory usage from calling DEC functions and seems to work well with contract operators

* Rough implementation of prealloc wedge product.

* Improved decapodes wedge_product

* Added support for more DEC operators

* Run Brusselator on Icosphere6

* Rearranged memory testing files

* Quick fix for Brusselator mem test

Do not run Brusselator on an earth-sized mesh!

* Prevented duplicate ops from being defined in compile_env

Strange error occuring in Simulations Test

* Fixed Multiscalearrays and Simulation tests

* Add scaffolding for recursive node deletion

* Remove pasted line

* Use stack for recursive var deletion

* Testing for memory optimizations

* Updated testing brusselator

* Remove unnecessary broadcast assignment

* Run Brusselator on GPU

* Cast to CPU for plotting

* Use views in GPU

* Fix parent check in sums and add tests

* Cleaned up testing Brusselator

* Squashed commit of the following:

commit 9fc12f8
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 20 12:08:24 2023 -0400

    fix missing compat entries

commit 7533c9f
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 20 10:48:23 2023 -0400

    add more contributors

commit 71a015f
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 20 10:39:05 2023 -0400

    fix github action versionf for julia-actions

commit 1790e48
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Tue Mar 7 15:28:59 2023 -0500

    Import compile from Catlab.Programs (#104)

commit e7ffee9
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Wed Feb 22 00:53:43 2023 -0500

    Fix old tests and add compatibility specs (#103)

    * Explicitly give initial primal orientations

    * Fix MvNormal deprecation

    * Set some compatibilities

commit 69d63b5
Author: GeorgeR227 <78235421+GeorgeR227@users.noreply.github.com>
Date:   Tue Feb 21 17:46:08 2023 -0500

    Gr/parsing overhaul (#95)

    * Basic literal support

    * Added Lit data term

    * Fix composed op2s and add test

    * Replaced Var for term in \circ decomp

    * Quick patch for arbitrary multiplication support.

    * Fixed Tvar's unable to parse on rhs

    * Added inferred spaces for variables

    * Do not infer literals as states

    * Check types are in recognized set

    * Fixed strange TVar behavior

    * Fix cache invalidation error and add tests

    * Add new parsing features tests

    * Updated visualization for support new parsing.

    Also cleaned up the parsing code.

    * Support Literals in simulations

    * Do not namespace Literals, and do not vcat Nothing

    * Move CombinatorialSpaces using

    * Remove erroneous for loop

    ---------

    Co-authored-by: Luke Morris <lukelukemorrismorris@gmail.com>
    Co-authored-by: Luke Morris <70283489+lukem12345@users.noreply.github.com>

commit ead3181
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Sat Feb 18 13:07:37 2023 -0500

    Add Brusselator Example

    * Add Brusselator, type, and function resolve

    * Generate and run first phase of simulation

    * Change alpha and add gif

    * Perform second stage of simulation

    * Showcase using F as a time-varying parameter

    * Keep compatibility with old CombinatorialSpaces

    * Demonstrate brusselator on sphere

    * Clean and change gif frames

    * Add GLMakie back

commit 4027d3e
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Fri Feb 3 16:47:44 2023 -0500

    Check if name attribute is nothing (#96)

* Started work on compiler optimizations

* Added optimizations for Op2 and Summations

* Support using mul! for op1 DEC calls

* Added optimizing compiler

Still need to handle dual forms and add specific constant/parameter typing

* Added support for DualForms in optimizations

* Cleaned up the type inference system

* Integrated optimizing compiler into Decapodes

Also added AdvDiff and Brusselator simulations to test new compilation

* Run optimizations on pressure-driven flow

Also moved out type inference rules relating to parameters.

* Squashed commit of the following:

commit 34ea660
Author: AlgebraicJulia Bot <129184742+algebraicjuliabot@users.noreply.github.com>
Date:   Mon Apr 24 10:39:01 2023 -0400

    Set version to 0.2.0

commit f80c513
Author: Micah Halter <micah@mehalter.com>
Date:   Fri Apr 21 09:49:04 2023 -0400

    Remove architecture specific integer types

commit 3b3ab55
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Mon Apr 10 14:55:55 2023 -0400

    Remove NamedDecapode constructor and compiler

commit d2d5cfb
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Mon Apr 10 14:44:44 2023 -0400

    Use @decapode macro

commit 28d6eb5
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 27 10:36:20 2023 -0400

    Move to organization level github actions

commit b3c2476
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Mon Mar 20 14:38:08 2023 -0400

    Remove Decapodes_v0.1 files

commit a40d7a1
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Tue Apr 18 14:46:50 2023 -0400

    Do not convert edge labels that are already Strings (#115)

commit 9fc12f8
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 20 12:08:24 2023 -0400

    fix missing compat entries

commit 7533c9f
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 20 10:48:23 2023 -0400

    add more contributors

commit 71a015f
Author: Micah Halter <micah@mehalter.com>
Date:   Mon Mar 20 10:39:05 2023 -0400

    fix github action versionf for julia-actions

commit 1790e48
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Tue Mar 7 15:28:59 2023 -0500

    Import compile from Catlab.Programs (#104)

commit e7ffee9
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Wed Feb 22 00:53:43 2023 -0500

    Fix old tests and add compatibility specs (#103)

    * Explicitly give initial primal orientations

    * Fix MvNormal deprecation

    * Set some compatibilities

commit 69d63b5
Author: GeorgeR227 <78235421+GeorgeR227@users.noreply.github.com>
Date:   Tue Feb 21 17:46:08 2023 -0500

    Gr/parsing overhaul (#95)

    * Basic literal support

    * Added Lit data term

    * Fix composed op2s and add test

    * Replaced Var for term in \circ decomp

    * Quick patch for arbitrary multiplication support.

    * Fixed Tvar's unable to parse on rhs

    * Added inferred spaces for variables

    * Do not infer literals as states

    * Check types are in recognized set

    * Fixed strange TVar behavior

    * Fix cache invalidation error and add tests

    * Add new parsing features tests

    * Updated visualization for support new parsing.

    Also cleaned up the parsing code.

    * Support Literals in simulations

    * Do not namespace Literals, and do not vcat Nothing

    * Move CombinatorialSpaces using

    * Remove erroneous for loop

    ---------

    Co-authored-by: Luke Morris <lukelukemorrismorris@gmail.com>
    Co-authored-by: Luke Morris <70283489+lukem12345@users.noreply.github.com>

commit ead3181
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Sat Feb 18 13:07:37 2023 -0500

    Add Brusselator Example

    * Add Brusselator, type, and function resolve

    * Generate and run first phase of simulation

    * Change alpha and add gif

    * Perform second stage of simulation

    * Showcase using F as a time-varying parameter

    * Keep compatibility with old CombinatorialSpaces

    * Demonstrate brusselator on sphere

    * Clean and change gif frames

    * Add GLMakie back

commit 4027d3e
Author: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Date:   Fri Feb 3 16:47:44 2023 -0500

    Check if name attribute is nothing (#96)

* Patched some errors caused by merging

* Cleaned up some code

Deleted unnecessary files and cleaned up default_dec_generate

* Removed return

As per request

* Shifted type inference ahead

This shift allows us to infer types for variables that were originally parameters or constants before being set to infer by the compiler.

* Removing debugging packages from Project.toml

---------

Co-authored-by: Luke Morris <lukelukemorrismorris@gmail.com>
Co-authored-by: Luke Morris <70283489+lukem12345@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants