[cig-commits] [commit] rajesh-petsc, rajesh-petsc-schur: Added PETSc header files, initialization and finalization code (3958782)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Nov 5 19:02:13 PST 2014


Repository : https://github.com/geodynamics/citcoms

On branches: rajesh-petsc,rajesh-petsc-schur
Link       : https://github.com/geodynamics/citcoms/compare/464e1b32299b15819f93efd98d969cddb84dfe51...f97ae655a50bdbd6dac1923a3471ee4dae178fbd

>---------------------------------------------------------------

commit 39587823e10e45e1ac7bd33a30d6f6edefb2388c
Author: Rajesh Kommu <rajesh.kommu at gmail.com>
Date:   Wed Aug 20 12:27:22 2014 -0700

    Added PETSc header files, initialization and finalization code


>---------------------------------------------------------------

39587823e10e45e1ac7bd33a30d6f6edefb2388c
 bin/Citcom.c           |  6 ++++--
 lib/Citcom_init.c      |  5 -----
 lib/Parallel_util.c    | 22 +++++++++-------------
 lib/global_defs.h      |  3 ++-
 lib/parallel_related.h |  2 +-
 lib/prototypes.h       |  2 +-
 6 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/bin/Citcom.c b/bin/Citcom.c
index 1f1d4a1..d64e88a 100644
--- a/bin/Citcom.c
+++ b/bin/Citcom.c
@@ -70,8 +70,10 @@ int main(argc,argv)
 
   struct All_variables *E;
   MPI_Comm world;
+  PetscErrorCode ierr;
 
-  MPI_Init(&argc,&argv); /* added here to allow command-line input */
+  ierr = PetscInitialize(&argc, &argv, NULL, NULL);
+  CHKERRQ(ierr);
 
   if (argc < 2)   {
     fprintf(stderr,"Usage: %s PARAMETERFILE\n", argv[0]);
@@ -83,7 +85,7 @@ int main(argc,argv)
   /* this section reads input, allocates memory, and set some initial values;
    * replaced by CitcomS.Controller.initialize() and
    * CitcomS.Solver.initialize() in Pyre. */
-  world = MPI_COMM_WORLD;
+  world = PETSC_COMM_WORLD;
   E = citcom_init(&world); /* allocate global E and do initializaion here */
 
   /* define common aliases for full/regional functions */
diff --git a/lib/Citcom_init.c b/lib/Citcom_init.c
index 3e839b8..a8d950c 100644
--- a/lib/Citcom_init.c
+++ b/lib/Citcom_init.c
@@ -32,8 +32,6 @@
 
 struct All_variables* citcom_init(MPI_Comm *world)
 {
-  int get_process_identifier();
-
   struct All_variables *E;
   int rank, nproc;
 
@@ -64,9 +62,6 @@ struct All_variables* citcom_init(MPI_Comm *world)
 
 void citcom_finalize(struct All_variables *E, int status)
 {
-    void output_finalize(struct All_variables*);
-    void parallel_process_finalize();
-
     output_finalize(E);
     parallel_process_finalize();
     exit(status);
diff --git a/lib/Parallel_util.c b/lib/Parallel_util.c
index 2b6a6f8..61ab507 100644
--- a/lib/Parallel_util.c
+++ b/lib/Parallel_util.c
@@ -34,10 +34,9 @@
 /* ============================================ */
 /* ============================================ */
 
-void parallel_process_finalize()
+PetscErrorCode parallel_process_finalize()
 {
-  MPI_Finalize();
-  return;
+  return Petsc_Finalize();
 }
 
 /* ============================================ */
@@ -46,10 +45,9 @@ void parallel_process_finalize()
 void parallel_process_termination()
 {
 
-  MPI_Finalize();
+  Petsc_Finalize();
   exit(8);
-  return;
-  }
+}
 
 /* ============================================ */
 /* ============================================ */
@@ -58,18 +56,16 @@ void parallel_process_sync(struct All_variables *E)
 {
 
   MPI_Barrier(E->parallel.world);
-  return;
-  }
+}
 
 
 /* ==========================   */
 
- double CPU_time0()
+double CPU_time0()
 {
- double time, MPI_Wtime();
- time = MPI_Wtime();
- return (time);
+  double time, MPI_Wtime();
+  time = MPI_Wtime();
+  return (time);
 }
 
-
 /* End of file */
diff --git a/lib/global_defs.h b/lib/global_defs.h
index a99cc67..c44edc0 100644
--- a/lib/global_defs.h
+++ b/lib/global_defs.h
@@ -43,7 +43,8 @@ to functions across the whole filespace of CITCOM.
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include "mpi.h"
+#include <mpi.h>
+#include <petscksp.h>
 
 
 
diff --git a/lib/parallel_related.h b/lib/parallel_related.h
index 348cceb..154b8a9 100644
--- a/lib/parallel_related.h
+++ b/lib/parallel_related.h
@@ -33,7 +33,7 @@
 extern "C" {
 #endif
 
-void parallel_process_finalize();
+PetscErrorCode parallel_process_finalize();
 void parallel_process_termination();
 void parallel_process_sync(struct All_variables *E);
 double CPU_time0();
diff --git a/lib/prototypes.h b/lib/prototypes.h
index 5420a47..6dd9ea9 100644
--- a/lib/prototypes.h
+++ b/lib/prototypes.h
@@ -358,7 +358,7 @@ void remove_trace_3x3(double [3][3]);
 void get_9vec_from_3x3(double *, double [3][3]);
 void get_3x3_from_9vec(double [3][3], double *);
 /* Parallel_util.c */
-void parallel_process_finalize(void);
+PetscErrorCode parallel_process_finalize(void);
 void parallel_process_termination(void);
 void parallel_process_sync(struct All_variables *);
 double CPU_time0(void);



More information about the CIG-COMMITS mailing list