xref: /petsc/src/benchmarks/streams/makefile (revision 967582eba84cc53dc1fbf6b54d6aa49b7d83bae6)
1-include ../../../petscdir.mk
2CFLAGS	      =
3FFLAGS	      =
4CPPFLAGS      =
5FPPFLAGS      =
6LOCDIR        = src/benchmarks/streams/
7EXAMPLESC     = BasicVersion.c MPIVersion.c OpenMPVersion.c SSEVersion.c PthreadVersion.c CUDAVersion.cu
8EXAMPLESF     =
9TESTS         = BasicVersion OpenMPVersion
10MANSEC        = Sys
11
12include ${PETSC_DIR}/lib/petsc/conf/variables
13include ${PETSC_DIR}/lib/petsc/conf/rules
14include ${PETSC_DIR}/lib/petsc/conf/test
15
16BasicVersion: BasicVersion.o
17	-@${CLINKER} -o BasicVersion BasicVersion.o ${PETSC_LIB}
18	@${RM} -f BasicVersion.o
19
20MPIVersion: MPIVersion.o
21	-@${CLINKER} -o MPIVersion MPIVersion.o ${PETSC_LIB}
22	@${RM} -f MPIVersion.o
23
24CUDAVersion: CUDAVersion.o
25	-@${CLINKER} -o CUDAVersion CUDAVersion.o ${PETSC_LIB}
26	@${RM} -f CUDAVersion.o
27
28OpenMPVersion: OpenMPVersion.o
29	-@${CLINKER} -o OpenMPVersion OpenMPVersion.o
30	@${RM} -f OpenMPVersion.o
31
32SSEVersion: SSEVersion.o
33	-${CLINKER} -o $@ $< ${PETSC_LIB}
34	${RM} -f $<
35
36PthreadVersion: PthreadVersion.o
37	-@${CLINKER} -o PthreadVersion PthreadVersion.o ${PETSC_LIB}
38	@${RM} -f PthreadVersion.o
39
40# make streams [NPMAX=integer_number_of_MPI_processes_to_use] [MPI_BINDING='binding options']
41mpistream:  MPIVersion
42	@if [ "${NPMAX}foo" = "foo" ]; then echo "---------"; printf " Run with [PETSC_OPTIONS=-process_view] make streams NPMAX=<integer number of MPI processes> [MPI_BINDING='-bind-to core -map-by numa']\n or       [I_MPI_PIN_PROCESSOR_LIST=:map=scatter] [PETSC_OPTIONS=-process_view] make streams NPMAX=<integer number of MPI processes>\n"; exit 1 ; fi
43	-@printf "" > scaling.log
44	-@printf "Running streams with '${MPIEXEC} ${MPI_BINDING}' using 'NPMAX=${NPMAX}' \n"
45	-@i=0; while [ $${i} -lt ${NPMAX} ]; do i=`expr $${i} + 1`; \
46	  ${MPIEXEC} ${MPI_BINDING} -n $${i} ./MPIVersion | tee -a scaling.log; \
47        done
48	-@echo "------------------------------------------------"
49	-@${PYTHON} process.py MPI fileoutput
50
51# Works on SUMMIT
52cudastreamjsrun:  CUDAVersion
53	@if [ "${NPMAX}foo" = "foo" ]; then echo "---------"; printf " Run with [PETSC_OPTIONS=-process_view] make streams NPMAX=<integer number of MPI processes> [MPI_BINDING='-bind-to core -map-by numa']\n or       [I_MPI_PIN_PROCESSOR_LIST=:map=scatter] [PETSC_OPTIONS=-process_view] make streams NPMAX=<integer number of MPI processes>\n"; exit 1 ; fi
54	-@printf "" > scaling.log
55	-@printf "Running streams with '${MPIEXEC} ${MPI_BINDING}' using 'NPMAX=${NPMAX}' \n"
56	-@i=0; while [ $${i} -lt ${NPMAX} ] && [ $${i} -lt 7 ]; do i=`expr $${i} + 1`; \
57	  ${MPIEXEC} ${MPI_BINDING} -n 1 -c$${i} -a$${i} -g1 ./CUDAVersion | tee -a scaling.log; \
58        done
59	-@n=1; i=7; while [ $${i} -lt ${NPMAX} ]; do i=`expr $${i} + 7`; n=`expr $${n} + 1`; \
60	       c=5; while [ $${c} -lt 7 ]; do c=`expr $${c} + 1`; \
61	  ${MPIEXEC} ${MPI_BINDING} -n $${n} -c$${c} -a$${c} -g1 ./CUDAVersion | tee -a scaling.log; \
62        done; done
63	-@echo "------------------------------------------------"
64	-@${PYTHON} process.py CUDA fileoutput
65
66openmpstream:  OpenMPVersion
67	@if [ "${NPMAX}foo" = "foo" ]; then echo "---------"; printf " Run with make openmpstream NPMAX=<integer number of threads>\n"; exit 1 ; fi
68	-@printf "" > scaling.log
69	@-@printf "Running openmpstreams using 'NPMAX=${NPMAX}'\n"
70	-@i=0; while [ $${i} -lt ${NPMAX} ]; do i=`expr $${i} + 1`; \
71	  OMP_NUM_THREADS=$${i} ./OpenMPVersion  | tee -a scaling.log;\
72        done
73	-@${PYTHON} process.py OpenMP fileoutput
74
75hwloc:
76	-@if [ "${LSTOPO}foo" != "foo" ]; then ${MPIEXEC} ${MPI_BINDING} -n 1 ${LSTOPO} --no-icaches --no-io --ignore PU ; fi
77
78mpistreams: mpistream hwloc
79	-@${PYTHON} process.py MPI
80
81
82openmpstreams: openmpstream hwloc
83	-@${PYTHON} process.py OpenMP
84
85
86