-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix cuda import position * fix chimera pathological * fix chimera overlap python * fix search to clear proper cache * add Exhaustive * restore NNlib * comment out working tests (for now) * fixed hamming tests * fixed hamming_distance in search and tests * fix testów * uncoment all tests * search chimera full passes * fixed the chimera_pathological_Z2 test * bugfix * fix repeated function definitions * comment out long tests * moved gauges to experimental so that they dont stop release (feature is not ready) * uncomment tests * fix deps * remove prints * make tests pass again * update exhaustive versions * update CI workflow --------- Co-authored-by: tomsmierz <[email protected]>
- Loading branch information
Showing
23 changed files
with
353 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,41 @@ | ||
name: CI | ||
on: | ||
- push | ||
- pull_request | ||
pull_request: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
jobs: | ||
test: | ||
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} | ||
runs-on: ${{ matrix.os }} | ||
name: Julia ${{ matrix.version }} | ||
runs-on: [self-hosted,titan,gpu] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: | ||
- '1.5' | ||
os: | ||
- ubuntu-latest | ||
- macOS-latest | ||
arch: | ||
- x64 | ||
- '1.9' | ||
- '1.10' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@v1 | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v2 | ||
with: | ||
version: ${{ matrix.version }} | ||
arch: ${{ matrix.arch }} | ||
- uses: julia-actions/julia-buildpkg@latest | ||
- uses: julia-actions/julia-runtest@latest | ||
env: | ||
JULIA_NUM_THREADS: 4 | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
# - uses: codecov/codecov-action@v1 | ||
# with: | ||
# file: lcov.info | ||
- uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: lcov.info | ||
path-to-lcov: lcov.info | ||
parallel: true | ||
flag-name: run-${{ matrix.version }} | ||
finish: | ||
needs: test | ||
runs-on: [self-hosted,titan] | ||
steps: | ||
- name: Close parallel build | ||
uses: coverallsapp/github-action@v1 | ||
with: | ||
parallel-finished: true | ||
carryforward: "run-1.9,run-1.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
using SpinGlassNetworks | ||
using SpinGlassTensors | ||
using SpinGlassEngine | ||
|
||
m = 4 | ||
n = 4 | ||
t = 8 | ||
|
||
L = n * m * t | ||
max_cl_states = 2^(t-0) | ||
|
||
β =0.5 | ||
bond_dim = 32 | ||
δp = 1E-3 | ||
num_states = 1000 | ||
|
||
instance = "$(@__DIR__)/instances/chimera_droplets/128power/001.txt" | ||
|
||
cl_h = clustered_hamiltonian( | ||
ising_graph(instance), | ||
max_cl_states, | ||
spectrum=full_spectrum, | ||
cluster_assignment_rule=super_square_lattice((m, n, t)) | ||
) | ||
|
||
params = MpsParameters(bond_dim, 1E-8, 10) | ||
search_params = SearchParameters(num_states, δp) | ||
|
||
# @testset "Overlaps calculated differently are the same." begin | ||
# for Lattice ∈ (SquareSingleNode, SquareCrossSingleNode) | ||
# for Sparsity ∈ (Dense, Sparse), transform ∈ all_lattice_transformations[[1]] | ||
# for Layout ∈ (GaugesEnergy, EnergyGauges, EngGaugesEng) | ||
# net = PEPSNetwork{Lattice{Layout}, Sparsity}(m, n, cl_h, transform, :id) | ||
# ctr_svd = MpsContractor{SVDTruncate, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate_truncate, params; onGPU=onGPU) | ||
# ctr_anneal = MpsContractor{MPSAnnealing, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate_truncate, params; onGPU=onGPU) | ||
|
||
# @testset "Overlaps calculated for different Starategies are the same." begin | ||
# indβ = 3 | ||
# for i ∈ 1:m-1 | ||
# ψ_top = mps_top(ctr_svd, i, indβ) | ||
# ϕ_top = mps_top(ctr_anneal, i, indβ) | ||
# @test ψ_top * ψ_top ≈ 1 | ||
# @test ϕ_top * ϕ_top ≈ 1 | ||
# @test ψ_top * ϕ_top ≈ 1 | ||
# end | ||
# end | ||
# end | ||
# clear_memoize_cache() | ||
|
||
# for Layout ∈ (GaugesEnergy,) | ||
# net = PEPSNetwork{Lattice{Layout}, Sparsity}(m, n, cl_h, transform, :id) | ||
# ctr_svd = MpsContractor{SVDTruncate, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate_truncate, params; onGPU=onGPU) | ||
# @testset "Overlaps calculated in Python are the same as in Julia." begin | ||
# indβ = [4, ] | ||
# overlap_python = [0.2637787707674837, 0.2501621729619047, 0.2951954406837012] | ||
|
||
# for i ∈ vcat(1:m-1)#, m-1:-1:1) | ||
# ψ_top = mps_top(ctr_svd, i, indβ[begin]) | ||
# ψ_bot = mps(ctr_svd, i+1, indβ[begin]) | ||
# overlap1 = ψ_top * ψ_bot | ||
# @test isapprox(overlap1, overlap_python[i], atol=1e-5) | ||
# end | ||
# clear_memoize_cache() | ||
# end | ||
# end | ||
# end | ||
# end | ||
# end | ||
|
||
@testset "Updating gauges works correctly." begin | ||
for Strategy ∈ (SVDTruncate, MPSAnnealing), Sparsity ∈ (Dense, Sparse) | ||
for Layout ∈ (GaugesEnergy,) | ||
for Gauge ∈ (GaugeStrategy, ) | ||
for Lattice ∈ (SquareSingleNode, SquareCrossSingleNode), transform ∈ all_lattice_transformations | ||
net = PEPSNetwork{Lattice{Layout}, Sparsity}(m, n, cl_h, transform, :id) | ||
ctr = MpsContractor{Strategy, Gauge}(net, [β/8, β/4, β/2, β], :graduate_truncate, params; onGPU=onGPU) | ||
|
||
@testset "Overlaps calculated differently are the same." begin | ||
indβ = 3 | ||
for i ∈ 1:m-1 | ||
|
||
ψ_top = mps_top(ctr, i, indβ) | ||
ψ_bot = mps(ctr, i+1, indβ) | ||
|
||
try | ||
overlap = tr(overlap_density_matrix(ψ_top, ψ_bot, indβ)) | ||
@test overlap ≈ ψ_bot * ψ_top | ||
catch | ||
println(Strategy, " ", Sparsity, " ", Lattice, " ", i) | ||
overlap = Inf | ||
@test overlap ≈ ψ_bot * ψ_top | ||
|
||
end | ||
|
||
end | ||
end | ||
clear_memoize_cache() | ||
|
||
# @testset "ψ_bot and ψ_top are not updated in place though memoize!" begin | ||
# indβ = [3,] | ||
# for aba in 1:3, i ∈ 1:m-1 | ||
# println(aba," ", i) | ||
# ψ_top = mps_top(ctr, i, indβ[begin]) | ||
# ψ_bot = mps(ctr, i+1, indβ[begin]) | ||
|
||
# overlap_old = ψ_top * ψ_bot | ||
|
||
# update_gauges!(ctr, i, indβ, Val(:down)) | ||
|
||
# # assert that ψ_bot and ψ_top are not updated in place though memoize! | ||
# overlap_old2 = ψ_bot * ψ_top | ||
|
||
# @test overlap_old ≈ overlap_old2 | ||
|
||
|
||
# end | ||
# end | ||
# break | ||
# clear_memoize_cache() | ||
|
||
# @testset "Updating gauges from top and bottom gives the same energy." begin | ||
# indβ = [3,] | ||
# update_gauges!(ctr, m, indβ, Val(:down)) | ||
# sol_l, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) | ||
# clear_memoize_cache() | ||
# update_gauges!(ctr, m, indβ, Val(:up)) | ||
# sol_r, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) | ||
# @test sol_l.energies[begin] ≈ sol_r.energies[begin] | ||
# end | ||
# clear_memoize_cache() | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.