Commit 76a9b5b6 authored by fisaila's avatar fisaila

Added epochs to Darshan. Epoches and full statistics are mutually exclusive.

Functionality:
An epoch is enclosed by:
darshan_start_epoch();
darshan_stop_epoch();

There is one log file per epoch and the epoch number appears in the file name. 
If epoches are not used the functionality should be the same as before. 

Implementation: 
I tried to minimally modify the code (only darshan-mpi-io.c was modified). 
1) darshan_shutdown became: 
void darshan_shutdown_epoch(int timing_flag)

5 lines were commented and moved to the new darshan_shutdown

2) void darshan_shutdown(int timing_flag)

If no epoch is used just calls darshan_shutdown_epoch
else 
for each epoch restore the counters from the end of epoch and call darshan_shutdown_epoch

3) void darshan_start_epoch(void)

just resets the counters from darshan_global_job

4) void darshan_end_epoch(void)

saves the counters from darshan_global_job 


 
Test:
One test has been added in darshan-test/epoch-testing/. 
I have not performed yet extensive testing. 




git-svn-id: https://svn.mcs.anl.gov/repos/darshan/branches/darshan-florin-extensions@818 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 4ea07ace
This diff is collapsed.
# Generated by configure from .in at Sun Jan 23 19:29:20 CET 2005
#CC = mpicc.darshan
CC = mpicc
LD = $(CC)
CFLAGS = -O0 -g -Wall -Wl,-rpath,../../darshan-runtime/lib
CFLAGS += -I../../darshan-runtime/lib -I. -I../../darshan-runtime -I../../darshan-florin-extensions
#LDFLAGS = -Wl,-wrap,MPI_Init
LDFLAGS = -L../../darshan-runtime/lib -ldarshan
#-L/home/fisaila/software/darshan-florin-extensions/darshan-runtime/lib -ldarshan-posix #-rdynamic -L/home/fisaila/software/darshan-florin-extensions/darshan-runtime/lib -ldarshan
OBJS =
LIBS =
SRCS = $(patsubst %.o,%.c,$(OBJS))
PRGS = writef
all: $(PRGS)
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c $*.c $(INCLUDE) -o $@
$(PRGS): $(OBJS) /homes/fisaila/software/darshan/lib/libdarshan.so
$(PRGS):
$(PRGS): % : %.o
$(CC) $(CFLAGS) -o $@ $< $(OBJS) $(LDFLAGS) $(LIBS)
clean:
-rm -f *.o *~ $(PRGS)
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2001 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpi.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <darshan-ext.h>
static void handle_error(int errcode, char *str)
{
char msg[MPI_MAX_ERROR_STRING];
int resultlen;
MPI_Error_string(errcode, msg, &resultlen);
fprintf(stderr, "%s: %s\n", str, msg);
MPI_Abort(MPI_COMM_WORLD, 1);
}
/* The file name is taken as a command-line argument. */
int main(int argc, char **argv)
{
int i, errcode;
int nprocs, len, *buf, bufcount, rank;
MPI_File fh,fh2;
MPI_Status status;
double stim, write_tim, new_write_tim, write_bw;
char *filename;
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
/* process 0 takes the file name as a command-line argument and
broadcasts it to other processes */
if (!rank) {
i = 1;
while ((i < argc) && strcmp("-fname", *argv)) {
i++;
argv++;
}
if (i >= argc) {
fprintf(stderr, "\n*# Usage: coll_perf -fname filename\n\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
argv++;
len = strlen(*argv);
filename = (char *) malloc(len+1);
strcpy(filename, *argv);
MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD);
}
else {
MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD);
filename = (char *) malloc(len+1);
MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD);
}
bufcount = 128*128*128;
buf = (int *) malloc(bufcount * sizeof(int));
darshan_start_epoch();
errcode = MPI_File_open(MPI_COMM_SELF, filename,
MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh);
darshan_end_epoch();
if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_open(1)");
MPI_Barrier(MPI_COMM_WORLD);
stim = MPI_Wtime();
darshan_start_epoch();
MPI_File_write_all(fh, buf, bufcount, MPI_INT, &status);
errcode = MPI_File_open(MPI_COMM_SELF, "abc",
MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh2);
MPI_File_write_all(fh2, buf, bufcount, MPI_INT, &status);
darshan_end_epoch();
write_tim = MPI_Wtime() - stim;
darshan_start_epoch();
MPI_File_write_all(fh, buf, bufcount, MPI_INT, &status);
darshan_end_epoch();
MPI_File_close(&fh);
MPI_File_close(&fh2);
MPI_Allreduce(&write_tim, &new_write_tim, 1, MPI_DOUBLE, MPI_MAX,
MPI_COMM_WORLD);
if (rank == 0) {
write_bw = (bufcount*sizeof(int))/(new_write_tim*1024.0*1024.0);
fprintf(stderr, "Each of %d processes writes buf size=%ld\n",nprocs, bufcount*sizeof(int));
fprintf(stderr, "Collective write time = %f sec, Collective write bandwidth = %f Mbytes/sec\n", new_write_tim, write_bw);
}
free(filename);
free(buf);
MPI_Finalize();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment