Skip to content

Commit f2deeb7

Browse files
committed
modify Makefile.gnu
1 parent 7d005bd commit f2deeb7

File tree

3 files changed

+82
-82
lines changed

3 files changed

+82
-82
lines changed

source/module_pw/pw_transform.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void PW_Basis:: recip2real(std::complex<float> * in, std::complex<float> * out)
196196

197197
for(int ir = 0 ; ir < this->nrxx ; ++ir)
198198
{
199-
out[ir] = this->ft.auxf1[ir] / double(this->bignxyz);
199+
out[ir] = this->ft.auxf1[ir] / float(this->bignxyz);
200200
}
201201

202202
return;
@@ -222,7 +222,7 @@ void PW_Basis:: recip2real(std::complex<float> * in, float * out)
222222
{
223223
for(int ipy = 0 ; ipy < npy ; ++ipy)
224224
{
225-
out[ix*npy + ipy] = this->ft.rf_rspace[ix*npy*2 + ipy] / double(this->bignxyz);
225+
out[ix*npy + ipy] = this->ft.rf_rspace[ix*npy*2 + ipy] / float(this->bignxyz);
226226
}
227227
}
228228
return;

source/module_pw/unittest/Makefile.gnu

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,8 @@ CPLUSPLUS = g++
66
CPLUSPLUS_MPI = mpicxx
77
CUDA_COMPILE = nvcc
88
OBJ_DIR = pw_obj
9+
BIN_DIR = testbin
910
NP = 12
10-
11-
#==========================
12-
# Options
13-
#==========================
14-
#Only MPI
15-
HONG = -D__MPI -D__NORMAL
16-
17-
#Mix Precision
18-
#HONG = -D__MIX_PRECISION -D__NORMAL
19-
20-
#Cuda
21-
#HONG = -D__MPI -D__CUDA -D__NORMAL
22-
23-
#Cuda & Mix Precision
24-
#HONG = -D__MPI -D__CUDA -D__MIX_PRECISION -D__NORMAL
25-
2611
#==========================
2712
# Objects
2813
#==========================
@@ -47,16 +32,48 @@ pw_distributeg_method1.o\
4732
pw_distributeg_method2.o\
4833
fft.o
4934

35+
DOUBLEFILE=test1.exe\
36+
test2.exe\
37+
test3.exe\
38+
test2-1.exe\
39+
test2-2.exe\
40+
test2-3.exe\
41+
test_t1.exe\
42+
test_t2.exe
43+
44+
FLOATFILE=testf2.exe\
45+
testf3.exe
46+
47+
#==========================
48+
# Options
49+
#==========================
50+
#Only MPI
51+
# HONG = -D__MPI -D__NORMAL
52+
# TESTFILE0 = ${DOUBLEFILE}
53+
54+
#Mix Precision
55+
HONG = -D__MPI -D__MIX_PRECISION -D__NORMAL
56+
TESTFILE0 = ${DOUBLEFILE} ${FLOATFILE}
57+
58+
#Cuda
59+
#HONG = -D__MPI -D__CUDA -D__NORMAL
60+
61+
#Cuda & Mix Precision
62+
#HONG = -D__MPI -D__CUDA -D__MIX_PRECISION -D__NORMAL
63+
64+
5065
PW_OBJS=$(patsubst %.o, ${OBJ_DIR}/%.o, ${PW_OBJS_0})
66+
TESTFILE=$(patsubst %.exe, ${BIN_DIR}/%.exe, ${TESTFILE0})
5167

5268
##==========================
5369
## FFTW package needed
5470
##==========================
5571
#Use fftw package
56-
FFTW_DIR = /home/qianrui/gnucompile/g_fftw-3.3.8
72+
FFTW_DIR = /home/qianrui/gnucompile/g_fftw-3.3.8-mpi
5773
FFTW_LIB_DIR = ${FFTW_DIR}/lib
5874
FFTW_INCLUDE_DIR = ${FFTW_DIR}/include
59-
FFTW_LIB = -L${FFTW_LIB_DIR} -lfftw3 -Wl,-rpath=${FFTW_LIB_DIR}
75+
FFTW_LIB = -L${FFTW_LIB_DIR} -lfftw3 -lfftw3f -Wl,-rpath=${FFTW_LIB_DIR}
76+
# FFTW_LIB = -L${FFTW_LIB_DIR} -lfftw3 -Wl,-rpath=${FFTW_LIB_DIR}
6077

6178

6279

