Skip to content

Conversation

@zgn-26714
Copy link

@zgn-26714 zgn-26714 commented Aug 26, 2025

This pull request addresses issue #6377

7d4fe5a

Modify the transfer function transfer_dm_2d_to_gint. Removed the temporary variable dm_full when transitioning from serial to 2D block parallelism in Hcontainer. At the same time, update the gint_old.cpp file accordingly.
A temporary variable DM2D_tmp was created to split the 2D block parallel dm into smaller blocks, which are then handled by DM2D_tmp. The function transferParallels2Serials is directly called to convert DM2D_tmp into dm_gint. This approach avoids the large memory consumption that would occur if a large matrix dm_full was first used to hold DM2D and then split into smaller matrices dm_gint.
some detail need to modify

b5a0f8f

Delete the function that fills the lower triangle matrix when nspin=4, and integrate it into function transfer_hr_gint_to_hR.
Following a similar approach as described above, the temporary variable hr_gint_full, which was used in the conversion of HContainer from serial to 2D block distributed parallel layout, has been removed. Instead, a smaller auxiliary matrix hR_tmp is now used to partition hR into blocks, facilitating the type conversion. The data transfer path has been changed from the original hr_gint_part → hr_gint_full → hR to hr_gint_part → hR_tmp → hR.

todo:

  • delete dm_full
  • delete hr_gint_full
  • Further optimize other variables

hamilt::transferSerials2Parallels(hr_gint, &hR);
}
delete[] iat2iwt;
delete pv;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think pv can be reused by HR and DMR transfer functions, maybe it can be member of gint_info?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The array pv and iat2iwt are used to construct the parallel version of hcontainer from its serial version. I believe this conversion functionality would be better implemented as a method provided by the hcontainer class itself. This way, the gint module wouldn't need to handle the pv array directly. Such a design would lead to a cleaner separation of concerns.

@dzzz2001 dzzz2001 self-requested a review August 27, 2025 13:45

#endif
ModuleBase::timer::tick("Gint", "transfer_hr_gint_to_hR");
ModuleBase::timer::tick("Gint", "transfer_hr_gint_to_hR_nspin4");
Copy link
Collaborator

Choose a reason for hiding this comment

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

the new name is too long, try to have a simple name

Copy link
Author

Choose a reason for hiding this comment

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

I chose a simpler name, "merge_hR_n4()".

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.

4 participants