...
 
Commits (26)
......@@ -217,6 +217,63 @@ enum darshan_indices
CP_SLOWEST_RANK,
CP_SLOWEST_RANK_BYTES,
CP_MPI_SENDS,
CP_MPI_RECVS,
CP_MPI_ISENDS,
CP_MPI_IRECVS,
CP_MPI_WAITS,
CP_MPI_TESTS,
CP_MPI_WAITANYS,
CP_MPI_TESTANYS,
CP_MPI_WAITALLS,
CP_MPI_TESTALLS,
CP_MPI_BARRIERS,
CP_MPI_BCASTS,
CP_MPI_GATHERS,
CP_MPI_GATHERVS,
CP_MPI_SCATHERS,
CP_MPI_SCATHERVS,
CP_MPI_ALLGATHERS,
CP_MPI_ALLGATHERVS,
CP_MPI_ALLTOALLS,
CP_MPI_ALLTOALLVS,
CP_MPI_REDUCES,
CP_MPI_ALLREDUCES,
CP_BYTES_MPI_SEND,
CP_BYTES_MPI_RECV,
CP_BYTES_MPI_ISEND,
CP_BYTES_MPI_IRECV,
CP_BYTES_MPI_BCAST,
CP_BYTES_MPI_GATHER,
CP_BYTES_MPI_GATHERV,
CP_BYTES_MPI_SCATHER,
CP_BYTES_MPI_SCATHERV,
CP_BYTES_MPI_ALLGATHER,
CP_BYTES_MPI_ALLGATHERV,
CP_BYTES_MPI_ALLTOALL,
CP_BYTES_MPI_ALLTOALLV,
CP_BYTES_MPI_REDUCE,
CP_BYTES_MPI_ALLREDUCE,
CP_AVG_MEM_DTYPE_SIZE,
CP_AVG_MEM_DTYPE_EXTENT,
CP_AVG_MEM_DTYPE_BLOCKS,
CP_AVG_FILE_DTYPE_EXTENT,
CP_AVG_FILE_DTYPE_BLOCKS,
CP_MAX_MEM_DTYPE_SIZE,
CP_MAX_MEM_DTYPE_EXTENT,
CP_MAX_MEM_DTYPE_BLOCKS,
CP_MAX_FILE_OFFSET,
CP_MAX_FILE_DTYPE_EXTENT,
CP_MAX_FILE_DTYPE_BLOCKS,
CP_MIN_MEM_DTYPE_SIZE,
CP_MIN_MEM_DTYPE_EXTENT,
CP_MIN_MEM_DTYPE_BLOCKS,
CP_MIN_FILE_OFFSET,
CP_MIN_FILE_DTYPE_EXTENT,
CP_MIN_FILE_DTYPE_BLOCKS,
CP_NUM_INDICES,
};
......@@ -242,6 +299,11 @@ enum f_darshan_indices
CP_F_VARIANCE_RANK_TIME,
CP_F_VARIANCE_RANK_BYTES,
CP_F_MPI_BARRIER_TIME,
CP_F_MPI_ALLTOALL_TIME,
CP_F_MPI_ALLTOALLV_TIME,
CP_F_MPI_ALLREDUCE_TIME,
CP_F_NUM_INDICES,
};
......@@ -276,4 +338,19 @@ struct darshan_job
*/
#define CP_FILE_PARTIAL(__file)((((__file)->counters[CP_POSIX_OPENS] || (__file)->counters[CP_POSIX_FOPENS] || (__file)->counters[CP_POSIX_STATS]) ? 0 : 1))
/* Florin
Structure for Darshan tracing functionality
*/
struct darshan_trace_record {
int rank;
int epoch;
int op;
double tm1;
double tm2;
int send_count;
int recv_count;
long long int offset;
};
#endif /* __DARSHAN_LOG_FORMAT_H */
......@@ -33,10 +33,10 @@ LIBS = -lz @LIBBZ2@
lib::
@mkdir -p $@
lib/darshan-mpi-io.o: lib/darshan-mpi-io.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
lib/darshan-mpi-io.o: lib/darshan-mpi-io.c lib/darshan-mpi-datatypes.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
$(CC) $(CFLAGS) -c $< -o $@
lib/darshan-mpi-io.po: lib/darshan-mpi-io.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
lib/darshan-mpi-io.po: lib/darshan-mpi-io.c lib/darshan-mpi-datatypes.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/darshan-mpi-init-finalize.o: lib/darshan-mpi-init-finalize.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
......@@ -45,6 +45,12 @@ lib/darshan-mpi-init-finalize.o: lib/darshan-mpi-init-finalize.c darshan.h darsh
lib/darshan-mpi-init-finalize.po: lib/darshan-mpi-init-finalize.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/darshan-mpi-datatypes.o: lib/darshan-mpi-datatypes.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
$(CC) $(CFLAGS) -c $< -o $@
lib/darshan-mpi-datatypes.po: lib/darshan-mpi-datatypes.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/darshan-pnetcdf.o: lib/darshan-pnetcdf.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
$(CC) $(CFLAGS) -c $< -o $@
......@@ -78,13 +84,13 @@ lib/lookup8.po: lib/lookup8.c
%.i: %.c
$(CC) -E $(CFLAGS) -c $< -o $@
lib/libdarshan-mpi-io.a: lib/darshan-mpi-io.o lib/darshan-mpi-init-finalize.o lib/darshan-pnetcdf.o lib/darshan-hdf5.o
lib/libdarshan-mpi-io.a: lib/darshan-mpi-io.o lib/darshan-mpi-init-finalize.o lib/darshan-pnetcdf.o lib/darshan-hdf5.o lib/darshan-mpi-datatypes.o
ar rcs $@ $^
lib/libdarshan-posix.a: lib/darshan-posix.o lib/lookup3.o lib/lookup8.o
ar rcs $@ $^
lib/libdarshan.so: lib/darshan-mpi-io.po lib/darshan-mpi-init-finalize.po lib/darshan-pnetcdf.po lib/darshan-hdf5.po lib/darshan-posix.po lib/lookup3.po lib/lookup8.po
lib/libdarshan.so: lib/darshan-mpi-io.po lib/darshan-mpi-init-finalize.po lib/darshan-pnetcdf.po lib/darshan-hdf5.po lib/darshan-posix.po lib/lookup3.po lib/lookup8.po lib/darshan-mpi-datatypes.po
$(CC) $(CFLAGS_SHARED) $(LDFLAGS) -ldl -o $@ $^ -lpthread -lrt -lz
install:: all
......
This diff is collapsed.
......@@ -25,7 +25,7 @@
#define CP_MEM_ALIGNMENT_OVERRIDE "DARSHAN_MEMALIGN"
/* maximum number of files per process we will track */
#define CP_MAX_FILES 1024
#define CP_MAX_FILES 10 //Intial default 1024
/* TODO: figure out how to pick good value here */
/* hash table size parameters */
......@@ -226,6 +226,22 @@ enum cp_counter_type
extern struct darshan_job_runtime* darshan_global_job;
extern int epoch_counter;
/* Florin
Trace log structures
*/
#define DARSHAN_TRACER_LOG_SIZE 1024*1024
extern char darshan_log[DARSHAN_TRACER_LOG_SIZE];
//extern char darshan_log[];
extern long long int darshan_log_ptr;
void darshan_trace_log_record(int rank, int epoch, int op, double tm1, double tm2, int send_count, int recv_count, long long int offset);
void darshan_trace_log_write();
void darshan_initialize(int argc, char** argv, int nprocs, int rank);
void darshan_finalize(struct darshan_job_runtime* job);
void darshan_condense(void);
......
/*
* (C) 2014 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
/* This header file defines an external API for applications to make
* explicit calls to control Darshan behavior
*/
#ifndef __DARSHAN_EXT_H
#define __DARSHAN_EXT_H
#include <unistd.h>
#include <sys/types.h>
#include <stdint.h>
#include <mpi.h>
void darshan_start_epoch(void);
void darshan_end_epoch(void);
#endif /* __DARSHAN_EXT_H */
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* (C) 2001 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
//#include "mpi.h"
#include "adio.h"
#include "adio_extern.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
ADIOI_Flatlist_node * get_flatlist(MPI_Datatype dt){
int is_contig;
ADIOI_Datatype_iscontig(dt,&is_contig);
if (is_contig)
return NULL;
else {
ADIOI_Flatlist_node *flat_buf;
ADIOI_Flatten_datatype(dt);
flat_buf = ADIOI_Flatlist;
while ((flat_buf)&&(flat_buf->type != dt)) flat_buf = flat_buf->next;
if (flat_buf) {
if (flat_buf->incr_size[0] == -1) {
int i;
flat_buf->incr_size[0] = 0;
for (i=1;i<flat_buf->count;i++)
flat_buf->incr_size[i] = flat_buf->incr_size[i-1] + flat_buf->blocklens[i-1];
}
}
return flat_buf;
}
}
void print_flatlist(MPI_Datatype dt) {
int b_index;
ADIOI_Flatlist_node *flat_buf;
flat_buf = get_flatlist(dt);
if (flat_buf) {
printf("FLATLIST with %lld elements\n",(long long) flat_buf->count);
for (b_index=0; b_index < flat_buf->count; b_index++) {
printf ("%3d-th: offset=%8lld len=%8lld \n",b_index, flat_buf->indices[b_index],flat_buf->blocklens[b_index]);
}
}
else
printf ("NULL flat_buf\n");
}
void print_flatlist2(ADIOI_Flatlist_node *flat_buf) {
int b_index;
if (flat_buf)
for (b_index=0; b_index < flat_buf->count; b_index++) {
printf ("%3d-th: offset=%8lld len=%8lld \n",b_index, flat_buf->indices[b_index],flat_buf->blocklens[b_index]);
}
else
printf ("NULL flat_buf\n");
}
#define LEFT 0
#define RIGHT 1
// assumes : x > 0
// result: between 0 and flat_buf->count inclusively
// returns the index of the flat_buf where x is located
// LEFT
// ____***____***____****--
// 000000011111112222222233
// RIGHT
// 000011111112222222333333
int find_bin_search(MPI_Offset x, MPI_Datatype datatype, int leftright){
ADIOI_Flatlist_node *flat_buf = get_flatlist(datatype);
if (!flat_buf) return 0;
int l = 0 ,r = flat_buf->count - 1 ,found = -1;
while (l <= r) {
int m = (l + r) / 2;
if (x < flat_buf->indices[m] - flat_buf->indices[0] + flat_buf->blocklens[m]) {
if (l == m) {
found = m;
break;
}
if (x >= flat_buf->indices[m - 1] - flat_buf->indices[0] + flat_buf->blocklens[m - 1]) {
found = m;
break;
}
r = m - 1 ;
}
else {
if (m == r) {
found = m +1;
//found = m;
break;
}
if (x < flat_buf->indices[m + 1] - flat_buf->indices[0]) {
found = m + 1;
//found = m;
break;
}
l = m +1;
}
}
// return found - ((flat_buf->blocklens[0] == 0)?1:0);
if ((leftright == RIGHT)
&& (found < flat_buf->count)
&& (x < flat_buf->indices[found] - flat_buf->indices[0] + flat_buf->blocklens[found])
&& (x >= flat_buf->indices[found] - flat_buf->indices[0])) found++;
return found;
}
// Finds the file offset within the extent range
// assumes : x > 0
MPI_Offset find_size_bin_search(MPI_Offset x, ADIOI_Flatlist_node *flat_buf){
int l = 0 ,r = flat_buf->count - 1;
MPI_Offset size;
while (l <= r) {
int m = (l + r) / 2;
//printf("\n*** l=%d r=%d\n",l,r);
if (x < flat_buf->incr_size[m] + flat_buf->blocklens[m]) {
if (l == m) {
size = flat_buf->indices[m] + x - flat_buf->incr_size[m];
break;
}
if (x >= flat_buf->incr_size[m]) {
size = flat_buf->indices[m] + x - flat_buf->incr_size[m];
break;
}
r = m - 1 ;
}
else {
// ???
if (m == r) {
size = flat_buf->indices[m] + x - flat_buf->incr_size[m];
break;
}
if (x < flat_buf->incr_size[m + 1] + flat_buf->blocklens[m + 1]) {
size = flat_buf->indices[m + 1] + x - flat_buf->incr_size[m + 1];
break;
}
l = m +1;
}
}
return size;
}
void free_datatype(MPI_Datatype type) {
int ni, na, nd, combiner;
MPI_Type_get_envelope(type, &ni, &na, &nd, &combiner);
if (combiner != MPI_COMBINER_NAMED)
MPI_Type_free(&type);
}
/*int my_get_view(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, MPI_Datatype *filetype){
ADIO_File adio_fh = MPIO_File_resolve(fh);
*disp = adio_fh->disp;
*etype = adio_fh->etype;
*filetype = adio_fh->filetype;
return MPI_SUCCESS;
}
*/
MPI_Offset func_1_per( MPI_Offset x, ADIOI_Flatlist_node *flat_buf){
return find_size_bin_search(x, flat_buf) - flat_buf->indices[0];
}
/* Maps a view offset on a file offset
Warning: offset is in multiple of etypes, needed func_1_inf for converting the x into byte offset before computing a mapping for x + number_of_bytes
*/
MPI_Offset func_1(MPI_File fh, MPI_Offset x){
int is_contig, etype_size;
MPI_Offset disp_plus_lb, ret;
MPI_Datatype etype, filetype;
char datarep[MPI_MAX_DATAREP_STRING];
MPI_Aint lb, extent;
MPI_File_get_view(fh, &disp_plus_lb, &etype, &filetype, datarep);
//my_get_view(fh, &disp_plus_lb, &etype, &filetype);
MPI_Type_get_extent(filetype, &lb, &extent);
MPI_Type_size(etype, &etype_size);
x = x * etype_size;
disp_plus_lb += lb;
ADIOI_Datatype_iscontig(filetype, &is_contig);
if (is_contig)
ret = x + disp_plus_lb;
else {
int sz;
MPI_Type_size(filetype, &sz);
ret = disp_plus_lb + x / sz * extent + func_1_per(x % sz, get_flatlist(filetype));
}
free_datatype(etype);
free_datatype(filetype);
return ret;
}
/*
Warning: offset is in multiple of etypes, needed func_1_inf for converting the x into byte offset before computing a mapping for x + number_of_bytes
Maps a view offset on a file offset:
trasforms first etype -> bytes
and then moves on the previous byte
*/
MPI_Offset func_1_inf(MPI_File fh, MPI_Offset x, int memtype_size){
int is_contig, etype_size;
MPI_Offset disp_plus_lb, ret;
MPI_Datatype etype, filetype;
char datarep[MPI_MAX_DATAREP_STRING];
MPI_Aint lb, extent;
MPI_File_get_view(fh, &disp_plus_lb, &etype, &filetype, datarep);
//my_get_view(fh, &disp_plus_lb, &etype, &filetype);
MPI_Type_get_extent(filetype, &lb, &extent);
MPI_Type_size(etype, &etype_size);
x = x * etype_size + memtype_size - 1;
disp_plus_lb += lb;
ADIOI_Datatype_iscontig(filetype, &is_contig);
if (is_contig)
ret = x + disp_plus_lb;
else {
int sz;
MPI_Type_size(filetype, &sz);
ret = disp_plus_lb + x / sz * extent + func_1_per(x % sz, get_flatlist(filetype));
}
free_datatype(etype);
free_datatype(filetype);
return ret;
}
/* This version compacts the neighboring contiguous blocks */
int count_contiguous_blocks_memory(MPI_Datatype datatype, int count) {
ADIOI_Flatlist_node *flat_buf;
flat_buf = get_flatlist(datatype);
return (flat_buf)?(flat_buf->count*count):1;
}
#define BEGIN_BLOCK(x,block_size) (((x)/(block_size))*(block_size))
#define END_BLOCK(x,block_size) (((x)/(block_size)+1)*(block_size)-1)
#define BEGIN_NEXT_BLOCK(x,block_size) (((x)/(block_size)+1)*(block_size))
int count_contiguous_blocks_file(MPI_File fh, MPI_Offset foff1, MPI_Offset foff2) {
MPI_Offset disp;
MPI_Datatype etype, filetype;
char datarep[MPI_MAX_DATAREP_STRING];
int is_contig;
int ret;
assert(foff1 <= foff2);
MPI_File_get_view(fh, &disp, &etype, &filetype, datarep);
//my_get_view(fh, &disp, &etype, &filetype);
ADIOI_Datatype_iscontig(filetype, &is_contig);
if (is_contig)
ret=1;
else {
MPI_Aint extent, lb;
ADIOI_Flatlist_node *flat_buf;
flat_buf = get_flatlist(filetype);
MPI_Type_get_extent(filetype, &lb, &extent);
if (disp+lb > foff1) {
printf("disp=%lld lb=%lld foff1=%lld foff2=%lld\n", disp, (long long) lb, foff1, foff2);
print_flatlist(filetype);
}
assert(disp+lb <= foff1);
assert(lb == flat_buf->indices[0]);
if (foff2 < ((flat_buf->blocklens[0] == 0)?flat_buf->indices[1]:flat_buf->indices[0]))
ret=0;
else{
int ind1, ind2;
ind1 = find_bin_search((foff1 - disp - lb) % extent, filetype, LEFT);
ind2 = find_bin_search((foff2 - disp - lb) % extent, filetype, RIGHT);
if ((foff2 - disp - lb) < BEGIN_NEXT_BLOCK(foff1 - disp - lb, extent))
ret = ind2 - ind1;
else
ret = flat_buf->count - ind1 - ((flat_buf->blocklens[flat_buf->count-1] == 0)?1:0)+
(BEGIN_BLOCK(foff2 - disp - lb, extent)-
BEGIN_NEXT_BLOCK(foff1 - disp - lb, extent))
/ extent * (flat_buf->count-
((flat_buf->blocklens[0] == 0)?1:0) -
((flat_buf->blocklens[flat_buf->count-1] == 0)?1:0)-
(((flat_buf->blocklens[flat_buf->count-1])&&(flat_buf->blocklens[flat_buf->count-1] + flat_buf->indices[flat_buf->count-1] - flat_buf->indices[0] == extent ))?1:0))
+ ind2 - (((ind2>0)&&(flat_buf->blocklens[0] == 0))?1:0) -
(((ind2>0)&&(flat_buf->indices[0]==0))?1:0);
}
}
free_datatype(etype);
free_datatype(filetype);
return ret;
}
This diff is collapsed.
......@@ -951,9 +951,18 @@ ssize_t DARSHAN_DECL(write)(int fd, const void *buf, size_t count)
ssize_t ret;
int aligned_flag = 0;
double tm1, tm2;
char *value;
MAP_OR_FAIL(write);
//int rank;
//DARSHAN_MPI_CALL(PMPI_Comm_rank)(MPI_COMM_WORLD, &rank);
/* printf("POSIX WRITE rank:%d count:%d\n", rank, count);
*/
if (value = getenv("DARSHAN_POSIX_EPOCH"))
darshan_start_epoch();
if((unsigned long)buf % darshan_mem_alignment == 0)
aligned_flag = 1;
......@@ -962,7 +971,20 @@ ssize_t DARSHAN_DECL(write)(int fd, const void *buf, size_t count)
tm2 = darshan_wtime();
CP_LOCK();
CP_RECORD_WRITE(ret, fd, count, 0, 0, aligned_flag, 0, tm1, tm2);
if (darshan_global_job) {
// int rank;
//PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (getenv("DARSHAN_TRACING")){
darshan_trace_log_record(-1, epoch_counter, CP_POSIX_WRITES, tm1, tm2, count, 0, __real_lseek64(fd,0,SEEK_CUR));
}
}
CP_UNLOCK();
if (value = getenv("DARSHAN_POSIX_EPOCH"))
darshan_end_epoch();
return(ret);
}
......@@ -1614,7 +1636,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs)
if(rank == 0)
printf("# 1 unique file per proc\n");
DARSHAN_MPI_CALL(PMPI_Barrier)(MPI_COMM_WORLD);
//DARSHAN_MPI_CALL(PMPI_Barrier)(MPI_COMM_WORLD);
darshan_shutdown(1);
darshan_global_job = NULL;
......@@ -1639,7 +1661,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs)
if(rank == 0)
printf("# 1 shared file across procs\n");
DARSHAN_MPI_CALL(PMPI_Barrier)(MPI_COMM_WORLD);
//DARSHAN_MPI_CALL(PMPI_Barrier)(MPI_COMM_WORLD);
darshan_shutdown(1);
darshan_global_job = NULL;
......@@ -1664,7 +1686,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs)
if(rank == 0)
printf("# 1024 unique files per proc\n");
DARSHAN_MPI_CALL(PMPI_Barrier)(MPI_COMM_WORLD);
//DARSHAN_MPI_CALL(PMPI_Barrier)(MPI_COMM_WORLD);
darshan_shutdown(1);
darshan_global_job = NULL;
......@@ -1689,7 +1711,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs)
if(rank == 0)
printf("# 1024 shared files across procs\n");
DARSHAN_MPI_CALL(PMPI_Barrier)(MPI_COMM_WORLD);
//DARSHAN_MPI_CALL(PMPI_Barrier)(MPI_COMM_WORLD);
darshan_shutdown(1);
darshan_global_job = NULL;
......
# 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 = -Wl,--no-as-needed -ldl -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_noepoch writef counters coll_perf
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>
/* The file name is taken as a command-line argument. */
/* Measures the I/O bandwidth for writing/reading a 3D
block-distributed array to a file corresponding to the global array
in row-major (C) order.
Note that the file access pattern is noncontiguous.
Array size 128^3. For other array sizes, change array_of_gsizes below.*/
int main(int argc, char **argv)
{
MPI_Datatype newtype;
int i, ndims, array_of_gsizes[3], array_of_distribs[3];
int order, nprocs, len, *buf, bufcount, mynod;
int array_of_dargs[3], array_of_psizes[3];
MPI_File fh;
MPI_Status status;
double stim, write_tim, new_write_tim, write_bw;
double read_tim, new_read_tim, read_bw;
char *filename;
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &mynod);
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 (!mynod) {
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);
}
ndims = 3;
order = MPI_ORDER_C;
array_of_gsizes[0] = 128;
array_of_gsizes[1] = 128;
array_of_gsizes[2] = 128;
array_of_distribs[0] = MPI_DISTRIBUTE_BLOCK;
array_of_distribs[1] = MPI_DISTRIBUTE_BLOCK;
array_of_distribs[2] = MPI_DISTRIBUTE_BLOCK;
array_of_dargs[0] = MPI_DISTRIBUTE_DFLT_DARG;
array_of_dargs[1] = MPI_DISTRIBUTE_DFLT_DARG;
array_of_dargs[2] = MPI_DISTRIBUTE_DFLT_DARG;
for (i=0; i<ndims; i++) array_of_psizes[i] = 0;
MPI_Dims_create(nprocs, ndims, array_of_psizes);
MPI_Type_create_darray(nprocs, mynod, ndims, array_of_gsizes,
array_of_distribs, array_of_dargs,
array_of_psizes, order, MPI_INT, &newtype);
MPI_Type_commit(&newtype);
MPI_Type_size(newtype, &bufcount);
bufcount = bufcount/sizeof(int);
buf = (int *) malloc(bufcount * sizeof(int));
/* to eliminate paging effects, do the operations once but don't time
them */
MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR,
MPI_INFO_NULL, &fh);
MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL);
MPI_File_write_all(fh, buf, bufcount, MPI_INT, &status);
MPI_File_seek(fh, 0, MPI_SEEK_SET);
MPI_File_read_all(fh, buf, bufcount, MPI_INT, &status);
MPI_File_close(&fh);
MPI_Barrier(MPI_COMM_WORLD);
/* now time write_all */
MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR,
MPI_INFO_NULL, &fh);
MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL);
MPI_Barrier(MPI_COMM_WORLD);
stim = MPI_Wtime();
darshan_start_epoch();
MPI_File_write_all(fh, buf, bufcount, MPI_INT, &status);
darshan_end_epoch();
write_tim = MPI_Wtime() - stim;
MPI_File_close(&fh);
MPI_Allreduce(&write_tim, &new_write_tim, 1, MPI_DOUBLE, MPI_MAX,
MPI_COMM_WORLD);
if (mynod == 0) {
write_bw = (array_of_gsizes[0]*array_of_gsizes[1]*array_of_gsizes[2]*sizeof(int))/(new_write_tim*1024.0*1024.0);
fprintf(stderr, "Global array size %d x %d x %d integers\n", array_of_gsizes[0], array_of_gsizes[1], array_of_gsizes[2]);
fprintf(stderr, "Collective write time = %f sec, Collective write bandwidth = %f Mbytes/sec\n", new_write_tim, write_bw);
}
MPI_Barrier(MPI_COMM_WORLD);
/* now time read_all */
MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR,
MPI_INFO_NULL, &fh);
MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL);
MPI_Barrier(MPI_COMM_WORLD);
stim = MPI_Wtime();
darshan_start_epoch();
MPI_File_read_all(fh, buf, bufcount, MPI_INT, &status);
darshan_end_epoch();
read_tim = MPI_Wtime() - stim;
MPI_File_close(&fh);
MPI_Allreduce(&read_tim, &new_read_tim, 1, MPI_DOUBLE, MPI_MAX,
MPI_COMM_WORLD);
if (mynod == 0) {
read_bw = (array_of_gsizes[0]*array_of_gsizes[1]*array_of_gsizes[2]*sizeof(int))/(new_read_tim*1024.0*1024.0);
fprintf(stderr, "Collective read time = %f sec, Collective read bandwidth = %f Mbytes/sec\n", new_read_tim, read_bw);
}
MPI_Type_free(&newtype);
free(buf);
free(filename);
MPI_Finalize();
return 0;
}
/* -*- 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;
}
/* -*- 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;
}
/* -*- 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));
errcode = MPI_File_open(MPI_COMM_SELF, filename,
MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh);
if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_open(1)");
MPI_Barrier(MPI_COMM_WORLD);
stim = MPI_Wtime();
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);
write_tim = MPI_Wtime() - stim;
MPI_File_write_all(fh, buf, bufcount, MPI_INT, &status);
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;
}
all: darshan-parser darshan-convert darshan-diff darshan-analyzer darshan-log-params darshan-util-lib
all: darshan-parser-trace darshan-convert darshan-diff darshan-analyzer darshan-log-params darshan-util-lib
DESTDIR =
srcdir = @srcdir@
......@@ -38,6 +38,9 @@ uthash-1.9.2:
darshan-parser: darshan-parser.c $(DARSHAN_LOG_FORMAT) darshan-logutils.h darshan-logutils.o | uthash-1.9.2
gcc $(CFLAGS) $< darshan-logutils.o -o $@ $(LIBS)
darshan-parser-trace: darshan-parser-trace.c $(DARSHAN_LOG_FORMAT) darshan-logutils.h darshan-logutils.o | uthash-1.9.2
gcc $(CFLAGS) $< darshan-logutils.o -o $@ $(LIBS)
darshan-convert: darshan-convert.c $(DARSHAN_LOG_FORMAT) darshan-logutils.h darshan-logutils.o lookup3.o
gcc $(CFLAGS) $< darshan-logutils.o lookup3.o -o $@ $(LIBS)
......@@ -74,6 +77,7 @@ install:: all
install -d $(libdir)
install -d $(includedir)
install -m 755 darshan-parser $(bindir)
install -m 755 darshan-parser-trace $(bindir)
install -m 755 darshan-convert $(bindir)
install -m 755 darshan-diff $(bindir)
install -m 755 darshan-analyzer $(bindir)
......
......@@ -163,6 +163,61 @@ char *darshan_names[] = {
"CP_FASTEST_RANK_BYTES",
"CP_SLOWEST_RANK",
"CP_SLOWEST_RANK_BYTES",
"CP_MPI_SENDS",
"CP_MPI_RECVS",
"CP_MPI_ISENDS",
"CP_MPI_IRECVS",
"CP_MPI_WAITS",
"CP_MPI_TESTS",
"CP_MPI_WAITANYS",
"CP_MPI_TESTANYS",
"CP_MPI_WAITALLS",
"CP_MPI_TESTALLS",
"CP_MPI_BARRIERS",
"CP_MPI_BCASTS",
"CP_MPI_GATHERS",
"CP_MPI_GATHERVS",
"CP_MPI_SCATHERS",
"CP_MPI_SCATHERVS",
"CP_MPI_ALLGATHERS",
"CP_MPI_ALLGATHERVS",
"CP_MPI_ALLTOALLS",
"CP_MPI_ALLTOALLVS",
"CP_MPI_REDUCES",
"CP_MPI_ALLREDUCES",
"CP_BYTES_MPI_SEND",
"CP_BYTES_MPI_RECV",
"CP_BYTES_MPI_ISEND",
"CP_BYTES_MPI_IRECV",
"CP_BYTES_MPI_BCAST",
"CP_BYTES_MPI_GATHER",
"CP_BYTES_MPI_GATHERV",
"CP_BYTES_MPI_SCATHER",
"CP_BYTES_MPI_SCATHERV",
"CP_BYTES_MPI_ALLGATHER",
"CP_BYTES_MPI_ALLGATHERV",
"CP_BYTES_MPI_ALLTOALL",
"CP_BYTES_MPI_ALLTOALLV",
"CP_BYTES_MPI_REDUCE",
"CP_BYTES_MPI_ALLREDUCE",
"CP_AVG_MEM_DTYPE_SIZE",
"CP_AVG_MEM_DTYPE_EXTENT",
"CP_AVG_MEM_DTYPE_BLOCKS",
"CP_AVG_FILE_DTYPE_EXTENT",
"CP_AVG_FILE_DTYPE_BLOCKS",
"CP_MAX_MEM_DTYPE_SIZE",
"CP_MAX_MEM_DTYPE_EXTENT",
"CP_MAX_MEM_DTYPE_BLOCKS",
"CP_MAX_FILE_OFFSET",
"CP_MAX_FILE_DTYPE_EXTENT",
"CP_MAX_FILE_DTYPE_BLOCKS",
"CP_MIN_MEM_DTYPE_SIZE",
"CP_MIN_MEM_DTYPE_EXTENT",
"CP_MIN_MEM_DTYPE_BLOCKS",
"CP_MIN_FILE_OFFSET",
"CP_MIN_FILE_DTYPE_EXTENT",
"CP_MIN_FILE_DTYPE_BLOCKS",
"CP_NUM_INDICES"
};
......@@ -187,6 +242,11 @@ char *darshan_f_names[] = {
"CP_F_SLOWEST_RANK_TIME",
"CP_F_VARIANCE_RANK_TIME",
"CP_F_VARIANCE_RANK_BYTES",
"CP_F_MPI_BARRIER_TIME",
"CP_F_MPI_ALLTOALL_TIME",
"CP_F_MPI_ALLTOALLV_TIME",
"CP_F_MPI_ALLREDUCE_TIME",
"CP_F_NUM_INDICES"
};
......
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <darshan-logutils.h>
/*
struct darshan_trace_record {
int rank;
int epoch;
int op;
double tm1;
double tm2;
int send_count;
int recv_count;
long long int offset;
};
*/
void read_log(char *filename, char* csvfile, int epoch, char* counter) {
int fd;
ssize_t bytes_read;
FILE *fout;
struct darshan_trace_record d;
int flag = 1;
if ((fd=open(filename,O_RDONLY))<0){
perror("Open Failed");
return;
}
if (csvfile){
if ((fout=fopen(csvfile,"w"))==NULL){
perror("Open Failed");
return;
}
}
else
fout = stdout;
fprintf(fout, "rank,epoch,counter,start_time,end_time,write_count,read_count,offset\n");
while ((bytes_read = read(fd,&d,sizeof(struct darshan_trace_record)))>0) {
if (epoch < 0) {
if (counter) {
if (strcmp(counter, darshan_names[d.op])) {
flag = 0;
}
}
}
else {
if (epoch != d.epoch)
flag = 0;
else {
if (counter) {
if (strcmp(counter, darshan_names[d.op])) {
flag = 0;
}
}
}
}
if (flag)
fprintf(fout, "%d,%d,%s,%.6f,%.6f,%d,%d,%lld\n",
d.rank, d.epoch, darshan_names[d.op],d.tm1,d.tm2,d.send_count, d.recv_count,d.offset);
flag = 1;
}
close(fd);
if (csvfile)
fclose(fout);
}
int main(int argc, char **argv)
{
int epoch = -1;
char *counter = NULL;
if (argc < 2) {
printf("Call %s darshan_trace_file_name [epoch] [counter] \n", argv[0]);
exit(1);
}
else {
if (argc > 2) {
epoch = atoi(argv[2]);
if (argc > 3)
counter = argv[3];
}
}
read_log(argv[1], NULL, epoch, counter);
return 0;
}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
#include <errno.h>
#include <darshan-logutils.h>
/*
struct darshan_trace_record {
int rank;
int epoch;
int op;
double tm1;
double tm2;
int send_count;
int recv_count;
long long int offset;
};
*/
void split_path_file(char** f, char *pf) {
char *slash = pf, *next;
while ((next = strpbrk(slash + 1, "\\/"))) slash = next;
if (pf != slash) slash++;
*f = strdup(slash);
}
void read_log(char *filename,char *dir, int cnt_epochs, int bin_text) {
int fd,i,j;
ssize_t bytes_read;
FILE *fout[11][5];
int outfd[11][5];
struct darshan_trace_record d;
char outdir[PATH_MAX], outfile[PATH_MAX];
char *justfile;
if ((fd=open(filename,O_RDONLY))<0){
perror("Open Failed");
return;
}
split_path_file(&justfile,filename);
//printf(justfile);
sprintf(outdir,"%s/%s",dir,justfile);
if (mkdir(outdir,0777)<0){
if (errno !=EEXIST) {
perror("Mkdir Failed");
return;
}
}
for (i=0;i<cnt_epochs;i++){
for (j=0;j<5;j++){
switch (j) {
case 0:
sprintf(outfile,"%s/CP_MPI_ALLREDUCES-%d",outdir,i);
break;
case 1:
sprintf(outfile,"%s/CP_MPI_ALLTOALLS-%d",outdir,i);
break;
case 2:
sprintf(outfile,"%s/CP_MPI_ALLTOALLVS-%d",outdir,i);
break;
case 3:
sprintf(outfile,"%s/CP_POSIX_WRITES-%d",outdir,i);
break;
case 4:
sprintf(outfile,"%s/CP_COLL_WRITES-%d",outdir,i);
break;
}
if (bin_text) {
if ((fout[i][j]=fopen(outfile,"w"))==NULL){
perror("Fopen Failed");
return;
}
fprintf(fout[i][j], "rank,epoch,counter,start_time,end_time,write_count,read_count,offset\n");
}
else
if ((outfd[i][j] = open(outfile,O_CREAT|O_WRONLY|O_TRUNC,0666))<0){
perror("Fopen 2 Failed");
return;
}
}
}
while ((bytes_read = read(fd,&d,sizeof(struct darshan_trace_record)))>0) {
int j;
switch (d.op) {
case CP_MPI_ALLREDUCES: j=0; break;
case CP_MPI_ALLTOALLS: j=1; break;
case CP_MPI_ALLTOALLVS: j=2; break;
case CP_POSIX_WRITES: j=3; break;
case CP_COLL_WRITES: j=4; break;
otherwise: {
printf("Unsupported counter\n");
continue;
}
}
if (bin_text)
fprintf(fout[d.epoch][j], "%d,%d,%s,%.6f,%.6f,%d,%d,%lld\n",
d.rank, d.epoch, darshan_names[d.op],d.tm1,d.tm2,d.send_count, d.recv_count,d.offset);
else
write(outfd[d.epoch][j],&d,sizeof(struct darshan_trace_record));
}
close(fd);
for (i=0;i<cnt_epochs;i++)
for (j=0;j<5;j++)
if (bin_text)
fclose(fout[i][j]);
else
close(outfd[i][j]);
}
int main(int argc, char **argv)
{
if (argc < 5) {
printf("Call %s darshan_trace_file_name processing_dir cnt_epochs binary/text(0/1)\n", argv[0]);
exit(1);
}
read_log(argv[1], argv[2], atoi(argv[3]), atoi(argv[4]));
return 0;
}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
#include <errno.h>
//#include <darshan-logutils.h>
struct darshan_trace_record {
int rank;
int epoch;
int op;
double tm1;
double tm2;
int send_count;
int recv_count;
long long int offset;
};
#define MAX_PROCS 8*1024
#define HISTOGRAM_BINS 10
long long int vmax_lli( long long int *v, int count) {
if (count <= 0) {
printf("Error: max can not be computed for a vector of %d elements\n", count);
exit(1);
return -1;
}
else{
int i;
long long int max = v[0];
for (i=1; i<count; i++) {
if (v[i] > max)
max = v[i];
}
return max;
}
}
long long int vmin_lli( long long int *v, int count) {
if (count <= 0) {
printf("Error: min can not be computed for a vector of %d elements\n", count);
exit(1);
return -1;
}
else{
int i;
long long int min = v[0];
for (i=1; i<count; i++) {
if (v[i] < min)
min = v[i];
}
return min;
}
}
long long int vmean_lli( long long int *v, int count) {
if (count <= 0) {
printf("Error: mean can not be computed for a vector of %d elements\n", count);
exit(1);
return -1;