Skip to content

Commit 403b9b8

Browse files
committed
restored main-mpi functionality on Shaheen, fixed bugs in dl-dload.c and collfs.c
1 parent b21d6d4 commit 403b9b8

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

collfs.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,10 @@ static int collfs_close(int fd)
300300
int rank = 0, xerr = 0;
301301

302302
debug_printf(2, "%s(%d) collective", __func__, fd);
303-
if (--link->refct > 0) return 0;
303+
if (--link->refct > 0) {
304+
debug_printf(2, "%s(%d) nonzero refcount %d", __func__, link->refct);
305+
return 0;
306+
}
304307
err = MPI_Comm_rank(CommStack ? CommStack->comm : MPI_COMM_WORLD, &rank); if (err) return -1;
305308
if (!rank) {
306309
((collfs_munmap_fp) unwrap.munmap)(link->mem, link->totallen);
@@ -310,7 +313,9 @@ static int collfs_close(int fd)
310313
}
311314
*linkp = link->next;
312315
free(link);
316+
debug_printf(2, "%s(%d) entering Bcast", __func__, fd);
313317
err = MPI_Bcast(&xerr, 1, MPI_INT, 0, CommStack->comm);
318+
debug_printf(2, "%s(%d) exiting Bcast", __func__, fd);
314319
return err;
315320
}
316321
}
@@ -404,6 +409,7 @@ static void *collfs_mmap(void *addr, size_t len, int prot, int flags, int fildes
404409
/* if (addr >= (void*)((char*) link->mem) && addr+len <= (void*)((char*)link->mem+link->totallen)) { */
405410
MPI_Comm_rank(CommStack->comm, &rank);
406411
if (!rank) {
412+
link->refct++;
407413
return ((collfs_mmap_fp) unwrap.mmap)(addr, len, prot, flags, link->fd, off);
408414
} else {
409415
/* debug_printf(2, "Allocated %zd bytes range [%p %p]", len, mem, (void*)(char*)addr+len); */

glibc-2.4-bgp-patches/elf/dl-load.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l,
856856
{
857857
/* The file might already be closed. */
858858
if (fd != -1)
859-
(void) __close (fd);
859+
(void) __collfs_close (fd);
860860
if (l != NULL)
861861
{
862862
/* Remove the stillborn object from the list and free it. */
@@ -927,7 +927,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
927927
{
928928
/* The object is already loaded.
929929
Just bump its reference count and return it. */
930-
__close (fd);
930+
__collfs_close (fd);
931931

932932
/* If the name is not in the list of names for this object add
933933
it. */
@@ -956,7 +956,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
956956

957957
/* No need to bump the refcount of the real object, ld.so will
958958
never be unloaded. */
959-
__close (fd);
959+
__collfs_close (fd);
960960

961961
return l;
962962
}
@@ -981,7 +981,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
981981
_dl_zerofd = _dl_sysdep_open_zero_fill ();
982982
if (_dl_zerofd == -1)
983983
{
984-
__close (fd);
984+
__collfs_close (fd);
985985
_dl_signal_error (errno, NULL, NULL,
986986
N_("cannot open zero fill device"));
987987
}
@@ -1495,7 +1495,7 @@ cannot enable executable stack as shared object requires");
14951495
#endif
14961496

14971497
/* We are done mapping in the file. We no longer need the descriptor. */
1498-
if (__builtin_expect (__close (fd) != 0, 0))
1498+
if (__builtin_expect (__collfs_close (fd) != 0, 0))
14991499
{
15001500
errstring = N_("cannot close file descriptor");
15011501
goto call_lose_errno;

makeinc.shaheen

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CC = /bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/bin/gcc
2+
MPICC = /bgsys/drivers/ppcfloor/comm/bin/mpicc
3+
4+
CFLAGS = -std=c99 -fPIC -Wall -Wextra ${CFLAGS_DEBUG} -D_LARGEFILE64_SOURCE
5+
CFLAGS_DEBUG = -g3 -DDEBUG=1
6+
LIBCPATH = /home/aron/bgpsys/lib
7+
LIBDL = -ldl
8+
LDSO = ld-2.4.so
9+
LDFLAGS = -dynamic -Wl,-Bdynamic -Wl,-rpath,${LIBCPATH} -L${LIBCPATH} -lc ${LIBDL} ${LIBCPATH}/${LDSO} -Wl,-rpath,${PWD} -Wl,--dynamic-linker=${LIBCPATH}/${LDSO}

0 commit comments

Comments
 (0)