Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AutoPerf
autoperf
Commits
eee2d2c6
Commit
eee2d2c6
authored
Jan 25, 2018
by
Kevin Harms
Browse files
Initial buildable code
parent
09e73498
Changes
3
Hide whitespace changes
Inline
Side-by-side
crayxc/Makefile.darshan
View file @
eee2d2c6
...
...
@@ -5,10 +5,17 @@ DARSHAN_STATIC_MOD_OBJS += lib/darshan-apxc.o
DARSHAN_DYNAMIC_MOD_OBJS
+=
lib/darshan-apxc.po
VPATH
+=
:
$(srcdir)
/../modules/autoperf/crayxc
CFLAGS
+=
\
-DDARSHAN_USE_APXC
\
-I
$(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
$@
CFLAGS_SHARED
+=
\
-DDARSHAN_USE_APXC
\
-I
$(srcdir)
/../modules/autoperf/crayxc
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
$@
lib/darshan-apxc.o
:
lib/darshan-apxc.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) darshan-apxc-log-format.h | lib
$(CC)
$(CFLAGS)
-c
$<
-o
$@
lib/darshan-apxc.po
:
lib/darshan-apxc.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) darshan-apxc-log-format.h | lib
$(CC)
$(CFLAGS_SHARED)
-c
$<
-o
$@
crayxc/darshan-apxc-log-format.h
View file @
eee2d2c6
...
...
@@ -10,45 +10,48 @@
/* current AutoPerf Cray XC log format version */
#define DARSHAN_APXC_VER 1
#define APXC_COUNTERS \
/* counter 1 */
\
X(APXC_COUNTER1) \
#define APXC_RTR_COUNTERS \
X(AR_RTR_0_0_INQ_PRF_INCOMING_FLIT_VC0) \
X(AR_RTR_0_0_INQ_PRF_INCOMING_FLIT_VC1) \
X(AR_RTR_0_0_INQ_PRF_INCOMING_FLIT_VC2) \
X(AR_RTR_0_0_INQ_PRF_INCOMING_FLIT_VC3) \
X(AR_RTR_0_0_INQ_PRF_INCOMING_FLIT_VC4) \
X(AR_RTR_0_0_INQ_PRF_INCOMING_FLIT_VC5) \
X(AR_RTR_0_0_INQ_PRF_INCOMING_FLIT_VC6) \
X(AR_RTR_0_0_INQ_PRF_INCOMING_FLIT_VC7) \
X(AR_RTR_0_0_INQ_PRF_ROWBUS_STALL_CNT) \
/* 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)
X(APXC_RTR_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
enum
darshan_apxc_rtr_indices
{
APXC_
F
_COUNTERS
APXC_
RTR
_COUNTERS
};
#undef X
/* the darshan_apxc_record structure encompasses the
high-level
data/counters
/* the darshan_apxc_
router_
record structure encompasses the 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.)
* - integer I/O counters
* - floating point I/O counters
*/
struct
darshan_apxc_record
struct
darshan_apxc_router_record
{
struct
darshan_base_record
base_rec
;
int64_t
coord
[
4
];
/* ugroup, uchassis, ublade, unode */
int64_t
counters
[
APXC_RTR_NUM_INDICES
];
};
struct
darshan_apxc_header_record
{
struct
darshan_base_record
base_rec
;
int64_t
counters
[
APXC_NUM_INDICES
];
double
fcounters
[
APXC_F_NUM_INDICES
];
int64_t
nblades
;
int64_t
nchassis
;
int64_t
ngroups
;
};
#endif
/* __DARSHAN_APXC_LOG_FORMAT_H */
crayxc/darshan-crayxc.c
deleted
100644 → 0
View file @
09e73498
/*
* 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
*/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment