From e0efda83168fe7cb6d2a3ae13cf268f663a8b7e2 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 12:45:48 +0000 Subject: [PATCH 01/37] Rename `CI` to `Tests` --- .github/workflows/Tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 17b8c0e89..a5a89ab0d 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -1,4 +1,4 @@ -name: CI +name: Tests on: push: From 621410913d9ed3ae846b9d3cf9b219a50131d475 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 13:12:25 +0000 Subject: [PATCH 02/37] a bit of formatting --- .github/workflows/Tests.yml | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index a5a89ab0d..8d216a783 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -2,28 +2,23 @@ name: Tests on: push: - branches: - - master + branches: ["master"] pull_request: + workflow_dispatch: + jobs: test: - name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} + name: Julia ${{ matrix.version }} on ${{ matrix.os }} (${{ matrix.arch }}) runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.version == 'nightly' }} strategy: fail-fast: false matrix: - version: - - '1' - - '1.9' - - 'nightly' - os: - - ubuntu-latest - - macOS-latest - - windows-latest - arch: - - x64 + version: ['1', '1.9', 'nightly'] + os: [ubuntu-latest, macOS-latest, windows-latest] + arch: [x64] + # specific config for codecov include: - version: '1' os: ubuntu-latest @@ -36,8 +31,6 @@ jobs: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - uses: actions/cache@v1 - env: - cache-name: cache-artifacts with: path: ~/.julia/artifacts key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} @@ -45,6 +38,8 @@ jobs: ${{ runner.os }}-test-${{ env.cache-name }}- ${{ runner.os }}-test- ${{ runner.os }}- + env: + cache-name: cache-artifacts - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 From 1d412b2a19484e2580ea0510f07f08f08751be11 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 13:13:34 +0000 Subject: [PATCH 03/37] update `checkout` and `cache` actions to v4 --- .github/workflows/Tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 8d216a783..9e51482aa 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -25,12 +25,12 @@ jobs: arch: x64 coverage: true steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 + - uses: actions/cache@v4 with: path: ~/.julia/artifacts key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} From 202d5c6af7b56f5d381eee73e1b2214bee65acd7 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 13:24:27 +0000 Subject: [PATCH 04/37] cache packages --- .github/workflows/Tests.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 9e51482aa..091b3f833 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -24,27 +24,30 @@ jobs: os: ubuntu-latest arch: x64 coverage: true + env: + CACHE_NAME: julia-${{ matrix.version }}-${{ matrix.arch }} steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v4 + - name: Cache Julia packages and artifacts + uses: actions/cache@v4 with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} + path: | + ~/.julia + ~/.julia/artifacts + key: ${{ runner.os }}-${{ env.CACHE_NAME }}-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }} restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- - env: - cache-name: cache-artifacts + ${{ runner.os }}-${{ env.CACHE_NAME }}- + ${{ runner.os }}-julia-${{ matrix.version }}- + ${{ runner.os }}-julia- - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 if: matrix.coverage - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v4 if: matrix.coverage with: file: lcov.info From 08227e8b1fcbe2bdeb6cc2f3626f163d4e7dfa27 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 14:00:30 +0000 Subject: [PATCH 05/37] add CompatHelper --- .github/workflows/CompatHelper.yml | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/CompatHelper.yml diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml new file mode 100644 index 000000000..3dfba52e8 --- /dev/null +++ b/.github/workflows/CompatHelper.yml @@ -0,0 +1,45 @@ +name: CompatHelper +on: + schedule: + - cron: 0 0 * * * + workflow_dispatch: +permissions: + contents: write + pull-requests: write +jobs: + CompatHelper: + runs-on: ubuntu-latest + steps: + - name: Check if Julia is already available in the PATH + id: julia_in_path + run: which julia + continue-on-error: true + - name: Install Julia, but only if it is not already available in the PATH + uses: julia-actions/setup-julia@v1 + with: + version: '1' + arch: ${{ runner.arch }} + if: steps.julia_in_path.outcome != 'success' + - name: "Add the General registry via Git" + run: | + import Pkg + ENV["JULIA_PKG_SERVER"] = "" + Pkg.Registry.add("General") + shell: julia --color=yes {0} + - name: "Install CompatHelper" + run: | + import Pkg + name = "CompatHelper" + uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" + version = "3" + Pkg.add(; name, uuid, version) + shell: julia --color=yes {0} + - name: "Run CompatHelper" + run: | + import CompatHelper + CompatHelper.main() + shell: julia --color=yes {0} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} + # COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} \ No newline at end of file From f8a07456ed1597d930c821bc4b7ae918a1a31b91 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 14:05:54 +0000 Subject: [PATCH 06/37] move `methadone` to `BUGSExample`, not enabled --- {test => src/BUGSExamples/Volume_4}/methadone/README.md | 0 {test => src/BUGSExamples/Volume_4}/methadone/data1.csv | 0 {test => src/BUGSExamples/Volume_4}/methadone/data2.csv | 0 {test => src/BUGSExamples/Volume_4}/methadone/methadone.jl | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {test => src/BUGSExamples/Volume_4}/methadone/README.md (100%) rename {test => src/BUGSExamples/Volume_4}/methadone/data1.csv (100%) rename {test => src/BUGSExamples/Volume_4}/methadone/data2.csv (100%) rename {test => src/BUGSExamples/Volume_4}/methadone/methadone.jl (100%) diff --git a/test/methadone/README.md b/src/BUGSExamples/Volume_4/methadone/README.md similarity index 100% rename from test/methadone/README.md rename to src/BUGSExamples/Volume_4/methadone/README.md diff --git a/test/methadone/data1.csv b/src/BUGSExamples/Volume_4/methadone/data1.csv similarity index 100% rename from test/methadone/data1.csv rename to src/BUGSExamples/Volume_4/methadone/data1.csv diff --git a/test/methadone/data2.csv b/src/BUGSExamples/Volume_4/methadone/data2.csv similarity index 100% rename from test/methadone/data2.csv rename to src/BUGSExamples/Volume_4/methadone/data2.csv diff --git a/test/methadone/methadone.jl b/src/BUGSExamples/Volume_4/methadone/methadone.jl similarity index 100% rename from test/methadone/methadone.jl rename to src/BUGSExamples/Volume_4/methadone/methadone.jl From 96cf29d3543b6a5f5eadb86117b2d0ba8099dcb9 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 14:06:28 +0000 Subject: [PATCH 07/37] remove `gradient_tests` --- test/gradient_tests/blockers.csv | 48 ----------------------- test/gradient_tests/rats.csv | 66 -------------------------------- 2 files changed, 114 deletions(-) delete mode 100755 test/gradient_tests/blockers.csv delete mode 100755 test/gradient_tests/rats.csv diff --git a/test/gradient_tests/blockers.csv b/test/gradient_tests/blockers.csv deleted file mode 100755 index 4350df1a8..000000000 --- a/test/gradient_tests/blockers.csv +++ /dev/null @@ -1,48 +0,0 @@ -param,label,value,diffs AD,diffs FD -mu[1],0,0.0,-32.5,-32.5 -mu[2],1,0.0,-94.0,-94.0 -mu[3],2,0.0,-65.0,-65.0 -mu[4],3,0.0,-1297.5,-1297.5 -mu[5],4,0.0,-305.0,-305.0 -mu[6],5,0.0,-45.5,-45.50000001 -mu[7],6,0.0,-692.0,-692.0 -mu[8],7,0.0,-443.5,-443.5 -mu[9],8,0.0,-218.0,-218.0 -mu[10],9,0.0,-1592.5,-1592.5 -mu[11],10,0.0,-612.0,-612.0 -mu[12],11,0.0,-172.5,-172.5 -mu[13],12,0.0,-267.0,-267.0 -mu[14],13,0.0,-768.5,-768.5 -mu[15],14,0.0,-94.5,-94.5 -mu[16],15,0.0,-139.0,-139.0 -mu[17],16,0.0,-146.5,-146.5 -mu[18],17,0.0,-138.5,-138.5 -mu[19],18,0.0,-145.0,-145.0 -mu[20],19,0.0,-141.5,-141.5 -mu[21],20,0.0,-307.5,-307.5 -mu[22],21,0.0,-616.0,-616.0 -delta[1],22,0.0,-16.0,-16.0 -delta[2],23,0.0,-50.0,-49.99999999 -delta[3],24,0.0,-29.5,-29.5 -delta[4],25,0.0,-664.5,-664.5 -delta[5],26,0.0,-149.5,-149.5 -delta[6],27,0.0,-25.5,-25.5 -delta[7],28,0.0,-374.5,-374.5 -delta[8],29,0.0,-256.0,-256.0 -delta[9],30,0.0,-114.0,-114.0 -delta[10],31,0.0,-820.0,-820.0 -delta[11],32,0.0,-372.5,-372.5 -delta[12],33,0.0,-86.5,-86.5 -delta[13],34,0.0,-136.5,-136.5 -delta[14],35,0.0,-372.0,-372.0 -delta[15],36,0.0,-52.0,-52.00000001 -delta[16],37,0.0,-70.5,-70.5 -delta[17],38,0.0,-97.5,-97.5 -delta[18],39,0.0,-67.5,-67.5 -delta[19],40,0.0,-81.0,-81.0 -delta[20],41,0.0,-72.5,-72.5 -delta[21],42,0.0,-168.5,-168.5 -delta[22],43,0.0,-318.0,-318.0 -d,44,1.0,0.0,0.0 -tau,45,0.0,11.5,11.5 -delta.new,46,0.0,0.0,0.0 diff --git a/test/gradient_tests/rats.csv b/test/gradient_tests/rats.csv deleted file mode 100755 index 1a8b53a3f..000000000 --- a/test/gradient_tests/rats.csv +++ /dev/null @@ -1,66 +0,0 @@ -param,label,value,diffs AD,diffs FD -alpha[1],0,250.0,-151.0,-151.0 -alpha[2],1,250.0,-110.0,-110.0 -alpha[3],2,250.0,-86.0,-86.00000001 -alpha[4],3,250.0,-189.0,-189.0 -alpha[5],4,250.0,-194.0,-194.0 -alpha[6],5,250.0,-100.0,-100.0000001 -alpha[7],6,250.0,-209.0,-209.0 -alpha[8],7,250.0,-107.0,-107.0 -alpha[9],8,250.0,74.0,74.00000002 -alpha[10],9,250.0,-258.0,-257.9999999 -alpha[11],10,250.0,-56.0,-55.99999989 -alpha[12],11,250.0,-212.0,-212.0 -alpha[13],12,250.0,-138.0,-138.0 -alpha[14],13,250.0,-4.0,-4.000000044 -alpha[15],14,250.0,-136.0,-135.9999999 -alpha[16],15,250.0,-123.0,-122.9999999 -alpha[17],16,250.0,-191.0,-190.9999999 -alpha[18],17,250.0,-148.0,-147.9999999 -alpha[19],18,250.0,-79.0,-78.99999997 -alpha[20],19,250.0,-142.0,-141.9999999 -alpha[21],20,250.0,-106.0,-105.9999999 -alpha[22],21,250.0,-227.0,-227.0 -alpha[23],22,250.0,-210.0,-210.0000001 -alpha[24],23,250.0,-124.0,-124.0000001 -alpha[25],24,250.0,-179.0,-179.0000001 -alpha[26],25,250.0,-78.0,-78.00000007 -alpha[27],26,250.0,-76.0,-76.00000012 -alpha[28],27,250.0,-135.0,-135.0 -alpha[29],28,250.0,-265.0,-265.0000001 -alpha[30],29,250.0,-143.0,-143.0000001 -beta[1],30,6.0,18.0,17.99999998 -beta[2],31,6.0,648.0,647.9999999 -beta[3],32,6.0,284.0,283.9999998 -beta[4],33,6.0,-444.0,-444.0000001 -beta[5],34,6.0,340.0,339.9999999 -beta[6],35,6.0,88.0,87.99999981 -beta[7],36,6.0,-38.0,-38.00000006 -beta[8],37,6.0,242.0,241.9999999 -beta[9],38,6.0,648.0,647.9999999 -beta[10],39,6.0,-122.0,-122.0000001 -beta[11],40,6.0,487.0,486.9999998 -beta[12],41,6.0,53.0,52.9999999 -beta[13],42,6.0,81.0,80.99999992 -beta[14],43,6.0,417.0,416.9999999 -beta[15],44,6.0,-395.0,-395.0000001 -beta[16],45,6.0,-73.0,-73.00000012 -beta[17],46,6.0,151.0,150.9999999 -beta[18],47,6.0,-122.0,-122.0000001 -beta[19],48,6.0,235.0,234.9999998 -beta[20],49,6.0,11.0,10.99999994 -beta[21],50,6.0,235.0,234.9999998 -beta[22],51,6.0,-115.0,-115.0000002 -beta[23],52,6.0,-185.0,-185.0000001 -beta[24],53,6.0,-94.0,-94.0000001 -beta[25],54,6.0,557.0,557.0 -beta[26],55,6.0,326.0,325.9999998 -beta[27],56,6.0,-87.0,-87.00000006 -beta[28],57,6.0,-122.0,-122.0 -beta[29],58,6.0,-234.0,-234.0000001 -beta[30],59,6.0,60.0,59.99999994 -tau.c,60,1.0,-23485.0,-23485.00004 -alpha.c,61,150.0,2999.99985,2999.99985 -alpha.tau,62,1.0,-149985.0,-149985.0002 -beta.c,63,10.0,-120.00001,-120.0000069 -beta.tau,64,1.0,-225.0,-224.9999975 From f63318e8129ecabc355d200376642c1350f2a7f3 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 14:24:39 +0000 Subject: [PATCH 08/37] rename BUGSExample folder name --- src/BUGSExamples/BUGSExamples.jl | 50 +++++++++---------- .../{Volume_I => Volume_1}/Blocker.jl | 0 .../{Volume_I => Volume_1}/Bones.jl | 0 .../{Volume_I => Volume_1}/Dogs.jl | 0 .../{Volume_I => Volume_1}/Dyes.jl | 0 .../{Volume_I => Volume_1}/Epil.jl | 0 .../{Volume_I => Volume_1}/Equiv.jl | 0 .../{Volume_I => Volume_1}/Inhalers.jl | 0 .../{Volume_I => Volume_1}/Kidney.jl | 0 .../{Volume_I => Volume_1}/LSAT.jl | 0 .../{Volume_I => Volume_1}/Leuk.jl | 0 .../{Volume_I => Volume_1}/LeukFr.jl | 0 .../{Volume_I => Volume_1}/Magnesium.jl | 0 .../{Volume_I => Volume_1}/Mice.jl | 0 .../{Volume_I => Volume_1}/Oxford.jl | 0 .../{Volume_I => Volume_1}/Pumps.jl | 0 .../{Volume_I => Volume_1}/Rats.jl | 0 .../{Volume_I => Volume_1}/Salm.jl | 0 .../{Volume_I => Volume_1}/Seeds.jl | 0 .../{Volume_I => Volume_1}/Stacks.jl | 0 .../{Volume_I => Volume_1}/Surgical.jl | 0 .../{Volume_II => Volume_2}/Alligators.jl | 0 .../{Volume_II => Volume_2}/BiRats.jl | 0 .../{Volume_II => Volume_2}/Eyes.jl | 0 src/compiler_pass.jl | 2 +- src/utils.jl | 8 +-- test/runtests.jl | 19 +------ 27 files changed, 32 insertions(+), 47 deletions(-) rename src/BUGSExamples/{Volume_I => Volume_1}/Blocker.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Bones.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Dogs.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Dyes.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Epil.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Equiv.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Inhalers.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Kidney.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/LSAT.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Leuk.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/LeukFr.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Magnesium.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Mice.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Oxford.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Pumps.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Rats.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Salm.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Seeds.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Stacks.jl (100%) rename src/BUGSExamples/{Volume_I => Volume_1}/Surgical.jl (100%) rename src/BUGSExamples/{Volume_II => Volume_2}/Alligators.jl (100%) rename src/BUGSExamples/{Volume_II => Volume_2}/BiRats.jl (100%) rename src/BUGSExamples/{Volume_II => Volume_2}/Eyes.jl (100%) diff --git a/src/BUGSExamples/BUGSExamples.jl b/src/BUGSExamples/BUGSExamples.jl index 5582374b1..6609ada77 100644 --- a/src/BUGSExamples/BUGSExamples.jl +++ b/src/BUGSExamples/BUGSExamples.jl @@ -2,31 +2,31 @@ module BUGSExamples using JuliaBUGS: @bugs -include("Volume_I/Blocker.jl") -include("Volume_I/Bones.jl") -include("Volume_I/Dogs.jl") -include("Volume_I/Dyes.jl") -include("Volume_I/Epil.jl") -include("Volume_I/Equiv.jl") -include("Volume_I/Inhalers.jl") -include("Volume_I/Kidney.jl") -include("Volume_I/Leuk.jl") -include("Volume_I/LeukFr.jl") -include("Volume_I/LSAT.jl") -include("Volume_I/Magnesium.jl") -include("Volume_I/Mice.jl") -include("Volume_I/Oxford.jl") -include("Volume_I/Pumps.jl") -include("Volume_I/Rats.jl") -include("Volume_I/Salm.jl") -include("Volume_I/Seeds.jl") -include("Volume_I/Stacks.jl") -include("Volume_I/Surgical.jl") +include("Volume_1/Blocker.jl") +include("Volume_1/Bones.jl") +include("Volume_1/Dogs.jl") +include("Volume_1/Dyes.jl") +include("Volume_1/Epil.jl") +include("Volume_1/Equiv.jl") +include("Volume_1/Inhalers.jl") +include("Volume_1/Kidney.jl") +include("Volume_1/Leuk.jl") +include("Volume_1/LeukFr.jl") +include("Volume_1/LSAT.jl") +include("Volume_1/Magnesium.jl") +include("Volume_1/Mice.jl") +include("Volume_1/Oxford.jl") +include("Volume_1/Pumps.jl") +include("Volume_1/Rats.jl") +include("Volume_1/Salm.jl") +include("Volume_1/Seeds.jl") +include("Volume_1/Stacks.jl") +include("Volume_1/Surgical.jl") -include("Volume_II/BiRats.jl") -include("Volume_II/Eyes.jl") +include("Volume_2/BiRats.jl") +include("Volume_2/Eyes.jl") -const VOLUME_I = ( +const VOLUME_1 = ( blockers=blockers, bones=bones, dogs=dogs, @@ -50,10 +50,10 @@ const VOLUME_I = ( surgical_realistic=surgical_realistic, ) -const VOLUME_II = (birats=birats, eyes=eyes) +const VOLUME_2 = (birats=birats, eyes=eyes) function has_ground_truth(m::Symbol) - if m in union(keys(VOLUME_I), keys(VOLUME_II)) + if m in union(keys(VOLUME_1), keys(VOLUME_2)) return haskey(getfield(BUGSExamples, m), :reference_results) else return false diff --git a/src/BUGSExamples/Volume_I/Blocker.jl b/src/BUGSExamples/Volume_1/Blocker.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Blocker.jl rename to src/BUGSExamples/Volume_1/Blocker.jl diff --git a/src/BUGSExamples/Volume_I/Bones.jl b/src/BUGSExamples/Volume_1/Bones.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Bones.jl rename to src/BUGSExamples/Volume_1/Bones.jl diff --git a/src/BUGSExamples/Volume_I/Dogs.jl b/src/BUGSExamples/Volume_1/Dogs.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Dogs.jl rename to src/BUGSExamples/Volume_1/Dogs.jl diff --git a/src/BUGSExamples/Volume_I/Dyes.jl b/src/BUGSExamples/Volume_1/Dyes.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Dyes.jl rename to src/BUGSExamples/Volume_1/Dyes.jl diff --git a/src/BUGSExamples/Volume_I/Epil.jl b/src/BUGSExamples/Volume_1/Epil.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Epil.jl rename to src/BUGSExamples/Volume_1/Epil.jl diff --git a/src/BUGSExamples/Volume_I/Equiv.jl b/src/BUGSExamples/Volume_1/Equiv.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Equiv.jl rename to src/BUGSExamples/Volume_1/Equiv.jl diff --git a/src/BUGSExamples/Volume_I/Inhalers.jl b/src/BUGSExamples/Volume_1/Inhalers.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Inhalers.jl rename to src/BUGSExamples/Volume_1/Inhalers.jl diff --git a/src/BUGSExamples/Volume_I/Kidney.jl b/src/BUGSExamples/Volume_1/Kidney.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Kidney.jl rename to src/BUGSExamples/Volume_1/Kidney.jl diff --git a/src/BUGSExamples/Volume_I/LSAT.jl b/src/BUGSExamples/Volume_1/LSAT.jl similarity index 100% rename from src/BUGSExamples/Volume_I/LSAT.jl rename to src/BUGSExamples/Volume_1/LSAT.jl diff --git a/src/BUGSExamples/Volume_I/Leuk.jl b/src/BUGSExamples/Volume_1/Leuk.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Leuk.jl rename to src/BUGSExamples/Volume_1/Leuk.jl diff --git a/src/BUGSExamples/Volume_I/LeukFr.jl b/src/BUGSExamples/Volume_1/LeukFr.jl similarity index 100% rename from src/BUGSExamples/Volume_I/LeukFr.jl rename to src/BUGSExamples/Volume_1/LeukFr.jl diff --git a/src/BUGSExamples/Volume_I/Magnesium.jl b/src/BUGSExamples/Volume_1/Magnesium.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Magnesium.jl rename to src/BUGSExamples/Volume_1/Magnesium.jl diff --git a/src/BUGSExamples/Volume_I/Mice.jl b/src/BUGSExamples/Volume_1/Mice.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Mice.jl rename to src/BUGSExamples/Volume_1/Mice.jl diff --git a/src/BUGSExamples/Volume_I/Oxford.jl b/src/BUGSExamples/Volume_1/Oxford.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Oxford.jl rename to src/BUGSExamples/Volume_1/Oxford.jl diff --git a/src/BUGSExamples/Volume_I/Pumps.jl b/src/BUGSExamples/Volume_1/Pumps.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Pumps.jl rename to src/BUGSExamples/Volume_1/Pumps.jl diff --git a/src/BUGSExamples/Volume_I/Rats.jl b/src/BUGSExamples/Volume_1/Rats.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Rats.jl rename to src/BUGSExamples/Volume_1/Rats.jl diff --git a/src/BUGSExamples/Volume_I/Salm.jl b/src/BUGSExamples/Volume_1/Salm.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Salm.jl rename to src/BUGSExamples/Volume_1/Salm.jl diff --git a/src/BUGSExamples/Volume_I/Seeds.jl b/src/BUGSExamples/Volume_1/Seeds.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Seeds.jl rename to src/BUGSExamples/Volume_1/Seeds.jl diff --git a/src/BUGSExamples/Volume_I/Stacks.jl b/src/BUGSExamples/Volume_1/Stacks.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Stacks.jl rename to src/BUGSExamples/Volume_1/Stacks.jl diff --git a/src/BUGSExamples/Volume_I/Surgical.jl b/src/BUGSExamples/Volume_1/Surgical.jl similarity index 100% rename from src/BUGSExamples/Volume_I/Surgical.jl rename to src/BUGSExamples/Volume_1/Surgical.jl diff --git a/src/BUGSExamples/Volume_II/Alligators.jl b/src/BUGSExamples/Volume_2/Alligators.jl similarity index 100% rename from src/BUGSExamples/Volume_II/Alligators.jl rename to src/BUGSExamples/Volume_2/Alligators.jl diff --git a/src/BUGSExamples/Volume_II/BiRats.jl b/src/BUGSExamples/Volume_2/BiRats.jl similarity index 100% rename from src/BUGSExamples/Volume_II/BiRats.jl rename to src/BUGSExamples/Volume_2/BiRats.jl diff --git a/src/BUGSExamples/Volume_II/Eyes.jl b/src/BUGSExamples/Volume_2/Eyes.jl similarity index 100% rename from src/BUGSExamples/Volume_II/Eyes.jl rename to src/BUGSExamples/Volume_2/Eyes.jl diff --git a/src/compiler_pass.jl b/src/compiler_pass.jl index bfffdd453..6a2d3cc4d 100644 --- a/src/compiler_pass.jl +++ b/src/compiler_pass.jl @@ -486,7 +486,7 @@ The function returns three values: Array elements and array variables are represented by tuples in the returned value. All `Colon` indexing is assumed to be concretized. # Examples -```jldoctest +```jldoctest; setup = :(using JuliaBUGS: evaluate_and_track_dependencies) julia> evaluate_and_track_dependencies(:(x[a]), (x=[missing, missing], a = missing)) (missing, (:a, (:x, 1:2))) diff --git a/src/utils.jl b/src/utils.jl index da0d43b69..0bc2b1b48 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -88,7 +88,7 @@ end Extract all the array variable names and number of dimensions from a given simple expression. # Examples: -```jldoctest +```jldoctest; setup = :(using JuliaBUGS: extract_variable_names_and_numdims) julia> extract_variable_names_and_numdims(:((a + b) * c), ()) (a = 0, b = 0, c = 0) @@ -154,7 +154,7 @@ will raise an error. # Example: ```jldoctest -extract_variable_names_and_numdims( +JuliaBUGS.extract_variable_names_and_numdims( @bugs begin for i in 1:N for j in 1:T @@ -434,7 +434,7 @@ Replace all `Colon()`s in `expr` with the corresponding array size. # Examples ```jldoctest -julia> concretize_colon_indexing(:(f(x[1, :])), (x = [1 2 3 4; 5 6 7 8; 9 10 11 12],)) +julia> JuliaBUGS.concretize_colon_indexing(:(f(x[1, :])), (x = [1 2 3 4; 5 6 7 8; 9 10 11 12],)) :(f(x[1, 1:4])) ``` """ @@ -460,7 +460,7 @@ This function evaluates expressions that consist solely of arithmetic operations is specifically designed for scenarios such as calculating array indices or determining loop boundaries. # Example: -```jldoctest +```jldoctest; setup = :(using JuliaBUGS: simple_arithmetic_eval) julia> simple_arithmetic_eval((a = 1, b = [1, 2]), 1) 1 diff --git a/test/runtests.jl b/test/runtests.jl index d9b2680dd..45308ed01 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,8 +5,7 @@ using AdvancedMH using Bijectors using Distributions using Documenter -using DynamicPPL -using DynamicPPL: getlogp, settrans!!, SimpleVarInfo +using DynamicPPL: DynamicPPL, getlogp, settrans!!, SimpleVarInfo using Graphs, MetaGraphsNext using JuliaBUGS using JuliaBUGS: @@ -37,21 +36,7 @@ if get(ENV, "RUN_MODE", "test") == "profile" include("profile.jl") else @testset "Function Unit Tests" begin - DocMeta.setdocmeta!( - JuliaBUGS, - :DocTestSetup, - :(using JuliaBUGS: - JuliaBUGS, - BUGSExamples, - @bugs, - evaluate_and_track_dependencies, - evaluate, - concretize_colon_indexing, - extract_variable_names_and_numdims, - extract_variables_in_bounds_and_lhs_indices, - simple_arithmetic_eval); - recursive=true, - ) + DocMeta.setdocmeta!(JuliaBUGS, :DocTestSetup, :(using JuliaBUGS); recursive=true) Documenter.doctest(JuliaBUGS; manual=false) end From 78c19514806ef6a3f348420610486dae86887098 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 14:43:37 +0000 Subject: [PATCH 09/37] factorize tests into different CI tasks --- .github/workflows/Benchmark.yml | 59 ------------- .github/workflows/Tests.yml | 12 +++ src/BUGSExamples/BUGSExamples.jl | 2 +- test/logp_tests/{ => BUGS_models}/blockers.jl | 0 test/logp_tests/{ => BUGS_models}/bones.jl | 0 test/logp_tests/{ => BUGS_models}/dogs.jl | 0 test/logp_tests/{ => BUGS_models}/rats.jl | 0 .../binomial.jl | 0 .../ddirich.jl | 0 .../dwish.jl | 0 .../gamma.jl | 0 .../{ => single_distribution _models}/lkj.jl | 0 test/logp_tests/test_logp.jl | 12 +++ test/runtests.jl | 85 ++++++------------- 14 files changed, 51 insertions(+), 119 deletions(-) delete mode 100644 .github/workflows/Benchmark.yml rename test/logp_tests/{ => BUGS_models}/blockers.jl (100%) rename test/logp_tests/{ => BUGS_models}/bones.jl (100%) rename test/logp_tests/{ => BUGS_models}/dogs.jl (100%) rename test/logp_tests/{ => BUGS_models}/rats.jl (100%) rename test/logp_tests/{ => single_distribution _models}/binomial.jl (100%) rename test/logp_tests/{ => single_distribution _models}/ddirich.jl (100%) rename test/logp_tests/{ => single_distribution _models}/dwish.jl (100%) rename test/logp_tests/{ => single_distribution _models}/gamma.jl (100%) rename test/logp_tests/{ => single_distribution _models}/lkj.jl (100%) create mode 100644 test/logp_tests/test_logp.jl diff --git a/.github/workflows/Benchmark.yml b/.github/workflows/Benchmark.yml deleted file mode 100644 index 4ac8f6f9f..000000000 --- a/.github/workflows/Benchmark.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Benchmarking - -on: - push: - branches: - - main - tags: ['*'] - pull_request: - -jobs: - profile: - name: Benchmarking Analysis Passes - runs-on: ubuntu-latest - continue-on-error: ${{ matrix.version == 'nightly' }} - strategy: - fail-fast: false - matrix: - version: - - '1' - os: - - ubuntu-latest - arch: - - x64 - include: - - version: '1' - os: ubuntu-latest - arch: x64 - coverage: false - steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 - with: - version: ${{ matrix.version }} - arch: ${{ matrix.arch }} - - uses: actions/cache@v1 - env: - cache-name: cache-artifacts - with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 - env: - RUN_MODE: profile - - uses: julia-actions/julia-processcoverage@v1 - if: matrix.coverage - - uses: codecov/codecov-action@v1 - if: matrix.coverage - with: - file: lcov.info - - uses: coverallsapp/github-action@master - if: matrix.coverage - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: lcov.info diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 091b3f833..c2b67bc8b 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -18,6 +18,16 @@ jobs: version: ['1', '1.9', 'nightly'] os: [ubuntu-latest, macOS-latest, windows-latest] arch: [x64] + test_group: + - 'profile' + - 'unit' + - 'parser' + - 'analysis_passes' + - 'compile_BUGS_examples' + - 'corner_cases' + - 'graph' + - 'gibbs' + - 'mcmchains' # specific config for codecov include: - version: '1' @@ -45,6 +55,8 @@ jobs: ${{ runner.os }}-julia- - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 + env: + TEST_GROUP: ${{ matrix.test_group }} - uses: julia-actions/julia-processcoverage@v1 if: matrix.coverage - uses: codecov/codecov-action@v4 diff --git a/src/BUGSExamples/BUGSExamples.jl b/src/BUGSExamples/BUGSExamples.jl index 6609ada77..599aa2ac1 100644 --- a/src/BUGSExamples/BUGSExamples.jl +++ b/src/BUGSExamples/BUGSExamples.jl @@ -33,7 +33,7 @@ const VOLUME_1 = ( dyes=dyes, epil=epil, equiv=equiv, - inhalers=inhalers, + # inhalers=inhalers, kidney=kidney, leuk=leuk, leukfr=leukfr, diff --git a/test/logp_tests/blockers.jl b/test/logp_tests/BUGS_models/blockers.jl similarity index 100% rename from test/logp_tests/blockers.jl rename to test/logp_tests/BUGS_models/blockers.jl diff --git a/test/logp_tests/bones.jl b/test/logp_tests/BUGS_models/bones.jl similarity index 100% rename from test/logp_tests/bones.jl rename to test/logp_tests/BUGS_models/bones.jl diff --git a/test/logp_tests/dogs.jl b/test/logp_tests/BUGS_models/dogs.jl similarity index 100% rename from test/logp_tests/dogs.jl rename to test/logp_tests/BUGS_models/dogs.jl diff --git a/test/logp_tests/rats.jl b/test/logp_tests/BUGS_models/rats.jl similarity index 100% rename from test/logp_tests/rats.jl rename to test/logp_tests/BUGS_models/rats.jl diff --git a/test/logp_tests/binomial.jl b/test/logp_tests/single_distribution _models/binomial.jl similarity index 100% rename from test/logp_tests/binomial.jl rename to test/logp_tests/single_distribution _models/binomial.jl diff --git a/test/logp_tests/ddirich.jl b/test/logp_tests/single_distribution _models/ddirich.jl similarity index 100% rename from test/logp_tests/ddirich.jl rename to test/logp_tests/single_distribution _models/ddirich.jl diff --git a/test/logp_tests/dwish.jl b/test/logp_tests/single_distribution _models/dwish.jl similarity index 100% rename from test/logp_tests/dwish.jl rename to test/logp_tests/single_distribution _models/dwish.jl diff --git a/test/logp_tests/gamma.jl b/test/logp_tests/single_distribution _models/gamma.jl similarity index 100% rename from test/logp_tests/gamma.jl rename to test/logp_tests/single_distribution _models/gamma.jl diff --git a/test/logp_tests/lkj.jl b/test/logp_tests/single_distribution _models/lkj.jl similarity index 100% rename from test/logp_tests/lkj.jl rename to test/logp_tests/single_distribution _models/lkj.jl diff --git a/test/logp_tests/test_logp.jl b/test/logp_tests/test_logp.jl new file mode 100644 index 000000000..0c691c54b --- /dev/null +++ b/test/logp_tests/test_logp.jl @@ -0,0 +1,12 @@ +@testset "Log joint probability" begin + @testset "Single distribution models" begin + @testset "$s" for s in [:binomial, :gamma, :lkj, :dwish, :ddirich] + include("./single_distribution_models/$s.jl") + end + end + @testset "BUGS models" begin + @testset "$s" for s in [:blockers, :bones, :dogs, :rats] + include("./BUGS_models/$s.jl") + end + end +end diff --git a/test/runtests.jl b/test/runtests.jl index 45308ed01..077d07fcc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -32,78 +32,45 @@ using Test AbstractMCMC.setprogress!(false) -if get(ENV, "RUN_MODE", "test") == "profile" +const test_group = get(ENV, "TEST_GROUP", "") + +if test_group == "profile" include("profile.jl") -else - @testset "Function Unit Tests" begin +elseif test_group == "unit" + @testset "doctests" begin DocMeta.setdocmeta!(JuliaBUGS, :DocTestSetup, :(using JuliaBUGS); recursive=true) Documenter.doctest(JuliaBUGS; manual=false) end - - include("bugs_primitives.jl") - + include("utils.jl") +elseif test_group == "parser" @testset "Parser" begin include("parser/bugs_macro.jl") include("parser/bugs_parser.jl") include("parser/winbugs_examples.jl") end - - include("compile.jl") - - include("cumulative_density.jl") - - @testset "Compile WinBUGS Vol I examples: $m" for m in [ - :blockers, - :bones, - :dogs, - :dyes, - :epil, - :equiv, - :kidney, - :leuk, - :leukfr, - :lsat, - :magnesium, - :mice, - :oxford, - :pumps, - :rats, - :salm, - :seeds, - :stacks, - :surgical_simple, - :surgical_realistic, - ] - model_def = JuliaBUGS.BUGSExamples.VOLUME_I[m].model_def - data = JuliaBUGS.BUGSExamples.VOLUME_I[m].data - inits = JuliaBUGS.BUGSExamples.VOLUME_I[m].inits[1] - model = compile(model_def, data, inits) - end - - @testset "Utils" begin - include("utils.jl") - end - +elseif test_group == "analysis_passes" include("passes.jl") - - @testset "Log Probability Test" begin - @testset "Single stochastic variable test" begin - @testset "test for $s" for s in [:binomial, :gamma, :lkj, :dwish, :ddirich] - include("logp_tests/$s.jl") - end - end - @testset "BUGS examples" begin - @testset "test for $s" for s in [:blockers, :bones, :dogs, :rats] - include("logp_tests/$s.jl") - end +elseif test_group == "compile_BUGS_examples" + @testset "BUGS examples volume 1" begin + @testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_I) + model_def = JuliaBUGS.BUGSExamples.VOLUME_I[m].model_def + data = JuliaBUGS.BUGSExamples.VOLUME_I[m].data + inits = JuliaBUGS.BUGSExamples.VOLUME_I[m].inits[1] + model = compile(model_def, data, inits) end end - - @testset "Graph data structure" begin - include("graphs.jl") +elseif test_group == "corner_cases" + @testset "Some corner cases" begin + include("bugs_primitives.jl") + include("compile.jl") + include("cumulative_density.jl") end - +elseif test_group == "graph" + include("graphs.jl") +elseif test_group == "gibbs" include("gibbs.jl") - +elseif test_group == "mcmchains" include("ext/mcmchains.jl") +else + # nothing end From 71e5113e9da9a15ef7ba45d784f9eecb8ea890c2 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 14:44:48 +0000 Subject: [PATCH 10/37] add Test_group to CI name --- .github/workflows/Tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index c2b67bc8b..ad8fb75bf 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -9,7 +9,7 @@ on: jobs: test: - name: Julia ${{ matrix.version }} on ${{ matrix.os }} (${{ matrix.arch }}) + name: Julia ${{ matrix.version }} on ${{ matrix.os }} (${{ matrix.arch }}) ${{ matrix.test_group }} runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.version == 'nightly' }} strategy: From cb1d0ba785668fe4f8f5ccfe74d1048ed694fad0 Mon Sep 17 00:00:00 2001 From: Xianda Sun <5433119+sunxd3@users.noreply.github.com> Date: Sun, 24 Mar 2024 14:45:48 +0000 Subject: [PATCH 11/37] Update test/runtests.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 077d07fcc..01e776a69 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -52,7 +52,7 @@ elseif test_group == "analysis_passes" include("passes.jl") elseif test_group == "compile_BUGS_examples" @testset "BUGS examples volume 1" begin - @testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_I) + @testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_I) model_def = JuliaBUGS.BUGSExamples.VOLUME_I[m].model_def data = JuliaBUGS.BUGSExamples.VOLUME_I[m].data inits = JuliaBUGS.BUGSExamples.VOLUME_I[m].inits[1] From fee107c9b71e941cc6a9ddb3ee7425bb915f87eb Mon Sep 17 00:00:00 2001 From: Xianda Sun <5433119+sunxd3@users.noreply.github.com> Date: Sun, 24 Mar 2024 14:45:52 +0000 Subject: [PATCH 12/37] Update test/runtests.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 01e776a69..587dc0bf9 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -63,7 +63,7 @@ elseif test_group == "corner_cases" @testset "Some corner cases" begin include("bugs_primitives.jl") include("compile.jl") - include("cumulative_density.jl") + include("cumulative_density.jl") end elseif test_group == "graph" include("graphs.jl") From 49be6cbb518f1434416260be0e25ab3ae1f3c899 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 14:58:26 +0000 Subject: [PATCH 13/37] propagate name changes --- docs/src/example.md | 2 +- test/inference.jl | 16 ++++++++-------- test/logp_tests/BUGS_models/bones.jl | 6 +++--- test/logp_tests/BUGS_models/dogs.jl | 6 +++--- test/profile.jl | 6 +++--- test/runtests.jl | 8 ++++---- test/utils.jl | 6 +++--- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/src/example.md b/docs/src/example.md index 99537de0a..bb9a74a3b 100644 --- a/docs/src/example.md +++ b/docs/src/example.md @@ -276,4 +276,4 @@ Note that the `init_params` argument is now a vector of initial parameters for e Sometimes the progress logger can cause problems in distributed setting, so we can disable it by setting `progress = false`. ## More Examples -We have transcribed all the examples from the first volume of the BUGS Examples ([original](https://www.multibugs.org/examples/latest/VolumeI.html) and [transcribed](https://github.com/TuringLang/JuliaBUGS.jl/tree/master/src/BUGSExamples/Volume_I)). All programs and data are included, and can be compiled using the steps described in the tutorial above. \ No newline at end of file +We have transcribed all the examples from the first volume of the BUGS Examples ([original](https://www.multibugs.org/examples/latest/VolumeI.html) and [transcribed](https://github.com/TuringLang/JuliaBUGS.jl/tree/master/src/BUGSExamples/VOLUME_1)). All programs and data are included, and can be compiled using the steps described in the tutorial above. \ No newline at end of file diff --git a/test/inference.jl b/test/inference.jl index 337e7a99c..ed26be864 100644 --- a/test/inference.jl +++ b/test/inference.jl @@ -46,9 +46,9 @@ end end @testset "Inference results on examples: $m" for m in [:seeds, :rats, :equiv, :stacks] - data = JuliaBUGS.BUGSExamples.VOLUME_I[m].data - inits = JuliaBUGS.BUGSExamples.VOLUME_I[m].inits[1] - model = JuliaBUGS.compile(JuliaBUGS.BUGSExamples.VOLUME_I[m].model_def, data, inits) + data = JuliaBUGS.BUGSExamples.VOLUME_1[m].data + inits = JuliaBUGS.BUGSExamples.VOLUME_1[m].inits[1] + model = JuliaBUGS.compile(JuliaBUGS.BUGSExamples.VOLUME_1[m].model_def, data, inits) ad_model = ADgradient(:ReverseDiff, model; compile=Val(true)) @@ -68,7 +68,7 @@ end ) @assert JuliaBUGS.BUGSExamples.has_ground_truth(m) "No reference inference results for $m" - ref_inference_results = JuliaBUGS.BUGSExamples.VOLUME_I[m].reference_results + ref_inference_results = JuliaBUGS.BUGSExamples.VOLUME_1[m].reference_results @testset "$m: $var" for var in keys(ref_inference_results) @test summarize(samples_and_stats)[var].nt.mean[1] ≈ ref_inference_results[var].mean rtol = 0.2 @@ -78,10 +78,10 @@ end end @testset "Inference results on examples: m" for m in [:birats] - data = JuliaBUGS.BUGSExamples.VOLUME_II[m].data - inits = JuliaBUGS.BUGSExamples.VOLUME_II[m].inits[1] + data = JuliaBUGS.BUGSExamples.VOLUME_2[m].data + inits = JuliaBUGS.BUGSExamples.VOLUME_2[m].inits[1] model = JuliaBUGS.compile( - JuliaBUGS.BUGSExamples.VOLUME_II[m].model_def, data, inits + JuliaBUGS.BUGSExamples.VOLUME_2[m].model_def, data, inits ) ad_model = ADgradient(:ReverseDiff, model; compile=Val(true)) @@ -102,7 +102,7 @@ end ) @assert JuliaBUGS.BUGSExamples.has_ground_truth(m) "No reference inference results for $m" - ref_inference_results = JuliaBUGS.BUGSExamples.VOLUME_II[m].reference_results + ref_inference_results = JuliaBUGS.BUGSExamples.VOLUME_2[m].reference_results @testset "$m: $var" for var in keys(ref_inference_results) @test summarize(samples_and_stats)[var].nt.mean[1] ≈ ref_inference_results[var].mean rtol = 0.2 diff --git a/test/logp_tests/BUGS_models/bones.jl b/test/logp_tests/BUGS_models/bones.jl index 2629979b5..0ef265e4c 100644 --- a/test/logp_tests/BUGS_models/bones.jl +++ b/test/logp_tests/BUGS_models/bones.jl @@ -1,6 +1,6 @@ -bugs_model_def = JuliaBUGS.BUGSExamples.VOLUME_I[:bones].model_def -data = JuliaBUGS.BUGSExamples.VOLUME_I[:bones].data -inits = JuliaBUGS.BUGSExamples.VOLUME_I[:bones].inits[1] +bugs_model_def = JuliaBUGS.BUGSExamples.VOLUME_1[:bones].model_def +data = JuliaBUGS.BUGSExamples.VOLUME_1[:bones].data +inits = JuliaBUGS.BUGSExamples.VOLUME_1[:bones].inits[1] bugs_model = compile(bugs_model_def, data, inits) vi = bugs_model.varinfo diff --git a/test/logp_tests/BUGS_models/dogs.jl b/test/logp_tests/BUGS_models/dogs.jl index 17f8079cc..4cdd83349 100644 --- a/test/logp_tests/BUGS_models/dogs.jl +++ b/test/logp_tests/BUGS_models/dogs.jl @@ -1,6 +1,6 @@ -bugs_model_def = JuliaBUGS.BUGSExamples.VOLUME_I[:dogs].model_def -data = JuliaBUGS.BUGSExamples.VOLUME_I[:dogs].data -inits = JuliaBUGS.BUGSExamples.VOLUME_I[:dogs].inits[1] +bugs_model_def = JuliaBUGS.BUGSExamples.VOLUME_1[:dogs].model_def +data = JuliaBUGS.BUGSExamples.VOLUME_1[:dogs].data +inits = JuliaBUGS.BUGSExamples.VOLUME_1[:dogs].inits[1] bugs_model = compile(bugs_model_def, data, inits) vi = bugs_model.varinfo diff --git a/test/profile.jl b/test/profile.jl index bf99dde3a..0aee38ec8 100644 --- a/test/profile.jl +++ b/test/profile.jl @@ -5,10 +5,10 @@ using JuliaBUGS: BUGSExamples suite = BenchmarkGroup() -for name in keys(BUGSExamples.VOLUME_I) +for name in keys(BUGSExamples.VOLUME_1) @info "Adding benchmark for $name" - model_def = BUGSExamples.VOLUME_I[name].model_def - data = BUGSExamples.VOLUME_I[name].data + model_def = BUGSExamples.VOLUME_1[name].model_def + data = BUGSExamples.VOLUME_1[name].data non_data_scalars, non_data_array_sizes = JuliaBUGS.determine_array_sizes( model_def, data diff --git a/test/runtests.jl b/test/runtests.jl index 587dc0bf9..b82b08e14 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -52,10 +52,10 @@ elseif test_group == "analysis_passes" include("passes.jl") elseif test_group == "compile_BUGS_examples" @testset "BUGS examples volume 1" begin - @testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_I) - model_def = JuliaBUGS.BUGSExamples.VOLUME_I[m].model_def - data = JuliaBUGS.BUGSExamples.VOLUME_I[m].data - inits = JuliaBUGS.BUGSExamples.VOLUME_I[m].inits[1] + @testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_1) + model_def = JuliaBUGS.BUGSExamples.VOLUME_1[m].model_def + data = JuliaBUGS.BUGSExamples.VOLUME_1[m].data + inits = JuliaBUGS.BUGSExamples.VOLUME_1[m].inits[1] model = compile(model_def, data, inits) end end diff --git a/test/utils.jl b/test/utils.jl index 13c1b565c..605fb060a 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -22,9 +22,9 @@ end # Tests for `getparams`, using `Rats` model @testset "`getparams` with Rats" begin m = :rats - data = JuliaBUGS.BUGSExamples.VOLUME_I[m].data - inits = JuliaBUGS.BUGSExamples.VOLUME_I[m].inits[1] - model = JuliaBUGS.compile(JuliaBUGS.BUGSExamples.VOLUME_I[m].model_def, data, inits) + data = JuliaBUGS.BUGSExamples.VOLUME_1[m].data + inits = JuliaBUGS.BUGSExamples.VOLUME_1[m].inits[1] + model = JuliaBUGS.compile(JuliaBUGS.BUGSExamples.VOLUME_1[m].model_def, data, inits) # transformed @test LogDensityProblems.logdensity( From 42248802ac0acadb3d4a3c0f5980334cd4b27502 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 15:02:15 +0000 Subject: [PATCH 14/37] format --- test/inference.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/inference.jl b/test/inference.jl index ed26be864..0f2bdec93 100644 --- a/test/inference.jl +++ b/test/inference.jl @@ -80,9 +80,7 @@ end @testset "Inference results on examples: m" for m in [:birats] data = JuliaBUGS.BUGSExamples.VOLUME_2[m].data inits = JuliaBUGS.BUGSExamples.VOLUME_2[m].inits[1] - model = JuliaBUGS.compile( - JuliaBUGS.BUGSExamples.VOLUME_2[m].model_def, data, inits - ) + model = JuliaBUGS.compile(JuliaBUGS.BUGSExamples.VOLUME_2[m].model_def, data, inits) ad_model = ADgradient(:ReverseDiff, model; compile=Val(true)) From 734c085fc9628b2760d37a86a790cbc255065a59 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 15:18:17 +0000 Subject: [PATCH 15/37] use retry for mcmcchains and gibbs --- .github/workflows/Tests.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index ad8fb75bf..c8cf9b111 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -38,7 +38,8 @@ jobs: CACHE_NAME: julia-${{ matrix.version }}-${{ matrix.arch }} steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - name: Set up Julia + uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} @@ -52,9 +53,21 @@ jobs: restore-keys: | ${{ runner.os }}-${{ env.CACHE_NAME }}- ${{ runner.os }}-julia-${{ matrix.version }}- - ${{ runner.os }}-julia- - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 + ${{ runner.os }}-julia-${{ matrix.version }}- + - name: Build package + uses: julia-actions/julia-buildpkg@v1 + - name: Run tests normally + if: matrix.test_group != 'gibbs' && matrix.test_group != 'mcmchains' + uses: julia-actions/julia-runtest@v1 + env: + TEST_GROUP: ${{ matrix.test_group }} + - name: Run tests with "nick-fields/retry" + if: matrix.test_group == 'gibbs' || matrix.test_group == 'mcmchains' + uses: nick-fields/retry@v3 + with: + timeout_minutes: 10 + max_attempts : 3 + command: julia --project -e 'using Pkg; Pkg.instantiate(); Pkg.test(coverage=true)' env: TEST_GROUP: ${{ matrix.test_group }} - uses: julia-actions/julia-processcoverage@v1 From 8eee5dae0273f522a7e7f6325f7af9d775bc3ae0 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 15:29:37 +0000 Subject: [PATCH 16/37] only trigger test run if changes are made to `src` and `test` --- .github/workflows/Tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index c8cf9b111..48b5a912d 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -3,7 +3,13 @@ name: Tests on: push: branches: ["master"] + paths: + - 'src/**/*' + - 'test/**/*' pull_request: + paths: + - 'src/**/*' + - 'test/**/*' workflow_dispatch: From 79e0ea9d6fd62cf4e5e277f6929efec2f0f0fc0a Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 15:32:04 +0000 Subject: [PATCH 17/37] bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index dc30f4c8a..a7c6278c5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "JuliaBUGS" uuid = "ba9fb4c0-828e-4473-b6a1-cd2560fee5bf" -version = "0.5.1" +version = "0.5.2" [deps] AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001" From 9b05fb31738b375c5f8b76567a8081da6a08c0e2 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Sun, 24 Mar 2024 15:48:44 +0000 Subject: [PATCH 18/37] add extra clause: run all the tests --- test/runtests.jl | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index b82b08e14..7cdfa4a9f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -32,7 +32,7 @@ using Test AbstractMCMC.setprogress!(false) -const test_group = get(ENV, "TEST_GROUP", "") +const test_group = get(ENV, "TEST_GROUP", "run_all") if test_group == "profile" include("profile.jl") @@ -71,6 +71,33 @@ elseif test_group == "gibbs" include("gibbs.jl") elseif test_group == "mcmchains" include("ext/mcmchains.jl") -else - # nothing +else # run all + include("profile.jl") + @testset "doctests" begin + DocMeta.setdocmeta!(JuliaBUGS, :DocTestSetup, :(using JuliaBUGS); recursive=true) + Documenter.doctest(JuliaBUGS; manual=false) + end + include("utils.jl") + @testset "Parser" begin + include("parser/bugs_macro.jl") + include("parser/bugs_parser.jl") + include("parser/winbugs_examples.jl") + end + include("passes.jl") + @testset "BUGS examples volume 1" begin + @testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_1) + model_def = JuliaBUGS.BUGSExamples.VOLUME_1[m].model_def + data = JuliaBUGS.BUGSExamples.VOLUME_1[m].data + inits = JuliaBUGS.BUGSExamples.VOLUME_1[m].inits[1] + model = compile(model_def, data, inits) + end + end + @testset "Some corner cases" begin + include("bugs_primitives.jl") + include("compile.jl") + include("cumulative_density.jl") + end + include("graphs.jl") + include("gibbs.jl") + include("ext/mcmchains.jl") end From f57d76735c046d15b7da63d81eb8fbd5daa72047 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 08:08:37 +0000 Subject: [PATCH 19/37] use multiple steps instead of strategy --- .github/workflows/Tests.yml | 57 +++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 48b5a912d..75b66363f 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -15,7 +15,7 @@ on: jobs: test: - name: Julia ${{ matrix.version }} on ${{ matrix.os }} (${{ matrix.arch }}) ${{ matrix.test_group }} + name: Julia ${{ matrix.version }} on ${{ matrix.os }} (${{ matrix.arch }}) runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.version == 'nightly' }} strategy: @@ -24,17 +24,6 @@ jobs: version: ['1', '1.9', 'nightly'] os: [ubuntu-latest, macOS-latest, windows-latest] arch: [x64] - test_group: - - 'profile' - - 'unit' - - 'parser' - - 'analysis_passes' - - 'compile_BUGS_examples' - - 'corner_cases' - - 'graph' - - 'gibbs' - - 'mcmchains' - # specific config for codecov include: - version: '1' os: ubuntu-latest @@ -43,7 +32,8 @@ jobs: env: CACHE_NAME: julia-${{ matrix.version }}-${{ matrix.arch }} steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - name: Set up Julia uses: julia-actions/setup-julia@v1 with: @@ -59,23 +49,48 @@ jobs: restore-keys: | ${{ runner.os }}-${{ env.CACHE_NAME }}- ${{ runner.os }}-julia-${{ matrix.version }}- - ${{ runner.os }}-julia-${{ matrix.version }}- - name: Build package uses: julia-actions/julia-buildpkg@v1 - - name: Run tests normally - if: matrix.test_group != 'gibbs' && matrix.test_group != 'mcmchains' + - name: Running `unit` tests + uses: julia-actions/julia-runtest@v1 + env: + TEST_GROUP: unit + - name: Running `parser` tests + uses: julia-actions/julia-runtest@v1 + env: + TEST_GROUP: parser + - name: Running `analysis_passes` tests + uses: julia-actions/julia-runtest@v1 + env: + TEST_GROUP: analysis_passes + - name: Running `compile_BUGS_examples` tests + uses: julia-actions/julia-runtest@v1 + env: + TEST_GROUP: compile_BUGS_examples + - name: Running `corner_cases` tests uses: julia-actions/julia-runtest@v1 env: - TEST_GROUP: ${{ matrix.test_group }} - - name: Run tests with "nick-fields/retry" - if: matrix.test_group == 'gibbs' || matrix.test_group == 'mcmchains' + TEST_GROUP: corner_cases + - name: Running `graph` tests + uses: julia-actions/julia-runtest@v1 + env: + TEST_GROUP: graph + - name: Running `gibbs` tests + uses: nick-fields/retry@v3 + with: + timeout_minutes: 10 + max_attempts: 3 + command: julia --project -e 'using Pkg; Pkg.instantiate(); Pkg.test(coverage=true)' + env: + TEST_GROUP: gibbs + - name: Running `mcmchains` tests uses: nick-fields/retry@v3 with: timeout_minutes: 10 - max_attempts : 3 + max_attempts: 3 command: julia --project -e 'using Pkg; Pkg.instantiate(); Pkg.test(coverage=true)' env: - TEST_GROUP: ${{ matrix.test_group }} + TEST_GROUP: mcmchains - uses: julia-actions/julia-processcoverage@v1 if: matrix.coverage - uses: codecov/codecov-action@v4 From 2153de1a7e2e7a0894d954db3d2d25575bcf889f Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 10:28:40 +0000 Subject: [PATCH 20/37] update tests --- .github/workflows/Tests.yml | 48 ++++------------ test/gibbs.jl | 7 ++- test/graphs.jl | 3 + test/logp_tests/test_logp.jl | 4 ++ test/parser/test_parser.jl | 5 ++ test/runtests.jl | 108 +++++++++++++++++------------------ 6 files changed, 81 insertions(+), 94 deletions(-) create mode 100644 test/parser/test_parser.jl diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 75b66363f..9e1c33fe5 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -32,15 +32,12 @@ jobs: env: CACHE_NAME: julia-${{ matrix.version }}-${{ matrix.arch }} steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Julia - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - name: Cache Julia packages and artifacts - uses: actions/cache@v4 + - uses: actions/cache@v4 with: path: | ~/.julia @@ -49,48 +46,23 @@ jobs: restore-keys: | ${{ runner.os }}-${{ env.CACHE_NAME }}- ${{ runner.os }}-julia-${{ matrix.version }}- - - name: Build package - uses: julia-actions/julia-buildpkg@v1 - - name: Running `unit` tests - uses: julia-actions/julia-runtest@v1 - env: - TEST_GROUP: unit - - name: Running `parser` tests - uses: julia-actions/julia-runtest@v1 - env: - TEST_GROUP: parser - - name: Running `analysis_passes` tests - uses: julia-actions/julia-runtest@v1 - env: - TEST_GROUP: analysis_passes - - name: Running `compile_BUGS_examples` tests - uses: julia-actions/julia-runtest@v1 - env: - TEST_GROUP: compile_BUGS_examples - - name: Running `corner_cases` tests - uses: julia-actions/julia-runtest@v1 - env: - TEST_GROUP: corner_cases - - name: Running `graph` tests - uses: julia-actions/julia-runtest@v1 - env: - TEST_GROUP: graph + - uses: julia-actions/julia-buildpkg@v1 + - name: Running elementary tests + run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"unit\", \"parser\", \"analysis_passes\", \"graph\"]);" + - name: Running compilation tests + run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"compile_BUGS_examples\", \"corner_cases\", \"logp\"]);" - name: Running `gibbs` tests uses: nick-fields/retry@v3 with: timeout_minutes: 10 max_attempts: 3 - command: julia --project -e 'using Pkg; Pkg.instantiate(); Pkg.test(coverage=true)' - env: - TEST_GROUP: gibbs + command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"gibbs\"]);" - name: Running `mcmchains` tests uses: nick-fields/retry@v3 with: timeout_minutes: 10 max_attempts: 3 - command: julia --project -e 'using Pkg; Pkg.instantiate(); Pkg.test(coverage=true)' - env: - TEST_GROUP: mcmchains + command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"mcmchains\"]);" - uses: julia-actions/julia-processcoverage@v1 if: matrix.coverage - uses: codecov/codecov-action@v4 diff --git a/test/gibbs.jl b/test/gibbs.jl index 973199429..99ad72810 100644 --- a/test/gibbs.jl +++ b/test/gibbs.jl @@ -1,3 +1,6 @@ +using JuliaBUGS: MHFromPrior, Gibbs +using DynamicPPL: DynamicPPL + @testset "Simple gibbs" begin model_def = @bugs begin # Likelihood @@ -32,7 +35,9 @@ :varinfo, begin vi = model.varinfo - SimpleVarInfo(DynamicPPL.values_as(vi, NamedTuple), vi.logp, vi.transformation) + DynamicPPL.SimpleVarInfo( + DynamicPPL.values_as(vi, NamedTuple), vi.logp, vi.transformation + ) end, ) diff --git a/test/graphs.jl b/test/graphs.jl index 6f72f89b5..43af035c0 100644 --- a/test/graphs.jl +++ b/test/graphs.jl @@ -1,3 +1,6 @@ +using JuliaBUGS: + stochastic_inneighbors, stochastic_neighbors, stochastic_outneighbors, markov_blanket + test_model = @bugs begin a ~ dnorm(f, c) f = b - 1 diff --git a/test/logp_tests/test_logp.jl b/test/logp_tests/test_logp.jl index 0c691c54b..a6e511bb5 100644 --- a/test/logp_tests/test_logp.jl +++ b/test/logp_tests/test_logp.jl @@ -1,3 +1,7 @@ +using JuliaBUGS: + BUGSGraph, DefaultContext, evaluate!!, get_params_varinfo, LogDensityContext +using DynamicPPL: DynamicPPL, getlogp, settrans!!, SimpleVarInfo + @testset "Log joint probability" begin @testset "Single distribution models" begin @testset "$s" for s in [:binomial, :gamma, :lkj, :dwish, :ddirich] diff --git a/test/parser/test_parser.jl b/test/parser/test_parser.jl new file mode 100644 index 000000000..9d6d0dae7 --- /dev/null +++ b/test/parser/test_parser.jl @@ -0,0 +1,5 @@ +@testset "Parser" begin + include("bugs_macro.jl") + include("bugs_parser.jl") + include("winbugs_examples.jl") +end diff --git a/test/runtests.jl b/test/runtests.jl index 7cdfa4a9f..171034716 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,95 +1,92 @@ +using JuliaBUGS +using JuliaBUGS.BUGSPrimitives +using Documenter +using Test +using JuliaBUGS.BUGSPrimitives: mean +DocMeta.setdocmeta!(JuliaBUGS, :DocTestSetup, :(using JuliaBUGS); recursive=true) + using AbstractPPL using AbstractMCMC using AdvancedHMC using AdvancedMH using Bijectors using Distributions -using Documenter -using DynamicPPL: DynamicPPL, getlogp, settrans!!, SimpleVarInfo -using Graphs, MetaGraphsNext -using JuliaBUGS -using JuliaBUGS: - BUGSGraph, - DefaultContext, - evaluate!!, - get_params_varinfo, - LogDensityContext, - MHFromPrior, - stochastic_inneighbors, - stochastic_neighbors, - stochastic_outneighbors, - markov_blanket, - Gibbs -using JuliaBUGS.BUGSPrimitives -using JuliaBUGS.BUGSPrimitives: mean +using Graphs +using MetaGraphsNext using LinearAlgebra -using LogDensityProblems, LogDensityProblemsAD +using LogDensityProblems +using LogDensityProblemsAD using MacroTools using MCMCChains using Random using ReverseDiff -using Test AbstractMCMC.setprogress!(false) -const test_group = get(ENV, "TEST_GROUP", "run_all") +const Tests = ( + "profile", + "unit", + "parser", + "analysis_passes", + "compile_BUGS_examples", + "corner_cases", + "graph", + "logp", + "gibbs", + "mcmchains", +) + +for arg in ARGS + if arg ∉ Tests + error("Unknown test group: $arg") + end +end -if test_group == "profile" +@info "Running tests for groups: $(ARGS)" + +if "profile" in ARGS include("profile.jl") -elseif test_group == "unit" - @testset "doctests" begin - DocMeta.setdocmeta!(JuliaBUGS, :DocTestSetup, :(using JuliaBUGS); recursive=true) +elseif "unit" in ARGS + @testset "Unit Tests" begin Documenter.doctest(JuliaBUGS; manual=false) + include("utils.jl") end - include("utils.jl") -elseif test_group == "parser" - @testset "Parser" begin - include("parser/bugs_macro.jl") - include("parser/bugs_parser.jl") - include("parser/winbugs_examples.jl") - end -elseif test_group == "analysis_passes" +elseif "parser" in ARGS + include("parser/test_parser.jl") +elseif "analysis_passes" in ARGS include("passes.jl") -elseif test_group == "compile_BUGS_examples" +elseif "compile_BUGS_examples" in ARGS @testset "BUGS examples volume 1" begin @testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_1) - model_def = JuliaBUGS.BUGSExamples.VOLUME_1[m].model_def - data = JuliaBUGS.BUGSExamples.VOLUME_1[m].data - inits = JuliaBUGS.BUGSExamples.VOLUME_1[m].inits[1] - model = compile(model_def, data, inits) + m = JuliaBUGS.BUGSExamples.VOLUME_1[m] + model = compile(m.model_def, m.data, m.inits[1]) end end -elseif test_group == "corner_cases" +elseif "corner_cases" in ARGS @testset "Some corner cases" begin include("bugs_primitives.jl") include("compile.jl") include("cumulative_density.jl") end -elseif test_group == "graph" +elseif "graph" in ARGS include("graphs.jl") -elseif test_group == "gibbs" +elseif "logp" in ARGS + include("logp_tests/test_logp.jl") +elseif "gibbs" in ARGS include("gibbs.jl") -elseif test_group == "mcmchains" +elseif "mcmchains" in ARGS include("ext/mcmchains.jl") else # run all - include("profile.jl") - @testset "doctests" begin - DocMeta.setdocmeta!(JuliaBUGS, :DocTestSetup, :(using JuliaBUGS); recursive=true) + @testset "Unit Tests" begin Documenter.doctest(JuliaBUGS; manual=false) + include("utils.jl") end - include("utils.jl") - @testset "Parser" begin - include("parser/bugs_macro.jl") - include("parser/bugs_parser.jl") - include("parser/winbugs_examples.jl") - end + include("parser/test_parser.jl") include("passes.jl") @testset "BUGS examples volume 1" begin @testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_1) - model_def = JuliaBUGS.BUGSExamples.VOLUME_1[m].model_def - data = JuliaBUGS.BUGSExamples.VOLUME_1[m].data - inits = JuliaBUGS.BUGSExamples.VOLUME_1[m].inits[1] - model = compile(model_def, data, inits) + m = JuliaBUGS.BUGSExamples.VOLUME_1[m] + model = compile(m.model_def, m.data, m.inits[1]) end end @testset "Some corner cases" begin @@ -98,6 +95,7 @@ else # run all include("cumulative_density.jl") end include("graphs.jl") + include("logp_tests/test_logp.jl") include("gibbs.jl") include("ext/mcmchains.jl") end From 49e71ff11151346eb47cabd18ddde6ec6b24b60c Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 10:36:54 +0000 Subject: [PATCH 21/37] fix error --- .github/workflows/Tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 9e1c33fe5..68b229edf 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -48,21 +48,21 @@ jobs: ${{ runner.os }}-julia-${{ matrix.version }}- - uses: julia-actions/julia-buildpkg@v1 - name: Running elementary tests - run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"unit\", \"parser\", \"analysis_passes\", \"graph\"]);" + run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["unit", "parser", "analysis_passes", "graph"]);" - name: Running compilation tests - run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"compile_BUGS_examples\", \"corner_cases\", \"logp\"]);" + run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["compile_BUGS_examples", "corner_cases", "logp"]);" - name: Running `gibbs` tests uses: nick-fields/retry@v3 with: timeout_minutes: 10 max_attempts: 3 - command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"gibbs\"]);" + command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["gibbs"]);" - name: Running `mcmchains` tests uses: nick-fields/retry@v3 with: timeout_minutes: 10 max_attempts: 3 - command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"mcmchains\"]);" + command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["mcmchains"]);" - uses: julia-actions/julia-processcoverage@v1 if: matrix.coverage - uses: codecov/codecov-action@v4 From a9862beb1f3a79d101e54ac8b9d5304c2c3d52e5 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 10:46:40 +0000 Subject: [PATCH 22/37] fix errors --- .github/workflows/Tests.yml | 10 ++++++---- test/runtests.jl | 31 ++++++++++++++++++------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 68b229edf..13b31fb15 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -48,21 +48,23 @@ jobs: ${{ runner.os }}-julia-${{ matrix.version }}- - uses: julia-actions/julia-buildpkg@v1 - name: Running elementary tests - run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["unit", "parser", "analysis_passes", "graph"]);" + run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["--elementary"]);" - name: Running compilation tests - run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["compile_BUGS_examples", "corner_cases", "logp"]);" + run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["--compilation"]);" + - name: Profile compiler passes + run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["--profile"]);" - name: Running `gibbs` tests uses: nick-fields/retry@v3 with: timeout_minutes: 10 max_attempts: 3 - command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["gibbs"]);" + command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["--gibbs"]);" - name: Running `mcmchains` tests uses: nick-fields/retry@v3 with: timeout_minutes: 10 max_attempts: 3 - command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["mcmchains"]);" + command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["--mcmchains"]);" - uses: julia-actions/julia-processcoverage@v1 if: matrix.coverage - uses: codecov/codecov-action@v4 diff --git a/test/runtests.jl b/test/runtests.jl index 171034716..49d7b541b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -44,39 +44,44 @@ end @info "Running tests for groups: $(ARGS)" -if "profile" in ARGS - include("profile.jl") -elseif "unit" in ARGS +if "--elementary" in ARGS @testset "Unit Tests" begin Documenter.doctest(JuliaBUGS; manual=false) include("utils.jl") end -elseif "parser" in ARGS include("parser/test_parser.jl") -elseif "analysis_passes" in ARGS include("passes.jl") -elseif "compile_BUGS_examples" in ARGS + include("graphs.jl") +end + +if "--compilation" in ARGS @testset "BUGS examples volume 1" begin @testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_1) m = JuliaBUGS.BUGSExamples.VOLUME_1[m] model = compile(m.model_def, m.data, m.inits[1]) end end -elseif "corner_cases" in ARGS @testset "Some corner cases" begin include("bugs_primitives.jl") include("compile.jl") include("cumulative_density.jl") end -elseif "graph" in ARGS - include("graphs.jl") -elseif "logp" in ARGS include("logp_tests/test_logp.jl") -elseif "gibbs" in ARGS +end + +if "--profile" in ARGS + include("profile.jl") +end + +if "--gibbs" in ARGS include("gibbs.jl") -elseif "mcmchains" in ARGS +end + +if "--mcmchains" in ARGS include("ext/mcmchains.jl") -else # run all +end + +if isempty(ARGS) # run all @testset "Unit Tests" begin Documenter.doctest(JuliaBUGS; manual=false) include("utils.jl") From cbe3a8cd5258e606012071c26a04a505bd97deeb Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 10:48:18 +0000 Subject: [PATCH 23/37] add escape symbol --- .github/workflows/Tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 13b31fb15..01595bebf 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -48,11 +48,11 @@ jobs: ${{ runner.os }}-julia-${{ matrix.version }}- - uses: julia-actions/julia-buildpkg@v1 - name: Running elementary tests - run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["--elementary"]);" + run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"--elementary\"]);" - name: Running compilation tests - run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["--compilation"]);" + run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"--compilation\"]);" - name: Profile compiler passes - run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["--profile"]);" + run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"--profile\"]);" - name: Running `gibbs` tests uses: nick-fields/retry@v3 with: From dc6f92a244443408f2560b6d9f36d214604fab0e Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 10:51:42 +0000 Subject: [PATCH 24/37] fix error --- test/runtests.jl | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 49d7b541b..9e4df5c8f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -24,16 +24,11 @@ using ReverseDiff AbstractMCMC.setprogress!(false) const Tests = ( - "profile", - "unit", - "parser", - "analysis_passes", - "compile_BUGS_examples", - "corner_cases", - "graph", - "logp", - "gibbs", - "mcmchains", + "--elementary", + "--compilation", + "--profile", + "--gibbs", + "--mcmchains", ) for arg in ARGS From a0cc28b62f6a061f1bff58a1f7b0d47dc9b2472f Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 11:10:24 +0000 Subject: [PATCH 25/37] fix errors --- .github/workflows/Tests.yml | 20 ++++++++++---- test/runtests.jl | 54 +++++++++++-------------------------- 2 files changed, 30 insertions(+), 44 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 01595bebf..11efbc0a6 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -48,23 +48,33 @@ jobs: ${{ runner.os }}-julia-${{ matrix.version }}- - uses: julia-actions/julia-buildpkg@v1 - name: Running elementary tests - run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"--elementary\"]);" + uses: julia-actions/julia-runtest@v1 + env: + TEST_GROUP: "elementary" - name: Running compilation tests - run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"--compilation\"]);" + uses: julia-actions/julia-runtest@v1 + env: + TEST_GROUP: "compilation" - name: Profile compiler passes - run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"--profile\"]);" + uses: julia-actions/julia-runtest@v1 + env: + TEST_GROUP: "profile" - name: Running `gibbs` tests uses: nick-fields/retry@v3 with: timeout_minutes: 10 max_attempts: 3 - command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["--gibbs"]);" + command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true);" + env: + TEST_GROUP: "gibbs" - name: Running `mcmchains` tests uses: nick-fields/retry@v3 with: timeout_minutes: 10 max_attempts: 3 - command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["--mcmchains"]);" + command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true);" + env: + TEST_GROUP: "mcmchains" - uses: julia-actions/julia-processcoverage@v1 if: matrix.coverage - uses: codecov/codecov-action@v4 diff --git a/test/runtests.jl b/test/runtests.jl index 9e4df5c8f..0a98d5d76 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -24,22 +24,22 @@ using ReverseDiff AbstractMCMC.setprogress!(false) const Tests = ( - "--elementary", - "--compilation", - "--profile", - "--gibbs", - "--mcmchains", + "elementary", + "compilation", + "profile", + "gibbs", + "mcmchains", + "all" ) -for arg in ARGS - if arg ∉ Tests - error("Unknown test group: $arg") - end +const test_group = get(ENV, TEST_GROUP, "all") +if test_group ∉ Tests + error("Unknown test group: $test_group") end -@info "Running tests for groups: $(ARGS)" +@info "Running tests for groups: $test_group" -if "--elementary" in ARGS +if test_group == "elementary" || test_group == "all" @testset "Unit Tests" begin Documenter.doctest(JuliaBUGS; manual=false) include("utils.jl") @@ -49,7 +49,7 @@ if "--elementary" in ARGS include("graphs.jl") end -if "--compilation" in ARGS +if test_group == "compilation" || test_group == "all" @testset "BUGS examples volume 1" begin @testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_1) m = JuliaBUGS.BUGSExamples.VOLUME_1[m] @@ -64,38 +64,14 @@ if "--compilation" in ARGS include("logp_tests/test_logp.jl") end -if "--profile" in ARGS +if test_group == "profile" || test_group == "all" include("profile.jl") end -if "--gibbs" in ARGS +if test_group == "gibbs" || test_group == "all" include("gibbs.jl") end -if "--mcmchains" in ARGS - include("ext/mcmchains.jl") -end - -if isempty(ARGS) # run all - @testset "Unit Tests" begin - Documenter.doctest(JuliaBUGS; manual=false) - include("utils.jl") - end - include("parser/test_parser.jl") - include("passes.jl") - @testset "BUGS examples volume 1" begin - @testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_1) - m = JuliaBUGS.BUGSExamples.VOLUME_1[m] - model = compile(m.model_def, m.data, m.inits[1]) - end - end - @testset "Some corner cases" begin - include("bugs_primitives.jl") - include("compile.jl") - include("cumulative_density.jl") - end - include("graphs.jl") - include("logp_tests/test_logp.jl") - include("gibbs.jl") +if test_group == "mcmchains" || test_group == "all" include("ext/mcmchains.jl") end From 78230c2d867dfd1f32599daa1c8e10993f4874b3 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 11:12:55 +0000 Subject: [PATCH 26/37] fix error --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 0a98d5d76..205cb72a7 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -32,7 +32,7 @@ const Tests = ( "all" ) -const test_group = get(ENV, TEST_GROUP, "all") +const test_group = get(ENV, :TEST_GROUP, "all") if test_group ∉ Tests error("Unknown test group: $test_group") end From 529f9897121b9e63d45387ddf3211220a70791b0 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 11:15:58 +0000 Subject: [PATCH 27/37] fix ENV key --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 205cb72a7..865d9b00b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -32,7 +32,7 @@ const Tests = ( "all" ) -const test_group = get(ENV, :TEST_GROUP, "all") +const test_group = get(ENV, "TEST_GROUP", "all") if test_group ∉ Tests error("Unknown test group: $test_group") end From 99712ec652c37e15077e7d725b77db4547dfa1f4 Mon Sep 17 00:00:00 2001 From: Xianda Sun <5433119+sunxd3@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:17:45 +0000 Subject: [PATCH 28/37] Update test/runtests.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- test/runtests.jl | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 865d9b00b..8cee00ff0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -23,14 +23,7 @@ using ReverseDiff AbstractMCMC.setprogress!(false) -const Tests = ( - "elementary", - "compilation", - "profile", - "gibbs", - "mcmchains", - "all" -) +const Tests = ("elementary", "compilation", "profile", "gibbs", "mcmchains", "all") const test_group = get(ENV, "TEST_GROUP", "all") if test_group ∉ Tests From 11a60d8d0259f90a5c22668cb6387f2dfd476443 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 11:21:39 +0000 Subject: [PATCH 29/37] fix more errors --- test/graphs.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/graphs.jl b/test/graphs.jl index 43af035c0..f2d63088a 100644 --- a/test/graphs.jl +++ b/test/graphs.jl @@ -78,8 +78,9 @@ end logp += logpdf(dnorm(2.0, 1.0), 4.0) # d, where g = 2.0 logp += logpdf(dnorm(4.0, 4.0), 5.0) # e, where h = 4.0 logp -end ≈ evaluate!!(model, LogDensityContext(), [-2.0, 4.0, 3.0, 2.0, 1.0, 4.0, 5.0])[2] atol = - 1e-8 +end ≈ evaluate!!( + model, JuliaBUGS.LogDensityContext(), [-2.0, 4.0, 3.0, 2.0, 1.0, 4.0, 5.0] +)[2] atol = 1e-8 # AuxiliaryNodeInfo test_model = @bugs begin From f057c2e463ca147706ae125b144d290a039f1d25 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 11:39:28 +0000 Subject: [PATCH 30/37] fix more errors --- test/graphs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/graphs.jl b/test/graphs.jl index f2d63088a..500c1ce61 100644 --- a/test/graphs.jl +++ b/test/graphs.jl @@ -65,7 +65,7 @@ mb_logp = begin end # order: b, l, c, a -@test mb_logp ≈ evaluate!!(cond_model, LogDensityContext(), [c_value])[2] rtol = 1e-8 +@test mb_logp ≈ evaluate!!(cond_model, JuliaBUGS.LogDensityContext(), [c_value])[2] rtol = 1e-8 # test LogDensityContext @test begin From 837c6ff2446e446fff6f73f5931c78539d43ebd0 Mon Sep 17 00:00:00 2001 From: Xianda Sun <5433119+sunxd3@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:42:43 +0000 Subject: [PATCH 31/37] Update test/graphs.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- test/graphs.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/graphs.jl b/test/graphs.jl index 500c1ce61..5820756e4 100644 --- a/test/graphs.jl +++ b/test/graphs.jl @@ -65,7 +65,8 @@ mb_logp = begin end # order: b, l, c, a -@test mb_logp ≈ evaluate!!(cond_model, JuliaBUGS.LogDensityContext(), [c_value])[2] rtol = 1e-8 +@test mb_logp ≈ evaluate!!(cond_model, JuliaBUGS.LogDensityContext(), [c_value])[2] rtol = + 1e-8 # test LogDensityContext @test begin From 8f22695160c4ce3a046091b2df3f4ca7dea4666f Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 11:51:40 +0000 Subject: [PATCH 32/37] fix path error --- test/logp_tests/test_logp.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/logp_tests/test_logp.jl b/test/logp_tests/test_logp.jl index a6e511bb5..7a408958b 100644 --- a/test/logp_tests/test_logp.jl +++ b/test/logp_tests/test_logp.jl @@ -5,12 +5,12 @@ using DynamicPPL: DynamicPPL, getlogp, settrans!!, SimpleVarInfo @testset "Log joint probability" begin @testset "Single distribution models" begin @testset "$s" for s in [:binomial, :gamma, :lkj, :dwish, :ddirich] - include("./single_distribution_models/$s.jl") + include(joinpath(dirname(@__FILE__), "/single_distribution_models/$s.jl")) end end @testset "BUGS models" begin @testset "$s" for s in [:blockers, :bones, :dogs, :rats] - include("./BUGS_models/$s.jl") + include(joinpath(dirname(@__FILE__), "/BUGS_models/$s.jl")) end end end From 6edb1537715c4e1f8e5ea68dde1115b0b240cf39 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 12:02:53 +0000 Subject: [PATCH 33/37] fix file path --- test/logp_tests/test_logp.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/logp_tests/test_logp.jl b/test/logp_tests/test_logp.jl index 7a408958b..ed65eeac4 100644 --- a/test/logp_tests/test_logp.jl +++ b/test/logp_tests/test_logp.jl @@ -5,12 +5,12 @@ using DynamicPPL: DynamicPPL, getlogp, settrans!!, SimpleVarInfo @testset "Log joint probability" begin @testset "Single distribution models" begin @testset "$s" for s in [:binomial, :gamma, :lkj, :dwish, :ddirich] - include(joinpath(dirname(@__FILE__), "/single_distribution_models/$s.jl")) + include("single_distribution_models/$s.jl") end end @testset "BUGS models" begin @testset "$s" for s in [:blockers, :bones, :dogs, :rats] - include(joinpath(dirname(@__FILE__), "/BUGS_models/$s.jl")) + include("BUGS_models/$s.jl") end end end From 3468be4734f3d7ba3ca24b48e8451c0347e3700b Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 12:09:42 +0000 Subject: [PATCH 34/37] fix folder name typo --- .../binomial.jl | 0 .../ddirich.jl | 0 .../dwish.jl | 0 .../gamma.jl | 0 .../lkj.jl | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename test/logp_tests/{single_distribution _models => single_distribution_models}/binomial.jl (100%) rename test/logp_tests/{single_distribution _models => single_distribution_models}/ddirich.jl (100%) rename test/logp_tests/{single_distribution _models => single_distribution_models}/dwish.jl (100%) rename test/logp_tests/{single_distribution _models => single_distribution_models}/gamma.jl (100%) rename test/logp_tests/{single_distribution _models => single_distribution_models}/lkj.jl (100%) diff --git a/test/logp_tests/single_distribution _models/binomial.jl b/test/logp_tests/single_distribution_models/binomial.jl similarity index 100% rename from test/logp_tests/single_distribution _models/binomial.jl rename to test/logp_tests/single_distribution_models/binomial.jl diff --git a/test/logp_tests/single_distribution _models/ddirich.jl b/test/logp_tests/single_distribution_models/ddirich.jl similarity index 100% rename from test/logp_tests/single_distribution _models/ddirich.jl rename to test/logp_tests/single_distribution_models/ddirich.jl diff --git a/test/logp_tests/single_distribution _models/dwish.jl b/test/logp_tests/single_distribution_models/dwish.jl similarity index 100% rename from test/logp_tests/single_distribution _models/dwish.jl rename to test/logp_tests/single_distribution_models/dwish.jl diff --git a/test/logp_tests/single_distribution _models/gamma.jl b/test/logp_tests/single_distribution_models/gamma.jl similarity index 100% rename from test/logp_tests/single_distribution _models/gamma.jl rename to test/logp_tests/single_distribution_models/gamma.jl diff --git a/test/logp_tests/single_distribution _models/lkj.jl b/test/logp_tests/single_distribution_models/lkj.jl similarity index 100% rename from test/logp_tests/single_distribution _models/lkj.jl rename to test/logp_tests/single_distribution_models/lkj.jl From e2520f73ea567be341c57f0519dc4a24516ab2fe Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Mon, 25 Mar 2024 12:18:45 +0000 Subject: [PATCH 35/37] fix more errors --- test/logp_tests/test_logp.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/logp_tests/test_logp.jl b/test/logp_tests/test_logp.jl index ed65eeac4..a6a34aec8 100644 --- a/test/logp_tests/test_logp.jl +++ b/test/logp_tests/test_logp.jl @@ -1,6 +1,6 @@ using JuliaBUGS: BUGSGraph, DefaultContext, evaluate!!, get_params_varinfo, LogDensityContext -using DynamicPPL: DynamicPPL, getlogp, settrans!!, SimpleVarInfo +using DynamicPPL: DynamicPPL, getlogp, settrans!!, SimpleVarInfo, @model @testset "Log joint probability" begin @testset "Single distribution models" begin From 20b083fff9394a4b903420e1dafaa7fa936108f0 Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Tue, 26 Mar 2024 09:36:13 +0000 Subject: [PATCH 36/37] output profile result to step summary --- .github/workflows/Tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 11efbc0a6..32c987ef3 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -56,7 +56,7 @@ jobs: env: TEST_GROUP: "compilation" - name: Profile compiler passes - uses: julia-actions/julia-runtest@v1 + run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(;coverage=true);" >> $GITHUB_STEP_SUMMARY env: TEST_GROUP: "profile" - name: Running `gibbs` tests From 224d3a64b827204d4a66fb00a7e5ec401804a3fb Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Tue, 26 Mar 2024 09:39:34 +0000 Subject: [PATCH 37/37] remove CACHE_NAME from env --- .github/workflows/Tests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 32c987ef3..99f553b42 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -29,8 +29,6 @@ jobs: os: ubuntu-latest arch: x64 coverage: true - env: - CACHE_NAME: julia-${{ matrix.version }}-${{ matrix.arch }} steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 @@ -42,9 +40,9 @@ jobs: path: | ~/.julia ~/.julia/artifacts - key: ${{ runner.os }}-${{ env.CACHE_NAME }}-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }} + key: ${{ runner.os }}-julia-${{ matrix.version }}-${{ matrix.arch }}-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }} restore-keys: | - ${{ runner.os }}-${{ env.CACHE_NAME }}- + ${{ runner.os }}-julia-${{ matrix.version }}-${{ matrix.arch }}- ${{ runner.os }}-julia-${{ matrix.version }}- - uses: julia-actions/julia-buildpkg@v1 - name: Running elementary tests