Commit 2bf558e1 authored by Shane Snyder's avatar Shane Snyder
Browse files

module name changes and small cleanup

parent 3b14dfcd
......@@ -13,11 +13,8 @@ CFLAGS_SHARED += \
-DDARSHAN_USE_APMPI \
-I$(srcdir)/../modules/autoperf/apmpi
lib/darshan-apmpi.o: lib/darshan-apmpi.c lib/darshan-apmpi-utils.h darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) darshan-apmpi-log-format.h | lib
lib/darshan-apmpi.o: lib/darshan-apmpi.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) darshan-apmpi-log-format.h | lib
$(CC) $(CFLAGS) -c $< -o $@
lib/darshan-apmpi.po: lib/darshan-apmpi.c lib/darshan-apmpi-utils.h darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) darshan-apmpi-log-format.h | lib
lib/darshan-apmpi.po: lib/darshan-apmpi.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) darshan-apmpi-log-format.h | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
print-apmpi-size: print-apmpi-size.c $(DARSHAN_LOG_FORMAT) $(srcdir)/../modules/autoperf/apmpi/darshan-apmpi-log-format.h
$(CC) $(CFLAGS) -g -O0 -o $@ $<
#ifndef __APMPI_UTILS_H__
#define __APMPI_UTILS_H__
#include <regex.h>
static void search_hwinfo(const char * mstr, char *mode)
{
FILE *f;
int r;
char *fdata;
long len;
regex_t preg;
regmatch_t mreg[1];
r = regcomp(&preg, mstr, 0);
f = fopen ("/.hwinfo.cray", "rb");
fseek(f, 0, SEEK_END);
len = ftell(f);
fdata = malloc(len);
fseek(f, 0, SEEK_SET);
fread(fdata, sizeof(char), len, f);
fclose(f);
r = regexec(&preg, fdata, 1, mreg, 0);
if ((r == 0) && (mreg[0].rm_so > -1))
{
sscanf(fdata+mreg[0].rm_so+strlen(mstr)-2, "%s", mode);
}
regfree(&preg);
free(fdata);
return;
}
static unsigned int count_bits(unsigned int *bitvec, int cnt)
{
unsigned int count = 0;
int i;
for (i = 0; i < cnt; i++)
{
count += __builtin_popcount(bitvec[i]);
}
return count;
}
#endif
......@@ -13,15 +13,12 @@
#include <stdlib.h>
#include <pthread.h>
#include <assert.h>
#include <papi.h>
#include "uthash.h"
#include "darshan.h"
#include "darshan-dynamic.h"
#include "darshan-apmpi-log-format.h"
#include "darshan-apmpi-utils.h"
typedef long long ap_bytes_t;
#define MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x==0.0)?y:((x<y)?x:y))
......@@ -298,7 +295,6 @@ static void apmpi_shutdown(
static void initialize_counters (void)
{
int i;
int code = 0;
for (i = 0; i < APMPI_NUM_INDICES; i++)
{
apmpi_runtime->perf_record->counters[i] = 0;
......@@ -364,25 +360,17 @@ void apmpi_runtime_initialize()
/* register the apmpi module with the darshan-core component */
darshan_core_register_module(
APMPI_MOD,
DARSHAN_APMPI_MOD,
mod_funcs,
&apmpi_buf_size,
&my_rank,
NULL);
/* not enough memory to fit apmpi module record */
if(apmpi_buf_size < sizeof(struct darshan_apmpi_header_record) + sizeof(struct darshan_apmpi_perf_record))
{
darshan_core_unregister_module(APMPI_MOD);
APMPI_UNLOCK();
return;
}
/* initialize module's global state */
apmpi_runtime = malloc(sizeof(*apmpi_runtime));
if(!apmpi_runtime)
{
darshan_core_unregister_module(APMPI_MOD);
darshan_core_unregister_module(DARSHAN_APMPI_MOD);
APMPI_UNLOCK();
return;
}
......@@ -397,12 +385,12 @@ void apmpi_runtime_initialize()
apmpi_runtime->header_id,
//NULL,
"darshan-apmpi-header",
APMPI_MOD,
DARSHAN_APMPI_MOD,
sizeof(struct darshan_apmpi_header_record),
NULL);
if(!(apmpi_runtime->header_record))
{
darshan_core_unregister_module(APMPI_MOD);
darshan_core_unregister_module(DARSHAN_APMPI_MOD);
free(apmpi_runtime);
apmpi_runtime = NULL;
APMPI_UNLOCK();
......@@ -424,12 +412,12 @@ void apmpi_runtime_initialize()
apmpi_runtime->perf_record = darshan_core_register_record(
apmpi_runtime->rec_id,
"APMPI",
APMPI_MOD,
DARSHAN_APMPI_MOD,
sizeof(struct darshan_apmpi_perf_record),
NULL);
if(!(apmpi_runtime->perf_record))
{
darshan_core_unregister_module(APMPI_MOD);
darshan_core_unregister_module(DARSHAN_APMPI_MOD);
free(apmpi_runtime);
apmpi_runtime = NULL;
APMPI_UNLOCK();
......
This diff is collapsed.
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