From b01787c3843f02dc3e65f883510de895fd211876 Mon Sep 17 00:00:00 2001 From: pollney Date: Thu, 23 Mar 2000 17:45:16 +0000 Subject: Allow compilation on the origin. git-svn-id: http://svn.cactuscode.org/arrangements/CactusElliptic/EllPETSc/trunk@35 1d96b42b-98df-4a6a-9d84-1b24288d4588 --- src/make.configuration.defn | 52 ++++++++++++++++--------------------------- src/petsc_confmetric_solver.c | 21 ++++++++--------- src/petsc_flat_solver.c | 2 +- 3 files changed, 31 insertions(+), 44 deletions(-) diff --git a/src/make.configuration.defn b/src/make.configuration.defn index 37d5b60..0b2dbcc 100644 --- a/src/make.configuration.defn +++ b/src/make.configuration.defn @@ -17,7 +17,7 @@ $(NAME): MissingPETSC_DIR .pseudo: MissingPETSC_DIR MissingPETSC_DIR: @echo "PETSc: need environment variable PETSC_DIR for compliling EllPETSc" - @echo "PETSc: set PETSC_DIR or remove EllPETSc from Thornlist" + @echo "PETSc: set PETSC_DIR or remove EllPETSc from ThornList" exit 2 endif @@ -26,48 +26,34 @@ $(NAME): MissingPETSC_ARCH .pseudo: MissingPETSC_ARCH MissingPETSC_ARCH: @echo "PETSc: need environment variable PETSC_ARCH for compliling EllPETSc" - @echo "PETSc: set PETSC_ARCH or remove EllPETSc from Thornlist" + @echo "PETSc: set PETSC_ARCH or remove EllPETSc from ThornList" exit 2 endif +PETSC_LIB_DIR = $(PETSC_DIR)/lib/libg/$(PETSC_ARCH) +PETSC_LIBS = petscts petscsnes petscsles petscdm petscmat petscvec petsc +PLATFORM_LIBS = -LIBDIRS += $(PETSC_DIR)/lib/libO/$(PETSC_ARCH) $(X_LIB_DIR) - - -### PETSC on the T3E -ifeq ($(PETSC_ARCH),t3e) - echo "No T3E support" - exit 2 - MYLIBS := petscts petscsnes petscsles \ - petscmat petscvec petscsys X11 sci - - LIBS = $(MYLIBS) +### PETSC on the Origin +ifeq ($(PETSC_ARCH),IRIX64) + PLATFORM_LIBS = blas complib.sgimath +endif +### PETSC on linux +ifeq ($(PETSC_ARCH),linux) + PLATFORM_LIBS = lapack blas g2c mpich endif -### PETSC on the SGI -ifeq ($(PETSC_ARCH),sgi) - echo "No SGI support" +### Otherwise +ifndef PLATFORM_LIBS +UnknownArch: + @echo "No Cactus/PETSc support for PETSC_ARCH=$(PETSC_ARCH)" exit 2 - MYLIBS := petscts petscsnes petscsles \ - petscmat petscvec petscsys X11 \ - complib.sgimath - - LIBS = $(MYLIBS) - endif -### PETSC on linux -ifeq ($(PETSC_ARCH),linux) - MYLIBS := petsc petscdm petsccontrib \ - petscts petscsnes petscsles \ - petscmat petscvec \ - lapack blas g2c \ - mpich X11 $(LIBS) - - LIBS = $(MYLIBS) +LIBDIRS += $(PETSC_LIB_DIR) $(X_LIB_DIR) +LIBS += $(PETSC_LIBS) $(PLATFORM_LIBS) X11 +EXTRAFLAGS = -I$(PETSC_DIR)/include - EXTRAFLAGS = -I$(PETSC_DIR)/bmake/$(PETSC_ARCH)/base -endif diff --git a/src/petsc_confmetric_solver.c b/src/petsc_confmetric_solver.c index 39958db..54b4002 100644 --- a/src/petsc_confmetric_solver.c +++ b/src/petsc_confmetric_solver.c @@ -25,7 +25,7 @@ static char *rcsid = "$Header$"; -#define DEBUG +/*#define DEBUG*/ /*Don't know what these actually mean! FIXME */ #define ELLCONV_ABSOLUTE 0 @@ -251,7 +251,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, /* We fix the lower and upper boundary indices, that actually "active" in the sense that they are no ghostzones: */ imin=((pughGH->neighbors[pughGH->myproc][XDM]<0) && !(octant) ? 1 : - pughGH->nghostzones[0]); + GH->cctk_nghostzones[0]); imax=((pughGH->neighbors[pughGH->myproc][XDP]<0) ? pughGH->lnsize[0]-1 : pughGH->lnsize[0]-GH->cctk_nghostzones[0]); @@ -356,6 +356,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, /*$if (trips == 0 || reuse == 0) {$*/ if (verbose) CCTK_INFO("Creating Matrices and Vectors ...."); + ierr = MatCreateMPIAIJ(pughGH->PUGH_COMM_WORLD, (endpoint-startpoint), /* # of rows */ (endpoint-startpoint), /* This is confusing */ @@ -381,13 +382,14 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, /* Compare the PETSc layout to Cactus, this better be a match */ ierr = VecGetOwnershipRange(soln,&pvstart,&pvend); ierr = MatGetOwnershipRange(A[0],&pstart,&pend); +#ifdef DEBUG printf("CAC M-Layout: %d %d \n",startpoint, endpoint); printf("PET M-Layout: %d %d \n",pstart, pend); printf("PET V-Layout: %d %d \n",pvstart,pvend); +#endif if (pstart != startpoint && pend != endpoint) CCTK_WARN(1,"WARNING: PETSC and data layouts differ! (why??)\n"); - /* Decide on the nabla form in PETSc: */ if (CCTK_EQUALS(petsc_nablaform,"down")) { if (verbose) @@ -457,7 +459,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, for (i=imin;i= 0) { - + CCTK_REAL tdxgxx, tdxgxy, tdxgxz, tdxgyy, tdxgyz, tdxgzz; CCTK_REAL tdygxx, tdygxy, tdygxz, tdygyy, tdygyz, tdygzz; CCTK_REAL tdzgxx, tdzgxy, tdzgxz, tdzgyy, tdzgyz, tdzgzz; @@ -491,7 +493,6 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, psiyp = 0.0; psizp = 0.0; } - if (nabla_form == 2) { /* Use finite differences of g for the d's */ int ijkp, ijkm; @@ -858,7 +859,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, if (trips==0) OptionsSetValue("-ksp_monitor",""); - CCTK_INFO("CREATING SLES"); + if (verbose) CCTK_INFO("CREATING SLES"); ierr = SLESCreate(pughGH->PUGH_COMM_WORLD,&sles); CHKERRA(ierr); @@ -871,14 +872,14 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, using A to precondition itself. Since I don't know what this means, we'll leave it for now. */ - CCTK_INFO("CREATING SLES OPERATOR"); + if (verbose) CCTK_INFO("CREATING SLES OPERATOR"); ierr = SLESSetOperators(sles,A[0],A[0],DIFFERENT_NONZERO_PATTERN); CHKERRA(ierr); /* Set linear solver defaults for this problem. Later this should be replaced/modified with appropriate parsing from the parameter parser. For now it is not. These defaults are reasonable, I hope. */ - CCTK_INFO("SLESGet KSP/PC"); + if (verbose) CCTK_INFO("SLESGet KSP/PC"); ierr = SLESGetKSP(sles,&ksp); CHKERRA(ierr); ierr = SLESGetPC(sles,&pc); CHKERRA(ierr); @@ -989,7 +990,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, ierr = KSPSetInitialGuessNonzero(KSP ksp); */ - CCTK_INFO("KSPSetInitialGuess\n"); + if (verbose) CCTK_INFO("KSPSetInitialGuess\n"); ierr = KSPSetInitialGuessNonzero(ksp); CHKERRA(ierr); /* @@ -1006,7 +1007,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the linear system - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - CCTK_INFO("SLES solve..."); + if (verbose) CCTK_INFO("SLES solve..."); ierr = SLESSolve(sles,b,soln,&its); CHKERRA(ierr); /* Here we can form a "res = Ax - b" and find its norm to get diff --git a/src/petsc_flat_solver.c b/src/petsc_flat_solver.c index 6501d9c..662c81b 100644 --- a/src/petsc_flat_solver.c +++ b/src/petsc_flat_solver.c @@ -178,7 +178,7 @@ void petsc_flat(cGH *GH, int FieldIndex, int MIndex, int NIndex, /* We fix the lower and upper boundary indices, that actually "active" in the sense that they are no ghostzones: */ imin=((pughGH->neighbors[pughGH->myproc][XDM]<0) && !(octant) ? 1 : - pughGH->nghostzones); + GH->cctk_nghostzones[0]); imax=((pughGH->neighbors[pughGH->myproc][XDP]<0) ? pughGH->lnsize[0]-1 : pughGH->lnsize[0]-GH->cctk_nghostzones[0]); -- cgit v1.2.3