-
Peter W. Draper authoredPeter W. Draper authored
mpiuse.h 3.04 KiB
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2019 Peter W. Draper (p.w.draper@durham.ac.uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_MPIUSE_H
#define SWIFT_MPIUSE_H
/* Local includes. */
#include "atomic.h"
#include "cycle.h"
#include "error.h"
/* Entry for logger of MPI send and recv requests in a step. */
struct mpiuse_log_entry {
/* Rank of entry. */
int rank;
/* Type and subtype of MPI task. */
int type;
int subtype;
/* Step of action. */
int step;
/* Whether an activation, send or recv, or if handoff completed. Not the
* same as delivered, need to match across ranks to see that. */
int activation;
/* Ticks at time of this action (original log). */
ticks tic;
/* Rank of otherside of communication. */
int otherrank;
/* The MPI tag. */
int tag;
/* Memory of the request. */
size_t size;
/* Extra information generated by the simulator. */
/* --------------------------------------------- */
/* Interaction is complete. */
int done;
/* Pointer to the data. */
void *data;
/* The request associated with the call. */
MPI_Request req;
/* The time that the injection started. */
ticks injtic;
/* The time that the exchange complete. */
ticks endtic;
/* The number of times that the exchange was tested. */
int nr_tests;
/* Sum of ticks that we tested. */
double tsum;
/* Maximum time in a test. */
ticks tmax;
/* Minimum time in a test. */
ticks tmin;
};
/* Flags for the types of request when generating fakes. */
#ifndef SEND_TYPE
#define SEND_TYPE 25
#define RECV_TYPE 26
#define NO_SUBTYPE 0
#endif
/* API. */
void mpiuse_log_allocation(int rank, int step, size_t tic, int type,
int subtype, int activation, size_t size,
int otherrank, int tag);
struct mpiuse_log_entry *mpiuse_get_log(int ind);
void mpiuse_log_restore(const char *filename);
int mpiuse_nr_logs(void);
int mpiuse_nr_ranks(void);
void mpiuse_dump_logs(int nranks, const char *logfile);
void mpiuse_log_generate(int nr_nodes, int nr_logs, int size, int random,
long int seed, int uniform, const char *cdf,
const char *odata);
void mpiuse_shuffle_logs(struct mpiuse_log_entry **logs, int nlogs);
#endif /* SWIFT_MPIUSE_H */