Skip to content

Fix -M by correctly initalizing eAll_temp - #93

Open
MiCurry wants to merge 1 commit into
magnetotellurics:developfrom
MiCurry:fix-M
Open

MiCurry wants to merge 1 commit into
magnetotellurics:developfrom
MiCurry:fix-M

Conversation

@MiCurry

@MiCurry MiCurry commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

This issue was raised by Xiaolei (@xltu) and provided a fix for it in #87

I am not sure if we can use eAll_out in the later on lines 1399 and 1400. @dong-hao or @akelbert do you think this will be okay? I know we can not always guarantee the eAll will be present in this subroutine, but I know we can use either eAll_Temp or eAll_out. I'm just not sure which one to use.

This issue was raised by Xiaolei (@xltu) and provided a fix for it.
@MiCurry
MiCurry requested review from akelbert and dong-hao and a lite review from Copilot September 22, 2026 21:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The updated Jmult logic passes the wrong field as the background solution to Lmult/Qmult (and JmultT still pre-allocates eAll_temp in a way that prevents proper initialization).

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity

Open (2)
What changed in this PR

This PR aims to address segmentation faults in the -M/Jmult MPI workflow by ensuring the temporary electric-field container (eAll_temp) is initialized correctly before being used in task distribution and Jacobian-vector products.

Changes:

  • Switch Master_job_Jmult to initialize eAll_temp via EsMgr_create_solnVectorMTX(..., grid=grid) instead of create_solnVectorMTX.
  • Update Master_job_Jmult to use eAll_out in the downstream Lmult/Qmult calls (intended to avoid referencing an absent optional eAll).
File Description
f90/​MPI/​Main_MPI.f90 Adjusts Jmult/JmultT solution-vector initialization and updates the fields used in Lmult/Qmult during Jmult.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread f90/MPI/Main_MPI.f90
Comment thread f90/MPI/Main_MPI.f90
Comment thread f90/MPI/Main_MPI.f90
call Lmult(eAll%solns(iper) ,m,eAll_out%solns(iper),d1)
call Qmult(eAll%solns(iper) ,m,mHat,d2)
call Lmult(eAll_out%solns(iper) ,m,eAll_out%solns(iper),d1)
call Qmult(eAll_out%solns(iper) ,m,mHat,d2)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akelbert @dong-hao should we use eAll_temp' here? Or is it okay to use eAll_out`?

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants