From f8fd50a0d89da42f939319ab84a15355578e7780 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Thu, 16 May 2019 06:54:07 +0100 Subject: [PATCH] Merge PR #4344: set runsim's default maxprocs to match system's GOMAXPROCS * set maxprocs to match system's GOMAXPROCS * Update circleci * Cap maxprocs in CI to 4 * Try to fix failures --- .circleci/config.yml | 12 ++++++++---- cmd/gaia/contrib/runsim/main.go | 7 +++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 04ccbf9f8a..21a0d8d15e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -141,7 +141,9 @@ jobs: - run: name: Test Gaia import/export simulation command: | - make test_sim_gaia_import_export + export GO111MODULE=on + make runsim + runsim -j 4 50 5 TestGaiaImportExport test_sim_gaia_simulation_after_import: <<: *linux_defaults @@ -156,7 +158,9 @@ jobs: - run: name: Test Gaia import/export simulation command: | - make test_sim_gaia_simulation_after_import + export GO111MODULE=on + make runsim + runsim -j 4 50 5 TestGaiaSimulationAfterImport test_sim_gaia_multi_seed_long: <<: *linux_defaults @@ -173,7 +177,7 @@ jobs: command: | export GO111MODULE=on make runsim - runsim 500 50 TestFullGaiaSimulation + runsim -j 4 500 50 TestFullGaiaSimulation test_sim_gaia_multi_seed: <<: *linux_defaults @@ -190,7 +194,7 @@ jobs: command: | export GO111MODULE=on make runsim - runsim 50 10 TestFullGaiaSimulation + runsim -j 4 50 10 TestFullGaiaSimulation test_cover: <<: *linux_defaults diff --git a/cmd/gaia/contrib/runsim/main.go b/cmd/gaia/contrib/runsim/main.go index 4c1d199c85..ef60915937 100644 --- a/cmd/gaia/contrib/runsim/main.go +++ b/cmd/gaia/contrib/runsim/main.go @@ -9,6 +9,7 @@ import ( "os/exec" "os/signal" "path/filepath" + "runtime" "strings" "sync" "syscall" @@ -33,7 +34,7 @@ var ( results chan bool // command line arguments and options - jobs int + jobs int = runtime.GOMAXPROCS(0) blocks string period string testname string @@ -49,7 +50,8 @@ func init() { procs = map[int]*os.Process{} mutex = &sync.Mutex{} - flag.IntVar(&jobs, "j", 10, "Number of parallel processes") + + flag.IntVar(&jobs, "j", jobs, "Number of parallel processes") flag.StringVar(&genesis, "g", "", "Genesis file") flag.Usage = func() { @@ -111,6 +113,7 @@ func main() { } // set up worker pool + log.Printf("Allocating %d workers...", jobs) wg := sync.WaitGroup{} for workerId := 0; workerId < jobs; workerId++ { wg.Add(1)