Skip to content

Conversation

@xuanweishan
Copy link

@xuanweishan xuanweishan commented Jun 5, 2025

Summary:

This PR reduce the virtual memory requirement of gamer with FFTW3.

Changes:

Init/Init_FFTW.cpp

  1. Add fftw_mpi_local_size_3d_transposed() to ComputePaddedTotalSize() and ComputeTotalSize() for mpi supported situation to enhance the estimation of memory requirement.
  2. Original MemUnit estimation is not proper, it can't decrease the memory usage per rank with mpi. So we replace the value MemUnit from amr->NPatchComma[0][1]*PS1 to amr->NPatchComma[0][1]/MPI_NRank
  3. Add variable check to the MemUnit related malloc and realloc to prevent error in after usage.

Tests:

  • SERIAL support
  • OPT__FFTW_STARTUP = 1 support

@hyschive hyschive requested a review from koarakawaii June 5, 2025 12:54
@hyschive hyschive added enhancement general General issues and improvement labels Jun 5, 2025
Wei-Hsuan Tzeng ([email protected]) added 2 commits June 6, 2025 11:20
…. And move fftw_mpi_local_size_3d_transposed() into these functions for mpi usage.
Copy link
Contributor

@koarakawaii koarakawaii left a comment

Choose a reason for hiding this comment

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

Hi, @xuanweishan: some minor comments are added. Please have a look 😺 ~

@koarakawaii
Copy link
Contributor

@hyschive : this PR looks fine to me now and @xuanweishan has tested it with OPT__FFTW_STARTUP = 1 and SERIAL enabled respectively.

Copy link
Contributor

@hyschive hyschive left a comment

Choose a reason for hiding this comment

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

@xuanweishan @koarakawaii Looks good. Thanks for the quick fix!

@hyschive hyschive merged commit eed0ed2 into gamer-project:main Jun 6, 2025
@xuanweishan xuanweishan deleted the FFTW_cpp_malloc_fix branch June 9, 2025 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement general General issues and improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants