-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test bitwise library builds of filter with regular build of filter lo…
…renz_96 compiling everything with -fPIC
- Loading branch information
1 parent
527f326
commit b2c4d52
Showing
2 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
export DART=$(git rev-parse --show-toplevel) | ||
|
||
main () { | ||
|
||
NETCDF_LIB=/opt/local/ | ||
testdir=$(pwd) | ||
|
||
# remove any previous test directoires | ||
rm -rf nolib | ||
rm -rf sharedlib | ||
rm -rf staticlib | ||
|
||
# use library mkmf.template | ||
cp "$testdir"/mkmf.template.gfortran "$DART"/build_templates/mkmf.template | ||
|
||
# regular filter build - this goes first so test directories get *.nc and obs_seq.out input files | ||
cd "$DART"/models/lorenz_96/work | ||
./quickbuild.sh clean | ||
./quickbuild.sh filter | ||
rm *.o *.mod | ||
|
||
#----------------- | ||
# setup test direcories | ||
cd "$testdir" | ||
cp -r "$DART"/models/lorenz_96/work nolib | ||
cp -r "$DART"/models/lorenz_96/work sharedlib | ||
cp -r "$DART"/models/lorenz_96/work staticlib | ||
|
||
#----------------- | ||
# shared library build | ||
cd "$DART"/developer_tests/library/shared/work | ||
./quickbuild.sh clean | ||
./quickbuild.sh | ||
|
||
mpif90 -o filter "$DART"/assimilation_code/programs/filter/filter.f90 -I. -L. -ldart | ||
|
||
#----------------- | ||
# static library build | ||
cd "$DART"/developer_tests/library/static/work | ||
./quickbuild.sh clean | ||
./quickbuild.sh | ||
|
||
mpif90 "$DART"/assimilation_code/programs/filter/filter.f90 -I. -L. -ldart -L/$NETCDF_LIB -lnetcdff -o filter | ||
|
||
#----------------- | ||
# copy executables built from libraries to test directories | ||
cd "$testdir"/sharedlib | ||
rm filter | ||
cp "$DART"/developer_tests/library/shared/work/filter . | ||
cp "$DART"/developer_tests/library/shared/work/libdart.so . # rather than setting library paths | ||
|
||
cd "$testdir"/staticlib | ||
rm filter | ||
cp "$DART"/developer_tests/library/static/work/filter . | ||
|
||
#----------------- | ||
# run filter | ||
cd "$testdir"/nolib/ | ||
mpirun -n 4 ./filter | ||
|
||
cd "$testdir"/sharedlib/ | ||
mpirun -n 4 ./filter | ||
|
||
cd "$testdir"/staticlib/ | ||
mpirun -n 4 ./filter | ||
|
||
check_bitwise "$testdir"/nolib/ "$testdir"/sharedlib/ | ||
check_bitwise "$testdir"/nolib/ "$testdir"/staticlib/ | ||
|
||
} | ||
|
||
#----------------- | ||
check_bitwise () { | ||
diff -s "$1"/obs_seq.final "$2"/obs_seq.final | ||
|
||
netcdffiles=(\ | ||
analysis.nc | ||
filter_input.nc | ||
filter_output.nc | ||
perfect_input.nc | ||
preassim.nc \ | ||
) | ||
|
||
for f in "${netcdffiles[@]}" | ||
do | ||
echo -n "$f" " " | ||
nccmp -d "$1"/"$f" "$2"/"$f" | ||
echo "" | ||
done | ||
} | ||
|
||
main "$@" | ||
|