@@ -76,37 +93,20 @@ OPTS = -I${FFTW_INCLUDE_DIR} ${HONG} -Ofast -std=c++11 -Wall -g
7693
#==========================
7794
pw :
7895
@ make init
79-
@ make -j $(NP) parallel
96+
@ make -j $(NP) ${PW_OBJS}
97+
@ make -j $(NP) ${TESTFILE}
8098

8199
init :
82100
@ if [ ! -d $(OBJ_DIR) ]; then mkdir $(OBJ_DIR); fi
101+
@ if [ ! -d $(BIN_DIR) ]; then mkdir $(BIN_DIR); fi
83102
@ if [ ! -d $(OBJ_DIR)/README ]; then echo "This directory contains all of the .o files" > $(OBJ_DIR)/README; fi
84103

85-
parallel : ${PW_OBJS}
86-
${CPLUSPLUS_MPI} ${OPTS} test1.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test1.exe
87-
${CPLUSPLUS_MPI} ${OPTS} test2.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test2.exe
88-
${CPLUSPLUS_MPI} ${OPTS} test3.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test3.exe
89-
${CPLUSPLUS_MPI} ${OPTS} test2-1.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test2-1.exe
90-
${CPLUSPLUS_MPI} ${OPTS} test2-2.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test2-2.exe
91-
${CPLUSPLUS_MPI} ${OPTS} test2-3.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test2-3.exe
92-
${CPLUSPLUS_MPI} ${OPTS} test_t1.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test_t1.exe
93-
${CPLUSPLUS_MPI} ${OPTS} test_t2.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test_t2.exe
94-
${CPLUSPLUS_MPI} ${OPTS} testf2.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o testf2.exe
95-
${CPLUSPLUS_MPI} ${OPTS} testf3.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o testf3.exe
96-
104+
${BIN_DIR}/%.exe: %.cpp
105+
${CPLUSPLUS_MPI} ${OPTS} $< test_tool.cpp ${PW_OBJS} ${LIBS} -o $@
97106
${OBJ_DIR}/%.o:%.cpp
98107
${CPLUSPLUS_MPI} ${OPTS} -c ${HONG} $< -o $@
99108

100109
.PHONY:clean
101110
clean:
102111
@ if [ -d $(OBJ_DIR) ]; then rm -rf $(OBJ_DIR); fi
103-
@ if [ -e test1.exe ]; then rm -f test1.exe; fi
104-
@ if [ -e test2.exe ]; then rm -f test2.exe; fi
105-
@ if [ -e test3.exe ]; then rm -f test3.exe; fi
106-
@ if [ -e test2-1.exe ]; then rm -f test2-1.exe; fi
107-
@ if [ -e test2-2.exe ]; then rm -f test2-2.exe; fi
108-
@ if [ -e test2-3.exe ]; then rm -f test2-3.exe; fi
109-
@ if [ -e test_t1.exe ]; then rm -f test_t1.exe; fi
110-
@ if [ -e test_t2.exe ]; then rm -f test_t2.exe; fi
111-
@ if [ -e testf2.exe ]; then rm -f testf2.exe; fi
112-
@ if [ -e testf3.exe ]; then rm -f testf3.exe; fi
112+
@ if [ -d $(BIN_DIR) ]; then rm -rf $(BIN_DIR); fi

source/module_pw/unittest/Makefile.intel

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,8 @@ CPLUSPLUS = icpc
66
CPLUSPLUS_MPI = mpiicpc
77
CUDA_COMPILE = nvcc
88
OBJ_DIR = pw_obj
9+
BIN_DIR = testbin
910
NP = 12
10-
11-
#==========================
12-
# Options
13-
#==========================
14-
#Only MPI
15-
HONG = -D__MPI -D__NORMAL
16-
17-
#Mix Precision
18-
# HONG = -D__MPI -D__MIX_PRECISION -D__NORMAL
19-
20-
#Cuda
21-
#HONG = -D__MPI -D__CUDA -D__NORMAL
22-
23-
#Cuda & Mix Precision
24-
#HONG = -D__MPI -D__CUDA -D__MIX_PRECISION -D__NORMAL
25-
2611
#==========================
2712
# Objects
2813
#==========================
@@ -47,7 +32,39 @@ pw_distributeg_method1.o\
4732
pw_distributeg_method2.o\
4833
fft.o
4934

