Commit 91b5e41a authored by Kevin Harms's avatar Kevin Harms

Updated compiler generation scripts to take a '--trim' option which will

remove the compiler's absolute path if it has one.

Modified Makefile so that objects are only rebuilt if the need to be.

Modified bg compiler generation script to remove compiler paths from bg
compilers and leave the absolute paths for gnu compilers.


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/branches/trac5@317 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 8658391b
all: checkpath lib/libdarshan-posix.a lib/libdarshan-mpi-io.a darshan-parser darshan-diff darshan-analyzer test/gztest test/gz-bench darshan-log-params
all: checkpath lib/libdarshan-posix.a lib/libdarshan-mpi-io.a darshan-parser darshan-diff darshan-analyzer darshan-log-params
DESTDIR =
srcdir = @srcdir@
......@@ -10,6 +10,7 @@ mandir = $(DESTDIR)@mandir@
sbindir = $(DESTDIR)@sbindir@
bindir = $(DESTDIR)@bindir@
libdir = $(DESTDIR)@libdir@
buildlib = lib
VPATH = $(srcdir)
......@@ -31,8 +32,8 @@ ifneq ($(darshan_lib_path),$(libdir))
@exit 1
endif
mklibdir::
mkdir -p lib
${buildlib}/::
@mkdir -p $@
mktestdir::
mkdir -p test
......@@ -59,16 +60,16 @@ test/gztest: test/gztest.c mktestdir
test/gz-bench: test/gz-bench.c mktestdir
gcc $(CFLAGS) -lz $< -o $@
lib/darshan-mpi-io.o: lib/darshan-mpi-io.c darshan.h darshan-log-format.h mklibdir
lib/darshan-mpi-io.o: lib/darshan-mpi-io.c darshan.h darshan-log-format.h | ${buildlib}/
$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
lib/darshan-pnetcdf.o: lib/darshan-pnetcdf.c darshan.h darshan-log-format.h mklibdir
lib/darshan-pnetcdf.o: lib/darshan-pnetcdf.c darshan.h darshan-log-format.h | ${buildlib}/
$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
lib/darshan-hdf5.o: lib/darshan-hdf5.c darshan.h darshan-log-format.h mklibdir
lib/darshan-hdf5.o: lib/darshan-hdf5.c darshan.h darshan-log-format.h | ${buildlib}/
$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
lib/darshan-posix.o: lib/darshan-posix.c darshan.h darshan-log-format.h mklibdir
lib/darshan-posix.o: lib/darshan-posix.c darshan.h darshan-log-format.h | ${buildlib}/
$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
lib/lookup3.o: lib/lookup3.c
......@@ -91,7 +92,6 @@ install:: all
install -m 755 lib/libdarshan-posix.a $(libdir)
install -m 755 lib/libdarshan-mpi-io.a $(libdir)
install -d $(bindir)
install -d $(bindir)/fast
install -m 755 darshan-parser $(bindir)
install -m 755 darshan-diff $(bindir)
install -m 755 darshan-analyzer $(bindir)
......@@ -99,42 +99,11 @@ install:: all
install -m 755 darshan-gen-cc.pl $(bindir)
install -m 755 darshan-gen-cxx.pl $(bindir)
install -m 755 darshan-gen-fortran.pl $(bindir)
install -m 755 compilers/mpicc-trace-bgp-V1R4 $(bindir)/mpicc
install -m 755 compilers/mpicxx-trace-bgp-V1R4 $(bindir)/mpicxx
install -m 755 compilers/mpif77-trace-bgp-V1R4 $(bindir)/mpif77
install -m 755 compilers/mpif90-trace-bgp-V1R4 $(bindir)/mpif90
install -m 755 compilers/mpixlc-trace-bgp-V1R4 $(bindir)/mpixlc
install -m 755 compilers/mpixlcxx-trace-bgp-V1R4 $(bindir)/mpixlcxx
install -m 755 compilers/mpixlf2003-trace-bgp-V1R4 $(bindir)/mpixlf2003
install -m 755 compilers/mpixlf77-trace-bgp-V1R4 $(bindir)/mpixlf77
install -m 755 compilers/mpixlf90-trace-bgp-V1R4 $(bindir)/mpixlf90
install -m 755 compilers/mpixlf95-trace-bgp-V1R4 $(bindir)/mpixlf95
install -m 755 compilers/mpixlc_r-trace-bgp-V1R4 $(bindir)/mpixlc_r
install -m 755 compilers/mpixlcxx_r-trace-bgp-V1R4 $(bindir)/mpixlcxx_r
install -m 755 compilers/mpixlf2003_r-trace-bgp-V1R4 $(bindir)/mpixlf2003_r
install -m 755 compilers/mpixlf77_r-trace-bgp-V1R4 $(bindir)/mpixlf77_r
install -m 755 compilers/mpixlf90_r-trace-bgp-V1R4 $(bindir)/mpixlf90_r
install -m 755 compilers/mpixlf95_r-trace-bgp-V1R4 $(bindir)/mpixlf95_r
install -m 755 compilers/mpicc-trace-bgp-V1R4 $(bindir)/fast/mpicc
install -m 755 compilers/mpicxx-trace-bgp-V1R4 $(bindir)/fast/mpicxx
install -m 755 compilers/mpif77-trace-bgp-V1R4 $(bindir)/fast/mpif77
install -m 755 compilers/mpif90-trace-bgp-V1R4 $(bindir)/fast/mpif90
install -m 755 compilers/mpixlc-trace-bgp-V1R4 $(bindir)/fast/mpixlc
install -m 755 compilers/mpixlcxx-trace-bgp-V1R4 $(bindir)/fast/mpixlcxx
install -m 755 compilers/mpixlf2003-trace-bgp-V1R4 $(bindir)/fast/mpixlf2003
install -m 755 compilers/mpixlf77-trace-bgp-V1R4 $(bindir)/fast/mpixlf77
install -m 755 compilers/mpixlf90-trace-bgp-V1R4 $(bindir)/fast/mpixlf90
install -m 755 compilers/mpixlf95-trace-bgp-V1R4 $(bindir)/fast/mpixlf95
install -m 755 compilers/mpixlc_r-trace-bgp-V1R4 $(bindir)/fast/mpixlc_r
install -m 755 compilers/mpixlcxx_r-trace-bgp-V1R4 $(bindir)/fast/mpixlcxx_r
install -m 755 compilers/mpixlf2003_r-trace-bgp-V1R4 $(bindir)/fast/mpixlf2003_r
install -m 755 compilers/mpixlf77_r-trace-bgp-V1R4 $(bindir)/fast/mpixlf77_r
install -m 755 compilers/mpixlf90_r-trace-bgp-V1R4 $(bindir)/fast/mpixlf90_r
install -m 755 compilers/mpixlf95_r-trace-bgp-V1R4 $(bindir)/fast/mpixlf95_r
clean::
rm -f *.o *.a lib/*.o lib/*.a darshan-parser darshan-diff darshan-analyzer darshan-log-params
distclean:: clean
rm -f darshan-config.h darshan-gen-cxx.pl darshan-gen-fortran.pl darshan-gen-cc.pl darshan-mk-log-dirs.pl aclocal.m4 autom4te.cache/* config.status config.log Makefile
rm -f compilers/*-V1R4 compilers/fast/*-V1R4 compilers/*-pcarns
rmdir autom4te.cache
......@@ -16,6 +16,7 @@ $CP_ZLIB_LINK_FLAGS="@__CP_ZLIB_LINK_FLAGS@";
my $input_file = "";
my $output_file = "";
my $trim_exe_path = 0;
process_args();
......@@ -44,6 +45,20 @@ if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/))
chomp($compile_cmd);
chomp($link_cmd);
#
# Incomprehensible re to eat the leading path of the compiler command
# and only give the basename.
#
# /cmd -> cmd
# cmd -> cmd
# /x/y/x/z/cmd -> cmd
#
if ($trim_exe_path)
{
$compile_cmd =~ s/\/*([^\/ ]+\/)*//;
$link_cmd =~ s/\/*([^\/ ]+\/)*//;
}
open (OUTPUT, ">$output_file") || die("Error opening output file: $!");
# substitute arguments and darshan options into commands
......@@ -113,7 +128,7 @@ print OUTPUT<<"EOF";
once=0;
newallargs=\("\$\{allargs\[\@\]\}"\);
for arg in "\$\{newallargs\[\@\]\}"; do
res=`expr match "\$arg" "^-l"`;
res=`expr match "\$arg" "-l"`;
if [ \$res -gt 0 -a \$once -lt 1 ]; then
newallargs[\$argno]=-ldarshan-mpi-io
argno=`expr \$argno + 1`
......@@ -181,11 +196,12 @@ exit(0);
sub process_args
{
use vars qw( $opt_help $opt_output );
use vars qw( $opt_help $opt_output $opt_trim);
Getopt::Long::Configure("no_ignore_case", "bundling");
GetOptions( "help",
"output=s");
"output=s",
"trim");
if($opt_help)
{
......@@ -193,6 +209,11 @@ sub process_args
exit(0);
}
if($opt_trim)
{
$trim_exe_path=1;
}
if($opt_output)
{
$output_file = $opt_output;
......@@ -223,6 +244,7 @@ Usage: $PROGRAM_NAME <stock mpicc> --output <modified mpicc>
--help Prints this help message
--output Specifies name of output script
--trim Trim the compilers path
Purpose:
......
......@@ -44,6 +44,20 @@ if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/))
chomp($compile_cmd);
chomp($link_cmd);
#
# Incomprehensible re to eat the leading path of the compiler command
# and only give the basename.
#
# /cmd -> cmd
# cmd -> cmd
# /x/y/x/z/cmd -> cmd
#
if($trim_exe_path)
{
$compile_cmd =~ s/\/*([^\/ ]+\/)*//;
$link_cmd =~ s/\/*([^\/ ]+\/)*//;
}
open (OUTPUT, ">$output_file") || die("Error opening output file: $!");
# substitute arguments and darshan options into commands
......@@ -113,7 +127,7 @@ print OUTPUT<<"EOF";
once=0;
newallargs=\("\$\{allargs\[\@\]\}"\);
for arg in "\$\{newallargs\[\@\]\}"; do
res=`expr match "\$arg" "^-l"`;
res=`expr match "\$arg" "-l"`;
if [ \$res -gt 0 -a \$once -lt 1 ]; then
newallargs[\$argno]=-ldarshan-mpi-io
argno=`expr \$argno + 1`
......@@ -196,11 +210,12 @@ exit(0);
sub process_args
{
use vars qw( $opt_help $opt_output );
use vars qw( $opt_help $opt_output $opt_trim );
Getopt::Long::Configure("no_ignore_case", "bundling");
GetOptions( "help",
"output=s");
"output=s",
"trim");
if($opt_help)
{
......@@ -208,6 +223,11 @@ sub process_args
exit(0);
}
if($opt_trim)
{
$trim_exe_path=1;
}
if($opt_output)
{
$output_file = $opt_output;
......@@ -238,6 +258,7 @@ Usage: $PROGRAM_NAME <stock mpicxx> --output <modified mpicc>
--help Prints this help message
--output Specifies name of output script
--trim Trim the compilers path
Purpose:
......
......@@ -16,6 +16,7 @@ $CP_ZLIB_LINK_FLAGS="@__CP_ZLIB_LINK_FLAGS@";
my $input_file = "";
my $output_file = "";
my $trim_exe_path=0;
process_args();
......@@ -44,6 +45,20 @@ if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/))
chomp($compile_cmd);
chomp($link_cmd);
#
# Incomprehensible re to eat the leading path of the compiler command
# and only give the basename.
#
# /cmd -> cmd
# cmd -> cmd
# /x/y/x/z/cmd -> cmd
#
if($trim_exe_path)
{
$compile_cmd =~ s/\/*([^\/ ]+\/)*//;
$link_cmd =~ s/\/*([^\/ ]+\/)*//;
}
open (OUTPUT, ">$output_file") || die("Error opening output file: $!");
# substitute arguments and darshan options into commands
......@@ -113,7 +128,7 @@ print OUTPUT<<"EOF";
once=0;
newallargs=\("\$\{allargs\[\@\]\}"\);
for arg in "\$\{newallargs\[\@\]\}"; do
res=`expr match "\$arg" "^-l"`;
res=`expr match "\$arg" "-l"`;
if [ \$res -gt 0 -a \$once -lt 1 ]; then
newallargs[\$argno]=-ldarshan-mpi-io
argno=`expr \$argno + 1`
......@@ -196,11 +211,12 @@ exit(0);
sub process_args
{
use vars qw( $opt_help $opt_output );
use vars qw( $opt_help $opt_output $opt_trim );
Getopt::Long::Configure("no_ignore_case", "bundling");
GetOptions( "help",
"output=s");
"output=s",
"trim");
if($opt_help)
{
......@@ -208,6 +224,11 @@ sub process_args
exit(0);
}
if($opt_trim)
{
$trim_exe_path=1;
}
if($opt_output)
{
$output_file = $opt_output;
......@@ -238,6 +259,7 @@ Usage: $PROGRAM_NAME <stock mpi fortran script> --output <modified mpi fortran s
--help Prints this help message
--output Specifies name of output script
--trim Trim the compilers path
Purpose:
......
......@@ -3,16 +3,34 @@
# Generates compiler scripts for all BG compilers
#
PREFIX=/home/harms/darshan/test
#PREFIX=/soft/apps/darshan-2.0.0
BGPATH=/bgsys/drivers/ppcfloor/comm/xxx/bin
INSTALL=/soft/apps/darshan-2.0.0/bin
for compiler_type in default fast xl;
do
compiler_path=${BGPATH/xxx/$type}
compiler_path=${BGPATH/xxx/$compiler_type}
compiler_opt=""
for compiler in $(ls $compiler_path);
do
if [ $compiler != "mpich2version" -a $compiler != "parkill" ]; then
../darshan-gen-cc.pl --output=$INSTALL/$compiler_type/$compiler $compiler_path/$compiler"
if [ $compiler != "mpich2version" -a \
$compiler != "parkill" ]; then
mkdir -p $PREFIX/bin/$compiler_type
if [ $(expr match $compiler ".*xl.*") -gt 0 -o \
$compiler_type = "fast" -o \
$compiler_type = "xl" ]; then
compiler_opt="--trim";
fi
if [ $(expr match $compiler ".*cxx") -gt 0 ]; then
$PREFIX/bin/darshan-gen-cxx.pl $compiler_opt --output=$PREFIX/bin/$compiler_type/$compiler $compiler_path/$compiler
elif [ $(expr match $compiler ".*f77") -gt 0 -o \
$(expr match $compiler ".*f90") -gt 0 -o \
$(expr match $compiler ".*f95") -gt 0 -o \
$(expr match $compiler ".*f2003") -gt 0 ]; then
$PREFIX/bin/darshan-gen-fortran.pl $compiler_opt --output=$PREFIX/bin/$compiler_type/$compiler $compiler_path/$compiler
else
$PREFIX/bin/darshan-gen-cc.pl $compiler_opt --output=$PREFIX/bin/$compiler_type/$compiler $compiler_path/$compiler
fi
fi
done
done
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