Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Cristian Simarro
darshan
Commits
75eee950
Commit
75eee950
authored
Mar 05, 2015
by
Shane Snyder
Browse files
initial shared lib support + more TODOs
parent
1c3f3690
Changes
5
Hide whitespace changes
Inline
Side-by-side
darshan-runtime/Makefile.in
View file @
75eee950
...
...
@@ -28,50 +28,60 @@ CFLAGS = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I ../ -I $(srcdir
#
CFLAGS_SHARED
=
-DDARSHAN_CONFIG_H
=
\"
darshan-runtime-config.h
\"
-I
.
-I
$(srcdir)
-I
$(srcdir)
/../ @CFLAGS@ @CPPFLAGS@
-D_LARGEFILE64_SOURCE
-shared
-fpic
-DPIC
-DDARSHAN_PRELOAD
# TODO: BZ2?
LIBS
=
-lz
@LIBBZ2@
lib
::
@
mkdir
-p
$@
# TODO make sure the headers are right in these prereqs
lib/darshan-core.o
:
lib/darshan-core.c darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
$(CC)
$(CFLAGS)
-c
$<
-o
$@
lib/darshan-core.po
:
lib/darshan-core.c darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
$(CC)
$(CFLAGS_SHARED)
-c
$<
-o
$@
lib/darshan-common.o
:
lib/darshan-common.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
$(CC)
$(CFLAGS)
-c
$<
-o
$@
lib/darshan-common.po
:
lib/darshan-common.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
$(CC)
$(CFLAGS_SHARED)
-c
$<
-o
$@
lib/darshan-posix.o
:
lib/darshan-posix.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
$(CC)
$(CFLAGS)
-c
$<
-o
$@
#
lib/darshan-posix.po: lib/darshan-posix.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
#
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/darshan-posix.po
:
lib/darshan-posix.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
$(CC)
$(CFLAGS_SHARED)
-c
$<
-o
$@
lib/lookup3.o
:
lib/lookup3.c
$(CC)
$(CFLAGS)
-c
$<
-o
$@
#
lib/lookup3.po: lib/lookup3.c
#
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/lookup3.po
:
lib/lookup3.c
$(CC)
$(CFLAGS_SHARED)
-c
$<
-o
$@
lib/lookup8.o
:
lib/lookup8.c
$(CC)
$(CFLAGS)
-c
$<
-o
$@
#
lib/lookup8.po: lib/lookup8.c
#
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/lookup8.po
:
lib/lookup8.c
$(CC)
$(CFLAGS_SHARED)
-c
$<
-o
$@
# TODO: huh?
#%.i: %.c
# $(CC) -E $(CFLAGS) -c $< -o $@
lib/libdarshan.a
:
lib/darshan-posix.o lib/darshan-core.o lib/darshan-common.o lib/lookup3.o lib/lookup8.o
ar rcs
$@
$^
#
lib/libdarshan.so: lib/darshan-
mpi-io.po lib/darshan-mpi-init-finalize.po lib/darshan-pnetcdf.po lib/darshan-hdf5
.po lib/darshan-posix.po lib/lookup3.po lib/lookup8.po
#
$(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $@ $^ -lpthread -lrt -lz -ldl
lib/libdarshan.so
:
lib/darshan-
core.po lib/darshan-common
.po lib/darshan-posix.po lib/lookup3.po lib/lookup8.po
$(CC)
$(CFLAGS_SHARED)
$(LDFLAGS)
-o
$@
$^
-lpthread
-lrt
-lz
-ldl
install
::
all
install
-d
$(libdir)
install
-m
755 lib/libdarshan.a
$(libdir)
#
ifndef DISABLE_LDPRELOAD
#
install -m 755 lib/libdarshan.so $(libdir)
#
endif
ifndef
DISABLE_LDPRELOAD
install
-m
755 lib/libdarshan.so
$(libdir)
endif
install
-d
$(bindir)
# install -m 755 darshan-mk-log-dirs.pl $(bindir)
install
-m
755
darshan-gen-cc.pl
$(bindir)
...
...
darshan-runtime/darshan.h
View file @
75eee950
...
...
@@ -25,9 +25,6 @@
/* Environment variable to override __CP_MEM_ALIGNMENT */
#define CP_MEM_ALIGNMENT_OVERRIDE "DARSHAN_MEMALIGN"
/* TODO where does this go? */
#define DARSHAN_MPI_CALL(func) func
struct
darshan_module_funcs
{
/* disable futher instrumentation within a module */
...
...
darshan-runtime/lib/darshan-core.c
View file @
75eee950
...
...
@@ -30,6 +30,8 @@
/* TODO is __progname_full needed here */
extern
char
*
__progname
;
#define DARSHAN_MPI_CALL(func) func
/* internal variable delcarations */
static
struct
darshan_core_runtime
*
darshan_core
=
NULL
;
static
pthread_mutex_t
darshan_core_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
...
...
@@ -255,7 +257,7 @@ static void darshan_core_shutdown()
final_core
=
darshan_core
;
darshan_core
=
NULL
;
/* we also need to set which modules were registerd on this process and
/* we also need to set which modules were register
e
d on this process and
* disable tracing within those modules while we shutdown
*/
for
(
i
=
0
;
i
<
DARSHAN_MAX_MODS
;
i
++
)
...
...
darshan-runtime/lib/darshan-posix.c
View file @
75eee950
...
...
@@ -3,10 +3,7 @@
* See COPYRIGHT in top-level directory.
*/
#define _GNU_SOURCE
#include
"darshan-runtime-config.h"
#include
<stdio.h>
#include
<unistd.h>
#include
<sys/types.h>
...
...
@@ -23,6 +20,7 @@
#include
<assert.h>
#include
<libgen.h>
#include
<aio.h>
#define __USE_GNU
#include
<pthread.h>
#include
"uthash.h"
...
...
@@ -36,15 +34,45 @@ typedef int64_t off64_t;
#define aiocb64 aiocb
#endif
/* TODO these go where ? */
#ifdef DARSHAN_PRELOAD
#define __USE_GNU
#include
<dlfcn.h>
#include
<stdlib.h>
#define DARSHAN_FORWARD_DECL(name,ret,args) \
ret (*__real_ ## name)args = NULL;
#define DARSHAN_DECL(__name) __name
#define DARSHAN_MPI_CALL(func) __real_ ## func
#define MAP_OR_FAIL(func) \
if (!(__real_ ## func)) \
{ \
__real_ ## func = dlsym(RTLD_NEXT, #func); \
if(!(__real_ ## func)) { \
fprintf(stderr, "Darshan failed to map symbol: %s\n", #func); \
exit(1); \
} \
}
#else
#define DARSHAN_FORWARD_DECL(name,ret,args) \
extern ret __real_ ## name args;
#define DARSHAN_DECL(__name) __wrap_ ## __name
#define DARSHAN_MPI_CALL(func) func
#define MAP_OR_FAIL(func)
#endif
DARSHAN_FORWARD_DECL
(
open
,
int
,
(
const
char
*
path
,
int
flags
,
...));
DARSHAN_FORWARD_DECL
(
open64
,
int
,
(
const
char
*
path
,
int
flags
,
...));
DARSHAN_FORWARD_DECL
(
close
,
int
,
(
int
fd
));
struct
posix_runtime_file
{
struct
darshan_posix_file
*
file_record
;
...
...
@@ -90,12 +118,7 @@ static char* exclusions[] = {
NULL
};
DARSHAN_FORWARD_DECL
(
open
,
int
,
(
const
char
*
path
,
int
flags
,
...));
DARSHAN_FORWARD_DECL
(
open64
,
int
,
(
const
char
*
path
,
int
flags
,
...));
DARSHAN_FORWARD_DECL
(
close
,
int
,
(
int
fd
));
static
void
posix_runtime_initialize
(
void
);
static
struct
posix_runtime_file
*
posix_file_by_name
(
const
char
*
name
);
static
struct
posix_runtime_file
*
posix_file_by_name_setfd
(
const
char
*
name
,
int
fd
);
static
struct
posix_runtime_file
*
posix_file_by_fd
(
int
fd
);
...
...
@@ -216,7 +239,7 @@ int DARSHAN_DECL(open64)(const char *path, int flags, ...)
int
ret
;
double
tm1
,
tm2
;
MAP_OR_FAIL
(
open
);
MAP_OR_FAIL
(
open
64
);
if
(
flags
&
O_CREAT
)
{
...
...
darshan-util/darshan-logutils.c
View file @
75eee950
...
...
@@ -362,6 +362,7 @@ int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash)
}
free
(
comp_buf
);
/* TODO: check for duplicate entries? */
buf_ptr
=
hash_buf
;
while
(
buf_ptr
<
(
hash_buf
+
hash_buf_sz
))
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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