Skip to content

Commit e3eba83

Browse files
committed
Fedora Core 5 interception working as well
1 parent b6203fd commit e3eba83

File tree

4 files changed

+38
-10
lines changed

4 files changed

+38
-10
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ MPICC = mpicc
77
CFLAGS = -std=c99 -fPIC -Wall -Wextra ${CFLAGS_DEBUG} -D_LARGEFILE64_SOURCE
88
CFLAGS_DEBUG = -g3 -DDEBUG=1
99
#LDFLAGS = -Wl,-Bdynamic -Wl,-rpath,/home/aron/sys/lib -L/home/aron/sys/lib ${LIBDL}
10-
LDFLAGS = -dynamic -Wl,-Bdynamic -Wl,-rpath,/home/aron/bgpsys/lib -L/home/aron/bgpsys/lib ${LIBDL}
10+
#LDFLAGS = -dynamic -Wl,-Bdynamic -Wl,-rpath,/home/aron/bgpsys/lib -L/home/aron/bgpsys/lib ${LIBDL}
11+
LDFLAGS = -dynamic -Wl,-Bdynamic -Wl,-rpath,${LIBCPATH} -L${LIBCPATH} ${LIBDL}
1112
LIBDL = -ldl
1213
COLLFS_SRC_C = collfs.c
1314
COLLFS_SRC_O = $(COLLFS_SRC_C:.c=.o)
@@ -26,7 +27,7 @@ thefunc.o : thefunc.c
2627
${CC} ${CFLAGS} -c -fPIC $^
2728

2829
minimal_main : minimal_main.o libminimal_thefunc.so
29-
${MPICC} -g3 -o $@ $^ ${LDFLAGS}
30+
${MPICC} -g3 -o $@ minimal_main.o ${LDFLAGS}
3031

3132
main : main.o libfoo.so libcollfs.so
3233
#main : main.o libfoo.so libcollfs.so libc-collfs.so

README.txt

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
11
***********************************************************************************************
2-
# Applying collfs patches to glibc-2.4
2+
# What is collfs?
33

4-
# The magic rtld rules go in elf/rtld-Rules
4+
collfs is a user library and set of patches to glibc that enables file system calls to be handled collectively over an
5+
MPI Communicator. collfs was written with the specific goal of providing scalable dynamic loading on supercomputers
6+
with faster interconnect than i/o performance, but is a general-purpose tool that can be used either directly as a
7+
library or implicitly by wrapping file system calls with collective versions.
58

6-
# This here is the whole point of all the shenanigans.
7-
# CPPFLAGS-rtld := -DNOT_IN_libc=1 -DIS_IN_rtld=1
9+
The collfs patches are currently quite minimal. They insert an externally visible struct object into the run-time
10+
dynamic linker containing void function hooks for collective MPI versions of the standard file system API. These function pointers
11+
are then used (when non-NULL) to replace file system function calls within the standard dynamic loading routines in glibc. Additionally,
12+
we provide a small static C library via LD_PRELOAD that initializes MPI (this is pre-main, so it passes NULL to the Init
13+
routines) and activates the function hooks to point to our collective versions of the standard file system API,
14+
shadowing the original file system functions (but utilizing them by default).
815

16+
***********************************************************************************************
17+
# Installing collfs on a Fedora Core 5 system
18+
19+
Fedora Core 5 is at this point, quite old, but it features a 2.4 version of glibc, which is very close to the 2.4 glibc
20+
installed on the IBM Blue Gene/P.
21+
22+
This assumes you have an FC5 installation with the standard development RPMs installed. If you are unable to build
23+
glibc-2.4 from the SRPM, you will probably need to install the missing RPMs from the DVD or a web repository.
24+
25+
Tips for setting up a non-root installation environment for SRPMs can be found here:
26+
http://www.owlriver.com/tips/non-root//
27+
28+
mkdir -p ~/sandbox/glibc
29+
cd ~/sandbox/glibc
30+
wget http://dl.dropbox.com/u/65439/glibc-2.4-11-collfs.src.rpm
31+
rpmbuild --nodeps --rebuild -bc glibc-2.4-11-collfs.src.rpm
932

33+
This should leave you with a built glibc (good for testing) in the RPM build directory, which
34+
was/var/tmp/glibc-2.4-root on my machine.
1035

1136
***********************************************************************************************
1237
# Building glibc-2.4 for the compute nodes:

glibc-2.4-bgp-patches/elf/rtld.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ struct libc_collfs_api {
8686
struct libc_collfs_api _dl_collfs_api = {
8787
.fxstat64 = NULL,
8888
.xstat64 = NULL,
89-
.open = __open,
90-
.close = __close,
89+
.open = NULL,
90+
.close = NULL,
9191
.read = NULL,
9292
.lseek = NULL,
9393
.mmap = NULL,

minimal_main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,17 @@ int main(int argc, char *argv[])
5959
collfs_open_fp _open_fp;
6060
char path[MAXPATHLEN];
6161

62+
typedef void (*vfptr)(void);
63+
6264
MPI_Init(&argc,&argv);
6365

64-
_dl_collfs_api.open = (void *) minimal_open;
66+
_dl_collfs_api.open = (vfptr) minimal_open;
6567
_open_fp = (collfs_open_fp) _dl_collfs_api.open;
6668
int fid = _open_fp("test_open.txt",O_RDONLY,0);
6769
close(fid);
6870

6971
if (!getcwd(path,sizeof path)) ERR("getcwd failed");
70-
strcat(path,"/libthefunc.so");
72+
strcat(path,"/libminimal_thefunc.so");
7173
err = run_tests(path, path);CHK(err);
7274

7375
MPI_Finalize();

0 commit comments

Comments
 (0)