Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions source/source_hsolver/module_genelpa/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,15 @@ void loadMatrix(const char FileName[], int nFull, double* a, int* desca, int bla

const int ROOT_PROC = 0;
std::ifstream matrixFile;
if (myid == ROOT_PROC)
if (myid == ROOT_PROC){
matrixFile.open(FileName);

double* b; // buffer
if (!matrixFile.is_open()) {
std::cerr << "Error: failed to open file " << FileName << std::endl;
exit(EXIT_FAILURE);
}
Comment on lines +94 to +100
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

In an MPI/BLACS run, calling exit(EXIT_FAILURE) only on ROOT_PROC will leave the other ranks continuing into Cpdgemr2d(...), which can hang/crash because a collective is entered with one rank missing. Consider broadcasting the is_open status to all ranks and having all ranks take the same error path, or aborting the whole BLACS/MPI communicator (e.g., via MPI_Abort on the communicator associated with blacs_ctxt).

Copilot uses AI. Check for mistakes.
Comment on lines +97 to +100
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

exit/EXIT_FAILURE are used here without including <cstdlib> (or <stdlib.h>). This can fail to compile depending on transitive includes and toolchain settings; please add the proper include and prefer std::exit(EXIT_FAILURE) if using <cstdlib>.

Copilot uses AI. Check for mistakes.
}
double* b; // buffer
const int MAX_BUFFER_SIZE = 1e9; // max buffer size is 1GB
Comment on lines +94 to 103
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

The new block’s formatting deviates from the surrounding style (brace placement, mixed tabs/spaces, and double* b; losing indentation). Please reformat to match the file’s existing indentation and brace conventions to keep diffs clean and avoid accidental whitespace issues.

Copilot uses AI. Check for mistakes.

int N = nFull;
Expand Down
Loading