Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix - Creating pcg parallel directory #297

Merged
merged 9 commits into from
Jul 17, 2023
1 change: 1 addition & 0 deletions examples/sunlinsol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ endif()
target_link_libraries(test_sunlinsol_obj PRIVATE sundials_sunlinsoldense)

if(ENABLE_MPI AND MPI_C_FOUND)
add_subdirectory(pcg/parallel)
add_subdirectory(spgmr/parallel)
add_subdirectory(spfgmr/parallel)
add_subdirectory(spbcgs/parallel)
Expand Down
11 changes: 10 additions & 1 deletion examples/sunlinsol/pcg/parallel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,21 @@
# CMakeLists.txt file for sunlinsol PCG examples
# ---------------------------------------------------------------

# Set tolerance for linear solver test based on Sundials precision
if(SUNDIALS_PRECISION MATCHES "SINGLE")
set(TOL "1e-2")
elseif(SUNDIALS_PRECISION MATCHES "DOUBLE")
set(TOL "1e-10")
else()
set(TOL "1e-13")
endif()

# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the
# type is develop for examples excluded from 'make test' in releases

# Examples using the SUNDIALS PCG linear solver
set(sunlinsol_pcg_examples
"test_sunlinsol_pcg_parallel\;100 100 1e-3 0\;1\;4\;"
"test_sunlinsol_pcg_parallel\;100 200 ${TOL} 0\;1\;4\;"
)

# Dependencies for nvector examples
Expand Down
11 changes: 5 additions & 6 deletions examples/sunlinsol/pcg/parallel/test_sunlinsol_pcg_parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ int main(int argc, char *argv[])
{
int fails=0; /* counter for test failures */
int passfail=0; /* overall passfail flag */
int mpierr; /* mpi error flag */
SUNLinearSolver LS; /* linear solver object */
N_Vector xhat, x, b; /* test vectors */
UserData ProbData; /* problem data structure */
Expand Down Expand Up @@ -158,8 +157,8 @@ int main(int argc, char *argv[])
if (ProbData.myid == 0) {
printf("\nPCG linear solver test:\n");
printf(" nprocs = %i\n", ProbData.nprocs);
printf(" local/global problem sizes = %ld/%ld\n", ProbData.Nloc,
ProbData.nprocs * ProbData.Nloc, sunctx);
printf(" local/global problem sizes = %ld/%ld\n", (long int) ProbData.Nloc,
(long int) ProbData.nprocs * ProbData.Nloc);
printf(" Maximum Krylov subspace dimension = %i\n", maxl);
printf(" Solver Tolerance = %g\n", tol);
printf(" timing output flag = %i\n\n", print_timing);
Expand Down Expand Up @@ -338,7 +337,7 @@ int main(int argc, char *argv[])
}

/* check if any other process failed */
mpierr = MPI_Allreduce(&passfail, &fails, 1, MPI_INT, MPI_MAX, ProbData.comm);
(void) MPI_Allreduce(&passfail, &fails, 1, MPI_INT, MPI_MAX, ProbData.comm);

/* Free solver and vectors */
SUNLinSolFree(LS);
Expand Down Expand Up @@ -489,8 +488,8 @@ static int check_flag(void *flagvalue, const char *funcname, int opt)
* --------------------------------------------------------------------*/
int check_vector(N_Vector X, N_Vector Y, realtype tol)
{
int failure = 0;
long int i;
int failure = 0;
sunindextype i;
realtype *Xdata, *Ydata, maxerr;

Xdata = N_VGetArrayPointer(X);
Expand Down
4 changes: 2 additions & 2 deletions scripts/shared
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,8 @@ $tar $tarfile $distrobase/examples/sunlinsol/magmadense/CMakeLists.txt
$tar $tarfile $distrobase/examples/sunlinsol/onemkldense/CMakeLists.txt
$tar $tarfile $distrobase/examples/sunlinsol/onemkldense/test_sunlinsol_onemkldense.cpp

#$tar $tarfile $distrobase/examples/sunlinsol/pcg/parallel/test_sunlinsol_pcg_parallel.c
#$tar $tarfile $distrobase/examples/sunlinsol/pcg/parallel/CMakeLists.txt
$tar $tarfile $distrobase/examples/sunlinsol/pcg/parallel/test_sunlinsol_pcg_parallel.c
$tar $tarfile $distrobase/examples/sunlinsol/pcg/parallel/CMakeLists.txt

$tar $tarfile $distrobase/examples/sunlinsol/pcg/serial/test_sunlinsol_pcg_serial.c
$tar $tarfile $distrobase/examples/sunlinsol/pcg/serial/test_fsunlinsol_pcg_mod_serial.f90
Expand Down