11_usage.tex 1.62 KB
 Tobias Weinzierl committed Jun 10, 2020 1 2 \chapter{Using \teaMPI}  Philipp Samfaß committed Oct 30, 2020 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 Using \teaMPI is as simple as linking \teaMPI to the application and setting \texttt{LD\_LIBRARY\_PATH} to point to \teaMPI: \begin{enumerate} \item Link with -ltmpi -L"path to teaMPI" \item Add "path to teaMPI" to \texttt{LD\_LIBRARY\_PATH} \end{enumerate} \section{Running with \teaMPI} Please set the number of teams with the TEAMS environment variable (default: 2) To use some example provided miniapps: 1. run make in the applications folder 2. run each application in the bin folder with the required command line parameters (documented in each application folder) \section{Example Heartbeat Usage} The following application models many scientific applications. Per loop, the two \texttt{MPI\_Sendrecv} calls act as heartbeats. The first starts the timer for this rank and the second stops it. Additionally the second heartbeat passes the data buffer for comparison with other teams. Only a hash of the data is sent. At the end of the application, the heartbeat times will be written to CSV files. \begin{code} double data[SIZE]; for (int t = 0; t < NUM_TRIALS; t++) { MPI_Barrier(MPI_COMM_WORLD); // Start Heartbeat MPI_Sendrecv(MPI_IN_PLACE, 0, MPI_BYTE, MPI_PROC_NULL, 1, MPI_IN_PLACE, 0, MPI_BYTE, MPI_PROC_NULL, 0, MPI_COMM_SELF, MPI_STATUS_IGNORE); for (int i = 0; i < NUM_COMPUTATIONS; i++) { // Arbitrary computation on data } // End Heartbeat and compare data MPI_Sendrecv(data, SIZE, MPI_DOUBLE, MPI_PROC_NULL, -1, MPI_IN_PLACE, 0, MPI_BYTE, MPI_PROC_NULL, 0, MPI_COMM_SELF, MPI_STATUS_IGNORE); MPI_Barrier(MPI_COMM_WORLD); } \end{code}  Tobias Weinzierl committed Jun 10, 2020 48