[cig-commits] [commit] rajesh-petsc: Added PETSc header files, initialization and finalization code (3958782)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed Aug 20 12:36:57 PDT 2014
Repository : https://github.com/geodynamics/citcoms
On branch : rajesh-petsc
Link : https://github.com/geodynamics/citcoms/compare/fb1839e7e93bc56eb542afd64b3db70f2df6a5d8...15e05e4d8d088429e89c42427a1392f428737625
>---------------------------------------------------------------
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