Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jakob Luettgau
darshan
Commits
5c5918aa
Commit
5c5918aa
authored
Apr 02, 2015
by
Shane Snyder
Browse files
add LD_PRELOAD functionality
parent
90c39ea6
Changes
10
Hide whitespace changes
Inline
Side-by-side
darshan-runtime/Makefile.in
View file @
5c5918aa
...
...
@@ -33,10 +33,16 @@ LIBS = -lz @LIBBZ2@
lib
::
@
mkdir
-p
$@
lib/darshan-core.o
:
lib/darshan-core
.c
darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
lib/darshan-core
-init-finalize
.o
:
lib/darshan-core
-init-finalize.c darshan.h
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
lib/darshan-core-init-finalize.po
:
lib/darshan-core-init-finalize.c darshan.h darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
$(CC)
$(CFLAGS_SHARED)
-c
$<
-o
$@
lib/darshan-core.o
:
lib/darshan-core.c darshan.h darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
$(CC)
$(CFLAGS)
-c
$<
-o
$@
lib/darshan-core.po
:
lib/darshan-core.c darshan.h 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
...
...
@@ -72,10 +78,10 @@ lib/lookup8.po: lib/lookup8.c
#%.i: %.c
# $(CC) -E $(CFLAGS) -c $< -o $@
lib/libdarshan.a
:
lib/darshan-
posix
.o lib/darshan-
mpiio
.o lib/darshan-co
re
.o lib/darshan-
common
.o lib/lookup3.o lib/lookup8.o
lib/libdarshan.a
:
lib/darshan-
core-init-finalize
.o lib/darshan-
core
.o lib/darshan-co
mmon
.o lib/darshan-
posix.o lib/darshan-mpiio
.o lib/lookup3.o lib/lookup8.o
ar rcs
$@
$^
lib/libdarshan.so
:
lib/darshan-core.po lib/darshan-common.po lib/darshan-posix.po lib/darshan-mpiio.po lib/lookup3.po lib/lookup8.po
lib/libdarshan.so
:
lib/darshan-core-init-finalize.po
lib/darshan-core.po lib/darshan-common.po lib/darshan-posix.po lib/darshan-mpiio.po lib/lookup3.po lib/lookup8.po
$(CC)
$(CFLAGS_SHARED)
$(LDFLAGS)
-o
$@
$^
-lpthread
-lrt
-lz
-ldl
install
::
all
...
...
darshan-runtime/configure
View file @
5c5918aa
...
...
@@ -687,7 +687,6 @@ with_zlib
enable_cuserid
enable_ld_preload
enable_group_readable_logs
enable_stat_at_open
with_mem_align
with_log_path_by_env
with_log_hints
...
...
@@ -1315,7 +1314,6 @@ Optional Features:
--disable-cuserid Disables attempted use of cuserid() at run time
--disable-ld-preload Disables support for LD_PRELOAD library
--enable-group-readable-logs Set log files to be group readable
--enable-stat-at-open Perform stat() call at open time to gather extra statistics
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
...
...
@@ -3567,17 +3565,6 @@ fi
fi
# Check whether --enable-stat-at-open was given.
if
test
"
${
enable_stat_at_open
+set
}
"
=
set
;
then
:
enableval
=
$enable_stat_at_open
;
if
test
"x
$enableval
"
=
"xyes"
;
then
$as_echo
"#define __CP_STAT_AT_OPEN 1"
>>
confdefs.h
fi
fi
# Check whether --with-mem-align was given.
if
test
"
${
with_mem_align
+set
}
"
=
set
;
then
:
...
...
darshan-runtime/darshan-core.h
View file @
5c5918aa
...
...
@@ -11,7 +11,8 @@
#include <sys/types.h>
#include <stdint.h>
#include "darshan.h"
#include "uthash.h"
#include "darshan-log-format.h"
#define DARSHAN_CORE_MAX_RECORDS 1024
...
...
@@ -50,6 +51,9 @@ struct darshan_core_record_ref
UT_hash_handle
hlink
;
};
void
darshan_core_initialize
(
int
argc
,
char
**
argv
);
void
darshan_core_shutdown
(
void
);
uint32_t
darshan_hashlittle
(
const
void
*
key
,
size_t
length
,
uint32_t
initval
);
uint64_t
darshan_hash
(
const
register
unsigned
char
*
k
,
register
uint64_t
length
,
register
uint64_t
level
);
...
...
darshan-runtime/darshan-dynamic.h
View file @
5c5918aa
...
...
@@ -9,16 +9,10 @@
#ifdef DARSHAN_PRELOAD
#include <dlfcn.h>
#include <stdlib.h>
#define DARSHAN_MPI_CALL(func) __real_ ## func
#define DARSHAN_EXTERN_DECL(name,ret,args) \
extern ret (*__real_ ## name)args;
DARSHAN_EXTERN_DECL
(
PMPI_File_close
,
int
,
(
MPI_File
*
fh
));
DARSHAN_EXTERN_DECL
(
PMPI_File_set_size
,
int
,
(
MPI_File
fh
,
MPI_Offset
size
));
DARSHAN_EXTERN_DECL
(
PMPI_File_iread_at
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
__D_MPI_REQUEST
*
request
));
DARSHAN_EXTERN_DECL
(
PMPI_File_iread
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
__D_MPI_REQUEST
*
request
));
DARSHAN_EXTERN_DECL
(
PMPI_File_iread_shared
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
__D_MPI_REQUEST
*
request
));
...
...
@@ -105,7 +99,6 @@ DARSHAN_EXTERN_DECL(PMPI_File_write_shared, int, (MPI_File fh, void *buf, int co
DARSHAN_EXTERN_DECL
(
PMPI_Finalize
,
int
,
());
DARSHAN_EXTERN_DECL
(
PMPI_Init
,
int
,
(
int
*
argc
,
char
***
argv
));
DARSHAN_EXTERN_DECL
(
PMPI_Init_thread
,
int
,
(
int
*
argc
,
char
***
argv
,
int
required
,
int
*
provided
));
DARSHAN_EXTERN_DECL
(
PMPI_Wtime
,
double
,
());
DARSHAN_EXTERN_DECL
(
PMPI_Allreduce
,
int
,
(
void
*
sendbuf
,
void
*
recvbuf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Op
op
,
MPI_Comm
comm
));
DARSHAN_EXTERN_DECL
(
PMPI_Bcast
,
int
,
(
void
*
buffer
,
int
count
,
MPI_Datatype
datatype
,
int
root
,
MPI_Comm
comm
));
...
...
@@ -117,16 +110,14 @@ DARSHAN_EXTERN_DECL(PMPI_Type_contiguous, int, (int count, MPI_Datatype oldtype,
DARSHAN_EXTERN_DECL
(
PMPI_Type_extent
,
int
,
(
MPI_Datatype
datatype
,
MPI_Aint
*
extent
));
DARSHAN_EXTERN_DECL
(
PMPI_Type_free
,
int
,
(
MPI_Datatype
*
datatype
));
DARSHAN_EXTERN_DECL
(
PMPI_Type_hindexed
,
int
,
(
int
count
,
int
*
array_of_blocklengths
,
MPI_Aint
*
array_of_displacements
,
MPI_Datatype
oldtype
,
MPI_Datatype
*
newtype
));
DARSHAN_EXTERN_DECL
(
PMPI_Type_get_envelope
,
int
,
(
MPI_Datatype
datatype
,
int
*
num_integers
,
int
*
num_addresses
,
int
*
num_datatypes
,
int
*
combiner
));
DARSHAN_EXTERN_DECL
(
PMPI_Type_size
,
int
,
(
MPI_Datatype
datatype
,
int
*
size
));
DARSHAN_EXTERN_DECL
(
PMPI_Op_create
,
int
,
(
MPI_User_function
*
function
,
int
commute
,
MPI_Op
*
op
));
DARSHAN_EXTERN_DECL
(
PMPI_Op_free
,
int
,
(
MPI_Op
*
op
));
DARSHAN_EXTERN_DECL
(
PMPI_Reduce
,
int
,
(
void
*
sendbuf
,
void
*
recvbuf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Op
op
,
int
root
,
MPI_Comm
comm
));
DARSHAN_EXTERN_DECL
(
PMPI_Type_get_envelope
,
int
,
(
MPI_Datatype
datatype
,
int
*
num_integers
,
int
*
num_addresses
,
int
*
num_datatypes
,
int
*
combiner
));
DARSHAN_EXTERN_DECL
(
PMPI_Type_size
,
int
,
(
MPI_Datatype
datatype
,
int
*
size
));
#else
#define DARSHAN_MPI_CALL(func) func
DARSHAN_EXTERN_DECL
(
PMPI_Send
,
int
,
(
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
int
dest
,
int
tag
,
MPI_Comm
comm
));
DARSHAN_EXTERN_DECL
(
PMPI_Recv
,
int
,
(
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
int
source
,
int
tag
,
MPI_Comm
comm
,
MPI_Status
*
status
));
#endif
#endif
#endif
/* __DARSHAN_DYNAMIC_H */
darshan-runtime/darshan-runtime-config.h.in
View file @
5c5918aa
...
...
@@ -105,9 +105,5 @@
/* Memory alignment in bytes */
#undef __CP_MEM_ALIGNMENT
/* Define if Darshan should stat files at open time to collect extra
statistics */
#undef __CP_STAT_AT_OPEN
/* Generalized request type for MPI-IO */
#undef __D_MPI_REQUEST
darshan-runtime/darshan.h
View file @
5c5918aa
...
...
@@ -30,12 +30,12 @@
* consistently regardless of whether static or dynamic linking is used
*/
#ifdef DARSHAN_PRELOAD
#define __USE_GNU
#include <dlfcn.h>
#include <stdlib.h>
#define DARSHAN_FORWARD_DECL(name,ret,args) \
ret (*__real_ ## name)args = NULL
;
ret (*__real_ ## name)args = NULL
#define DARSHAN_DECL(__name) __name
...
...
darshan-runtime/lib/darshan-core-init-finalize.c
0 → 100644
View file @
5c5918aa
/*
* Copyright (C) 2015 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 <stdlib.h>
#include <mpi.h>
#include "darshan.h"
#include "darshan-core.h"
#ifdef DARSHAN_PRELOAD
DARSHAN_FORWARD_DECL
(
PMPI_File_close
,
int
,
(
MPI_File
*
fh
));
DARSHAN_FORWARD_DECL
(
PMPI_File_iread_at
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
__D_MPI_REQUEST
*
request
));
DARSHAN_FORWARD_DECL
(
PMPI_File_iread
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
__D_MPI_REQUEST
*
request
));
DARSHAN_FORWARD_DECL
(
PMPI_File_iread_shared
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
__D_MPI_REQUEST
*
request
));
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_iwrite_at
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
__D_MPI_REQUEST
*
request
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_iwrite_at
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
__D_MPI_REQUEST
*
request
));
#endif
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_iwrite
,
int
,
(
MPI_File
fh
,
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
__D_MPI_REQUEST
*
request
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_iwrite
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
__D_MPI_REQUEST
*
request
));
#endif
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_iwrite_shared
,
int
,
(
MPI_File
fh
,
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
__D_MPI_REQUEST
*
request
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_iwrite_shared
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
__D_MPI_REQUEST
*
request
));
#endif
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_open
,
int
,
(
MPI_Comm
comm
,
const
char
*
filename
,
int
amode
,
MPI_Info
info
,
MPI_File
*
fh
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_open
,
int
,
(
MPI_Comm
comm
,
char
*
filename
,
int
amode
,
MPI_Info
info
,
MPI_File
*
fh
));
#endif
DARSHAN_FORWARD_DECL
(
PMPI_File_read_all_begin
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
));
DARSHAN_FORWARD_DECL
(
PMPI_File_read_all
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
DARSHAN_FORWARD_DECL
(
PMPI_File_read_at_all
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
DARSHAN_FORWARD_DECL
(
PMPI_File_read_at_all_begin
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
));
DARSHAN_FORWARD_DECL
(
PMPI_File_read_at
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
DARSHAN_FORWARD_DECL
(
PMPI_File_read
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
DARSHAN_FORWARD_DECL
(
PMPI_File_read_ordered_begin
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
));
DARSHAN_FORWARD_DECL
(
PMPI_File_read_ordered
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
DARSHAN_FORWARD_DECL
(
PMPI_File_read_shared
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_set_view
,
int
,
(
MPI_File
fh
,
MPI_Offset
disp
,
MPI_Datatype
etype
,
MPI_Datatype
filetype
,
const
char
*
datarep
,
MPI_Info
info
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_set_view
,
int
,
(
MPI_File
fh
,
MPI_Offset
disp
,
MPI_Datatype
etype
,
MPI_Datatype
filetype
,
char
*
datarep
,
MPI_Info
info
));
#endif
DARSHAN_FORWARD_DECL
(
PMPI_File_sync
,
int
,
(
MPI_File
fh
));
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_write_all_begin
,
int
,
(
MPI_File
fh
,
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_write_all_begin
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
));
#endif
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_write_all
,
int
,
(
MPI_File
fh
,
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_write_all
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#endif
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_write_at_all_begin
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_write_at_all_begin
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
));
#endif
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_write_at_all
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_write_at_all
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#endif
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_write_at
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_write_at
,
int
,
(
MPI_File
fh
,
MPI_Offset
offset
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#endif
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_write
,
int
,
(
MPI_File
fh
,
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_write
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#endif
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_write_ordered_begin
,
int
,
(
MPI_File
fh
,
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_write_ordered_begin
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
));
#endif
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_write_ordered
,
int
,
(
MPI_File
fh
,
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_write_ordered
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#endif
#ifdef HAVE_MPIIO_CONST
DARSHAN_FORWARD_DECL
(
PMPI_File_write_shared
,
int
,
(
MPI_File
fh
,
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#else
DARSHAN_FORWARD_DECL
(
PMPI_File_write_shared
,
int
,
(
MPI_File
fh
,
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Status
*
status
));
#endif
DARSHAN_FORWARD_DECL
(
PMPI_Finalize
,
int
,
());
DARSHAN_FORWARD_DECL
(
PMPI_Init
,
int
,
(
int
*
argc
,
char
***
argv
));
DARSHAN_FORWARD_DECL
(
PMPI_Init_thread
,
int
,
(
int
*
argc
,
char
***
argv
,
int
required
,
int
*
provided
));
DARSHAN_FORWARD_DECL
(
PMPI_Wtime
,
double
,
());
DARSHAN_FORWARD_DECL
(
PMPI_Allreduce
,
int
,
(
void
*
sendbuf
,
void
*
recvbuf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Op
op
,
MPI_Comm
comm
));
DARSHAN_FORWARD_DECL
(
PMPI_Bcast
,
int
,
(
void
*
buffer
,
int
count
,
MPI_Datatype
datatype
,
int
root
,
MPI_Comm
comm
));
DARSHAN_FORWARD_DECL
(
PMPI_Comm_rank
,
int
,
(
MPI_Comm
comm
,
int
*
rank
));
DARSHAN_FORWARD_DECL
(
PMPI_Comm_size
,
int
,
(
MPI_Comm
comm
,
int
*
size
));
DARSHAN_FORWARD_DECL
(
PMPI_Scan
,
int
,
(
void
*
sendbuf
,
void
*
recvbuf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Op
op
,
MPI_Comm
comm
));
DARSHAN_FORWARD_DECL
(
PMPI_Type_commit
,
int
,
(
MPI_Datatype
*
datatype
));
DARSHAN_FORWARD_DECL
(
PMPI_Type_contiguous
,
int
,
(
int
count
,
MPI_Datatype
oldtype
,
MPI_Datatype
*
newtype
));
DARSHAN_FORWARD_DECL
(
PMPI_Type_extent
,
int
,
(
MPI_Datatype
datatype
,
MPI_Aint
*
extent
));
DARSHAN_FORWARD_DECL
(
PMPI_Type_free
,
int
,
(
MPI_Datatype
*
datatype
));
DARSHAN_FORWARD_DECL
(
PMPI_Type_hindexed
,
int
,
(
int
count
,
int
*
array_of_blocklengths
,
MPI_Aint
*
array_of_displacements
,
MPI_Datatype
oldtype
,
MPI_Datatype
*
newtype
));
DARSHAN_FORWARD_DECL
(
PMPI_Type_get_envelope
,
int
,
(
MPI_Datatype
datatype
,
int
*
num_integers
,
int
*
num_addresses
,
int
*
num_datatypes
,
int
*
combiner
));
DARSHAN_FORWARD_DECL
(
PMPI_Type_size
,
int
,
(
MPI_Datatype
datatype
,
int
*
size
));
DARSHAN_FORWARD_DECL
(
PMPI_Op_create
,
int
,
(
MPI_User_function
*
function
,
int
commute
,
MPI_Op
*
op
));
DARSHAN_FORWARD_DECL
(
PMPI_Op_free
,
int
,
(
MPI_Op
*
op
));
DARSHAN_FORWARD_DECL
(
PMPI_Reduce
,
int
,
(
void
*
sendbuf
,
void
*
recvbuf
,
int
count
,
MPI_Datatype
datatype
,
MPI_Op
op
,
int
root
,
MPI_Comm
comm
));
DARSHAN_FORWARD_DECL
(
PMPI_Send
,
int
,
(
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
int
dest
,
int
tag
,
MPI_Comm
comm
));
DARSHAN_FORWARD_DECL
(
PMPI_Recv
,
int
,
(
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
int
source
,
int
tag
,
MPI_Comm
comm
,
MPI_Status
*
status
));
void
resolve_mpi_symbols
(
void
)
{
/*
* Overloaded functions
*/
MAP_OR_FAIL
(
PMPI_File_close
);
MAP_OR_FAIL
(
PMPI_File_iread_at
);
MAP_OR_FAIL
(
PMPI_File_iread
);
MAP_OR_FAIL
(
PMPI_File_iread_shared
);
MAP_OR_FAIL
(
PMPI_File_iwrite_at
);
MAP_OR_FAIL
(
PMPI_File_iwrite
);
MAP_OR_FAIL
(
PMPI_File_iwrite_shared
);
MAP_OR_FAIL
(
PMPI_File_open
);
MAP_OR_FAIL
(
PMPI_File_read_all_begin
);
MAP_OR_FAIL
(
PMPI_File_read_all
);
MAP_OR_FAIL
(
PMPI_File_read_at_all_begin
);
MAP_OR_FAIL
(
PMPI_File_read_at_all
);
MAP_OR_FAIL
(
PMPI_File_read_at
);
MAP_OR_FAIL
(
PMPI_File_read
);
MAP_OR_FAIL
(
PMPI_File_read_ordered_begin
);
MAP_OR_FAIL
(
PMPI_File_read_ordered
);
MAP_OR_FAIL
(
PMPI_File_read_shared
);
MAP_OR_FAIL
(
PMPI_File_set_view
);
MAP_OR_FAIL
(
PMPI_File_sync
);
MAP_OR_FAIL
(
PMPI_File_write_all_begin
);
MAP_OR_FAIL
(
PMPI_File_write_all
);
MAP_OR_FAIL
(
PMPI_File_write_at_all_begin
);
MAP_OR_FAIL
(
PMPI_File_write_at_all
);
MAP_OR_FAIL
(
PMPI_File_write_at
);
MAP_OR_FAIL
(
PMPI_File_write
);
MAP_OR_FAIL
(
PMPI_File_write_ordered_begin
);
MAP_OR_FAIL
(
PMPI_File_write_ordered
);
MAP_OR_FAIL
(
PMPI_File_write_shared
);
MAP_OR_FAIL
(
PMPI_Finalize
);
MAP_OR_FAIL
(
PMPI_Init
);
MAP_OR_FAIL
(
PMPI_Init_thread
);
/*
* These function are not intercepted but are used
* by darshan itself.
*/
MAP_OR_FAIL
(
PMPI_Wtime
);
MAP_OR_FAIL
(
PMPI_Allreduce
);
MAP_OR_FAIL
(
PMPI_Bcast
);
MAP_OR_FAIL
(
PMPI_Comm_rank
);
MAP_OR_FAIL
(
PMPI_Comm_size
);
MAP_OR_FAIL
(
PMPI_Scan
);
MAP_OR_FAIL
(
PMPI_Type_commit
);
MAP_OR_FAIL
(
PMPI_Type_contiguous
);
MAP_OR_FAIL
(
PMPI_Type_extent
);
MAP_OR_FAIL
(
PMPI_Type_free
);
MAP_OR_FAIL
(
PMPI_Type_hindexed
);
MAP_OR_FAIL
(
PMPI_Type_get_envelope
);
MAP_OR_FAIL
(
PMPI_Type_size
);
MAP_OR_FAIL
(
PMPI_Op_create
);
MAP_OR_FAIL
(
PMPI_Op_free
);
MAP_OR_FAIL
(
PMPI_Reduce
);
MAP_OR_FAIL
(
PMPI_Send
);
MAP_OR_FAIL
(
PMPI_Recv
);
return
;
}
#endif
int
MPI_Init
(
int
*
argc
,
char
***
argv
)
{
int
ret
;
#ifdef DARSHAN_PRELOAD
resolve_mpi_symbols
();
#endif
ret
=
DARSHAN_MPI_CALL
(
PMPI_Init
)(
argc
,
argv
);
if
(
ret
!=
MPI_SUCCESS
)
{
return
(
ret
);
}
if
(
argc
&&
argv
)
{
darshan_core_initialize
(
*
argc
,
*
argv
);
}
else
{
/* we don't see argc and argv here in fortran */
darshan_core_initialize
(
0
,
NULL
);
}
return
(
ret
);
}
int
MPI_Init_thread
(
int
*
argc
,
char
***
argv
,
int
required
,
int
*
provided
)
{
int
ret
;
#ifdef DARSHAN_PRELOAD
resolve_mpi_symbols
();
#endif
ret
=
DARSHAN_MPI_CALL
(
PMPI_Init_thread
)(
argc
,
argv
,
required
,
provided
);
if
(
ret
!=
MPI_SUCCESS
)
{
return
(
ret
);
}
if
(
argc
&&
argv
)
{
darshan_core_initialize
(
*
argc
,
*
argv
);
}
else
{
/* we don't see argc and argv here in fortran */
darshan_core_initialize
(
0
,
NULL
);
}
return
(
ret
);
}
int
MPI_Finalize
(
void
)
{
int
ret
;
darshan_core_shutdown
();
ret
=
DARSHAN_MPI_CALL
(
PMPI_Finalize
)();
return
(
ret
);
}
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ts=8 sts=4 sw=4 expandtab
*/
darshan-runtime/lib/darshan-core.c
View file @
5c5918aa
...
...
@@ -26,7 +26,9 @@
#include <assert.h>
#include "uthash.h"
#include "darshan.h"
#include "darshan-core.h"
#include "darshan-dynamic.h"
extern
char
*
__progname
;
extern
char
*
__progname_full
;
...
...
@@ -70,12 +72,6 @@ static struct mnt_data mnt_data_array[DARSHAN_MAX_MNTS];
static
int
mnt_data_count
=
0
;
/* prototypes for internal helper functions */
static
void
darshan_core_initialize
(
int
argc
,
char
**
argv
);
static
void
darshan_core_shutdown
(
void
);
static
void
darshan_core_cleanup
(
struct
darshan_core_runtime
*
core
);
static
void
darshan_get_logfile_name
(
char
*
logfile_name
,
int
jobid
,
struct
tm
*
start_tm
);
static
void
darshan_log_record_hints_and_ver
(
...
...
@@ -100,67 +96,12 @@ static int darshan_log_write_record_hash(
static
int
darshan_log_append_all
(
MPI_File
log_fh
,
struct
darshan_core_runtime
*
core
,
void
*
buf
,
int
count
,
uint64_t
*
inout_off
,
uint64_t
*
agg_uncomp_sz
);
/* intercept MPI initialize and finalize to manage darshan core runtime */
int
MPI_Init
(
int
*
argc
,
char
***
argv
)
{
int
ret
;
ret
=
DARSHAN_MPI_CALL
(
PMPI_Init
)(
argc
,
argv
);
if
(
ret
!=
MPI_SUCCESS
)
{
return
(
ret
);
}
if
(
argc
&&
argv
)
{
darshan_core_initialize
(
*
argc
,
*
argv
);
}
else
{
/* we don't see argc and argv here in fortran */
darshan_core_initialize
(
0
,
NULL
);
}
return
(
ret
);
}
int
MPI_Init_thread
(
int
*
argc
,
char
***
argv
,
int
required
,
int
*
provided
)
{
int
ret
;
ret
=
DARSHAN_MPI_CALL
(
PMPI_Init_thread
)(
argc
,
argv
,
required
,
provided
);
if
(
ret
!=
MPI_SUCCESS
)
{
return
(
ret
);
}
if
(
argc
&&
argv
)
{
darshan_core_initialize
(
*
argc
,
*
argv
);
}
else
{
/* we don't see argc and argv here in fortran */
darshan_core_initialize
(
0
,
NULL
);
}
return
(
ret
);
}
int
MPI_Finalize
(
void
)
{
int
ret
;
darshan_core_shutdown
();
ret
=
DARSHAN_MPI_CALL
(
PMPI_Finalize
)();
return
(
ret
);
}
static
void
darshan_core_cleanup
(
struct
darshan_core_runtime
*
core
);
/* *********************************** */
static
void
darshan_core_initialize
(
int
argc
,
char
**
argv
)
void
darshan_core_initialize
(
int
argc
,
char
**
argv
)
{
int
i
;
int
internal_timing_flag
=
0
;
...
...
@@ -270,7 +211,7 @@ static void darshan_core_initialize(int argc, char **argv)
return
;
}
static
void
darshan_core_shutdown
()
void
darshan_core_shutdown
()
{
int
i
;
char
*
logfile_name
;
...
...
@@ -769,33 +710,7 @@ static void darshan_core_shutdown()
return
;
}
/* free darshan core data structures to shutdown */
static
void
darshan_core_cleanup
(
struct
darshan_core_runtime
*
core
)
{
struct
darshan_core_record_ref
*
tmp
,
*
ref
;
int
i
;
HASH_ITER
(
hlink
,
core
->
rec_hash
,
ref
,
tmp
)
{
HASH_DELETE
(
hlink
,
core
->
rec_hash
,
ref
);
free
(
ref
->
rec
.
name
);
free
(
ref
);
}
for
(
i
=
0
;
i
<
DARSHAN_MAX_MODS
;
i
++
)
{
if
(
core
->
mod_array
[
i
])
{
free
(
core
->
mod_array
[
i
]);
core
->
mod_array
[
i
]
=
NULL
;
}
}
free
(
core
->
trailing_data
);
free
(
core
);
return
;
}
/* *********************************** */
/* construct the darshan log file name */
static
void
darshan_get_logfile_name
(
char
*
logfile_name
,
int
jobid
,
struct
tm
*
start_tm
)
...
...
@@ -1564,6 +1479,34 @@ static int darshan_log_append_all(MPI_File log_fh, struct darshan_core_runtime *
return
(
0
);
}
/* free darshan core data structures to shutdown */
static
void
darshan_core_cleanup
(
struct
darshan_core_runtime
*
core
)
{
struct
darshan_core_record_ref
*
tmp
,
*
ref
;
int
i
;
HASH_ITER
(
hlink
,
core
->
rec_hash
,
ref
,
tmp
)
{
HASH_DELETE
(
hlink
,
core
->
rec_hash
,
ref
);
free
(
ref
->
rec
.
name
);
free
(
ref
);
}
for
(
i
=
0
;
i
<
DARSHAN_MAX_MODS
;
i
++
)
{
if
(
core
->
mod_array
[
i
])
{
free
(
core
->
mod_array
[
i
]);
core
->
mod_array
[
i
]
=
NULL
;
}
}
free
(
core
->
trailing_data
);
free
(
core
);
return
;
}
/* ********************************************************* */
void
darshan_core_register_module
(
...
...
darshan-runtime/lib/darshan-mpiio.c
View file @
5c5918aa
...
...
@@ -27,6 +27,7 @@
#include "uthash.h"
#include "darshan.h"