[cig-commits] [commit] QA: adds more tests (2dbb673)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed Feb 5 06:53:06 PST 2014
Repository : ssh://geoshell/specfem3d
On branch : QA
Link : https://github.com/geodynamics/specfem3d/compare/e38ba401e045bc221ec1099e88d3aa31e7b4773c...2dbb673169cd90b856b600c84a8119509592b7d0
>---------------------------------------------------------------
commit 2dbb673169cd90b856b600c84a8119509592b7d0
Author: daniel peter <peterda at ethz.ch>
Date: Wed Feb 5 14:52:53 2014 +0100
adds more tests
>---------------------------------------------------------------
2dbb673169cd90b856b600c84a8119509592b7d0
src/decompose_mesh/decompose_mesh.F90 | 6 +-
.../0.compile.default_make.sh | 11 +-
tests/decompose_mesh/0.compile.default_make.sh | 7 +-
.../{1.test_read.sh => 3.test_partitioning.sh} | 2 +-
tests/decompose_mesh/test_partitioning.f90 | 116 +++++++++++++++++++++
...valence.makefile => test_partitioning.makefile} | 6 +-
tests/decompose_mesh/test_read.makefile | 2 +-
tests/decompose_mesh/test_valence.makefile | 2 +-
tests/generate_databases/0.compile.default_make.sh | 7 +-
tests/meshfem3D/0.compile.default_make.sh | 7 +-
tests/run_all_tests.sh | 21 ++--
tests/specfem3D/0.compile.default_make.sh | 7 +-
12 files changed, 163 insertions(+), 31 deletions(-)
diff --git a/src/decompose_mesh/decompose_mesh.F90 b/src/decompose_mesh/decompose_mesh.F90
index 193ef57..283c598 100644
--- a/src/decompose_mesh/decompose_mesh.F90
+++ b/src/decompose_mesh/decompose_mesh.F90
@@ -779,6 +779,9 @@ module decompose_mesh
stop 'ERROR: sup_neighbour is too large'
endif
+ ! checks that no underestimation
+ if( sup_neighbour < nsize) sup_neighbour = nsize
+
print *, ' nsize = ',nsize, 'sup_neighbour = ', sup_neighbour
end subroutine check_valence
@@ -962,11 +965,12 @@ module decompose_mesh
!! DK DK added this because poroelastic repartitioning routine of Christina Morency is currently broken
! implement mesh repartitioning of poroelastic-elastic interface
! (the risk being to break the nice load balancing created by the domain decomposer for high-performance computing)
- if(PORO_INTERFACE_REPARTITIONING) &
+ if(PORO_INTERFACE_REPARTITIONING) then
call poro_elastic_repartitioning (nspec, nnodes, elmnts, &
count_def_mat, num_material , mat_prop, &
sup_neighbour, nsize, &
nparts, part, NGNOD)
+ endif
deallocate(num_material)
diff --git a/tests/meshfem3D/0.compile.default_make.sh b/tests/auxiliaries/0.compile.default_make.sh
similarity index 70%
copy from tests/meshfem3D/0.compile.default_make.sh
copy to tests/auxiliaries/0.compile.default_make.sh
index bd232d6..569d845 100755
--- a/tests/meshfem3D/0.compile.default_make.sh
+++ b/tests/auxiliaries/0.compile.default_make.sh
@@ -25,18 +25,17 @@ rm -rf ./bin ./obj ./setup ./OUTPUT_FILES
$srcdir/configure >> $testdir/results.log 2>&1
# single compilation
-echo "compilation: xdecompose_mesh" >> $testdir/results.log
+echo "compilation: auxiliaries" >> $testdir/results.log
make clean >> $testdir/results.log 2>&1
-var=xmeshfem3D
-make -j 4 $var >> $testdir/results.log 2>&1
+make -j 4 aux >> $testdir/results.log 2>&1
# check
-if [ ! -e bin/$var ]; then
- echo "compilation of $var failed, please check..." >> $testdir/results.log
+if [ ! -e bin/xsum_kernels ]; then
+ echo "compilation of auxiliaries failed, please check..." >> $testdir/results.log
exit 1
else
- echo "binary exists: $var" >> $testdir/results.log
+ echo "binary exists: xsum_kernels" >> $testdir/results.log
fi
#cleanup
diff --git a/tests/decompose_mesh/0.compile.default_make.sh b/tests/decompose_mesh/0.compile.default_make.sh
index 020a20a..21ac832 100755
--- a/tests/decompose_mesh/0.compile.default_make.sh
+++ b/tests/decompose_mesh/0.compile.default_make.sh
@@ -1,6 +1,9 @@
#!/bin/bash
testdir=`pwd`
+# executable
+var=xdecompose_mesh
+
#checks if ROOT valid
if [ -z "${ROOT}" ]; then export ROOT=../../ ; fi
@@ -25,10 +28,8 @@ rm -rf ./bin ./obj ./setup ./OUTPUT_FILES
$srcdir/configure >> $testdir/results.log 2>&1
# single compilation
-echo "compilation: xdecompose_mesh" >> $testdir/results.log
+echo "compilation: $var" >> $testdir/results.log
make clean >> $testdir/results.log 2>&1
-
-var=xdecompose_mesh
make -j 4 $var >> $testdir/results.log 2>&1
# check
diff --git a/tests/decompose_mesh/1.test_read.sh b/tests/decompose_mesh/3.test_partitioning.sh
similarity index 97%
copy from tests/decompose_mesh/1.test_read.sh
copy to tests/decompose_mesh/3.test_partitioning.sh
index 9e73ff3..f4b1b46 100755
--- a/tests/decompose_mesh/1.test_read.sh
+++ b/tests/decompose_mesh/3.test_partitioning.sh
@@ -2,7 +2,7 @@
testdir=`pwd`
# executable
-var=test_read
+var=test_partitioning
# title
echo >> $testdir/results.log
diff --git a/tests/decompose_mesh/test_partitioning.f90 b/tests/decompose_mesh/test_partitioning.f90
new file mode 100644
index 0000000..a0361eb
--- /dev/null
+++ b/tests/decompose_mesh/test_partitioning.f90
@@ -0,0 +1,116 @@
+program test_partitioning
+
+ use decompose_mesh
+
+ implicit none
+ integer :: i
+
+ print*,'program: test_partitioning'
+
+ ! ficticious setup
+ nspec = 12
+ NGNOD = 8
+
+ ! allocates mesh elements
+ allocate(elmnts(NGNOD,nspec),stat=ier)
+ if( ier /= 0 ) stop 'error allocating array elmnts'
+ elmnts(:,:) = 0
+
+ print*,'nspec = ',nspec
+ print*,'NGNOD = ',NGNOD
+
+ ! element ids
+ inode = 0
+ do ispec = 1,nspec
+ do i = 1,NGNOD
+ ! connects last element with first one
+ if( ispec == nspec .and. i == 5 ) then
+ elmnts(i,ispec) = elmnts(1,1)
+ else if( ispec == nspec .and. i == 6 ) then
+ elmnts(i,ispec) = elmnts(2,1)
+ else if( ispec == nspec .and. i == 7 ) then
+ elmnts(i,ispec) = elmnts(3,1)
+ else if( ispec == nspec .and. i == 8 ) then
+ elmnts(i,ispec) = elmnts(4,1)
+ else
+ inode = inode + 1
+ elmnts(i,ispec) = inode
+ endif
+ enddo
+ enddo
+
+ nnodes = inode
+ print*,'nnodes = ',nnodes
+
+ ! initializes
+ nsize = 0
+ sup_neighbour = 0
+
+ ! valence routine
+ call check_valence()
+
+ ! checks
+ print*,'nsize = ',nsize
+ if( nsize /= 2 ) then
+ print*,'error valence: nsize =',nsize,'should be 2'
+ stop 1
+ else
+ print*,' result is correct'
+ endif
+
+ ! assigns elastic material
+ allocate(mat(2,nspec),stat=ier)
+ if( ier /= 0 ) stop 'error allocating array mat'
+ mat(:,:) = 0
+ do ispec = 1, nspec
+ mat(1,ispec) = 1
+ enddo
+
+ count_def_mat = 1
+ count_undef_mat = 0
+ allocate(mat_prop(16,count_def_mat),stat=ier)
+ if( ier /= 0 ) stop 'error allocating array mat_prop'
+ allocate(undef_mat_prop(6,count_undef_mat),stat=ier)
+ if( ier /= 0 ) stop 'error allocating array undef_mat_prop'
+ mat_prop(:,:) = 0.d0
+ undef_mat_prop(:,:) = ''
+
+ mat_prop(1,num_mat) = 2500.d0
+ mat_prop(2,num_mat) = 3200.d0
+ mat_prop(3,num_mat) = 1100.d0
+ mat_prop(4,num_mat) = 200.d0
+ mat_prop(5,num_mat) = 0
+ mat_prop(6,num_mat) = 1
+ mat_prop(7,num_mat) = 9000.d0
+
+ ANY_FAULT = .false.
+ nparts = 4
+
+ ! partitioning routine
+ print*,'calling partitioning routine...'
+
+ call scotch_partitioning()
+
+ ! check
+ print*,'partitioning results:'
+ do i = 0,nparts-1
+ print*,'partition ',i
+ do ispec = 1,nspec
+ if( part(ispec) == i ) print*,' contains element ',ispec
+ ! checks if element belongs to no partition
+ if( part(ispec) < 0 ) then
+ print*,'error partitioning: element ',ispec,'has invalid partition number: ',part(ispec)
+ stop 1
+ endif
+ enddo
+ enddo
+
+ ! this crashes, not sure why...
+ !deallocate(elmnts)
+ !deallocate(mat,mat_prop,undef_mat_prop)
+
+ ! done
+ print*,'test_partitioning done successfully'
+
+end program test_partitioning
+
diff --git a/tests/decompose_mesh/test_valence.makefile b/tests/decompose_mesh/test_partitioning.makefile
similarity index 68%
copy from tests/decompose_mesh/test_valence.makefile
copy to tests/decompose_mesh/test_partitioning.makefile
index 5e46f8e..62d57cb 100644
--- a/tests/decompose_mesh/test_valence.makefile
+++ b/tests/decompose_mesh/test_partitioning.makefile
@@ -2,7 +2,7 @@
include Makefile
# test target
-default: test_valence
+default: test_partitioning
OBJECTS = \
./obj/decompose_mesh.dec.o \
@@ -14,6 +14,6 @@ OBJECTS = \
./obj/read_value_parameters.shared.o \
$(EMPTY_MACRO)
-test_valence:
- ${FC} -o ./bin/test_valence test_valence.f90 -I./obj $(OBJECTS) $(SCOTCH_LIBS)
+test_partitioning:
+ ${FCCOMPILE_CHECK} ${FCFLAGS_f90} -o ./bin/test_partitioning test_partitioning.f90 -I./obj $(OBJECTS) $(SCOTCH_LIBS)
diff --git a/tests/decompose_mesh/test_read.makefile b/tests/decompose_mesh/test_read.makefile
index 1712f5a..6bf6823 100644
--- a/tests/decompose_mesh/test_read.makefile
+++ b/tests/decompose_mesh/test_read.makefile
@@ -15,5 +15,5 @@ OBJECTS = \
$(EMPTY_MACRO)
test_read:
- ${FC} -o ./bin/test_read test_read.f90 -I./obj $(OBJECTS) $(SCOTCH_LIBS)
+ ${FCCOMPILE_CHECK} ${FCFLAGS_f90} -o ./bin/test_read test_read.f90 -I./obj $(OBJECTS) $(SCOTCH_LIBS)
diff --git a/tests/decompose_mesh/test_valence.makefile b/tests/decompose_mesh/test_valence.makefile
index 5e46f8e..61ac9cf 100644
--- a/tests/decompose_mesh/test_valence.makefile
+++ b/tests/decompose_mesh/test_valence.makefile
@@ -15,5 +15,5 @@ OBJECTS = \
$(EMPTY_MACRO)
test_valence:
- ${FC} -o ./bin/test_valence test_valence.f90 -I./obj $(OBJECTS) $(SCOTCH_LIBS)
+ ${FCCOMPILE_CHECK} ${FCFLAGS_f90} -o ./bin/test_valence test_valence.f90 -I./obj $(OBJECTS) $(SCOTCH_LIBS)
diff --git a/tests/generate_databases/0.compile.default_make.sh b/tests/generate_databases/0.compile.default_make.sh
index 86327d8..8bff4cb 100755
--- a/tests/generate_databases/0.compile.default_make.sh
+++ b/tests/generate_databases/0.compile.default_make.sh
@@ -1,6 +1,9 @@
#!/bin/bash
testdir=`pwd`
+# executable
+var=xgenerate_databases
+
#checks if ROOT valid
if [ -z "${ROOT}" ]; then export ROOT=../../ ; fi
@@ -25,10 +28,8 @@ rm -rf ./bin ./obj ./setup ./OUTPUT_FILES
$srcdir/configure >> $testdir/results.log 2>&1
# single compilation
-echo "compilation: xdecompose_mesh" >> $testdir/results.log
+echo "compilation: $var" >> $testdir/results.log
make clean >> $testdir/results.log 2>&1
-
-var=xgenerate_databases
make -j 4 $var >> $testdir/results.log 2>&1
# check
diff --git a/tests/meshfem3D/0.compile.default_make.sh b/tests/meshfem3D/0.compile.default_make.sh
index bd232d6..60de671 100755
--- a/tests/meshfem3D/0.compile.default_make.sh
+++ b/tests/meshfem3D/0.compile.default_make.sh
@@ -1,6 +1,9 @@
#!/bin/bash
testdir=`pwd`
+# executable
+var=xmeshfem3D
+
#checks if ROOT valid
if [ -z "${ROOT}" ]; then export ROOT=../../ ; fi
@@ -25,10 +28,8 @@ rm -rf ./bin ./obj ./setup ./OUTPUT_FILES
$srcdir/configure >> $testdir/results.log 2>&1
# single compilation
-echo "compilation: xdecompose_mesh" >> $testdir/results.log
+echo "compilation: $var" >> $testdir/results.log
make clean >> $testdir/results.log 2>&1
-
-var=xmeshfem3D
make -j 4 $var >> $testdir/results.log 2>&1
# check
diff --git a/tests/run_all_tests.sh b/tests/run_all_tests.sh
index 11f1ceb..200dd54 100755
--- a/tests/run_all_tests.sh
+++ b/tests/run_all_tests.sh
@@ -1,22 +1,31 @@
#!/bin/bash
+echo "---------------------------------------------------------------------------------"
+echo
+echo " S P E C F E M 3 D - Tests"
+echo
+echo "---------------------------------------------------------------------------------"
+echo "This script is running a set of compilation and unit tests in directory tests/"
+echo "It will take a short while to execute, grab a coffee and hope for the best ;)"
+echo
+echo "Please consider adding more test units to this directory here ..."
+echo "Contributions can be sent to: $(tput bold)http://github.com/geodynamics/specfem3d$(tput sgr0)"
+echo
+
# directories
dir=`pwd`
# changes to subdirectory tests/ if called in root directory SPECFEM3D/
currentdir=`basename $dir`
-echo "current directory: $currentdir"
+#echo "current directory: $currentdir"
if [ "$currentdir" == "SPECFEM3D" ]; then
cd tests/
dir=`pwd`
fi
# running tests
-echo "all tests"
-echo "`date`"
-echo
-echo "directory: $dir"
-echo
+echo "main directory: $dir"
+echo "all tests starting: `date`"
# loops over subdirectories
for testdir in ./*/
diff --git a/tests/specfem3D/0.compile.default_make.sh b/tests/specfem3D/0.compile.default_make.sh
index b0c07f1..2677887 100755
--- a/tests/specfem3D/0.compile.default_make.sh
+++ b/tests/specfem3D/0.compile.default_make.sh
@@ -1,6 +1,9 @@
#!/bin/bash
testdir=`pwd`
+# executable
+var=xspecfem3D
+
#checks if ROOT valid
if [ -z "${ROOT}" ]; then export ROOT=../../ ; fi
@@ -25,10 +28,8 @@ rm -rf ./bin ./obj ./setup ./OUTPUT_FILES
$srcdir/configure >> $testdir/results.log 2>&1
# single compilation
-echo "compilation: xdecompose_mesh" >> $testdir/results.log
+echo "compilation: $var" >> $testdir/results.log
make clean >> $testdir/results.log 2>&1
-
-var=xspecfem3D
make -j 4 $var >> $testdir/results.log 2>&1
# check
More information about the CIG-COMMITS
mailing list