From 86283359f191316111401a784e2082f54787e31a Mon Sep 17 00:00:00 2001
From: Pratheek Shanthraj
Date: Thu, 26 Mar 2015 13:43:18 +0000
Subject: [PATCH] PetscFinalize should be the last call before exiting
---
code/DAMASK_spectral_driver.f90 | 4 +++-
code/DAMASK_spectral_solverAL.f90 | 1 -
code/DAMASK_spectral_solverBasicPETSc.f90 | 1 -
code/DAMASK_spectral_solverPolarisation.f90 | 1 -
4 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/code/DAMASK_spectral_driver.f90 b/code/DAMASK_spectral_driver.f90
index 986d71033..5d129498f 100644
--- a/code/DAMASK_spectral_driver.f90
+++ b/code/DAMASK_spectral_driver.f90
@@ -360,7 +360,7 @@ program DAMASK_spectral_Driver
close(resUnit) ! end of header
endif
endif
- allocate(outputSize(worldsize), source = 0_pInt); outputSize(worldrank+1) = sizeof(materialpoint_results)
+ allocate(outputSize(worldsize), source = 0_pInt); outputSize(worldrank+1) = size(materialpoint_results)*8
call MPI_Allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_INT,MPI_SUM,PETSC_COMM_WORLD,ierr)
call MPI_File_open(PETSC_COMM_WORLD, &
trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'.spectralOut', &
@@ -590,6 +590,8 @@ program DAMASK_spectral_Driver
call Polarisation_destroy()
end select
+ call PetscFinalize(ierr); CHKERRQ(ierr)
+
if (notConvergedCounter > 0_pInt) call quit(3_pInt) ! error if some are not converged
call quit(0_pInt) ! no complains ;)
diff --git a/code/DAMASK_spectral_solverAL.f90 b/code/DAMASK_spectral_solverAL.f90
index 1ccf47a8d..c60075f3d 100644
--- a/code/DAMASK_spectral_solverAL.f90
+++ b/code/DAMASK_spectral_solverAL.f90
@@ -727,7 +727,6 @@ subroutine AL_destroy()
call VecDestroy(solution_vec,ierr); CHKERRQ(ierr)
call SNESDestroy(snes,ierr); CHKERRQ(ierr)
call DMDestroy(da,ierr); CHKERRQ(ierr)
- call PetscFinalize(ierr); CHKERRQ(ierr)
call Utilities_destroy()
end subroutine AL_destroy
diff --git a/code/DAMASK_spectral_solverBasicPETSc.f90 b/code/DAMASK_spectral_solverBasicPETSc.f90
index 05e33a019..12f3f6a30 100644
--- a/code/DAMASK_spectral_solverBasicPETSc.f90
+++ b/code/DAMASK_spectral_solverBasicPETSc.f90
@@ -578,7 +578,6 @@ subroutine BasicPETSc_destroy()
call VecDestroy(solution_vec,ierr); CHKERRQ(ierr)
call SNESDestroy(snes,ierr); CHKERRQ(ierr)
call DMDestroy(da,ierr); CHKERRQ(ierr)
- call PetscFinalize(ierr); CHKERRQ(ierr)
call Utilities_destroy()
end subroutine BasicPETSc_destroy
diff --git a/code/DAMASK_spectral_solverPolarisation.f90 b/code/DAMASK_spectral_solverPolarisation.f90
index 4a71ab7ca..54e445a22 100644
--- a/code/DAMASK_spectral_solverPolarisation.f90
+++ b/code/DAMASK_spectral_solverPolarisation.f90
@@ -727,7 +727,6 @@ subroutine Polarisation_destroy()
call VecDestroy(solution_vec,ierr); CHKERRQ(ierr)
call SNESDestroy(snes,ierr); CHKERRQ(ierr)
call DMDestroy(da,ierr); CHKERRQ(ierr)
- call PetscFinalize(ierr); CHKERRQ(ierr)
call Utilities_destroy()
end subroutine Polarisation_destroy