diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 6a675adb..5268c8ad 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -18,7 +18,7 @@ steps: end println("+++ :julia: Running tests") - Pkg.test(; coverage=true)' + Pkg.test(; coverage=true, test_args=`--platform cuda`)' agents: queue: "juliagpu" cuda: "*" diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 47d362b0..7e08d192 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -38,6 +38,8 @@ jobs: Pkg.develop(path="lib/intrinsics") end' - uses: julia-actions/julia-runtest@v1 + with: + test_args: '--platform pocl' - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v5 with: diff --git a/test/runtests.jl b/test/runtests.jl index 73f9792c..9c1ce000 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -34,6 +34,7 @@ if do_help --list List all available tests. --quickfail Fail the entire run as soon as a single test errored. --jobs=N Launch `N` processes to perform tests (default: Sys.CPU_THREADS). + --platform=NAME Run tests on the platform named `NAME` (default: all platforms). Remaining arguments filter the tests that will be executed.""") exit(0) @@ -99,6 +100,8 @@ if do_list end exit(0) end +## --platform selector +do_platform, platform = extract_flag!(ARGS, "--platform", nothing) ## no options should remain optlike_args = filter(startswith("-"), ARGS) if !isempty(optlike_args) @@ -245,8 +248,9 @@ try # run the test running_tests[test] = now() try - - resp = remotecall_fetch(runtests, wrkr, test_runners[test], test) + resp = remotecall_fetch(runtests, wrkr, + test_runners[test], test, + platform) catch e isa(e, InterruptException) && return resp = Any[e] diff --git a/test/setup.jl b/test/setup.jl index 2796aa5f..536fa2f0 100644 --- a/test/setup.jl +++ b/test/setup.jl @@ -52,10 +52,33 @@ using Random ## entry point -function runtests(f, name) +const targets = [] + +function runtests(f, name, platform_filter) old_print_setting = Test.TESTSET_PRINT_ENABLE[] Test.TESTSET_PRINT_ENABLE[] = false + if isempty(targets) + for platform in cl.platforms(), + device in cl.devices(platform) + if platform_filter !== nothing + # filter on the name or vendor + names = lowercase.([platform.name, platform.vendor]) + if !any(contains(platform_filter), names) + continue + end + end + push!(targets, (; platform, device)) + end + if isempty(targets) + if platform_filter === nothing + throw(ArgumentError("No OpenCL platforms found")) + else + throw(ArgumentError("No OpenCL platforms found matching $platform_filter")) + end + end + end + try # generate a temporary module to execute the tests in mod_name = Symbol("Test", rand(1:100), "Main_", replace(name, '/' => '_')) @@ -76,9 +99,7 @@ function runtests(f, name) OpenCL.allowscalar(false) @timed @testset $"$name" begin - @testset "\$(device.name)" for platform in cl.platforms(), - device in cl.devices(platform) - + @testset "\$(device.name)" for (; platform, device) in $targets cl.platform!(platform) cl.device!(device)