Skip to content

Fix runtime seg-fualts on Mac #5

Open

Description

@mbkumar

Matt reports VMEC compiles fine on Mac, but fails at runtime with seg-faults.

Activity

  1. self-assigned this
    on Mar 19, 2021
  2. mbkumar commented on Oct 31, 2023

    @mbkumar
    CollaboratorAuthor

    Damient Hunt also reported this issue. The minimal simsopt code and the input file are attached.

    vmec_segfault.zip

    Debugging this issue shows that the code fails with

    At line 115 of file /Users/bharatmedasani/Software/VMEC2000/Sources/TimeStep/evolve.f
    Fortran runtime error: Index '3' of dimension 1 of array 'f3d_num' above upper bound of 2
    

    The code at that line is

    ./TimeStep/evolve.f:115:      f3d_num(NS_RESLTN) = f3d_num(NS_RESLTN)+1
    

    Grepping for NS_RESLTN shows

    ./TimeStep/runvmec.f:294:         IF (PARVMEC .AND. NS_RESLTN .GE. 1) THEN
    ./TimeStep/evolve.f:115:      f3d_num(NS_RESLTN) = f3d_num(NS_RESLTN)+1
    ./TimeStep/evolve.f:122:      f3d_time(NS_RESLTN) = f3d_time(NS_RESLTN) + (f3dt2 - f3dt1)
    
    ./TimeStep/parallel_vmec_module.f90:26:    INTEGER :: NS_RESLTN=0
    ./TimeStep/parallel_vmec_module.f90:133:!    NS_RESLTN = 0  ! SAL 070619
    ./TimeStep/parallel_vmec_module.f90:163:    NS_RESLTN = NS_RESLTN + 1
    ./TimeStep/parallel_vmec_module.f90:433:    NS_RESLTN=0
    ./TimeStep/parallel_include_module.f90:24:        USE parallel_vmec_module, ONLY: NS_RESLTN
    ./General/blocktridiagonalsolver_bst.f90:9:USE parallel_include_module, ONLY: NS_RESLTN
    ./General/blocktridiagonalsolver.f90:15:USE parallel_include_module, ONLY: NS_RESLTN
    

    Should the commented out code at ./TimeStep/parallel_vmec_module.f90:133 be enabled?

  3. mbkumar commented on Oct 31, 2023

    @mbkumar
    CollaboratorAuthor

    I uncommented the line ./TimeStep/parallel_vmec_module.f90:133, but it didn't help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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