diff --git a/MPI-Codes/PSCTOOLKIT/Makefile b/MPI-Codes/PSCTOOLKIT/Makefile new file mode 100644 index 0000000..8babf07 --- /dev/null +++ b/MPI-Codes/PSCTOOLKIT/Makefile @@ -0,0 +1,40 @@ +TOP=/mnt/data/software/psctoolkit +include $(TOP)/include/Make.inc.psblas +LIBDIR=$(TOP)/lib +INCLUDEDIR=$(TOP)/include +MODDIR=$(TOP)/modules/ +HERE=../.. + +FINCLUDES=$(FMFLAG). $(FMFLAG)$(HERE) $(FMFLAG)$(MODDIR) +CINCLUDES=-I. -I$(HERE) -I$(INCLUDEDIR) + +PSBC_LIBS= -L$(LIBDIR) -lpsb_cbind +PSB_LIBS=-lpsb_util -lpsb_krylov -lpsb_prec -lpsb_base -L$(LIBDIR) + +# +# Compilers and such +# + +EXEDIR=./runs + +all: ppdec build + +ppdec: ppdec.o + $(MPFC) ppdec.o -o ppdec $(PSBC_LIBS) $(PSB_LIBS) $(PSBLDLIBS) -lm -lgfortran + /bin/mv ppdec $(EXEDIR) + +.f90.o: + $(MPFC) $(FCOPT) $(FINCLUDES) $(FDEFINES) -c $< +.c.o: + $(MPCC) $(CCOPT) $(CINCLUDES) $(CDEFINES) -c $< + + +clean: + /bin/rm -f ppdec.o build.o $(EXEDIR)/ppdec +verycleanlib: + (cd ../..; make veryclean) +lib: + (cd ../../; make library) + +tests: all + cd runs ; ./ppdec < ppde.inp diff --git a/MPI-Codes/PSCTOOLKIT/ppdec.c b/MPI-Codes/PSCTOOLKIT/ppdec.c new file mode 100644 index 0000000..fb83514 --- /dev/null +++ b/MPI-Codes/PSCTOOLKIT/ppdec.c @@ -0,0 +1,428 @@ +/*----------------------------------------------------------------------------------*/ +/* Parallel Sparse BLAS v 3.5.0 */ +/* (C) Copyright 2017 Salvatore Filippone */ +/* */ +/* Redistribution and use in source and binary forms, with or without */ +/* modification, are permitted provided that the following conditions */ +/* are met: */ +/* 1. Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* 2. Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions, and the following disclaimer in the */ +/* documentation and/or other materials provided with the distribution. */ +/* 3. The name of the PSBLAS group or the names of its contributors may */ +/* not be used to endorse or promote products derived from this */ +/* software without specific written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED */ +/* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ +/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS */ +/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR */ +/* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF */ +/* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS */ +/* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ +/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) */ +/* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ +/* POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/* */ +/* File: ppdec.c */ +/* */ +/* Program: ppdec */ +/* This sample program shows how to build and solve a sparse linear */ +/* */ +/* The program solves a linear system based on the partial differential */ +/* equation */ +/* */ +/* */ +/* */ +/* The equation generated is */ +/* */ +/* b1 d d (u) b2 d d (u) a1 d (u)) a2 d (u))) */ +/* - ------ - ------ + ----- + ------ + a3 u = 0 */ +/* dx dx dy dy dx dy */ +/* */ +/* */ +/* with Dirichlet boundary conditions on the unit cube */ +/* */ +/* 0<=x,y,z<=1 */ +/* */ +/* The equation is discretized with finite differences and uniform stepsize; */ +/* the resulting discrete equation is */ +/* */ +/* ( u(x,y,z)(2b1+2b2+a1+a2)+u(x-1,y)(-b1-a1)+u(x,y-1)(-b2-a2)+ */ +/* -u(x+1,y)b1-u(x,y+1)b2)*(1/h**2) */ +/* */ +/* Example adapted from: C.T.Kelley */ +/* Iterative Methods for Linear and Nonlinear Equations */ +/* SIAM 1995 */ +/* */ +/* */ +/* In this sample program the index space of the discretized */ +/* computational domain is first numbered sequentially in a standard way, */ +/* then the corresponding vector is distributed according to an HPF BLOCK */ +/* distribution directive. The discretization ensures there are IDIM */ +/* *internal* points in each direction. */ +/* */ +/*----------------------------------------------------------------------------------*/ + +#include +#include +#include +#include + +#include "psb_base_cbind.h" +#include "psb_prec_cbind.h" +#include "psb_krylov_cbind.h" + +#define LINEBUFSIZE 1024 +#define NBMAX 20 +#define DUMPMATRIX 0 + +double a1(double x, double y, double z) +{ + return(1.0/80.0); +} +double a2(double x, double y, double z) +{ + return(1.0/80.0); +} +double a3(double x, double y, double z) +{ + return(1.0/80.0); +} +double c(double x, double y, double z) +{ + return(0.0); +} +double b1(double x, double y, double z) +{ + return(0.0/sqrt(3.0)); +} +double b2(double x, double y, double z) +{ + return(0.0/sqrt(3.0)); +} +double b3(double x, double y, double z) +{ + return(0.0/sqrt(3.0)); +} + +double g(double x, double y, double z) +{ + if (x == 1.0) { + return(1.0); + } else if (x == 0.0) { + return( exp(-y*y-z*z)); + } else { + return(0.0); + } +} + +psb_i_t matgen(psb_c_ctxt cctxt, psb_i_t nl, psb_i_t idim, psb_l_t vl[], + psb_c_dspmat *ah,psb_c_descriptor *cdh, + psb_c_dvector *xh, psb_c_dvector *bh, psb_c_dvector *rh) +{ + psb_i_t iam, np; + psb_l_t ix, iy, iz, el,glob_row; + psb_i_t i, k, info,ret; + double x, y, z, deltah, sqdeltah, deltah2; + double val[10*NBMAX], zt[NBMAX]; + psb_l_t irow[10*NBMAX], icol[10*NBMAX]; + + info = 0; + psb_c_info(cctxt,&iam,&np); + deltah = (double) 1.0/(idim+1); + sqdeltah = deltah*deltah; + deltah2 = 2.0* deltah; + psb_c_set_index_base(0); + for (i=0; idescriptor); + + /* Clean up object handles */ + free(ph); + free(xh); + free(bh); + free(rh); + free(ah); + free(cdh); + + /* further cleanup */ + free(vl); + //if (iam == 0) fprintf(stderr,"program completed successfully\n"); + + psb_c_barrier(*cctxt); + psb_c_exit(*cctxt); + free(cctxt); +} + diff --git a/MPI-Codes/PSCTOOLKIT/runs/ppde.inp b/MPI-Codes/PSCTOOLKIT/runs/ppde.inp new file mode 100644 index 0000000..6dad139 --- /dev/null +++ b/MPI-Codes/PSCTOOLKIT/runs/ppde.inp @@ -0,0 +1,9 @@ +7 Number of entries below this +BICGSTAB Iterative method BICGSTAB CGS BICG BICGSTABL RGMRES +BJAC Preconditioner NONE DIAG BJAC +CSR A Storage format CSR COO +080 Domain size (acutal system is this**3) +1 Stopping criterion +80 MAXIT +01 ITRACE +20 IRST restart for RGMRES and BiCGSTABL