From b5cefef4a6dd7fceee9e1c4106ddd5c3ea49d6e5 Mon Sep 17 00:00:00 2001 From: tmigot Date: Mon, 28 Jul 2025 17:27:55 -0400 Subject: [PATCH] Parallelize tests and fix consistency checks --- test/Project.toml | 2 ++ test/runtests.jl | 37 ++++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/test/Project.toml b/test/Project.toml index df53446..4528109 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,4 +1,6 @@ [deps] +CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" +Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6" NLPModelsTest = "7998695d-6960-4d3a-85c4-e1bceb8cd856" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/runtests.jl b/test/runtests.jl index 09ea267..0163c7c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,18 +1,29 @@ -using TimerNLPModels -using NLPModels, NLPModelsTest -using Test +using Distributed -@testset "TimerNLPModels.jl for NLP" begin - @testset "NLP: $pb" for pb in NLPModelsTest.nlp_problems - nlp = TimerNLPModel(eval(Meta.parse(pb))()) - consistent_nlps([nlp, nlp]; exclude = [], linear_api = true) +np = Sys.CPU_THREADS +addprocs(np - 1) + +@everywhere using TimerNLPModels +@everywhere using CUDA, NLPModels, NLPModelsTest, Test + +@everywhere function nlp_tests(p) + @testset "TimerNLPModels.jl for NLP: $p" begin + nlp = eval(Meta.parse(p))() + timed_nlp = TimerNLPModel(nlp) + consistent_nlps([nlp, timed_nlp]; exclude = [], linear_api = true) end end - -@testset "TimerNLPModels.jl for NLS" begin - @testset "NLS: $pb" for pb in NLPModelsTest.nls_problems - exclude = pb == "LLS" ? [hess_coord, hess] : [] - nls = TimerNLSModel(eval(Meta.parse(pb))()) - consistent_nlss([nls, nls]; exclude = exclude, linear_api = true) +@everywhere function nls_tests(p) + @testset "TimerNLPModels.jl for NLS: $p" begin + nls = eval(Meta.parse(p))() + timed_nls = TimerNLSModel(nls) + exclude = p == "LLS" ? [hess_coord, hess] : [] + consistent_nlss([nls, timed_nls]; exclude = exclude, linear_api = true) end end +@testset "TimerNLPModels.jl for NLP" begin + pmap(nlp_tests, NLPModelsTest.nlp_problems) +end +@testset "TimerNLPModels.jl for NLS" begin + pmap(nls_tests, NLPModelsTest.nls_problems) +end