55 |
HAVE_MPACK=f |
HAVE_MPACK=f |
56 |
fi |
fi |
57 |
echo -n "building mpack... " |
echo -n "building mpack... " |
58 |
( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1 |
if test "x$CC" = x ; then |
59 |
|
export CC=cc |
60 |
|
fi |
61 |
|
( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1 |
62 |
RETVAL=$? |
RETVAL=$? |
63 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
64 |
echo |
echo |
66 |
echo |
echo |
67 |
HAVE_MPACK=f |
HAVE_MPACK=f |
68 |
else |
else |
69 |
|
rm -f tr_build_mpack.out |
70 |
HAVE_MPACK=t |
HAVE_MPACK=t |
71 |
fi |
fi |
72 |
else |
else |
319 |
) |
) |
320 |
} |
} |
321 |
|
|
322 |
|
symlink_mpifiles() |
323 |
|
{ |
324 |
|
# Put special links so that MPI specific files are used |
325 |
|
# This MUST be invoked between makeclean and makelinks because |
326 |
|
# the Makefile will link to non-mpi files by default |
327 |
|
|
328 |
|
dir=$1 |
329 |
|
code_dir=$2 |
330 |
|
BUILD_DIR=$dir/$3 |
331 |
|
CODE_DIR=$dir/$code_dir |
332 |
|
|
333 |
|
# These are files that should replace their counter-part when using -mpi |
334 |
|
MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")` |
335 |
|
|
336 |
|
# Is this an MPI run? |
337 |
|
if test "x$MPI" = xt ; then |
338 |
|
# YES: We symbolically link these files to the build |
339 |
|
# dir so long as there is no real file in place |
340 |
|
for ii in $MPI_FILES ; do |
341 |
|
i=`echo $ii | sed 's:^\./::'` |
342 |
|
name=`echo $i | sed 's:_mpi::' ` |
343 |
|
cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1 |
344 |
|
RETVAL=$? |
345 |
|
if test "x$RETVAL" != x0 ; then |
346 |
|
if ! test -f $BUILD_DIR/$i ; then |
347 |
|
#echo Linking $name to $i |
348 |
|
(cd $BUILD_DIR; ln -sf ../$code_dir/$i $name) |
349 |
|
fi |
350 |
|
fi |
351 |
|
done |
352 |
|
else |
353 |
|
# NO: We undo any _mpi symbolically linked files |
354 |
|
for ii in $MPI_FILES ; do |
355 |
|
i=`echo $ii | sed 's:^\./::'` |
356 |
|
name=`echo $i | sed 's:_mpi::' ` |
357 |
|
if test -L $BUILD_DIR/$name ; then |
358 |
|
linktarg=`(cd $BUILD_DIR; readlink $name)` |
359 |
|
if test $linktarg = "../$code_dir/$name"_mpi ; then |
360 |
|
#echo Un-linking $name from $linktarg |
361 |
|
rm -f $BUILD_DIR/$name |
362 |
|
fi |
363 |
|
fi |
364 |
|
done |
365 |
|
fi |
366 |
|
|
367 |
|
} |
368 |
|
|
369 |
linkdata() |
linkdata() |
370 |
{ |
{ |
371 |
# linkdata flag |
# linkdata flag |
437 |
#include <stdio.h> |
#include <stdio.h> |
438 |
#include <math.h> |
#include <math.h> |
439 |
int main( int argc, char** argv ) { |
int main( int argc, char** argv ) { |
440 |
int linnum,best; |
int linnum,best,lncnt; |
441 |
double a,b,diff; |
double a,b,diff; |
442 |
best = -16; |
best = -16; |
443 |
while( 1 ) { |
lncnt = 0; |
444 |
|
while( 1 & (lncnt+=1) < 999 ) { |
445 |
scanf("%d", &linnum); |
scanf("%d", &linnum); |
446 |
if (linnum == -1) break; |
if (linnum == -1) break; |
447 |
scanf("%lf", &a); scanf("%lf", &b); |
scanf("%lf", &a); scanf("%lf", &b); |
457 |
} |
} |
458 |
} |
} |
459 |
} |
} |
460 |
|
if (lncnt == 999) best=-29; |
461 |
printf("%d\n", -best); |
printf("%d\n", -best); |
462 |
return 0; |
return 0; |
463 |
} |
} |
677 |
createcodelet |
createcodelet |
678 |
|
|
679 |
# build the mpack utility |
# build the mpack utility |
680 |
build_mpack |
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
681 |
|
echo "skipping mpack build" |
682 |
|
else |
683 |
|
build_mpack |
684 |
|
fi |
685 |
|
|
686 |
# Create a uniquely named directory to store results |
# Create a uniquely named directory to store results |
687 |
MACH=`hostname` |
MACH=`hostname` |
688 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
689 |
DATE=`date +%Y%m%d` |
DATE=`date +%Y%m%d` |
690 |
BASE=$MACH"_"$DATE"_" |
BASE="tr_"$MACH"_"$DATE"_" |
691 |
DNUM=0 |
DNUM=0 |
692 |
DRESULTS="$BASE$DNUM" |
DRESULTS="$BASE$DNUM" |
693 |
while test -e $DRESULTS ; do |
while test -e $DRESULTS ; do |
780 |
continue |
continue |
781 |
fi |
fi |
782 |
|
|
|
echo "-------------------------------------------------------------------------------" |
|
|
echo |
|
|
echo "Experiment: $dir" |
|
|
echo |
|
|
unset genmake makedepend make run |
|
|
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
|
|
|
|
783 |
builddir="input" |
builddir="input" |
784 |
rundir="input" |
rundir="input" |
785 |
use_seperate_build=0 |
use_seperate_build=0 |
791 |
fi |
fi |
792 |
|
|
793 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
794 |
|
code_dir=code |
795 |
CODE_DIR=$dir/code |
CODE_DIR=$dir/code |
796 |
else |
else |
797 |
|
code_dir=code_ad |
798 |
CODE_DIR=$dir/code_ad |
CODE_DIR=$dir/code_ad |
799 |
fi |
fi |
800 |
BUILD_DIR=$dir/$builddir |
BUILD_DIR=$dir/$builddir |
|
MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi" |
|
|
NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi" |
|
801 |
|
|
802 |
# Is this an MPI run? |
if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then |
803 |
if test "x$MPI" = xt ; then |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
|
FILES=$MPI_FILES |
|
|
endings="_mpi" |
|
|
else |
|
|
FILES=$NOMPI_FILES |
|
|
endings="_nompi" |
|
|
fi |
|
|
|
|
|
# Check to see that we have the files |
|
|
have_files=t |
|
|
for i in $FILES ; do |
|
|
if test ! -r $CODE_DIR/$i ; then |
|
|
echo "Warning: can't read file $CODE_DIR/$i" |
|
|
have_files=f |
|
|
fi |
|
|
done |
|
|
if test "x$have_files" != xt -a "x$MPI" = xt ; then |
|
|
echo "Skipping $dir due to lack of input files (see above warning)" |
|
804 |
continue |
continue |
805 |
fi |
fi |
806 |
|
|
807 |
# If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR |
echo "-------------------------------------------------------------------------------" |
808 |
if test "x$have_files" = xt ; then |
echo |
809 |
for i in $FILES ; do |
echo "Experiment: $dir" |
810 |
sstr="s|$endings||" |
echo |
811 |
name=`echo $i | sed -e $sstr ` |
unset genmake makedepend make run |
812 |
cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1 |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
813 |
RETVAL=$? |
|
|
if test "x$RETVAL" != x0 ; then |
|
|
cp $CODE_DIR/$i $BUILD_DIR/$name |
|
|
fi |
|
|
done |
|
|
fi |
|
|
|
|
814 |
# Create an output dir for each OPTFILE/tdir combination |
# Create an output dir for each OPTFILE/tdir combination |
815 |
rel_CDIR=$DRESULTS"/"$dir |
rel_CDIR=$DRESULTS"/"$dir |
816 |
mkdir $rel_CDIR |
mkdir $rel_CDIR |
821 |
else |
else |
822 |
genmakemodel $dir/$builddir && genmake=Y \ |
genmakemodel $dir/$builddir && genmake=Y \ |
823 |
&& makeclean $dir/$builddir \ |
&& makeclean $dir/$builddir \ |
824 |
|
&& symlink_mpifiles $dir $code_dir $builddir \ |
825 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
826 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
827 |
&& linkdata $use_seperate_build $dir/$rundir \ |
&& linkdata $use_seperate_build $dir/$rundir \ |
885 |
|
|
886 |
if test "x$CLEANUP" != xt ; then |
if test "x$CLEANUP" != xt ; then |
887 |
cat $SUMMARY |
cat $SUMMARY |
888 |
if test -e tr.out ; then |
if test -e tr_out.txt ; then |
889 |
mv tr.out tr.out.old |
mv tr_out.txt tr_out.txt.old |
890 |
fi |
fi |
891 |
cat $SUMMARY > tr.out |
cat $SUMMARY > tr_out.txt |
892 |
fi |
fi |
893 |
|
|