Skip to content

Conversation

@A-006
Copy link
Collaborator

@A-006 A-006 commented Jul 7, 2025

Linked Issue

Fix #6355

Unit Tests and/or Case Tests for my changes

  • Test the 01_PW/performance on sw,the results will be pasted here.

What's changed?

  • We have successfully enabled ABACUS compilation on the sw architecture by setting use_sw=on. Additionally, we configured SW_MATH and SW_FFT to properly reference the mathematical libraries (including BLAS, LAPACK, and ScaLAPACK) optimized for sw processors.
  • Fixed floating-point errors and undefined behaviors reported in issue Floating point exception, which may lead to bugs #6355, which involved division by zero operations and the use of non-standard numerical values.
  • Implemented standardization for the handling of gg0 (plane wave modulus with zero values). Previously, the code employed various inconsistent approaches (such as using ig0_index or setting minimum thresholds) to avoid division by zero. This unification improves code clarity and maintainability by establishing a consistent method for zero-value handling.

Attention

  • Now the abacus does not support the sw FFT,it will be add later.

@mohanchen mohanchen changed the title USE Sunway Architecture and fix Floating point exception USE SW Architecture and fix Floating point exception Jul 8, 2025
@mohanchen mohanchen changed the title USE SW Architecture and fix Floating point exception USE SW and fix Floating point exception Jul 8, 2025
set(SW ON)
include_directories(${SW_MATH}/include)
include_directories(${SW_FFT}/include)
include_directories(${SW_FFT}/lib/libfftw3.a)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe include_directories should be a directory (e.g. lib/) instead of the library file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks,the problem has been fixed in the new PR .

}//end if section
}//end c_index loop
sum /= rot_count;
if (rot_count!=0) sum/= rot_count;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the value of sum be changed if rot_count == 0? What is the expected behaviour of the code if rot_count==0 encountered and divided by zero?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, when rot_count == 0, the subsequent parallel computation will not run. Therefore, the sum variable is irrelevant. However, since sum stores Infinity, using it in other code could lead to undefined behavior.

@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes GPU & DCU & HPC GPU and DCU and HPC related any issues labels Jul 9, 2025
@A-006
Copy link
Collaborator Author

A-006 commented Jul 10, 2025

It changes into PR 'sw'

@A-006 A-006 closed this Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugs Bugs that only solvable with sufficient knowledge of DFT GPU & DCU & HPC GPU and DCU and HPC related any issues Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Floating point exception, which may lead to bugs

3 participants