Skip to content

[nest-mpi-races] SetKernelStatus without rank guard in test files #24

@wody34

Description

@wody34

📁 Location

  • Files: tests/test_nest_file/*.py (6 files)
  • Category: nest-mpi-races
  • Severity: high
  • Hashes: 0d1f9750806d, c15ab18ce2da, 2aa2e840d4bd, bdb5950c5d9b, 9fb87c8a0bf1, 2b4faa1a082c

🔍 Problem

nest.SetKernelStatus() called globally without rank 0 guard. With MPI, ALL ranks execute this, causing race conditions on shared kernel state.

Affected Files

  1. spikedetector_mpi_thread.py:14
  2. spikegenerator_mpi_dict.py:15
  3. step_current_generator_mpi_thread.py:17
  4. step_current_generator_mpi.py:14
  5. spikegenerator_mpi.py:40
  6. spikedetector_mpi.py:14

💡 Fix

# Before
nest.SetKernelStatus({"overwrite_files": True, "total_num_virtual_procs": 4})

# After  
if nest.Rank() == 0:
    nest.SetKernelStatus({"overwrite_files": True, "total_num_virtual_procs": 4})
nest.Barrier()  # Synchronize after kernel modification

🧪 TDD Evidence

Test file: tests/evidence/test_nest_mpi_races.py

  • Verifies rank-guarded pattern only allows rank 0 to modify kernel
  • Documents current broken pattern lacking guards
tests/evidence/test_nest_mpi_races.py::TestNestMpiRaceConditions::test_set_kernel_status_pattern_with_rank_guard PASSED
tests/evidence/test_nest_mpi_races.py::TestNestMpiRaceConditions::test_current_code_lacks_rank_guard PASSED

Run: 2026-02-05-1228 | Auto-generated by UltraQA

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions