Skip to content

Commit

Permalink
Fix tolerance problem on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
fghoussen committed Sep 16, 2024
1 parent bc6850f commit 3cd1544
Showing 1 changed file with 36 additions and 32 deletions.
68 changes: 36 additions & 32 deletions EXAMPLES/MATRIX_MARKET/arpackmm.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
#!/bin/bash -eu

trap 'catch' ERR
catch() {
grep OPT arpackmm.run.log
grep Error arpackmm.run.log
exit 1
}

# For all these eigen problems, the first eigen value is about 382 or (382, 0.).

for eigPb in "--A As.mtx" "--nonSymPb --A An.mtx" "--nonSymPb --cpxPb --A Az.mtx"
do
# Choose B matrix according to A.
export fileB=""
if [[ "$eigPb" == *cpxPb* ]]; then
export fileB="--B Bz.mtx"
Expand All @@ -16,19 +26,29 @@ do
# Note: this is expected as "power-like" methods are designed to find largest eigen values.
for magOpt in "--mag LM" "--mag SM --noCheck"
do
export tol="--tol 1.e-2" # Relax tol to get stable tests.
export mrn="--maxResNorm 1." # Relax residual check to get stable tests.

export shiftOpt=""
# Shift slightly to avoid the zero-vector starting problem.
export shiftZV=""
if [[ "$eigPb" == *cpxPb* ]]; then
export shiftOpt="--shiftReal 1.0 --shiftImag 1.0"
export shiftZV="--shiftReal 1.0 --shiftImag 1.0"
else
export shiftOpt="--shiftReal 1.0"
export shiftZV="--shiftReal 1.0"
fi

for shiftRI in "" "$shiftOpt"
# Shift according to the estimation of the eigen value we may have.
export shiftEV=""
if [[ "$eigPb" == *cpxPb* ]]; then
export shiftEV="--shiftReal 380.0 --shiftImag 1.0"
else
export shiftEV="--shiftReal 380.0"
fi

for shiftRI in "$shiftZV" "$shiftEV"
do
for invert in "" "--invert"
do
# Choose solver according to the sym/non-sym type of the problem.
export cgSlv=""
if [[ "$eigPb" == *nonSymPb* ]]; then
export cgSlv="BiCG"
Expand All @@ -44,44 +64,28 @@ do
do
for dsMat in "" "--dense true"
do
export extraGenPb=""
if [[ "$genPb" == *genPb* ]]; then
export extraGenPb="$shiftOpt" # Force shift if genPb.
fi

if [[ "$slv" == *" CG "* ]]; then
if [[ "$eigPb" == *nonSymPb* ]]; then
continue # Skip CG that could fail (CG is meant to deal with sym matrices).
fi
fi

if [[ "$slv" == *LLT* ]] || [[ "$slv" == *LDLT* ]]; then
if [[ "$eigPb" == *nonSymPb* ]] || [[ "$genPb" == *genPb* ]]; then
continue # Skip LLT/LDLT that could fail (LLT/LDLT are meant to deal with SPD matrices).
fi
fi

# Skip not supported cases.
if [[ "$dsMat" == *dense* ]]; then
if [[ "$slv" == *CG* ]]; then
continue # Iterative solvers are not allowed when using dense matrices.
fi
fi

# Run arpackmm: use --nbCV 6 and --maxIt 200 to ease convergence.
./arpackmm "$eigPb" "$genPb" "$magOpt" "$tol" "$shiftRI" "$invert" "$slv" "$rs" "$dsPrec" "$dsMat" "$extraGenPb" \
--nbCV 6 --maxIt 200 \
./arpackmm "$eigPb" "$genPb" "$magOpt" "$mrn" "$shiftRI" "$invert" "$slv" "$rs" "$dsPrec" "$dsMat" \
--nbCV 6 --maxIt 200 \
--verbose 3 --debug 3 &> arpackmm.run.log
head arpackmm.run.log
tail arpackmm.run.log
grep OPT arpackmm.run.log
grep OUT arpackmm.run.log
echo "----------------------------------------------------------------------------------------"

# Run arpackmm: re-run with restart from slightly different starting point using shift.
./arpackmm "$eigPb" "$genPb" "$magOpt" "$tol" "$shiftRI" "$invert" "$slv" "$rs" "$dsPrec" "$dsMat" "$extraGenPb" \
--nbCV 6 --maxIt 200 \
--restart "$shiftOpt" \
# Run arpackmm: re-run with restart.
./arpackmm "$eigPb" "$genPb" "$magOpt" "$mrn" "$shiftRI" "$invert" "$slv" "$rs" "$dsPrec" "$dsMat" \
--nbCV 6 --maxIt 200 \
--restart \
--verbose 3 --debug 3 &> arpackmm.run.log
head arpackmm.run.log
tail arpackmm.run.log
grep OPT arpackmm.run.log
grep OUT arpackmm.run.log
echo "========================================================================================"
done
done
Expand Down

0 comments on commit 3cd1544

Please sign in to comment.