Commit e0914e02 authored by Sudheer Chunduri's avatar Sudheer Chunduri
Browse files

Merge branch 'snyder-updates2' into 'master'

small cleanups of APXC/APMPI modules

See merge request AutoPerf/autoperf!5
parents 702eeba7 7be6f3a6
......@@ -133,6 +133,9 @@ static int darshan_log_get_apmpi_rec(darshan_fd fd, void** buf_p)
/* swap bytes if necessary */
DARSHAN_BSWAP64(&(hdr_rec->base_rec.id));
DARSHAN_BSWAP64(&(hdr_rec->base_rec.rank));
DARSHAN_BSWAP64(&(hdr_rec->magic));
DARSHAN_BSWAP32(&(hdr_rec->version));
DARSHAN_BSWAP32(&(hdr_rec->sync_flag));
DARSHAN_BSWAP64(&(hdr_rec->apmpi_f_variance_total_mpitime));
DARSHAN_BSWAP64(&(hdr_rec->apmpi_f_variance_total_mpisynctime));
}
......
......@@ -18,6 +18,3 @@ lib/darshan-apxc.o: lib/darshan-apxc.c lib/darshan-apxc-utils.h darshan.h darsha
lib/darshan-apxc.po: lib/darshan-apxc.c lib/darshan-apxc-utils.h darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) darshan-apxc-log-format.h | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
print-apxc-size: print-apxc-size.c $(DARSHAN_LOG_FORMAT) $(srcdir)/../modules/autoperf/apxc/darshan-apxc-log-format.h
$(CC) $(CFLAGS) -g -O0 -o $@ $<
......@@ -462,11 +462,10 @@ enum apxc_cluster_modes
struct darshan_apxc_perf_record
{
struct darshan_base_record base_rec;
int group;
int chassis;
int blade;
int node;
int marked;
int64_t group;
int64_t chassis;
int64_t blade;
int64_t node;
uint64_t counters[APXC_NUM_INDICES];
};
......@@ -474,11 +473,11 @@ struct darshan_apxc_header_record
{
struct darshan_base_record base_rec;
int64_t magic;
int nblades;
int nchassis;
int ngroups;
int memory_mode;
int cluster_mode;
int64_t nblades;
int64_t nchassis;
int64_t ngroups;
int64_t memory_mode;
int64_t cluster_mode;
uint64_t appid;
};
......
......@@ -60,6 +60,7 @@ struct apxc_runtime
int chassis;
int blade;
int node;
int perf_record_marked;
};
static struct apxc_runtime *apxc_runtime = NULL;
......@@ -138,7 +139,6 @@ static void capture(struct darshan_apxc_perf_record *rec,
rec->chassis = apxc_runtime->chassis;
rec->blade = apxc_runtime->blade;
rec->node = apxc_runtime->node;
rec->marked = 0;
rec->base_rec.id = rec_id;
rec->base_rec.rank = my_rank;
......@@ -173,25 +173,18 @@ void apxc_runtime_initialize()
/* register the APXC module with the darshan-core component */
darshan_core_register_module(
APXC_MOD,
DARSHAN_APXC_MOD,
mod_funcs,
&apxc_buf_size,
&my_rank,
NULL);
/* not enough memory to fit apxc module record */
if(apxc_buf_size < sizeof(struct darshan_apxc_header_record) + sizeof(struct darshan_apxc_perf_record))
{
darshan_core_unregister_module(APXC_MOD);
APXC_UNLOCK();
return;
}
/* initialize module's global state */
apxc_runtime = malloc(sizeof(*apxc_runtime));
if(!apxc_runtime)
{
darshan_core_unregister_module(APXC_MOD);
darshan_core_unregister_module(DARSHAN_APXC_MOD);
APXC_UNLOCK();
return;
}
......@@ -206,12 +199,12 @@ void apxc_runtime_initialize()
apxc_runtime->header_id,
//NULL,
"darshan-apxc-header",
APXC_MOD,
DARSHAN_APXC_MOD,
sizeof(struct darshan_apxc_header_record),
NULL);
if(!(apxc_runtime->header_record))
{
darshan_core_unregister_module(APXC_MOD);
darshan_core_unregister_module(DARSHAN_APXC_MOD);
free(apxc_runtime);
apxc_runtime = NULL;
APXC_UNLOCK();
......@@ -236,12 +229,12 @@ void apxc_runtime_initialize()
//NULL,
"APXC", // we want the record for each rank to be treated as shared records so that mpi_redux can operate on
//rtr_rec_name,
APXC_MOD,
DARSHAN_APXC_MOD,
sizeof(struct darshan_apxc_perf_record),
NULL);
if(!(apxc_runtime->perf_record))
{
darshan_core_unregister_module(APXC_MOD);
darshan_core_unregister_module(DARSHAN_APXC_MOD);
free(apxc_runtime);
apxc_runtime = NULL;
APXC_UNLOCK();
......@@ -405,7 +398,7 @@ static void apxc_mpi_redux(
{
apxc_runtime->perf_record->counters[i] /= router_count;
}
apxc_runtime->perf_record->marked = -1;
apxc_runtime->perf_record_marked = -1;
}
PMPI_Comm_free(&router_comm);
......@@ -429,7 +422,7 @@ static void apxc_shutdown(
*apxc_buf_sz += sizeof(*apxc_runtime->header_record);
}
if (apxc_runtime->perf_record->marked == -1)
if (apxc_runtime->perf_record_marked == -1)
{
*apxc_buf_sz += sizeof( *apxc_runtime->perf_record);
}
......
......@@ -9,22 +9,21 @@ structdefs = '''
struct darshan_apxc_perf_record
{
struct darshan_base_record base_rec;
int group;
int chassis;
int blade;
int node;
int marked;
int64_t group;
int64_t chassis;
int64_t blade;
int64_t node;
uint64_t counters[392];
};
struct darshan_apxc_header_record
{
struct darshan_base_record base_rec;
int64_t magic;
int nblades;
int nchassis;
int ngroups;
int memory_mode;
int cluster_mode;
int64_t nblades;
int64_t nchassis;
int64_t ngroups;
int64_t memory_mode;
int64_t cluster_mode;
uint64_t appid;
};
......
......@@ -60,6 +60,14 @@ static int darshan_log_get_apxc_rec(darshan_fd fd, void** buf_p)
if(fd->mod_map[DARSHAN_APXC_MOD].len == 0)
return(0);
if(fd->mod_ver[DARSHAN_APXC_MOD] == 0 ||
fd->mod_ver[DARSHAN_APXC_MOD] > APXC_VER)
{
fprintf(stderr, "Error: Invalid APXC module version number (got %d)\n",
fd->mod_ver[DARSHAN_APXC_MOD]);
return(-1);
}
if (!*buf_p)
{
/* assume this is the largest possible record size */
......@@ -74,15 +82,7 @@ static int darshan_log_get_apxc_rec(darshan_fd fd, void** buf_p)
buffer = *buf_p;
}
if (fd->mod_ver[DARSHAN_APXC_MOD] == 0)
{
printf("Either unknown or debug version: %d\n",
fd->mod_ver[DARSHAN_APXC_MOD]);
return(0);
}
if ((fd->mod_ver[DARSHAN_APXC_MOD] > 0) &&
(fd->mod_ver[DARSHAN_APXC_MOD] < APXC_VER))
if (fd->mod_ver[DARSHAN_APXC_MOD] < APXC_VER)
{
/* perform conversion as needed */
}
......@@ -111,11 +111,12 @@ static int darshan_log_get_apxc_rec(darshan_fd fd, void** buf_p)
/* swap bytes if necessary */
DARSHAN_BSWAP64(&(hdr_rec->base_rec.id));
DARSHAN_BSWAP64(&(hdr_rec->base_rec.rank));
DARSHAN_BSWAP32(&(hdr_rec->nblades));
DARSHAN_BSWAP32(&(hdr_rec->nchassis));
DARSHAN_BSWAP32(&(hdr_rec->ngroups));
DARSHAN_BSWAP32(&(hdr_rec->memory_mode));
DARSHAN_BSWAP32(&(hdr_rec->cluster_mode));
DARSHAN_BSWAP64(&(hdr_rec->magic));
DARSHAN_BSWAP64(&(hdr_rec->nblades));
DARSHAN_BSWAP64(&(hdr_rec->nchassis));
DARSHAN_BSWAP64(&(hdr_rec->ngroups));
DARSHAN_BSWAP64(&(hdr_rec->memory_mode));
DARSHAN_BSWAP64(&(hdr_rec->cluster_mode));
DARSHAN_BSWAP64(&(hdr_rec->appid));
}
else
......@@ -140,12 +141,14 @@ static int darshan_log_get_apxc_rec(darshan_fd fd, void** buf_p)
{
//*buf_p = NULL;
// if (buffer) free(buffer);
if (!*buf_p) free(buffer);
return(-1);
}
else
{
// *buf_p = NULL;
// if (buffer) free(buffer);
if (!*buf_p) free(buffer);
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