Skip to content

fix nvhpc compilation - #1169

Merged
toxa81 merged 7 commits into
developfrom
nvhpc
Sep 16, 2026
Merged

toxa81 merged 7 commits into
developfrom
nvhpc

Conversation

@simonpintarelli

@simonpintarelli simonpintarelli commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

nvhpc crashed with a segfault on hamiltonian_k.cpp when using sirius+cuda. Most likely cause is the number of template instantiations/TU complexity.

  • remove the declaration for omp reduction for std::complex when nvhpc is used (this gave a compilation error)
  • rewrite (reorder) omp for loops in hamiltonian_k.cpp to avoid the segfault
  • rewrite range-based for loops (nvhpc seems to require the canonical form)

The error for range-based for loops with nvhpc are the following:

NVC++-S-0155-Unsupported initialization in OMP for loop  (rangefor_omp_test.cpp: 24)
NVC++-S-0155-#pragma pfor does not match canonical form  (rangefor_omp_test.cpp: 24)
NVC++/arm Linux 26.5-0: compilation completed with severe errors

@simonpintarelli

Copy link
Copy Markdown
Collaborator Author

cscs-ci run default

@simonpintarelli

Copy link
Copy Markdown
Collaborator Author

CI on eiger is failing, the base uenv on eiger requires a rebuild

@simonpintarelli

Copy link
Copy Markdown
Collaborator Author

cscs-ci run default

2 similar comments
@simonpintarelli

Copy link
Copy Markdown
Collaborator Author

cscs-ci run default

@simonpintarelli

Copy link
Copy Markdown
Collaborator Author

cscs-ci run default

@toxa81 toxa81 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One comment about missing OMP statement in the hamiltonian_k.cpp and more concerning issue: my PR #1168 might cause a lot of conflicts. I will probably rebase it on top of this one.

for (auto it : spl_atoms) {
int tid = omp_get_thread_num();
int ia = it.i;
auto apply_hmt_apw_lo = [this, &ctx, &phi__, la, mem, &b__, &spl_atoms,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What about OMP statement over atoms? In case of CPU this will be executed sequentially atom by atom and omp parallelization will only come via threaded blas

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

True, I forgot about the CPU only case. I'll revert this change.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've reverted the loops over the atoms to using openmp, compilation with nvhpc is still working.

@simonpintarelli

Copy link
Copy Markdown
Collaborator Author

cscs-ci run default

@toxa81
toxa81 merged commit 349d002 into develop Sep 16, 2026
5 checks passed
@toxa81
toxa81 deleted the nvhpc branch September 16, 2026 12:10
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