@@ -6,23 +6,8 @@ CPLUSPLUS = g++
66CPLUSPLUS_MPI = mpicxx
77CUDA_COMPILE = nvcc
88OBJ_DIR = pw_obj
9+ BIN_DIR = testbin
910NP = 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\
4732pw_distributeg_method2 .o\
4833fft.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+
5065PW_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
5773FFTW_LIB_DIR = ${FFTW_DIR}/lib
5874FFTW_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# ==========================
7794pw :
7895 @ make init
79- @ make -j $(NP) parallel
96+ @ make -j $(NP) ${PW_OBJS}
97+ @ make -j $(NP) ${TESTFILE}
8098
8199init :
82100 @ if [ ! - d $ (OBJ_D IR ) ]; then mkdir $(OBJ_DIR); fi
101+ @ if [ ! - d $ (B IN_D IR ) ]; then mkdir $(BIN_DIR); fi
83102 @ if [ ! - d $ (OBJ_D IR )/ R EADM E ]; 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
101110clean:
102111 @ if [ - d $ (OBJ_D IR ) ]; then rm -rf $(OBJ_DIR); fi
103- @ if [ - e t est 1 . ex e ]; then rm -f test1 .exe; fi
104- @ if [ - e t est 2 . ex e ]; then rm -f test2 .exe; fi
105- @ if [ - e t est 3 . ex e ]; then rm -f test3 .exe; fi
106- @ if [ - e t est 2-1 . ex e ]; then rm -f test2-1 .exe; fi
107- @ if [ - e t est 2-2 . ex e ]; then rm -f test2-2 .exe; fi
108- @ if [ - e t est 2-3 . ex e ]; then rm -f test2-3 .exe; fi
109- @ if [ - e t est_t 1 . ex e ]; then rm -f test_t1 .exe; fi
110- @ if [ - e t est_t 2 . ex e ]; then rm -f test_t2 .exe; fi
111- @ if [ - e t estf 2 . ex e ]; then rm -f testf2 .exe; fi
112- @ if [ - e t estf 3 . ex e ]; then rm -f testf3 .exe; fi
112+ @ if [ - d $ (B IN_D IR ) ]; then rm -rf $(BIN_DIR); fi
0 commit comments