Commit 09e73498 authored by Kevin Harms's avatar Kevin Harms
Browse files

Initial file set

parents
COPYRIGHT
The following is a notice of limited availability of the code, and disclaimer
which must be included in the prologue of the code and in all source listings
of the code.
Copyright Notice
+ 2017 University of Chicago
Permission is hereby granted to use, reproduce, prepare derivative works, and
to redistribute to others. This software was authored by:
Argonne Leadership Computing Facility
Argonne National Laboratory, Argonne IL 60439
GOVERNMENT LICENSE
Portions of this material resulted from work developed under a U.S.
Government Contract and are subject to the following license: the Government
is granted for itself and others acting on its behalf a paid-up, nonexclusive,
irrevocable worldwide license in this computer software to reproduce, prepare
derivative works, and perform publicly and display publicly.
DISCLAIMER
This computer code material was prepared, in part, as an account of work
sponsored by an agency of the United States Government. Neither the United
States, nor the University of Chicago, nor any of their employees, makes any
warranty express or implied, or assumes any legal liability or responsibility
for the accuracy, completeness, or usefulness of any information, apparatus,
product, or process disclosed, or represents that its use would not infringe
privately owned rights.
---------------------------
AutoPerf Release Change Log
---------------------------
autoperf-1.0
============
* Initial public release
AutoPerf is a module for Darshan which tracks compute and network metrics
on the Cray XC class systems.
#
# AutoPerf Make rules for Darshan
#
DARSHAN_STATIC_MOD_OBJS += lib/darshan-apxc.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-apxc.po
VPATH += :$(srcdir)/../modules/autoperf/crayxc
lib/darshan-apxc.o: lib/darshan-apxc.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../modules/autoperf/crayxc/darshan-apxc-log-format.h | lib
$(CC) $(CFLAGS) -c $< -o $@
lib/darshan-apxc.po: lib/darshan-bgq.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../modules/autoperf/darshan-apxc-log-format.h | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
/*
* Copyright (C) 2017 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#ifndef __DARSHAN_APXC_LOG_FORMAT_H
#define __DARSHAN_APXC_LOG_FORMAT_H
/* current AutoPerf Cray XC log format version */
#define DARSHAN_APXC_VER 1
#define APXC_COUNTERS \
/* counter 1 */\
X(APXC_COUNTER1) \
/* end of counters */\
X(APXC_NUM_INDICES)
#define AP_CRAYXC_F_COUNTERS \
/* timestamp when data was collected */\
X(APXC_F_TIMESTAMP) \
/* end of counters */\
X(APXC_F_NUM_INDICES)
#define X(a) a,
/* integer counters for the "BGQ" example module */
enum darshan_apxc_indices
{
APXC_COUNTERS
};
/* floating point counters for the "AutoPerf Cray XC" module */
enum darshan_apxc_f_indices
{
APXC_F_COUNTERS
};
#undef X
/* the darshan_apxc_record structure encompasses the high-level data/counters
* which would actually be logged to file by Darshan for the AP Cray XC
* module. This example implementation logs the following data for each
* record:
* - a darshan_base_record structure, which contains the record id & rank
* - integer I/O counters (operation counts, I/O sizes, etc.)
* - floating point I/O counters (timestamps, cumulative timers, etc.)
*/
struct darshan_apxc_record
{
struct darshan_base_record base_rec;
int64_t counters[APXC_NUM_INDICES];
double fcounters[APXC_F_NUM_INDICES];
};
#endif /* __DARSHAN_APXC_LOG_FORMAT_H */
/*
* Copyright (C) 2017 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#define _XOPEN_SOURCE 500
#define _GNU_SOURCE
#include "darshan-runtime-config.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#include <assert.h>
#include "uthash.h"
#include "darshan.h"
#include "darshan-dynamic.h"
/*
* <Description>
*
* This module does not intercept any system calls. It just pulls data
* from the personality struct at initialization.
*/
/*
* Global runtime struct for tracking data needed at runtime
*/
struct crayxc_runtime
{
struct darshan_crayxc_record *record;
};
static struct crayxc_runtime *crayxc_runtime = NULL;
static pthread_mutex_t crayxc_runtime_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
/* my_rank indicates the MPI rank of this process */
static int my_rank = -1;
/* internal helper functions for the BGQ module */
void crayxc_runtime_initialize(void);
/* forward declaration for shutdown function needed to interface with darshan-core */
static void crayxc_shutdown(MPI_Comm mod_comm, darshan_record_id *shared_recs, int shared_rec_count, void **buffer, int *size);
/* macros for obtaining/releasing the BGQ module lock */
#define CRAYXC_LOCK() pthread_mutex_lock(&crayxc_runtime_mutex)
#define CRAYXC_UNLOCK() pthread_mutex_unlock(&crayxc_runtime_mutex)
/*
* Function which updates all the counter data
*/
static void capture(struct darshan_crayxc_record *rec, darshan_record_id rec_id)
{
rec->counters[XXXX] = val;
rec->base_rec.id = rec_id;
rec->base_rec.rank = my_rank;
rec->fcounters[XXX_F_TIMESTAMP] = darshan_core_wtime();
return;
}
/**********************************************************
* Internal functions for manipulating BGQ module state *
**********************************************************/
void crayxc_runtime_initialize()
{
int crayxc_buf_size;
darshan_record_id rec_id;
CRAYXC_LOCK();
/* don't do anything if already initialized */
if(crayxc_runtime)
{
CRAYXC_UNLOCK();
return;
}
/* we just need to store one single record */
crayxc_buf_size = sizeof(struct darshan_crayxc_record);
/* register the BG/Q module with the darshan-core component */
darshan_core_register_module(
DARSHAN_CRAYXC_MOD,
&crayxc_shutdown,
&crayxc_buf_size,
&my_rank,
NULL);
/* not enough memory to fit crayxc module record */
if(crayxc_buf_size < sizeof(struct darshan_crayxc_record))
{
darshan_core_unregister_module(DARSHAN_CRAYXC_MOD);
CRAYXC_UNLOCK();
return;
}
/* initialize module's global state */
crayxc_runtime = malloc(sizeof(*crayxc_runtime));
if(!crayxc_runtime)
{
darshan_core_unregister_module(DARSHAN_CRAYXC_MOD);
CRAYXC_UNLOCK();
return;
}
memset(crayxc_runtime, 0, sizeof(*crayxc_runtime));
rec_id = darshan_core_gen_record_id("darshan-crayxc-record");
/* register the crayxc file record with darshan-core */
crayxc_runtime->record = darshan_core_register_record(
rec_id,
NULL,
DARSHAN_CRAYXC_MOD,
sizeof(struct darshan_crayxc_record),
NULL);
if(!(crayxc_runtime->record))
{
darshan_core_unregister_module(DARSHAN_CRAYXC_MOD);
free(crayxc_runtime);
crayxc_runtime = NULL;
CRAYXC_UNLOCK();
return;
}
capture(crayxc_runtime->record, rec_id);
CRAYXC_UNLOCK();
return;
}
/********************************************************************************
* shutdown function exported by this module for coordinating with darshan-core *
********************************************************************************/
/* Pass data for the crayxc module back to darshan-core to log to file. */
static void crayxc_shutdown(
MPI_Comm mod_comm,
darshan_record_id *shared_recs,
int shared_rec_count,
void **buffer,
int *size)
{
int nprocs;
int result;
uint64_t *ion_ids;
CRAYXC_LOCK();
assert(crayxc_runtime);
/* non-zero ranks throw out their CRAYXC record */
if (my_rank != 0)
{
*buffer = NULL;
*size = 0;
}
free(crayxc_runtime);
crayxc_runtime = NULL;
CRAYXC_UNLOCK();
return;
}
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ts=8 sts=4 sw=4 expandtab
*/
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