diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 913c455aa..0ce0ff240 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -3,19 +3,12 @@ steps: plugins: - JuliaCI/julia#v1: version: "1" + - JuliaCI/julia-test#v1: + project: "GraphNeuralNetworks" - JuliaCI/julia-coverage#v1: dirs: - GraphNeuralNetworks/src - command: | - julia --color=yes --depwarn=yes --project=GraphNeuralNetworks/test -e ' - import Pkg - dev_pkgs = Pkg.PackageSpec[] - for pkg in ("GNNGraphs", "GNNlib", "GraphNeuralNetworks") - push!(dev_pkgs, Pkg.PackageSpec(path=pkg)); - end - Pkg.develop(dev_pkgs) - Pkg.add(["CUDA", "cuDNN"]) - Pkg.test("GraphNeuralNetworks")' + - GraphNeuralNetworks/ext agents: queue: "juliagpu" cuda: "*" @@ -28,19 +21,12 @@ steps: plugins: - JuliaCI/julia#v1: version: "1" + - JuliaCI/julia-test#v1: + project: "GraphNeuralNetworks" - JuliaCI/julia-coverage#v1: dirs: - GraphNeuralNetworks/src - command: | - julia --color=yes --depwarn=yes --project=GraphNeuralNetworks/test -e ' - import Pkg - dev_pkgs = Pkg.PackageSpec[] - for pkg in ("GNNGraphs", "GNNlib", "GraphNeuralNetworks") - push!(dev_pkgs, Pkg.PackageSpec(path=pkg)); - end - Pkg.develop(dev_pkgs) - Pkg.add(["AMDGPU"]) - Pkg.test("GraphNeuralNetworks")' + - GraphNeuralNetworks/ext agents: queue: "juliagpu" rocm: "*" @@ -54,19 +40,12 @@ steps: plugins: - JuliaCI/julia#v1: version: "1" + - JuliaCI/julia-test#v1: + project: "GNNlib" - JuliaCI/julia-coverage#v1: dirs: - GNNlib/src - command: | - julia --color=yes --depwarn=yes --project=GNNlib/test -e ' - import Pkg - dev_pkgs = Pkg.PackageSpec[] - for pkg in ("GNNGraphs", "GNNlib") - push!(dev_pkgs, Pkg.PackageSpec(path=pkg)); - end - Pkg.develop(dev_pkgs) - Pkg.add(["CUDA", "cuDNN"]) - Pkg.test("GNNlib")' + - GNNlib/ext agents: queue: "juliagpu" cuda: "*" @@ -79,19 +58,12 @@ steps: plugins: - JuliaCI/julia#v1: version: "1" + - JuliaCI/julia-test#v1: + project: "GNNlib" - JuliaCI/julia-coverage#v1: dirs: - GNNlib/src - command: | - julia --color=yes --depwarn=yes --project=GNNlib/test -e ' - import Pkg - dev_pkgs = Pkg.PackageSpec[] - for pkg in ("GNNGraphs", "GNNlib") - push!(dev_pkgs, Pkg.PackageSpec(path=pkg)); - end - Pkg.develop(dev_pkgs) - Pkg.add(["AMDGPU"]) - Pkg.test("GNNlib")' + - GNNlib/ext agents: queue: "juliagpu" rocm: "*" @@ -105,19 +77,13 @@ steps: plugins: - JuliaCI/julia#v1: version: "1" + - JuliaCI/julia-test#v1: + project: "GNNGraphs" - JuliaCI/julia-coverage#v1: + codecov: true dirs: - GNNGraphs/src - command: | - julia --color=yes --depwarn=yes --project=GNNGraphs/test -e ' - import Pkg - dev_pkgs = Pkg.PackageSpec[] - for pkg in ("GNNGraphs",) - push!(dev_pkgs, Pkg.PackageSpec(path=pkg)); - end - Pkg.develop(dev_pkgs) - Pkg.add(["CUDA", "cuDNN"]) - Pkg.test("GNNGraphs")' + - GNNGraphs/ext agents: queue: "juliagpu" cuda: "*" @@ -130,19 +96,12 @@ steps: plugins: - JuliaCI/julia#v1: version: "1" + - JuliaCI/julia-test#v1: + project: "GNNGraphs" - JuliaCI/julia-coverage#v1: dirs: - GNNGraphs/src - command: | - julia --color=yes --depwarn=yes --project=GNNGraphs/test -e ' - import Pkg - dev_pkgs = Pkg.PackageSpec[] - for pkg in ("GNNGraphs",) - push!(dev_pkgs, Pkg.PackageSpec(path=pkg)); - end - Pkg.develop(dev_pkgs) - Pkg.add(["AMDGPU"]) - Pkg.test("GNNGraphs")' + - GNNGraphs/ext agents: queue: "juliagpu" rocm: "*" diff --git a/.github/workflows/multidocs.yml b/.github/workflows/multidocs.yml index 631c1c5bf..ec424c9ae 100644 --- a/.github/workflows/multidocs.yml +++ b/.github/workflows/multidocs.yml @@ -20,14 +20,18 @@ jobs: version: '1' - uses: julia-actions/cache@v2 # Build individual docs - - run: julia GNNGraphs/docs/make.jl - - run: julia GNNlib/docs/make.jl - - run: julia GNNLux/docs/make.jl - - run: julia GraphNeuralNetworks/docs/make.jl + - run: julia --project=GNNGraphs/docs/ -e 'using Pkg; Pkg.instantiate()' + - run: julia --color=yes --project=GNNGraphs/docs/ GNNGraphs/docs/make.jl + - run: julia --project=GNNlib/docs/ -e 'using Pkg; Pkg.instantiate()' + - run: julia --color=yes --project=GNNlib/docs/ GNNlib/docs/make.jl + - run: julia --project=GNNLux/docs/ -e 'using Pkg; Pkg.instantiate()' + - run: julia --color=yes --project=GNNLux/docs/ GNNLux/docs/make.jl + - run: julia --project=GraphNeuralNetworks/docs/ -e 'using Pkg; Pkg.instantiate()' + - run: julia --color=yes --project=GraphNeuralNetworks/docs/ GraphNeuralNetworks/docs/make.jl # Compile multi docs - name: MultiDocs run: | git config user.name github-actions git config user.email github-actions@github.com julia --project=docs/ -e 'using Pkg; Pkg.instantiate()' - julia --project=docs/ docs/make-multi.jl + julia --color=yes --project=docs/ docs/make-multi.jl diff --git a/.github/workflows/test_GNNGraphs.yml b/.github/workflows/test_GNNGraphs.yml index f83552143..eb8de9df9 100644 --- a/.github/workflows/test_GNNGraphs.yml +++ b/.github/workflows/test_GNNGraphs.yml @@ -15,10 +15,12 @@ jobs: matrix: version: - '1.10' # Replace this with the minimum Julia version that your package supports. - # - '1' # '1' will automatically expand to the latest stable 1.x release of Julia. + - '1' # '1' will automatically expand to the latest stable 1.x release of Julia. # - 'pre' os: - ubuntu-latest + # - windows-latest + # - macos-latest arch: - x64 diff --git a/.github/workflows/test_GNNLux.yml b/.github/workflows/test_GNNLux.yml index b83da7ac7..5909b03cf 100644 --- a/.github/workflows/test_GNNLux.yml +++ b/.github/workflows/test_GNNLux.yml @@ -15,7 +15,7 @@ jobs: matrix: version: - '1.10' # Replace this with the minimum Julia version that your package supports. - # - '1' # '1' will automatically expand to the latest stable 1.x release of Julia. + - '1' # '1' will automatically expand to the latest stable 1.x release of Julia. # - 'pre' os: - ubuntu-latest diff --git a/.github/workflows/test_GNNlib.yml b/.github/workflows/test_GNNlib.yml index 15d80267e..34e281814 100644 --- a/.github/workflows/test_GNNlib.yml +++ b/.github/workflows/test_GNNlib.yml @@ -15,10 +15,12 @@ jobs: matrix: version: - '1.10' # Replace this with the minimum Julia version that your package supports. - # - '1' # '1' will automatically expand to the latest stable 1.x release of Julia. + - '1' # '1' will automatically expand to the latest stable 1.x release of Julia. # - 'pre' os: - ubuntu-latest + # - windows-latest + # - macos-latest arch: - x64 diff --git a/GNNGraphs/Project.toml b/GNNGraphs/Project.toml index 5baf95bf0..40fc049ba 100644 --- a/GNNGraphs/Project.toml +++ b/GNNGraphs/Project.toml @@ -1,7 +1,10 @@ name = "GNNGraphs" uuid = "aed8fd31-079b-4b5a-b342-a13352159b8c" -authors = ["Carlo Lucibello and contributors"] version = "1.4.2" +authors = ["Carlo Lucibello and contributors"] + +[workspace] +projects = ["test", "docs"] [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" @@ -10,7 +13,6 @@ Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MLDataDevices = "7e8f7934-dd98-4c1a-8fe8-92b47a384d40" -MLDatasets = "eb30cadb-4394-5ae3-aed4-317e484a6458" MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54" NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce" @@ -35,7 +37,6 @@ Graphs = "1.4" KrylovKit = "0.8, 0.9" LinearAlgebra = "1" MLDataDevices = "1.0" -MLDatasets = "0.7.18" MLUtils = "0.4" NNlib = "0.9" NearestNeighbors = "0.4" diff --git a/GNNGraphs/docs/Project.toml b/GNNGraphs/docs/Project.toml index 6d6ed11be..e1bf21e11 100644 --- a/GNNGraphs/docs/Project.toml +++ b/GNNGraphs/docs/Project.toml @@ -6,3 +6,6 @@ Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" MLDatasets = "eb30cadb-4394-5ae3-aed4-317e484a6458" MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" + +[sources] +GNNGraphs = {path = ".."} \ No newline at end of file diff --git a/GNNGraphs/docs/make.jl b/GNNGraphs/docs/make.jl index 70f495946..8b57c956f 100644 --- a/GNNGraphs/docs/make.jl +++ b/GNNGraphs/docs/make.jl @@ -1,8 +1,3 @@ -using Pkg -Pkg.activate(@__DIR__) -Pkg.develop(path=joinpath(@__DIR__, "..")) -Pkg.instantiate() - using Documenter using DocumenterInterLinks using GNNGraphs diff --git a/GNNGraphs/test/Project.toml b/GNNGraphs/test/Project.toml index d4af78e8f..3c1bb0d3a 100644 --- a/GNNGraphs/test/Project.toml +++ b/GNNGraphs/test/Project.toml @@ -19,3 +19,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a" TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" + +[sources] +GNNGraphs = {path = ".."} diff --git a/GNNGraphs/test/gnngraph.jl b/GNNGraphs/test/gnngraph.jl index 1d6d27b77..ca9c8af02 100644 --- a/GNNGraphs/test/gnngraph.jl +++ b/GNNGraphs/test/gnngraph.jl @@ -112,7 +112,7 @@ end @test get_device(mat_gpu)isa AbstractGPUDevice @test Array(mat_gpu) == mat end - end + end @testset "scaled_laplacian" begin if TEST_GPU && !(dev isa MetalDevice) && GRAPH_T != :sparse && GRAPH_T != :coo diff --git a/GNNGraphs/test/runtests.jl b/GNNGraphs/test/runtests.jl index aa1f58496..cf7c7d1f4 100644 --- a/GNNGraphs/test/runtests.jl +++ b/GNNGraphs/test/runtests.jl @@ -1,16 +1,10 @@ -## The test environment is instantiated as follows: -# using Pkg -# Pkg.activate(@__DIR__) -# Pkg.develop(path=joinpath(@__DIR__, "..")) -# Pkg.instantiate() - using TestItemRunner ## See https://www.julia-vscode.org/docs/stable/userguide/testitems/ ## for how to run the tests within VS Code. ## See test_module.jl for the test infrastructure. -## Uncomment below and in test_module.jl to change the default test settings +## Uncomment below to change the default test settings # ENV["GNN_TEST_CPU"] = "false" # ENV["GNN_TEST_CUDA"] = "true" # ENV["GNN_TEST_AMDGPU"] = "true" diff --git a/GNNGraphs/test/test_module.jl b/GNNGraphs/test/test_module.jl index e0dfea248..87331c11f 100644 --- a/GNNGraphs/test/test_module.jl +++ b/GNNGraphs/test/test_module.jl @@ -2,11 +2,6 @@ using Pkg -## Uncomment below to change the default test settings -# ENV["GNN_TEST_CUDA"] = "true" -# ENV["GNN_TEST_AMDGPU"] = "true" -# ENV["GNN_TEST_Metal"] = "true" - to_test(backend) = get(ENV, "GNN_TEST_$(backend)", "false") == "true" has_dependecies(pkgs) = all(pkg -> haskey(Pkg.project().dependencies, pkg), pkgs) deps_dict = Dict(:CUDA => ["CUDA", "cuDNN"], :AMDGPU => ["AMDGPU"], :Metal => ["Metal"]) diff --git a/GNNLux/Project.toml b/GNNLux/Project.toml index eac8b5468..d32c75c91 100644 --- a/GNNLux/Project.toml +++ b/GNNLux/Project.toml @@ -1,7 +1,10 @@ name = "GNNLux" uuid = "e8545f4d-a905-48ac-a8c4-ca114b98986d" -authors = ["Carlo Lucibello and contributors"] version = "0.2.0-DEV" +authors = ["Carlo Lucibello and contributors"] + +[workspace] +projects = ["test", "docs"] [deps] ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471" @@ -15,6 +18,10 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69" Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +[sources] +GNNGraphs = {path = "../GNNGraphs"} +GNNlib = {path = "../GNNlib"} + [compat] ConcreteStructs = "0.2.3" GNNGraphs = "1.4" diff --git a/GNNLux/docs/Project.toml b/GNNLux/docs/Project.toml index 206899f94..c8ae968aa 100644 --- a/GNNLux/docs/Project.toml +++ b/GNNLux/docs/Project.toml @@ -16,3 +16,8 @@ OneHotArrays = "0b1bfda6-eb8a-41d2-88d8-f5af5cad476f" Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2" TSne = "24678dba-d5e9-5843-a4c6-250288b04835" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" + +[sources] +GNNGraphs = {path = "../../GNNGraphs"} +GNNLux = {path = ".."} +GNNlib = {path = "../../GNNlib"} diff --git a/GNNLux/docs/make.jl b/GNNLux/docs/make.jl index d79dd6171..5a35ec1e5 100644 --- a/GNNLux/docs/make.jl +++ b/GNNLux/docs/make.jl @@ -1,12 +1,3 @@ -using Pkg -Pkg.activate(@__DIR__) -Pkg.develop([ - PackageSpec(path=joinpath(@__DIR__, "..", "..", "GNNGraphs")), - PackageSpec(path=joinpath(@__DIR__, "..", "..", "GNNlib")), - PackageSpec(path=joinpath(@__DIR__, "..")), -]) -Pkg.instantiate() - using Documenter using GNNLux using Lux, GNNGraphs, GNNlib, Graphs diff --git a/GNNLux/src/layers/basic.jl b/GNNLux/src/layers/basic.jl index ea0df2908..e906e91c0 100644 --- a/GNNLux/src/layers/basic.jl +++ b/GNNLux/src/layers/basic.jl @@ -34,8 +34,8 @@ julia> rng = Random.default_rng(); julia> m = GNNChain(GCNConv(2 => 5, relu), Dense(5 => 4)) GNNChain( layers = NamedTuple( - layer_1 = GCNConv(2 => 5, relu), # 15 parameters - layer_2 = Dense(5 => 4), # 24 parameters + layer_1 = GCNConv(2 => 5, relu), # 15 parameters + layer_2 = Dense(5 => 4), # 24 parameters ), ) # Total: 39 parameters, # plus 0 states. diff --git a/GNNLux/test/Project.toml b/GNNLux/test/Project.toml index 75b82f42d..ec4757047 100644 --- a/GNNLux/test/Project.toml +++ b/GNNLux/test/Project.toml @@ -21,5 +21,7 @@ TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a" TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" -[compat] -LuxTestUtils = "1" +[sources] +GNNGraphs = {path = "../../GNNGraphs"} +GNNLux = {path = ".."} +GNNlib = {path = "../../GNNlib"} \ No newline at end of file diff --git a/GNNLux/test/layers/conv.jl b/GNNLux/test/layers/conv.jl index dd30795ee..e97206c45 100644 --- a/GNNLux/test/layers/conv.jl +++ b/GNNLux/test/layers/conv.jl @@ -32,11 +32,12 @@ l = EdgeConv(nn, aggr = +) test_lux_layer(rng, l, g, x, sizey=(out_dims,10), container=true) end - - @testset "CGConv" begin - l = CGConv(in_dims => in_dims, residual = true) - test_lux_layer(rng, l, g, x, outputsize=(in_dims,), container=true) - end + + ## TODO SEGFAULT on julia 1.12 + # @testset "CGConv" begin + # l = CGConv(in_dims => in_dims, residual = true) + # test_lux_layer(rng, l, g, x, outputsize=(in_dims,), container=true) + # end @testset "DConv" begin l = DConv(in_dims => out_dims, 2) @@ -62,7 +63,7 @@ l = GATConv(6 => 8, heads=2) test_lux_layer(rng, l, g, x, outputsize=(16,)) - l = GATConv(6 => 8, heads=2, concat=false, dropout=0.5) + l = GATConv(6 => 8, heads=2, concat=false) test_lux_layer(rng, l, g, x, outputsize=(8,)) #TODO test edge @@ -74,7 +75,7 @@ l = GATv2Conv(6 => 8, heads=2) test_lux_layer(rng, l, g, x, outputsize=(16,)) - l = GATv2Conv(6 => 8, heads=2, concat=false, dropout=0.5) + l = GATv2Conv(6 => 8, heads=2, concat=false) test_lux_layer(rng, l, g, x, outputsize=(8,)) #TODO test edge @@ -125,12 +126,13 @@ test_lux_layer(rng, l, g2, x; outputsize=(n_out,), e, container=true) end - @testset "GMMConv" begin - ein_dims = 4 - e = randn(rng, Float32, ein_dims, g.num_edges) - l = GMMConv((in_dims, ein_dims) => out_dims, tanh; K = 2, residual = false) - test_lux_layer(rng, l, g, x; outputsize=(out_dims,), e) - end + ## TODO SEGFAULT on julia 1.12 + # @testset "GMMConv" begin + # ein_dims = 4 + # e = randn(rng, Float32, ein_dims, g.num_edges) + # l = GMMConv((in_dims, ein_dims) => out_dims, tanh; K = 2, residual = false) + # test_lux_layer(rng, l, g, x; outputsize=(out_dims,), e) + # end @testset "ResGatedGraphConv" begin l = ResGatedGraphConv(in_dims => out_dims, tanh) diff --git a/GNNLux/test/layers/temporalconv.jl b/GNNLux/test/layers/temporalconv.jl index 794775f88..4657b66df 100644 --- a/GNNLux/test/layers/temporalconv.jl +++ b/GNNLux/test/layers/temporalconv.jl @@ -1,6 +1,6 @@ @testitem "layers/temporalconv" setup=[TestModuleLux] begin using .TestModuleLux - using LuxTestUtils: test_gradients, AutoReverseDiff, AutoTracker, AutoForwardDiff, AutoEnzyme + using LuxTestUtils: test_gradients, AutoTracker, AutoForwardDiff, AutoEnzyme rng = StableRNG(1234) g = rand_graph(rng, 10, 40) @@ -16,7 +16,7 @@ st = LuxCore.initialstates(rng, l) y1, _ = l(g, x, ps, st) loss = (x, ps) -> sum(first(l(g, x, ps, st))) - test_gradients(loss, x, ps; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoReverseDiff(), AutoTracker(), AutoForwardDiff(), AutoEnzyme()]) + test_gradients(loss, x, ps; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoForwardDiff(), AutoEnzyme()]) # Test with custom activation (relu) l_relu = TGCN(3=>3, act = relu) @@ -28,7 +28,7 @@ @test !isapprox(y1, y2, rtol=1.0f-2) loss_relu = (x, ps) -> sum(first(l_relu(g, x, ps, st_relu))) - test_gradients(loss_relu, x, ps_relu; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoReverseDiff(), AutoTracker(), AutoForwardDiff(), AutoEnzyme()]) + test_gradients(loss_relu, x, ps_relu; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoForwardDiff(), AutoEnzyme()]) end @testset "A3TGCN" begin @@ -36,7 +36,7 @@ ps = LuxCore.initialparameters(rng, l) st = LuxCore.initialstates(rng, l) loss = (x, ps) -> sum(first(l(g, x, ps, st))) - test_gradients(loss, x, ps; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoReverseDiff(), AutoTracker(), AutoForwardDiff(), AutoEnzyme()]) + test_gradients(loss, x, ps; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoForwardDiff(), AutoEnzyme()]) end @testset "GConvGRU" begin @@ -44,7 +44,7 @@ ps = LuxCore.initialparameters(rng, l) st = LuxCore.initialstates(rng, l) loss = (x, ps) -> sum(first(l(g, x, ps, st))) - test_gradients(loss, x, ps; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoReverseDiff(), AutoTracker(), AutoForwardDiff(), AutoEnzyme()]) + test_gradients(loss, x, ps; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoForwardDiff(), AutoEnzyme()]) end @testset "GConvLSTM" begin @@ -52,7 +52,7 @@ ps = LuxCore.initialparameters(rng, l) st = LuxCore.initialstates(rng, l) loss = (x, ps) -> sum(first(l(g, x, ps, st))) - test_gradients(loss, x, ps; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoReverseDiff(), AutoTracker(), AutoForwardDiff(), AutoEnzyme()]) + test_gradients(loss, x, ps; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoForwardDiff(), AutoEnzyme()]) end @testset "DCGRU" begin @@ -60,7 +60,7 @@ ps = LuxCore.initialparameters(rng, l) st = LuxCore.initialstates(rng, l) loss = (x, ps) -> sum(first(l(g, x, ps, st))) - test_gradients(loss, x, ps; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoReverseDiff(), AutoTracker(), AutoForwardDiff(), AutoEnzyme()]) + test_gradients(loss, x, ps; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoForwardDiff(), AutoEnzyme()]) end @testset "EvolveGCNO" begin @@ -68,6 +68,6 @@ ps = LuxCore.initialparameters(rng, l) st = LuxCore.initialstates(rng, l) loss = (tx, ps) -> sum(sum(first(l(tg, tx, ps, st)))) - test_gradients(loss, tx, ps; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoReverseDiff(), AutoTracker(), AutoForwardDiff(), AutoEnzyme()]) + test_gradients(loss, tx, ps; atol=1.0f-2, rtol=1.0f-2, skip_backends=[AutoForwardDiff(), AutoEnzyme()]) end end \ No newline at end of file diff --git a/GNNLux/test/runtests.jl b/GNNLux/test/runtests.jl index 0483eff61..91f74105f 100644 --- a/GNNLux/test/runtests.jl +++ b/GNNLux/test/runtests.jl @@ -1,11 +1,3 @@ -## The test environment is instantiated as follows: -# using Pkg -# Pkg.activate(@__DIR__) -# Pkg.develop(path=joinpath(@__DIR__, "..", "..", "GNNGraphs")) -# Pkg.develop(path=joinpath(@__DIR__, "..", "..", "GNNlib")) -# Pkg.develop(path=joinpath(@__DIR__, "..")) -# Pkg.instantiate() - using TestItemRunner ## See https://www.julia-vscode.org/docs/stable/userguide/testitems/ diff --git a/GNNLux/test/test_module.jl b/GNNLux/test/test_module.jl index 83f3e7062..3f895b996 100644 --- a/GNNLux/test/test_module.jl +++ b/GNNLux/test/test_module.jl @@ -32,7 +32,7 @@ using Reexport: @reexport @reexport using StableRNGs @reexport using Random, Statistics -using LuxTestUtils: test_gradients, AutoReverseDiff, AutoTracker, AutoForwardDiff, AutoEnzyme +using LuxTestUtils: test_gradients, AutoTracker, AutoForwardDiff, AutoEnzyme export test_lux_layer @@ -67,11 +67,11 @@ function test_lux_layer(rng::AbstractRNG, l, g::GNNGraph, x; end if e !== nothing - loss = (x, ps) -> sum(first(l(g, x, e, ps, st))) + loss = (x, ps) -> mean(first(l(g, x, e, ps, st))) else - loss = (x, ps) -> sum(first(l(g, x, ps, st))) + loss = (x, ps) -> mean(first(l(g, x, ps, st))) end - test_gradients(loss, x, ps; atol, rtol, skip_backends=[AutoReverseDiff(), AutoTracker(), AutoForwardDiff(), AutoEnzyme()]) + test_gradients(loss, x, ps; atol, rtol, skip_backends=[AutoForwardDiff(), AutoEnzyme()]) end end diff --git a/GNNlib/Project.toml b/GNNlib/Project.toml index fd64ac6a8..d0f753fd7 100644 --- a/GNNlib/Project.toml +++ b/GNNlib/Project.toml @@ -3,6 +3,9 @@ uuid = "a6a84749-d869-43f8-aacc-be26a1996e48" authors = ["Carlo Lucibello and contributors"] version = "1.0.1" +[workspace] +projects = ["test", "docs", "../GNNGraphs"] + [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" diff --git a/GNNlib/docs/Project.toml b/GNNlib/docs/Project.toml index 3bd80885f..6ebb215f0 100644 --- a/GNNlib/docs/Project.toml +++ b/GNNlib/docs/Project.toml @@ -6,3 +6,7 @@ GNNlib = "a6a84749-d869-43f8-aacc-be26a1996e48" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" MLDatasets = "eb30cadb-4394-5ae3-aed4-317e484a6458" MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54" + +[sources] +GNNGraphs = {path = "../../GNNGraphs"} +GNNlib = {path = ".."} \ No newline at end of file diff --git a/GNNlib/docs/make.jl b/GNNlib/docs/make.jl index 7538b2bd3..f19a442c5 100644 --- a/GNNlib/docs/make.jl +++ b/GNNlib/docs/make.jl @@ -1,11 +1,3 @@ -using Pkg -Pkg.activate(@__DIR__) -Pkg.develop([ - PackageSpec(path=joinpath(@__DIR__, "..", "..", "GNNGraphs")), - PackageSpec(path=joinpath(@__DIR__, "..")), -]) -Pkg.instantiate() - using Documenter using GNNlib using GNNGraphs diff --git a/GNNlib/test/Project.toml b/GNNlib/test/Project.toml index c944e6684..2d87c8e99 100644 --- a/GNNlib/test/Project.toml +++ b/GNNlib/test/Project.toml @@ -16,3 +16,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" + +[sources] +GNNGraphs = {path = "../../GNNGraphs"} +GNNlib = {path = ".."} \ No newline at end of file diff --git a/GNNlib/test/msgpass.jl b/GNNlib/test/msgpass.jl index a9dff3a56..44bda260b 100644 --- a/GNNlib/test/msgpass.jl +++ b/GNNlib/test/msgpass.jl @@ -168,7 +168,8 @@ end @testset "copy_xj +" begin for g in TEST_GRAPHS - broken = get_graph_type(g) == :sparse && gpu_backend() == "AMDGPU" + # broken = get_graph_type(g) == :sparse + broken = false f(g, x) = propagate(copy_xj, g, +, xj = x) @test test_gradients( f, g, g.x; test_gpu=true, test_grad_f=false, compare_finite_diff=false @@ -178,7 +179,8 @@ end @testset "copy_xj mean" begin for g in TEST_GRAPHS - broken = get_graph_type(g) == :sparse && gpu_backend() == "AMDGPU" + # broken = get_graph_type(g) == :sparse + broken = false f(g, x) = propagate(copy_xj, g, mean, xj = x) @test test_gradients( f, g, g.x; test_gpu=true, test_grad_f=false, compare_finite_diff=false @@ -188,7 +190,8 @@ end @testset "e_mul_xj +" begin for g in TEST_GRAPHS - broken = get_graph_type(g) == :sparse && gpu_backend() == "AMDGPU" + # broken = get_graph_type(g) == :sparse + broken = false e = rand(Float32, size(g.x, 1), g.num_edges) f(g, x, e) = propagate(e_mul_xj, g, +; xj = x, e) @test test_gradients( diff --git a/GNNlib/test/runtests.jl b/GNNlib/test/runtests.jl index 25f2ca5aa..d420f5a6c 100644 --- a/GNNlib/test/runtests.jl +++ b/GNNlib/test/runtests.jl @@ -1,10 +1,3 @@ -## The test environment is instantiated as follows: -# using Pkg -# Pkg.activate(@__DIR__) -# Pkg.develop(path=joinpath(@__DIR__, "..", "..", "GNNGraphs")) -# Pkg.develop(path=joinpath(@__DIR__, "..")) -# Pkg.instantiate() - using TestItemRunner ## See https://www.julia-vscode.org/docs/stable/userguide/testitems/ diff --git a/GraphNeuralNetworks/Project.toml b/GraphNeuralNetworks/Project.toml index 9d32f6768..0fc4c82f5 100644 --- a/GraphNeuralNetworks/Project.toml +++ b/GraphNeuralNetworks/Project.toml @@ -3,6 +3,9 @@ uuid = "cffab07f-9bc2-4db1-8861-388f63bf7694" authors = ["Carlo Lucibello and contributors"] version = "1.0.0" +[workspace] +projects = ["test", "docs"] + [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471" diff --git a/GraphNeuralNetworks/docs/Project.toml b/GraphNeuralNetworks/docs/Project.toml index 62c4ff8d3..b5b3e0dfe 100644 --- a/GraphNeuralNetworks/docs/Project.toml +++ b/GraphNeuralNetworks/docs/Project.toml @@ -4,6 +4,7 @@ CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" DemoCards = "311a05b2-6137-4a5a-b473-18580a3d38b5" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656" +DocumenterMermaid = "a078cd44-4d9c-4618-b545-3ab9d77f9177" FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" GNNGraphs = "aed8fd31-079b-4b5a-b342-a13352159b8c" @@ -22,5 +23,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" TSne = "24678dba-d5e9-5843-a4c6-250288b04835" cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd" -[compat] -Literate = "2.20" +[sources] +GNNGraphs = {path = "../../GNNGraphs"} +GNNlib = {path = "../../GNNlib"} +GraphNeuralNetworks = {path = ".."} diff --git a/GraphNeuralNetworks/docs/make.jl b/GraphNeuralNetworks/docs/make.jl index 5579ad80d..4958f6a28 100644 --- a/GraphNeuralNetworks/docs/make.jl +++ b/GraphNeuralNetworks/docs/make.jl @@ -1,12 +1,3 @@ -using Pkg -Pkg.activate(@__DIR__) -Pkg.develop([ - PackageSpec(path=joinpath(@__DIR__, "..", "..", "GNNGraphs")), - PackageSpec(path=joinpath(@__DIR__, "..", "..", "GNNlib")), - PackageSpec(path=joinpath(@__DIR__, "..")), -]) -Pkg.instantiate() - using Documenter using DemoCards: DemoCards using GraphNeuralNetworks diff --git a/GraphNeuralNetworks/docs/src/democards/gridtheme.css b/GraphNeuralNetworks/docs/src/democards/gridtheme.css deleted file mode 100644 index 4d02fc844..000000000 --- a/GraphNeuralNetworks/docs/src/democards/gridtheme.css +++ /dev/null @@ -1,59 +0,0 @@ -.grid-card-section { - display: flex; - flex-direction: row; - flex-wrap: wrap; - align-content: space-between; -} - -.grid-card:hover{ - box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.4), 0 6px 20px 0 rgba(0, 0, 0, 0.1); -} - -.grid-card { - width: 210px; - max-height: 400px; - margin: 10px 15px; - box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); - transition: 0.3s; - border-radius: 5px; -} - -.grid-card-text { - padding: 0 15px; -} - -.grid-card-cover img { - width: 100%; -} - -.grid-card-cover { - width: 200px; - height: 220px; - padding: 5px; - box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2); - transition: 0.3s; - border-radius: 5px; - display:block; - margin:auto; -} - -.grid-card-cover .grid-card-description { - opacity: 0; - z-index: -1; - position: absolute; - top: 25%; - left: 140%; - width: 100%; - transform: translate(-50%, -50%); - padding: 10px; - border-radius: 5px; - background: rgba(0, 0, 0, 0.8); - color: #fff; - text-align: center; - font-size: 14px; -} - -.grid-card-cover:hover .grid-card-description{ - z-index: 3; - opacity: 1; -} diff --git a/GraphNeuralNetworks/docs/src/dev.md b/GraphNeuralNetworks/docs/src/dev.md index 6a0da262c..eb92e2aa1 100644 --- a/GraphNeuralNetworks/docs/src/dev.md +++ b/GraphNeuralNetworks/docs/src/dev.md @@ -2,15 +2,32 @@ ## Development Enviroment -GraphNeuralNetworks.jl is package hosted in a monorepo that contains multiple packages. -The GraphNeuralNetworks.jl package depends on GNNGraphs.jl and GNNlib.jl, also hosted in the same monorepo. -In order +GraphNeuralNetworks.jl is a collection of packages hosted on a single GitHub repository. +These packages are `GraphNeuralNetworks.jl` (a package with the same name as the whole project), `GNNGraphs.jl`, `GNNlib.jl`, and `GNNLux.jl`. + +The dependencies between these packages are as follows: +```mermaid +graph TD; + GNNGraphs --> GNNlib; + GNNlib --> GraphNeuralNetworks; + GNNGraphs --> GraphNeuralNetworks; + GNNlib --> GNNLux; + GNNGraphs --> GNNLux; +``` -```julia -pkg> activate . +Thanks to [workspaces](https://pkgdocs.julialang.org/v1/toml-files/#The-%5Bworkspace%5D-section) introduced in julia 1.12, developing multiple packages in a monorepo is straightforward. + +Clone the repository with +``` +git clone https://github.com/JuliaGraphs/GraphNeuralNetworks.jl +``` -pkg> dev ./GNNGraphs +Then activate any of the packages you want to develop, for example `GraphNeuralNetworks`: +``` +cd GraphNeuralNetworks +julia --project=. ``` +Dependencies in the monorepo will be automatically available in `dev` mode, so you can start editing the code of any of the packages and test your changes immediately. ## Add a New Layer diff --git a/GraphNeuralNetworks/perf/Project.toml b/GraphNeuralNetworks/perf/Project.toml index 39f4e96fc..8e875afcc 100644 --- a/GraphNeuralNetworks/perf/Project.toml +++ b/GraphNeuralNetworks/perf/Project.toml @@ -7,3 +7,8 @@ GNNlib = "a6a84749-d869-43f8-aacc-be26a1996e48" GraphNeuralNetworks = "cffab07f-9bc2-4db1-8861-388f63bf7694" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" + +[sources] +GNNGraphs = {path = "../../GNNGraphs"} +GNNlib = {path = "../../GNNlib"} +GraphNeuralNetworks = {path = ".."} \ No newline at end of file diff --git a/GraphNeuralNetworks/perf/sparse_propagate_cuda.jl b/GraphNeuralNetworks/perf/sparse_propagate_cuda.jl index e29e82596..99d1b905f 100644 --- a/GraphNeuralNetworks/perf/sparse_propagate_cuda.jl +++ b/GraphNeuralNetworks/perf/sparse_propagate_cuda.jl @@ -1,10 +1,3 @@ -# # Activate the perf environment -# using Pkg -# Pkg.activate(@__DIR__) -# Pkg.develop(path=joinpath(@__DIR__, "..", "..", "GNNGraphs")) -# Pkg.develop(path=joinpath(@__DIR__, "..", "..", "GNNlib")) -# Pkg.develop(path=joinpath(@__DIR__, "..")) -# Pkg.instantiate() using SparseArrays using GraphNeuralNetworks using BenchmarkTools diff --git a/GraphNeuralNetworks/test/Project.toml b/GraphNeuralNetworks/test/Project.toml index 32f30347c..31f7482f4 100644 --- a/GraphNeuralNetworks/test/Project.toml +++ b/GraphNeuralNetworks/test/Project.toml @@ -16,3 +16,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" +[sources] +GNNGraphs = {path = "../../GNNGraphs"} +GNNlib = {path = "../../GNNlib"} +GraphNeuralNetworks = {path = ".."} diff --git a/GraphNeuralNetworks/test/runtests.jl b/GraphNeuralNetworks/test/runtests.jl index b6faea378..0a1dfeec6 100644 --- a/GraphNeuralNetworks/test/runtests.jl +++ b/GraphNeuralNetworks/test/runtests.jl @@ -1,18 +1,10 @@ -## The test environment is instantiated as follows: -# using Pkg -# Pkg.activate(@__DIR__) -# Pkg.develop(path=joinpath(@__DIR__, "..", "..", "GNNGraphs")) -# Pkg.develop(path=joinpath(@__DIR__, "..", "..", "GNNlib")) -# Pkg.develop(path=joinpath(@__DIR__, "..")) -# Pkg.instantiate() - using TestItemRunner ## See https://www.julia-vscode.org/docs/stable/userguide/testitems/ ## for how to run the tests within VS Code. ## See test_module.jl for the test infrastructure. -## Uncomment below and in test_module.jl to change the default test settings +## Uncomment below to change the default test settings # ENV["GNN_TEST_CPU"] = "false" # ENV["GNN_TEST_CUDA"] = "true" # ENV["GNN_TEST_AMDGPU"] = "true" diff --git a/GraphNeuralNetworks/test/test_module.jl b/GraphNeuralNetworks/test/test_module.jl index 74c25a555..ea6cc3a06 100644 --- a/GraphNeuralNetworks/test/test_module.jl +++ b/GraphNeuralNetworks/test/test_module.jl @@ -2,11 +2,6 @@ using Pkg -## Uncomment below to change the default test settings -# ENV["GNN_TEST_CUDA"] = "true" -# ENV["GNN_TEST_AMDGPU"] = "true" -# ENV["GNN_TEST_Metal"] = "true" - to_test(backend) = get(ENV, "GNN_TEST_$(backend)", "false") == "true" has_dependecies(pkgs) = all(pkg -> haskey(Pkg.project().dependencies, pkg), pkgs) deps_dict = Dict(:CUDA => ["CUDA", "cuDNN"], :AMDGPU => ["AMDGPU"], :Metal => ["Metal"]) diff --git a/Project.toml b/Project.toml new file mode 100644 index 000000000..eec639f25 --- /dev/null +++ b/Project.toml @@ -0,0 +1,2 @@ +[workspace] +projects = ["GNNGraphs", "GNNlib", "GraphNeuralNetworks", "GNNLux"]