From 1f981804189af2ec581e99f4e80c05cef053ce21 Mon Sep 17 00:00:00 2001 From: Miles Date: Thu, 4 Apr 2024 12:46:30 -0400 Subject: [PATCH 01/18] Add weakdep and compat for Observers --- Project.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Project.toml b/Project.toml index e5927dd8af..009f2a7081 100644 --- a/Project.toml +++ b/Project.toml @@ -34,6 +34,7 @@ Zeros = "bd1ec220-6eb4-527a-9b49-e79c3db6233b" ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444" [weakdeps] +Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0" VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8" [extensions] @@ -53,6 +54,7 @@ KrylovKit = "0.4.2, 0.5, 0.6, 0.7" LinearAlgebra = "1.6" LinearMaps = "3" NDTensors = "0.2.30" +Observers = "0.2" PackageCompiler = "1.0.0, 2" PackageExtensionCompat = "1" Pkg = "1.6" @@ -72,4 +74,5 @@ ZygoteRules = "0.2.2" julia = "1.6" [extras] +Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0" VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8" From f373aabd37a5b16abbfb01d25aeb1f9cb5a73b1c Mon Sep 17 00:00:00 2001 From: Miles Date: Thu, 4 Apr 2024 14:22:23 -0400 Subject: [PATCH 02/18] Try removing compat entry --- Project.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Project.toml b/Project.toml index 009f2a7081..7ed4e71264 100644 --- a/Project.toml +++ b/Project.toml @@ -54,7 +54,6 @@ KrylovKit = "0.4.2, 0.5, 0.6, 0.7" LinearAlgebra = "1.6" LinearMaps = "3" NDTensors = "0.2.30" -Observers = "0.2" PackageCompiler = "1.0.0, 2" PackageExtensionCompat = "1" Pkg = "1.6" From a36fb94c3d8f825b007f4ff71a8bdce8ca4c5e15 Mon Sep 17 00:00:00 2001 From: Miles Date: Thu, 4 Apr 2024 14:24:27 -0400 Subject: [PATCH 03/18] Remove Observers from extras --- Project.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Project.toml b/Project.toml index 7ed4e71264..9c0eed4500 100644 --- a/Project.toml +++ b/Project.toml @@ -73,5 +73,4 @@ ZygoteRules = "0.2.2" julia = "1.6" [extras] -Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0" VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8" From 9b39ea7f51d08903bb3a3ed6045bb32d6c4ec936 Mon Sep 17 00:00:00 2001 From: Miles Date: Thu, 4 Apr 2024 15:01:43 -0400 Subject: [PATCH 04/18] Try adding Pkg.resolve() to some workflows --- .github/workflows/test_itensors_base_ubuntu.yml | 1 + .github/workflows/test_ndtensors.yml | 1 + Project.toml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/test_itensors_base_ubuntu.yml b/.github/workflows/test_itensors_base_ubuntu.yml index c991a2dd0b..e7240b002c 100644 --- a/.github/workflows/test_itensors_base_ubuntu.yml +++ b/.github/workflows/test_itensors_base_ubuntu.yml @@ -39,6 +39,7 @@ jobs: using Pkg; Pkg.develop(path="."); Pkg.develop(path="./NDTensors"); + Pkg.resolve(); - name: Run the tests shell: julia --project=monorepo {0} run: | diff --git a/.github/workflows/test_ndtensors.yml b/.github/workflows/test_ndtensors.yml index 9109345bd5..0e373115d6 100644 --- a/.github/workflows/test_ndtensors.yml +++ b/.github/workflows/test_ndtensors.yml @@ -36,6 +36,7 @@ jobs: using Pkg; Pkg.develop(path="."); Pkg.develop(path="./NDTensors"); + Pkg.resolve(); - name: Run the tests run: | julia --project=monorepo --depwarn=yes -e 'using Pkg; Pkg.test("NDTensors")' diff --git a/Project.toml b/Project.toml index 9c0eed4500..7ed4e71264 100644 --- a/Project.toml +++ b/Project.toml @@ -73,4 +73,5 @@ ZygoteRules = "0.2.2" julia = "1.6" [extras] +Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0" VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8" From a7a65d4ea3a99ac514822c3c04005af70a0bec64 Mon Sep 17 00:00:00 2001 From: Miles Date: Wed, 10 Apr 2024 22:57:05 +0200 Subject: [PATCH 05/18] Correct call to update_observer! in alternating_update --- src/ITensorMPS/alternating_update.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ITensorMPS/alternating_update.jl b/src/ITensorMPS/alternating_update.jl index 3770f8b86e..63c62154c6 100644 --- a/src/ITensorMPS/alternating_update.jl +++ b/src/ITensorMPS/alternating_update.jl @@ -98,7 +98,7 @@ function alternating_update( ) end current_time += time_step - update!(step_observer!; psi, sweep, outputlevel, current_time) + update_observer!(step_observer!; psi, sweep, outputlevel, current_time) if outputlevel >= 1 print("After sweep ", sweep, ":") print(" maxlinkdim=", maxlinkdim(psi)) From 2a59eb64005e38f7f7e8c4c75e419d682c37820f Mon Sep 17 00:00:00 2001 From: Miles Date: Fri, 12 Apr 2024 23:03:22 +0200 Subject: [PATCH 06/18] Add Observers package extension --- Project.toml | 1 + ext/ITensorsObserversExt/ITensorsObserversExt.jl | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 ext/ITensorsObserversExt/ITensorsObserversExt.jl diff --git a/Project.toml b/Project.toml index 6a2b7890f5..74cbcc273f 100644 --- a/Project.toml +++ b/Project.toml @@ -38,6 +38,7 @@ Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0" VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8" [extensions] +ITensorsObserversExt = "Observers" ITensorsVectorInterfaceExt = "VectorInterface" [compat] diff --git a/ext/ITensorsObserversExt/ITensorsObserversExt.jl b/ext/ITensorsObserversExt/ITensorsObserversExt.jl new file mode 100644 index 0000000000..f5829b99be --- /dev/null +++ b/ext/ITensorsObserversExt/ITensorsObserversExt.jl @@ -0,0 +1,11 @@ +module ITensorsObserversExt + +using Observers: Observers +using Observers.DataFrames: AbstractDataFrame +using ITensors.ITensorMPS: ITensorMPS + +function ITensorMPS.update_observer!(observer::AbstractDataFrame; kwargs...) + return Observers.update!(observer; kwargs...) +end + +end From 47dd422593d6069f4058ea9cade06aab32b19286 Mon Sep 17 00:00:00 2001 From: Miles Date: Fri, 12 Apr 2024 23:42:09 +0200 Subject: [PATCH 07/18] Try improving ITensorTDVP test [no ci] --- .github/workflows/comment_trigger_test_itensortdvp.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/comment_trigger_test_itensortdvp.yml b/.github/workflows/comment_trigger_test_itensortdvp.yml index eb557bb55b..dcf51c9228 100644 --- a/.github/workflows/comment_trigger_test_itensortdvp.yml +++ b/.github/workflows/comment_trigger_test_itensortdvp.yml @@ -51,6 +51,8 @@ jobs: run: | using Pkg; Pkg.add("ITensorTDVP"); + Pkg.activate(temp=true); + Pkg.develop("ITensors"); Pkg.test("ITensorTDVP"); - name: Set latest commit status as ${{ job.status }} uses: myrotvorets/set-commit-status-action@master From 3a1fb01411d38c175f4d60c2fe6783f994de47ba Mon Sep 17 00:00:00 2001 From: Miles Date: Sat, 13 Apr 2024 18:36:51 +0200 Subject: [PATCH 08/18] Change ITensorTDVP workflow, based on itensors base --- .../comment_trigger_test_itensortdvp.yml | 79 ------------------- .github/workflows/test_itensortdvp.yml | 49 ++++++++++++ 2 files changed, 49 insertions(+), 79 deletions(-) delete mode 100644 .github/workflows/comment_trigger_test_itensortdvp.yml create mode 100644 .github/workflows/test_itensortdvp.yml diff --git a/.github/workflows/comment_trigger_test_itensortdvp.yml b/.github/workflows/comment_trigger_test_itensortdvp.yml deleted file mode 100644 index dcf51c9228..0000000000 --- a/.github/workflows/comment_trigger_test_itensortdvp.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Run ITensorTDVP tests from comment trigger - -# https://dev.to/zirkelc/trigger-github-workflow-for-comment-on-pull-request-45l2 - -on: - issue_comment: - types: [created] - -jobs: - deploy: - name: Deploy - if: github.event.issue.pull_request && contains(github.event.comment.body, '[test ITensorTDVP]') - runs-on: ${{ matrix.os }} - env: - JULIA_NUM_THREADS: ${{ matrix.threads }} - strategy: - matrix: - version: - - '1' - os: - - ubuntu-latest - threads: - - '2' - arch: - - x64 - steps: - - name: Get PR branch - uses: xt0rted/pull-request-comment-branch@v1 - id: comment-branch - - name: Set latest commit status as pending - uses: myrotvorets/set-commit-status-action@master - with: - sha: ${{ steps.comment-branch.outputs.head_sha }} - token: ${{ secrets.GITHUB_TOKEN }} - status: pending - - name: Checkout PR branch - uses: actions/checkout@v3 - with: - # https://github.com/actions/checkout/issues/331#issuecomment-1438220926 - ref: refs/pull/${{ github.event.issue.number }}/head - - name: Setup Node.js 16 - uses: actions/setup-node@v3 - with: - node-version: 16 - - uses: julia-actions/setup-julia@latest - with: - version: ${{ matrix.version }} - arch: ${{ matrix.arch }} - - name: Install Julia dependencies - shell: julia --project=monorepo {0} - run: | - using Pkg; - Pkg.add("ITensorTDVP"); - Pkg.activate(temp=true); - Pkg.develop("ITensors"); - Pkg.test("ITensorTDVP"); - - name: Set latest commit status as ${{ job.status }} - uses: myrotvorets/set-commit-status-action@master - if: always() - with: - sha: ${{ steps.comment-branch.outputs.head_sha }} - token: ${{ secrets.GITHUB_TOKEN }} - status: ${{ job.status }} - - name: Add comment to PR - uses: actions/github-script@v6 - if: always() - with: - script: | - const name = '${{ github.workflow }}'; - const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; - const success = '${{ job.status }}' === 'success'; - const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`; - - await github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: body - }) diff --git a/.github/workflows/test_itensortdvp.yml b/.github/workflows/test_itensortdvp.yml new file mode 100644 index 0000000000..9f69598364 --- /dev/null +++ b/.github/workflows/test_itensortdvp.yml @@ -0,0 +1,49 @@ +name: Run ITensorTDVP tests from comment trigger + +# https://dev.to/zirkelc/trigger-github-workflow-for-comment-on-pull-request-45l2 + +on: + push: + branches: + - main + tags: '*' + pull_request: + +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ matrix.threads }} thread(s) + runs-on: ${{ matrix.os }} + env: + JULIA_NUM_THREADS: ${{ matrix.threads }} + strategy: + matrix: + version: + - '1.6' + - '1' + os: + - ubuntu-latest + threads: + - '2' + arch: + - x64 + exclude: + # MacOS not available on x86 + - {os: 'macOS-latest', arch: 'x86'} + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@latest + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - name: Install Julia dependencies and run tests + shell: julia {0} + run: | + using Pkg; + Pkg.activate(temp=true); + Pkg.develop(path="./NDTensors"); + Pkg.develop(path="."); + Pkg.add("ITensorTDVP"); + Pkg.test("ITensorTDVP"); + - uses: julia-actions/julia-uploadcodecov@latest + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 7e349ebe6c4c100f58ffac6eef8720649735c7ab Mon Sep 17 00:00:00 2001 From: Miles Date: Sat, 13 Apr 2024 18:37:23 +0200 Subject: [PATCH 09/18] Remove extra line from test_ndtensors.yml --- .github/workflows/test_ndtensors.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test_ndtensors.yml b/.github/workflows/test_ndtensors.yml index 3815e70222..fcbc39b2b1 100644 --- a/.github/workflows/test_ndtensors.yml +++ b/.github/workflows/test_ndtensors.yml @@ -38,4 +38,3 @@ jobs: Pkg.develop(path="./NDTensors"); Pkg.develop(path="."); Pkg.test("NDTensors"); - \ No newline at end of file From d55d7730a84cf666122c0c0466206f9ecceeae9d Mon Sep 17 00:00:00 2001 From: Miles Date: Sat, 13 Apr 2024 19:17:23 +0200 Subject: [PATCH 10/18] Add test print statement (will remove) [no ci] --- src/ITensorMPS/tdvp.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ITensorMPS/tdvp.jl b/src/ITensorMPS/tdvp.jl index 39e82c2140..6e6368a276 100644 --- a/src/ITensorMPS/tdvp.jl +++ b/src/ITensorMPS/tdvp.jl @@ -58,6 +58,7 @@ function itensortdvp_tdvp( solver_outputlevel=default_solver_outputlevel(solver_function), kwargs..., ) + println("Testing PR 1381") return itensortdvp_tdvp( tdvp_solver( solver_function; From 716323226deb57570242dca8f0dca2b4643db140 Mon Sep 17 00:00:00 2001 From: Miles Date: Sat, 13 Apr 2024 19:45:39 +0200 Subject: [PATCH 11/18] Update .github/workflows/test_itensortdvp.yml Co-authored-by: Matt Fishman --- .github/workflows/test_itensortdvp.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test_itensortdvp.yml b/.github/workflows/test_itensortdvp.yml index 9f69598364..a3719bf6d2 100644 --- a/.github/workflows/test_itensortdvp.yml +++ b/.github/workflows/test_itensortdvp.yml @@ -1,6 +1,4 @@ -name: Run ITensorTDVP tests from comment trigger - -# https://dev.to/zirkelc/trigger-github-workflow-for-comment-on-pull-request-45l2 +name: Run ITensorTDVP tests (Unbuntu) on: push: From 86bf4f529aa86c6cca30425c900755c892e54478 Mon Sep 17 00:00:00 2001 From: Miles Date: Sat, 13 Apr 2024 19:46:48 +0200 Subject: [PATCH 12/18] Rename workflow file [no ci] --- .../{test_itensortdvp.yml => test_itensortdvp_ubuntu.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{test_itensortdvp.yml => test_itensortdvp_ubuntu.yml} (100%) diff --git a/.github/workflows/test_itensortdvp.yml b/.github/workflows/test_itensortdvp_ubuntu.yml similarity index 100% rename from .github/workflows/test_itensortdvp.yml rename to .github/workflows/test_itensortdvp_ubuntu.yml From e58ec77354602e34f1f808a96cb8ef79dc4a55dd Mon Sep 17 00:00:00 2001 From: Miles Date: Sun, 14 Apr 2024 10:47:43 +0200 Subject: [PATCH 13/18] Remove code coverage part of workflow --- .github/workflows/test_itensortdvp_ubuntu.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test_itensortdvp_ubuntu.yml b/.github/workflows/test_itensortdvp_ubuntu.yml index a3719bf6d2..65d4ce8e4d 100644 --- a/.github/workflows/test_itensortdvp_ubuntu.yml +++ b/.github/workflows/test_itensortdvp_ubuntu.yml @@ -42,6 +42,3 @@ jobs: Pkg.develop(path="."); Pkg.add("ITensorTDVP"); Pkg.test("ITensorTDVP"); - - uses: julia-actions/julia-uploadcodecov@latest - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From c3fbb73e52e239f5b0000ed57dc2f5eb4700ed9b Mon Sep 17 00:00:00 2001 From: Miles Date: Sun, 14 Apr 2024 10:53:13 +0200 Subject: [PATCH 14/18] Move test printing statement [no ci] --- src/ITensorMPS/abstractprojmpo/projmpo_apply.jl | 1 + src/ITensorMPS/tdvp.jl | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ITensorMPS/abstractprojmpo/projmpo_apply.jl b/src/ITensorMPS/abstractprojmpo/projmpo_apply.jl index 9134aad563..174a85887d 100644 --- a/src/ITensorMPS/abstractprojmpo/projmpo_apply.jl +++ b/src/ITensorMPS/abstractprojmpo/projmpo_apply.jl @@ -65,6 +65,7 @@ function makeL!(P::ProjMPOApply, psi::MPS, k::Int) end function makeR!(P::ProjMPOApply, psi::MPS, k::Int) + println("Testing PR 1381") # Save the last `R` that is made to help with caching # for DiskProjMPO rl = P.rpos diff --git a/src/ITensorMPS/tdvp.jl b/src/ITensorMPS/tdvp.jl index 6e6368a276..39e82c2140 100644 --- a/src/ITensorMPS/tdvp.jl +++ b/src/ITensorMPS/tdvp.jl @@ -58,7 +58,6 @@ function itensortdvp_tdvp( solver_outputlevel=default_solver_outputlevel(solver_function), kwargs..., ) - println("Testing PR 1381") return itensortdvp_tdvp( tdvp_solver( solver_function; From a62e91f14accb3c916d987559ec1b3eaf0fe4a3b Mon Sep 17 00:00:00 2001 From: Miles Date: Sun, 14 Apr 2024 11:06:54 +0200 Subject: [PATCH 15/18] Commit to restart tests --- src/ITensorMPS/abstractprojmpo/projmpo_apply.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ITensorMPS/abstractprojmpo/projmpo_apply.jl b/src/ITensorMPS/abstractprojmpo/projmpo_apply.jl index 174a85887d..47afb9bf2f 100644 --- a/src/ITensorMPS/abstractprojmpo/projmpo_apply.jl +++ b/src/ITensorMPS/abstractprojmpo/projmpo_apply.jl @@ -66,6 +66,7 @@ end function makeR!(P::ProjMPOApply, psi::MPS, k::Int) println("Testing PR 1381") + # Save the last `R` that is made to help with caching # for DiskProjMPO rl = P.rpos From 561e0a9e74867c501de4e1c67a47cb52769a536d Mon Sep 17 00:00:00 2001 From: Miles Date: Mon, 15 Apr 2024 21:06:44 -0400 Subject: [PATCH 16/18] Wrap ITensorTDVP in a try catch block --- .github/workflows/test_itensortdvp_ubuntu.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_itensortdvp_ubuntu.yml b/.github/workflows/test_itensortdvp_ubuntu.yml index 65d4ce8e4d..0e8611ff44 100644 --- a/.github/workflows/test_itensortdvp_ubuntu.yml +++ b/.github/workflows/test_itensortdvp_ubuntu.yml @@ -37,8 +37,17 @@ jobs: shell: julia {0} run: | using Pkg; - Pkg.activate(temp=true); - Pkg.develop(path="./NDTensors"); - Pkg.develop(path="."); - Pkg.add("ITensorTDVP"); - Pkg.test("ITensorTDVP"); + try + Pkg.activate(temp=true); + Pkg.develop(path="./NDTensors"); + Pkg.develop(path="."); + Pkg.add("ITensorTDVP"); + Pkg.test("ITensorTDVP"); + catch err + err isa Pkg.Resolve.ResolverError || rethrow() + # If we can't resolve that means this is incompatible by SemVer and this is fine + # It means we marked this as a breaking change, so we don't need to worry about + # Mistakenly introducing a breaking change, as we have intentionally made one + @info "ITensorTDVP not compatible with this release. Skipping this test." exception=err + exit(0) # Exit immediately, as a success + end From c66a97f70c0582deedc0b402afdf29b9ec59a45f Mon Sep 17 00:00:00 2001 From: Miles Date: Mon, 15 Apr 2024 21:09:24 -0400 Subject: [PATCH 17/18] Move PR test printing statement (will remove before merging) --- src/ITensorMPS/abstractmps.jl | 2 ++ src/ITensorMPS/abstractprojmpo/projmpo_apply.jl | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ITensorMPS/abstractmps.jl b/src/ITensorMPS/abstractmps.jl index c4b98a2716..3126caeb1e 100644 --- a/src/ITensorMPS/abstractmps.jl +++ b/src/ITensorMPS/abstractmps.jl @@ -1220,6 +1220,8 @@ the full inner product of the MPS/MPO with itself. See also [`lognorm`](@ref). """ function norm(M::AbstractMPS) + println("Using PR #1381") + if isortho(M) return norm(M[orthocenter(M)]) end diff --git a/src/ITensorMPS/abstractprojmpo/projmpo_apply.jl b/src/ITensorMPS/abstractprojmpo/projmpo_apply.jl index 47afb9bf2f..9134aad563 100644 --- a/src/ITensorMPS/abstractprojmpo/projmpo_apply.jl +++ b/src/ITensorMPS/abstractprojmpo/projmpo_apply.jl @@ -65,8 +65,6 @@ function makeL!(P::ProjMPOApply, psi::MPS, k::Int) end function makeR!(P::ProjMPOApply, psi::MPS, k::Int) - println("Testing PR 1381") - # Save the last `R` that is made to help with caching # for DiskProjMPO rl = P.rpos From 5b38c22014449ac3cbf0c1fe6ffd4b7ba196f68c Mon Sep 17 00:00:00 2001 From: Miles Date: Mon, 15 Apr 2024 21:32:40 -0400 Subject: [PATCH 18/18] Remove debug printing statement --- src/ITensorMPS/abstractmps.jl | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ITensorMPS/abstractmps.jl b/src/ITensorMPS/abstractmps.jl index 3126caeb1e..c4b98a2716 100644 --- a/src/ITensorMPS/abstractmps.jl +++ b/src/ITensorMPS/abstractmps.jl @@ -1220,8 +1220,6 @@ the full inner product of the MPS/MPO with itself. See also [`lognorm`](@ref). """ function norm(M::AbstractMPS) - println("Using PR #1381") - if isortho(M) return norm(M[orthocenter(M)]) end