Commit 4ea07ace authored by Philip Carns's avatar Philip Carns

updates to support external control of instrumentation epochs


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/branches/darshan-florin-extensions@812 3b7491f3-a168-0410-bf4b-c445ed680a29
parent ef025239
/*
* (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 */
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "mpi.h" #include "mpi.h"
#include "darshan.h" #include "darshan.h"
#include "darshan-dynamic.h" #include "darshan-dynamic.h"
#include "darshan-ext.h"
extern char* __progname; extern char* __progname;
...@@ -2484,6 +2485,35 @@ void darshan_mnt_id_from_path(const char* path, int64_t* device_id, int64_t* blo ...@@ -2484,6 +2485,35 @@ void darshan_mnt_id_from_path(const char* path, int64_t* device_id, int64_t* blo
return; return;
} }
static int epoch_counter = 0;
void darshan_start_epoch(void)
{
int nprocs, rank;
if(darshan_global_job)
{
/* darshan instrumentation already on; turn it off */
darshan_finalize(darshan_global_job);
darshan_global_job = NULL;
}
epoch_counter++;
DARSHAN_MPI_CALL(PMPI_Comm_size)(MPI_COMM_WORLD, &nprocs);
DARSHAN_MPI_CALL(PMPI_Comm_rank)(MPI_COMM_WORLD, &rank);
darshan_initialize(0, NULL, nprocs, rank);
return;
}
void darshan_end_epoch(void)
{
darshan_shutdown(0);
darshan_global_job = NULL;
return;
}
/* /*
* Local variables: * Local variables:
* c-indent-level: 4 * c-indent-level: 4
......
...@@ -1614,7 +1614,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs) ...@@ -1614,7 +1614,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs)
if(rank == 0) if(rank == 0)
printf("# 1 unique file per proc\n"); 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_shutdown(1);
darshan_global_job = NULL; darshan_global_job = NULL;
...@@ -1639,7 +1639,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs) ...@@ -1639,7 +1639,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs)
if(rank == 0) if(rank == 0)
printf("# 1 shared file across procs\n"); 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_shutdown(1);
darshan_global_job = NULL; darshan_global_job = NULL;
...@@ -1664,7 +1664,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs) ...@@ -1664,7 +1664,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs)
if(rank == 0) if(rank == 0)
printf("# 1024 unique files per proc\n"); 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_shutdown(1);
darshan_global_job = NULL; darshan_global_job = NULL;
...@@ -1689,7 +1689,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs) ...@@ -1689,7 +1689,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs)
if(rank == 0) if(rank == 0)
printf("# 1024 shared files across procs\n"); 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_shutdown(1);
darshan_global_job = NULL; darshan_global_job = NULL;
......
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