Commit 328f68bd authored by Shane Snyder's avatar Shane Snyder

allow modules to statically init

parent 10068d00
......@@ -23,22 +23,24 @@ ifndef DISABLE_LDPRELOAD
all: lib/libdarshan.so lib/darshan-null.po
endif
VPATH = $(srcdir)
CFLAGS = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I ../ -I $(srcdir) -I$(srcdir)/../ @CFLAGS@ @CPPFLAGS@ -D_LARGEFILE64_SOURCE
CFLAGS_SHARED = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I$(srcdir) -I$(srcdir)/../ @CFLAGS@ @CPPFLAGS@ -D_LARGEFILE64_SOURCE -shared -fpic -DPIC -DDARSHAN_PRELOAD
LIBS = -lz @LIBBZ2@
static-mod-objs = lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-hdf5.o lib/darshan-pnetcdf.o
dynamic-mod-objs = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-hdf5.po lib/darshan-pnetcdf.po
ifdef DARSHAN_USE_BGQ
static-mod-objs += lib/darshan-bgq.o
dynamic-mod-objs += lib/darshan-bgq.po
CFLAGS += -DDARSHAN_BGQ
CFLAGS_SHARED += -DDARSHAN_BGQ
endif
VPATH = $(srcdir)
CFLAGS = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I ../ -I $(srcdir) -I$(srcdir)/../ @CFLAGS@ @CPPFLAGS@ -D_LARGEFILE64_SOURCE
CFLAGS_SHARED = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I$(srcdir) -I$(srcdir)/../ @CFLAGS@ @CPPFLAGS@ -D_LARGEFILE64_SOURCE -shared -fpic -DPIC -DDARSHAN_PRELOAD
LIBS = -lz @LIBBZ2@
lib::
@mkdir -p $@
......
......@@ -4248,7 +4248,7 @@ $as_echo "no" >&6; }
MPICH_LIB_OLD=0
fi
# check to see if the bgq instrumentation module should be built
# check to see whether the bgq instrumentation module should be built
# Check whether --enable-bgq_mod was given.
if test "${enable_bgq_mod+set}" = set; then :
enableval=$enable_bgq_mod;
......
......@@ -18,11 +18,9 @@
#include "darshan.h"
#include "darshan-bgq-log-format.h"
#ifdef __bgq__
#include <spi/include/kernel/location.h>
#include <spi/include/kernel/process.h>
#include <firmware/include/personality.h>
#endif
/*
* Simple module which captures BG/Q hardware specific information about
......@@ -70,7 +68,6 @@ static void bgq_record_reduction_op(void* infile_v,void* inoutfile_v,int *len,MP
*/
static void capture(struct darshan_bgq_record *rec)
{
#ifdef __bgq__
Personality_t person;
int r;
......@@ -96,7 +93,6 @@ static void capture(struct darshan_bgq_record *rec)
rec->counters[BGQ_DDRPERNODE] = person.DDR_Config.DDRSizeMB;
}
#endif
rec->rank = my_rank;
rec->fcounters[BGQ_F_TIMESTAMP] = darshan_core_wtime();
......
......@@ -55,6 +55,21 @@ char* darshan_path_exclusions[] = {
NULL
};
#ifdef DARSHAN_BGQ
extern void bgq_runtime_initialize();
#endif
/* array of init functions for modules which need to be statically
* initialized by darshan at startup time
*/
void (*mod_static_init_fns[])(void) =
{
#ifdef DARSHAN_BGQ
&bgq_runtime_initialize,
#endif
NULL
};
#define DARSHAN_CORE_LOCK() pthread_mutex_lock(&darshan_core_mutex)
#define DARSHAN_CORE_UNLOCK() pthread_mutex_unlock(&darshan_core_mutex)
......@@ -196,6 +211,14 @@ void darshan_core_initialize(int argc, char **argv)
}
}
/* maybe bootstrap modules with static initializers */
i = 0;
while(mod_static_init_fns[i])
{
(*mod_static_init_fns[i])();
i++;
}
if(internal_timing_flag)
{
init_time = DARSHAN_MPI_CALL(PMPI_Wtime)() - init_start;
......@@ -208,11 +231,6 @@ void darshan_core_initialize(int argc, char **argv)
}
}
#ifdef __bgq__
extern void bgq_runtime_initialize();
bgq_runtime_initialize();
#endif
return;
}
......
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