Skip to content

Commit 19badb0

Browse files
committed
update the template file
1 parent de67db2 commit 19badb0

File tree

8 files changed

+10
-52
lines changed

8 files changed

+10
-52
lines changed

source/module_basis/module_pw/module_fft/fft_cpu.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace ModulePW
44
{
55

6-
template <>
7-
void FFT_CPU<double>::initfft(int nx_in,
6+
template <typename FPTYPE>
7+
void FFT_CPU<FPTYPE>::initfft(int nx_in,
88
int ny_in,
99
int nz_in,
1010
int lixy_in,
@@ -457,8 +457,4 @@ template <> std::complex<double>*
457457
FFT_CPU<double>::get_auxr_data() const {return z_auxr;}
458458
template <> std::complex<double>*
459459
FFT_CPU<double>::get_auxg_data() const {return z_auxg;}
460-
461-
462-
template FFT_CPU<double>::FFT_CPU();
463-
template FFT_CPU<double>::~FFT_CPU();
464460
}

source/module_basis/module_pw/module_fft/fft_cpu.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class FFT_CPU : public FFT_BASE<FPTYPE>
3333
* @param gamma_only_in whether only gamma point is used.
3434
* @param xprime_in whether xprime is used.
3535
*/
36-
__attribute__((weak))
36+
3737
void initfft(int nx_in,
3838
int ny_in,
3939
int nz_in,
@@ -169,5 +169,7 @@ class FFT_CPU : public FFT_BASE<FPTYPE>
169169
*/
170170
int fft_mode = 0;
171171
};
172+
template FFT_CPU<float>::FFT_CPU();
173+
template FFT_CPU<double>::FFT_CPU();
172174
}
173175
#endif // FFT_CPU_H

source/module_basis/module_pw/module_fft/fft_cpu_float.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,6 @@
33
namespace ModulePW
44
{
55
template <>
6-
void FFT_CPU<float>::initfft(int nx_in,
7-
int ny_in,
8-
int nz_in,
9-
int lixy_in,
10-
int rixy_in,
11-
int ns_in,
12-
int nplane_in,
13-
int nproc_in,
14-
bool gamma_only_in,
15-
bool xprime_in)
16-
{
17-
this->gamma_only = gamma_only_in;
18-
this->xprime = xprime_in;
19-
this->fftnx = this->nx = nx_in;
20-
this->fftny = this->ny = ny_in;
21-
if (this->gamma_only)
22-
{
23-
if (xprime) {
24-
this->fftnx = int(this->nx / 2) + 1;
25-
} else {
26-
this->fftny = int(this->ny / 2) + 1;
27-
}
28-
}
29-
this->nz = nz_in;
30-
this->ns = ns_in;
31-
this->lixy = lixy_in;
32-
this->rixy = rixy_in;
33-
this->nplane = nplane_in;
34-
this->nproc = nproc_in;
35-
this->nxy = this->nx * this->ny;
36-
this->fftnxy = this->fftnx * this->fftny;
37-
const int nrxx = this->nxy * this->nplane;
38-
const int nsz = this->nz * this->ns;
39-
this->maxgrids = (nsz > nrxx) ? nsz : nrxx;
40-
}
41-
template <>
426
void FFT_CPU<float>::setupFFT()
437
{
448
unsigned int flag = FFTW_ESTIMATE;
@@ -466,6 +430,4 @@ template <> std::complex<float>*
466430
FFT_CPU<float>::get_auxr_data() const {return c_auxr;}
467431
template <> std::complex<float>*
468432
FFT_CPU<float>::get_auxg_data() const {return c_auxg;}
469-
template FFT_CPU<float>::FFT_CPU();
470-
template FFT_CPU<float>::~FFT_CPU();
471433
}

source/module_basis/module_pw/module_fft/fft_cuda.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,4 @@ template <> std::complex<float>*
105105
FFT_CUDA<float>::get_auxr_3d_data() const {return this->c_auxr_3d;}
106106
template <> std::complex<double>*
107107
FFT_CUDA<double>::get_auxr_3d_data() const {return this->z_auxr_3d;}
108-
109-
template FFT_CUDA<float>::FFT_CUDA();
110-
template FFT_CUDA<double>::FFT_CUDA();
111108
}// namespace ModulePW

source/module_basis/module_pw/module_fft/fft_cuda.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,7 @@ class FFT_CUDA : public FFT_BASE<FPTYPE>
6262
std::complex<double>* z_auxr_3d = nullptr; // fft space
6363

6464
};
65+
template FFT_CUDA<float>::FFT_CUDA();
66+
template FFT_CUDA<double>::FFT_CUDA();
6567
} // namespace ModulePW
6668
#endif

source/module_basis/module_pw/module_fft/fft_rcom.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,4 @@ template <> std::complex<float>*
103103
FFT_RCOM<float>::get_auxr_3d_data() const {return this->c_auxr_3d;}
104104
template <> std::complex<double>*
105105
FFT_RCOM<double>::get_auxr_3d_data() const {return this->z_auxr_3d;}
106-
107-
template FFT_RCOM<float>::FFT_RCOM();
108-
template FFT_RCOM<double>::FFT_RCOM();
109106
}// namespace ModulePW

source/module_basis/module_pw/module_fft/fft_rcom.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,7 @@ class FFT_ROCM : public FFT_BASE<FPTYPE>
5757
mutable std::complex<double>* z_auxr_3d = nullptr; // fft space
5858

5959
};
60+
template FFT_RCOM<float>::FFT_RCOM();
61+
template FFT_RCOM<double>::FFT_RCOM();
6062
}// namespace ModulePW
6163
#endif

source/module_basis/module_pw/test/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ GTEST_DIR = /home/qianrui/gnucompile/g_gtest
2727
HONG = -D__NORMAL
2828
INCLUDES = -I. -I../../../ -I../../../module_base/module_container
2929
LIBS =
30-
OPTS = -Ofast -march=native -std=c++11 -m64 ${INCLUDES}
30+
OPTS = -Ofast -march=native -std=c++11 -m64 ${INCLUDES} -w -g
3131
OBJ_DIR = obj
3232
LIBNAME = libpw.a
3333
GEN = OFF

0 commit comments

Comments
 (0)