Skip to content
Snippets Groups Projects
Commit 5ff9e1d2 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Only call MPI if `HAVE_MPI`

Motivation: we want to call `open_shpc` and `read_field_indices` from
program `inst_eddies` without making it an MPI program for one process only.
parent 8ef2473e
No related branches found
No related tags found
No related merge requests found
...@@ -7,13 +7,15 @@ contains ...@@ -7,13 +7,15 @@ contains
subroutine read_field_indices(hshp, rank) subroutine read_field_indices(hshp, rank)
! Libraries: ! Libraries:
#ifdef HAVE_MPI
use ezmpi, only: ezmpi_bcast use ezmpi, only: ezmpi_bcast
#endif
use shapelib_03, only: dbf_get_field_index_03 use shapelib_03, only: dbf_get_field_index_03
use derived_types, only: shpc use derived_types, only: shpc
TYPE(shpc), intent(inout):: hshp TYPE(shpc), intent(inout):: hshp
integer, intent(in):: rank integer, intent(in):: rank ! should be 0 if not in MPI program
!--------------------------------------------------------------------- !---------------------------------------------------------------------
...@@ -35,6 +37,7 @@ contains ...@@ -35,6 +37,7 @@ contains
call dbf_get_field_index_03(hshp%max_speed, "ssh", hshp%max_speed_ssh) call dbf_get_field_index_03(hshp%max_speed, "ssh", hshp%max_speed_ssh)
end if end if
#ifdef HAVE_MPI
call ezmpi_bcast(hshp%extr_ssh, root = 0) call ezmpi_bcast(hshp%extr_ssh, root = 0)
call ezmpi_bcast(hshp%extr_date, root = 0) call ezmpi_bcast(hshp%extr_date, root = 0)
call ezmpi_bcast(hshp%extr_eddy_index, root = 0) call ezmpi_bcast(hshp%extr_eddy_index, root = 0)
...@@ -45,6 +48,7 @@ contains ...@@ -45,6 +48,7 @@ contains
call ezmpi_bcast(hshp%out_radius4, root = 0) call ezmpi_bcast(hshp%out_radius4, root = 0)
call ezmpi_bcast(hshp%max_speed_r_eq_area, root = 0) call ezmpi_bcast(hshp%max_speed_r_eq_area, root = 0)
call ezmpi_bcast(hshp%max_speed_ssh, root = 0) call ezmpi_bcast(hshp%max_speed_ssh, root = 0)
#endif
end subroutine read_field_indices end subroutine read_field_indices
......
...@@ -7,7 +7,9 @@ contains ...@@ -7,7 +7,9 @@ contains
subroutine shpc_open(hshp, shpc_dir, rank) subroutine shpc_open(hshp, shpc_dir, rank)
! Libraries: ! Libraries:
#ifdef HAVE_MPI
use ezmpi, only: ezmpi_bcast use ezmpi, only: ezmpi_bcast
#endif
USE jumble, only: new_unit USE jumble, only: new_unit
use shapelib_03, only: shp_open_03 use shapelib_03, only: shp_open_03
...@@ -16,7 +18,7 @@ contains ...@@ -16,7 +18,7 @@ contains
TYPE(shpc), intent(out):: hshp TYPE(shpc), intent(out):: hshp
character(len = *), intent(in):: shpc_dir character(len = *), intent(in):: shpc_dir
integer, intent(in):: rank integer, intent(in):: rank ! should be 0 if not in MPI program
! Local: ! Local:
integer unit integer unit
...@@ -41,7 +43,9 @@ contains ...@@ -41,7 +43,9 @@ contains
hshp%cyclone = trim(adjustl(orientation)) == "cyclones" hshp%cyclone = trim(adjustl(orientation)) == "cyclones"
end if end if
#ifdef HAVE_MPI
call ezmpi_bcast(hshp%cyclone, root = 0) call ezmpi_bcast(hshp%cyclone, root = 0)
#endif
end subroutine shpc_open end subroutine shpc_open
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment