|
1 | 1 | using ParticleDA |
2 | 2 | using TimerOutputs |
3 | 3 | using MPI |
| 4 | +using ThreadPinning |
4 | 5 |
|
5 | 6 | # Initialise MPI |
6 | 7 | MPI.Init() |
7 | | -mpi_size = MPI.Comm_size(MPI.COMM_WORLD) |
| 8 | +comm = MPI.COMM_WORLD |
| 9 | +mpi_size = MPI.Comm_size(comm) |
| 10 | +my_rank = MPI.Comm_rank(comm) |
| 11 | + |
| 12 | +cores_per_numa = 16 |
| 13 | +threads_per_rank = Threads.nthreads() |
| 14 | +ranks_per_numa = div(cores_per_numa, threads_per_rank) |
| 15 | + |
| 16 | +# Pin threads so that threads of a MPI rank will be pinned to cores with |
| 17 | +# contiguous IDs. This will ensure that |
| 18 | +# - When running 16 or less threads per rank, all threads will be pinned to the same |
| 19 | +# NUMA region as their master (sharing a memory controller within Infinity fabric) |
| 20 | +# - When running 8 or less threads per rank, all threads will be pinned to the same |
| 21 | +# Core Complex Die |
| 22 | +# - When running 4 or less threads per rank, all threads will be pinned to the same |
| 23 | +# Core Complex (sharing a L3 cache) |
| 24 | + |
| 25 | +my_numa, my_id_in_numa = divrem(my_rank, ranks_per_numa) .+ (1, 0) |
| 26 | +pinthreads( numa( my_numa, 1:Threads.nthreads() ) .+ threads_per_rank .* my_id_in_numa ) |
8 | 27 |
|
9 | 28 | # Save some variables for later use |
10 | 29 | test_dir = joinpath(dirname(pathof(ParticleDA)), "..", "test") |
11 | 30 | llw2d_src = joinpath(test_dir, "models", "llw2d.jl") |
12 | | -observation_file = "observations.h5" |
| 31 | +observation_file = "test_observations.h5" |
13 | 32 |
|
14 | 33 | # Instantiate the test environment |
15 | 34 | using Pkg |
|
0 commit comments