Skip to content

Commit

Permalink
Merge branch 'early-PetscOptionsClear' into 'development'
Browse files Browse the repository at this point in the history
Early petsc options clear

See merge request damask/DAMASK!862
  • Loading branch information
sharanroongta committed Dec 7, 2023
2 parents 224ee5a + 4749b36 commit b5f71d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/grid/spectral_utilities.f90
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ subroutine spectral_utilities_init()
num_grid => num_solver%get_dict('grid',defaultVal=emptyDict)
num_grid_fft => num_grid%get_dict('FFT',defaultVal=emptyDict)

call PetscOptionsClear(PETSC_NULL_OPTIONS,err_PETSc)
CHKERRQ(err_PETSc)
call PetscOptionsInsertString(PETSC_NULL_OPTIONS,&
num_grid%get_asStr('PETSc_options',defaultVal=''),err_PETSc)
CHKERRQ(err_PETSc)
Expand Down
2 changes: 0 additions & 2 deletions src/mesh/FEM_utilities.f90
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ subroutine FEM_utilities_init(num_mesh)
call IO_error(821,ext_msg='integration order (p_i) out of bounds')

flush(IO_STDOUT)
call PetscOptionsClear(PETSC_NULL_OPTIONS,err_PETSc)
CHKERRQ(err_PETSc)

petsc_options = misc_prefixOptions('-snes_type newtonls &
&-snes_linesearch_type cp -snes_ksp_ew &
Expand Down
10 changes: 5 additions & 5 deletions src/parallelization.f90
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ subroutine parallelization_init()
!$ integer :: got_env, threadLevel
!$ integer(pI32) :: OMP_NUM_THREADS
!$ character(len=6) NumThreadsString

PetscErrorCode :: err_PETSc


#ifdef _OPENMP
! If openMP is enabled, check if the MPI libary supports it and initialize accordingly.
call MPI_Init_Thread(MPI_THREAD_FUNNELED,threadLevel,err_MPI)
Expand All @@ -74,11 +75,7 @@ subroutine parallelization_init()
if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI init failed'
#endif

#if defined(DEBUG)
call PetscInitialize(PETSC_NULL_CHARACTER,err_PETSc)
#else
call PetscInitializeNoArguments(err_PETSc)
#endif
CHKERRQ(err_PETSc)

#if defined(DEBUG) && defined(__INTEL_COMPILER)
Expand All @@ -88,6 +85,9 @@ subroutine parallelization_init()
#endif
CHKERRQ(err_PETSc)

call PetscOptionsClear(PETSC_NULL_OPTIONS,err_PETSc)
CHKERRQ(err_PETSc)

call MPI_Comm_rank(MPI_COMM_WORLD,worldrank,err_MPI)
if (err_MPI /= 0_MPI_INTEGER_KIND) &
error stop 'Could not determine worldrank'
Expand Down

0 comments on commit b5f71d2

Please sign in to comment.