Skip to content

Commit bd1614c

Browse files
updates to GNNLux for first release (#540)
1 parent 5b5663e commit bd1614c

File tree

9 files changed

+92
-30
lines changed

9 files changed

+92
-30
lines changed

GNNGraphs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ GNNGraphsSimpleWeightedGraphsExt = "SimpleWeightedGraphs"
3131
Adapt = "4"
3232
CUDA = "5"
3333
ChainRulesCore = "1"
34-
Functors = "0.4.1"
34+
Functors = "0.4.1, 0.5"
3535
Graphs = "1.4"
3636
KrylovKit = "0.8"
3737
LinearAlgebra = "1"

GNNLux/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Carlo Lucibello <[email protected]> and contributors
3+
Copyright (c) 2024 Carlo Lucibello <[email protected]> and contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

GNNLux/Project.toml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,12 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1717

1818
[compat]
1919
ConcreteStructs = "0.2.3"
20-
Lux = "1.0"
21-
LuxCore = "1.0"
20+
GNNGraphs = "1.3"
21+
GNNlib = "0.2.3"
22+
Lux = "1"
23+
LuxCore = "1"
2224
NNlib = "0.9.21"
2325
Reexport = "1.2"
2426
Static = "1.1"
27+
Statistics = "1"
2528
julia = "1.10"
26-
27-
[extras]
28-
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
29-
Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196"
30-
LuxTestUtils = "ac9de150-d08f-4546-94fb-7472b5760531"
31-
MLDataDevices = "7e8f7934-dd98-4c1a-8fe8-92b47a384d40"
32-
ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
33-
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
34-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
35-
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
36-
37-
[targets]
38-
test = ["Test", "MLDataDevices", "ComponentArrays", "Functors", "LuxTestUtils", "ReTestItems", "StableRNGs", "Zygote"]

GNNLux/test/Project.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[deps]
2+
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
3+
ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
4+
Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196"
5+
GNNGraphs = "aed8fd31-079b-4b5a-b342-a13352159b8c"
6+
GNNLux = "e8545f4d-a905-48ac-a8c4-ca114b98986d"
7+
GNNlib = "a6a84749-d869-43f8-aacc-be26a1996e48"
8+
Lux = "b2108857-7c20-44ae-9111-449ecde12c47"
9+
LuxCore = "bb33d45b-7691-41d6-9220-0943567d0623"
10+
LuxTestUtils = "ac9de150-d08f-4546-94fb-7472b5760531"
11+
MLDataDevices = "7e8f7934-dd98-4c1a-8fe8-92b47a384d40"
12+
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
13+
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
14+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
15+
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
16+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
17+
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
18+
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
19+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
20+
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
21+
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"
22+
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

GNNLux/test/layers/basic_tests.jl renamed to GNNLux/test/layers/basic.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
@testitem "layers/basic" setup=[SharedTestSetup] begin
1+
@testitem "layers/basic" setup=[TestModuleLux] begin
2+
using .TestModuleLux
3+
24
rng = StableRNG(17)
35
g = rand_graph(rng, 10, 40)
46
x = randn(rng, Float32, 3, 10)

GNNLux/test/layers/conv_tests.jl renamed to GNNLux/test/layers/conv.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
@testitem "layers/conv" setup=[SharedTestSetup] begin
1+
@testitem "layers/conv" setup=[TestModuleLux] begin
2+
using .TestModuleLux
3+
24
rng = StableRNG(1234)
35
g = rand_graph(rng, 10, 40)
46
in_dims = 3

GNNLux/test/layers/temporalconv_test.jl renamed to GNNLux/test/layers/temporalconv.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
@testitem "layers/temporalconv" setup=[SharedTestSetup] begin
1+
@testitem "layers/temporalconv" setup=[TestModuleLux] begin
2+
using .TestModuleLux
23
using LuxTestUtils: test_gradients, AutoReverseDiff, AutoTracker, AutoForwardDiff, AutoEnzyme
34

45
rng = StableRNG(1234)

GNNLux/test/runtests.jl

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
1-
using Test
2-
using Lux
3-
using GNNLux
4-
using Random, Statistics
1+
using TestItemRunner
52

6-
using ReTestItems
7-
# using Pkg, Preferences, Test
8-
# using InteractiveUtils, Hwloc
3+
## See https://www.julia-vscode.org/docs/stable/userguide/testitems/
4+
## for how to run the tests within VS Code.
5+
## See test_module.jl for the test infrastructure.
96

10-
runtests(GNNLux)
7+
## Uncomment below and in test_module.jl to change the default test settings
8+
# ENV["GNN_TEST_CPU"] = "false"
9+
# ENV["GNN_TEST_CUDA"] = "true"
10+
# ENV["GNN_TEST_AMDGPU"] = "true"
11+
# ENV["GNN_TEST_Metal"] = "true"
12+
13+
# The only available tag at the moment is :gpu
14+
# Tests not tagged with :gpu are considered to be CPU tests
15+
# Tests tagged with :gpu should run on all GPU backends
16+
17+
# TODO add gpu tests. Not urgent since almost the whole path for layers is tested
18+
# in GraphNeuralNetworks.jl
19+
20+
if get(ENV, "GNN_TEST_CPU", "true") == "true"
21+
@run_package_tests filter = ti -> :gpu ti.tags
22+
end
23+
if get(ENV, "GNN_TEST_CUDA", "false") == "true"
24+
@run_package_tests filter = ti -> :gpu ti.tags
25+
end
26+
if get(ENV, "GNN_TEST_AMDGPU", "false") == "true"
27+
@run_package_tests filter = ti -> :gpu ti.tags
28+
end
29+
if get(ENV, "GNN_TEST_Metal", "false") == "true"
30+
@run_package_tests filter = ti -> :gpu ti.tags
31+
end

GNNLux/test/shared_testsetup.jl renamed to GNNLux/test/test_module.jl

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
1-
@testsetup module SharedTestSetup
1+
@testmodule TestModuleLux begin
22

3-
import Reexport: @reexport
3+
using Pkg
4+
5+
## Uncomment below to change the default test settings
6+
# ENV["GNN_TEST_CUDA"] = "true"
7+
# ENV["GNN_TEST_AMDGPU"] = "true"
8+
# ENV["GNN_TEST_Metal"] = "true"
9+
10+
to_test(backend) = get(ENV, "GNN_TEST_$(backend)", "false") == "true"
11+
has_dependecies(pkgs) = all(pkg -> haskey(Pkg.project().dependencies, pkg), pkgs)
12+
deps_dict = Dict(:CUDA => ["CUDA", "cuDNN"], :AMDGPU => ["AMDGPU"], :Metal => ["Metal"])
13+
14+
for (backend, deps) in deps_dict
15+
if to_test(backend)
16+
if !has_dependecies(deps)
17+
Pkg.add(deps)
18+
end
19+
@eval using $backend
20+
if backend == :CUDA
21+
@eval using cuDNN
22+
end
23+
@eval $backend.allowscalar(false)
24+
end
25+
end
26+
27+
using Reexport: @reexport
428

529
@reexport using Test
630
@reexport using GNNLux

0 commit comments

Comments
 (0)