35+
DOUBLEFILE=test1.exe\
36+
test2.exe\
37+
test3.exe\
38+
test2-1.exe\
39+
test2-2.exe\
40+
test2-3.exe\
41+
test_t1.exe\
42+
test_t2.exe
43+
44+
FLOATFILE=testf2.exe\
45+
testf3.exe
46+
47+
48+
#==========================
49+
# Options
50+
#==========================
51+
#Only MPI
52+
HONG = -D__MPI -D__NORMAL
53+
TESTFILE0 = ${DOUBLEFILE}
54+
55+
#Mix Precision
56+
# HONG = -D__MPI -D__MIX_PRECISION -D__NORMAL
57+
# TESTFILE0 = ${DOUBLEFILE} ${FLOATFILE}
58+
59+
#Cuda
60+
#HONG = -D__MPI -D__CUDA -D__NORMAL
61+
62+
#Cuda & Mix Precision
63+
#HONG = -D__MPI -D__CUDA -D__MIX_PRECISION -D__NORMAL
64+
65+
5066
PW_OBJS=$(patsubst %.o, ${OBJ_DIR}/%.o, ${PW_OBJS_0})
67+
TESTFILE=$(patsubst %.exe, ${BIN_DIR}/%.exe, ${TESTFILE0})
5168

5269
##==========================
5370
## FFTW package needed
@@ -81,37 +98,20 @@ OPTS = -I${FFTW_INCLUDE_DIR} ${HONG} -Ofast -std=c++11 -simd -m64 -qopenmp -Wall
8198
#==========================
8299
pw :
83100
@ make init
84-
@ make -j $(NP) parallel
101+
@ make -j $(NP) ${PW_OBJS}
102+
@ make -j $(NP) ${TESTFILE}
85103

86104
init :
87105
@ if [ ! -d $(OBJ_DIR) ]; then mkdir $(OBJ_DIR); fi
106+
@ if [ ! -d $(BIN_DIR) ]; then mkdir $(BIN_DIR); fi
88107
@ if [ ! -d $(OBJ_DIR)/README ]; then echo "This directory contains all of the .o files" > $(OBJ_DIR)/README; fi
89108

90-
parallel : ${PW_OBJS}
91-
${CPLUSPLUS_MPI} ${OPTS} test1.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test1.exe
92-
${CPLUSPLUS_MPI} ${OPTS} test2.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test2.exe
93-
${CPLUSPLUS_MPI} ${OPTS} test3.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test3.exe
94-
${CPLUSPLUS_MPI} ${OPTS} test2-1.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test2-1.exe
95-
${CPLUSPLUS_MPI} ${OPTS} test2-2.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test2-2.exe
96-
${CPLUSPLUS_MPI} ${OPTS} test2-3.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test2-3.exe
97-
${CPLUSPLUS_MPI} ${OPTS} test_t1.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test_t1.exe
98-
${CPLUSPLUS_MPI} ${OPTS} test_t2.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o test_t2.exe
99-
${CPLUSPLUS_MPI} ${OPTS} testf2.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o testf2.exe
100-
${CPLUSPLUS_MPI} ${OPTS} testf3.cpp test_tool.cpp ${PW_OBJS} ${LIBS} -o testf3.exe
101-
109+
${BIN_DIR}/%.exe: %.cpp
110+
${CPLUSPLUS_MPI} ${OPTS} $< test_tool.cpp ${PW_OBJS} ${LIBS} -o $@
102111
${OBJ_DIR}/%.o:%.cpp
103112
${CPLUSPLUS_MPI} ${OPTS} -c ${HONG} $< -o $@
104113

105114
.PHONY:clean
106115
clean:
107116
@ if [ -d $(OBJ_DIR) ]; then rm -rf $(OBJ_DIR); fi
108-
@ if [ -e test1.exe ]; then rm -f test1.exe; fi
109-
@ if [ -e test2.exe ]; then rm -f test2.exe; fi
110-
@ if [ -e test3.exe ]; then rm -f test3.exe; fi
111-
@ if [ -e test2-1.exe ]; then rm -f test2-1.exe; fi
112-
@ if [ -e test2-2.exe ]; then rm -f test2-2.exe; fi
113-
@ if [ -e test2-3.exe ]; then rm -f test2-3.exe; fi
114-
@ if [ -e test_t1.exe ]; then rm -f test_t1.exe; fi
115-
@ if [ -e test_t2.exe ]; then rm -f test_t2.exe; fi
116-
@ if [ -e testf2.exe ]; then rm -f testf2.exe; fi
117-
@ if [ -e testf3.exe ]; then rm -f testf3.exe; fi
117+
@ if [ -d $(BIN_DIR) ]; then rm -rf $(BIN_DIR); fi

0 commit comments

Comments
 (0)