[cig-commits] [commit] devel: fixed the "STOP NUMBER_OF_SIMULTANEOUS_RUNS <= 0 makes no sense" bug (779a2ad)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed Dec 10 15:02:45 PST 2014
Repository : https://github.com/geodynamics/specfem3d_globe
On branch : devel
Link : https://github.com/geodynamics/specfem3d_globe/compare/b6e97b3d9d9bbb98c98d67064611f0277a82f533...779a2ade4f10197d238d5bd51bd1b73f622854ec
>---------------------------------------------------------------
commit 779a2ade4f10197d238d5bd51bd1b73f622854ec
Author: Dimitri Komatitsch <komatitsch at lma.cnrs-mrs.fr>
Date: Wed Dec 10 23:55:14 2014 +0100
fixed the "STOP NUMBER_OF_SIMULTANEOUS_RUNS <= 0 makes no sense" bug
>---------------------------------------------------------------
779a2ade4f10197d238d5bd51bd1b73f622854ec
src/auxiliaries/rules.mk | 12 +++++
src/meshfem3D/initialize_mesher.f90 | 2 +-
src/shared/parallel.f90 | 80 ++++++++++++++++++++++-----------
src/shared/rules.mk | 2 +-
src/specfem3D/initialize_simulation.f90 | 2 +-
5 files changed, 69 insertions(+), 29 deletions(-)
diff --git a/src/auxiliaries/rules.mk b/src/auxiliaries/rules.mk
index 58b04af..c2c6dff 100644
--- a/src/auxiliaries/rules.mk
+++ b/src/auxiliaries/rules.mk
@@ -182,6 +182,9 @@ xcombine_vol_data_SHARED_OBJECTS = \
$O/make_ellipticity.shared.o \
$O/model_prem.shared.o \
$O/parallel.sharedmpi.o \
+ $O/read_parameter_file.shared.o \
+ $O/read_value_parameters.shared.o \
+ $O/param_reader.cc.o \
$O/reduce.shared.o \
$O/rthetaphi_xyz.shared.o \
$O/spline_routines.shared.o \
@@ -206,6 +209,9 @@ xcombine_vol_data_adios_SHARED_OBJECTS = \
$O/make_ellipticity.shared.o \
$O/model_prem.shared.o \
$O/parallel.sharedmpi.o \
+ $O/read_parameter_file.shared.o \
+ $O/read_value_parameters.shared.o \
+ $O/param_reader.cc.o \
$O/reduce.shared.o \
$O/rthetaphi_xyz.shared.o \
$O/spline_routines.shared.o \
@@ -231,6 +237,9 @@ xcombine_vol_data_vtk_SHARED_OBJECTS = \
$O/make_ellipticity.shared.o \
$O/model_prem.shared.o \
$O/parallel.sharedmpi.o \
+ $O/read_parameter_file.shared.o \
+ $O/read_value_parameters.shared.o \
+ $O/param_reader.cc.o \
$O/reduce.shared.o \
$O/rthetaphi_xyz.shared.o \
$O/spline_routines.shared.o \
@@ -255,6 +264,9 @@ xcombine_vol_data_vtk_adios_SHARED_OBJECTS = \
$O/make_ellipticity.shared.o \
$O/model_prem.shared.o \
$O/parallel.sharedmpi.o \
+ $O/read_parameter_file.shared.o \
+ $O/read_value_parameters.shared.o \
+ $O/param_reader.cc.o \
$O/reduce.shared.o \
$O/rthetaphi_xyz.shared.o \
$O/spline_routines.shared.o \
diff --git a/src/meshfem3D/initialize_mesher.f90 b/src/meshfem3D/initialize_mesher.f90
index 4495ed2..6c0039d 100644
--- a/src/meshfem3D/initialize_mesher.f90
+++ b/src/meshfem3D/initialize_mesher.f90
@@ -69,7 +69,7 @@
call read_compute_parameters()
endif
- ! distributes parameters from master to all processes
+ ! broadcast parameters read from master to all processes
call broadcast_computed_parameters(myrank)
! check that the code is running with the requested number of processes
diff --git a/src/shared/parallel.f90 b/src/shared/parallel.f90
index 6d309b7..e166736 100644
--- a/src/shared/parallel.f90
+++ b/src/shared/parallel.f90
@@ -25,28 +25,28 @@
!
!=====================================================================
-!! DK DK July 2014, CNRS Marseille, France:
-!! DK DK added the ability to run several calculations (several earthquakes)
-!! DK DK in an embarrassingly-parallel fashion from within the same run;
-!! DK DK this can be useful when using a very large supercomputer to compute
-!! DK DK many earthquakes in a catalog, in which case it can be better from
-!! DK DK a batch job submission point of view to start fewer and much larger jobs,
-!! DK DK each of them computing several earthquakes in parallel.
-!! DK DK To turn that option on, set parameter NUMBER_OF_SIMULTANEOUS_RUNS
-!! DK DK to a value greater than 1 in file setup/constants.h.in before
-!! DK DK configuring and compiling the code.
-!! DK DK To implement that, we create NUMBER_OF_SIMULTANEOUS_RUNS MPI sub-communicators,
-!! DK DK each of them being labeled "my_local_mpi_comm_world", and we use them
-!! DK DK in all the routines in "src/shared/parallel.f90", except in MPI_ABORT() because in that case
-!! DK DK we need to kill the entire run.
-!! DK DK When that option is on, of course the number of processor cores used to start
-!! DK DK the code in the batch system must be a multiple of NUMBER_OF_SIMULTANEOUS_RUNS,
-!! DK DK all the individual runs must use the same number of processor cores,
-!! DK DK which as usual is NPROC in the input file DATA/Par_file,
-!! DK DK and thus the total number of processor cores to request from the batch system
-!! DK DK should be NUMBER_OF_SIMULTANEOUS_RUNS * NPROC.
-!! DK DK All the runs to perform must be placed in directories called run0001, run0002, run0003 and so on
-!! DK DK (with exactly four digits).
+! Dimitri Komatitsch, July 2014, CNRS Marseille, France:
+! added the ability to run several calculations (several earthquakes)
+! in an embarrassingly-parallel fashion from within the same run;
+! this can be useful when using a very large supercomputer to compute
+! many earthquakes in a catalog, in which case it can be better from
+! a batch job submission point of view to start fewer and much larger jobs,
+! each of them computing several earthquakes in parallel.
+! To turn that option on, set parameter NUMBER_OF_SIMULTANEOUS_RUNS
+! to a value greater than 1 in file setup/constants.h.in before
+! configuring and compiling the code.
+! To implement that, we create NUMBER_OF_SIMULTANEOUS_RUNS MPI sub-communicators,
+! each of them being labeled "my_local_mpi_comm_world", and we use them
+! in all the routines in "src/shared/parallel.f90", except in MPI_ABORT() because in that case
+! we need to kill the entire run.
+! When that option is on, of course the number of processor cores used to start
+! the code in the batch system must be a multiple of NUMBER_OF_SIMULTANEOUS_RUNS,
+! all the individual runs must use the same number of processor cores,
+! which as usual is NPROC in the input file DATA/Par_file,
+! and thus the total number of processor cores to request from the batch system
+! should be NUMBER_OF_SIMULTANEOUS_RUNS * NPROC.
+! All the runs to perform must be placed in directories called run0001, run0002, run0003 and so on
+! (with exactly four digits).
module my_mpi
@@ -68,16 +68,26 @@ end module my_mpi
subroutine init_mpi()
- use mpi
+ use my_mpi
+ use shared_parameters, only: NUMBER_OF_SIMULTANEOUS_RUNS,BROADCAST_SAME_MESH_AND_MODEL
implicit none
- integer :: ier
+ integer :: myrank,ier
! initialize the MPI communicator and start the NPROCTOT MPI processes.
call MPI_INIT(ier)
if (ier /= 0 ) stop 'Error initializing MPI'
+ ! we need to make sure that NUMBER_OF_SIMULTANEOUS_RUNS and BROADCAST_SAME_MESH_AND_MODEL are read before calling world_split()
+ ! read the parameter file and compute additional parameters
+ call MPI_COMM_RANK(MPI_COMM_WORLD,myrank,ier)
+ if (myrank == 0) call read_parameter_file()
+ ! broadcast parameters read from master to all processes
+ my_local_mpi_comm_world = MPI_COMM_WORLD
+ call bcast_all_singlei(NUMBER_OF_SIMULTANEOUS_RUNS)
+ call bcast_all_singlel(BROADCAST_SAME_MESH_AND_MODEL)
+
! create sub-communicators if needed, if running more than one earthquake from the same job
call world_split()
@@ -568,6 +578,24 @@ end module my_mpi
!-------------------------------------------------------------------------------------------------
!
+ subroutine bcast_all_singlel(buffer)
+
+ use my_mpi
+
+ implicit none
+
+ logical :: buffer
+
+ integer :: ier
+
+ call MPI_BCAST(buffer,1,MPI_LOGICAL,0,my_local_mpi_comm_world,ier)
+
+ end subroutine bcast_all_singlel
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
subroutine bcast_all_i(buffer, countval)
use my_mpi
@@ -1496,8 +1524,8 @@ end module my_mpi
!
! create sub-communicators if needed, if running more than one earthquake from the same job.
-!! DK DK create a sub-communicator for each independent run;
-!! DK DK if there is a single run to do, then just copy the default communicator to the new one
+! create a sub-communicator for each independent run;
+! if there is a single run to do, then just copy the default communicator to the new one
subroutine world_split()
use my_mpi
diff --git a/src/shared/rules.mk b/src/shared/rules.mk
index 10f92ab..eaa2a6b 100644
--- a/src/shared/rules.mk
+++ b/src/shared/rules.mk
@@ -131,7 +131,7 @@ $O/%.shared.o: $S/%.f90 $O/shared_par.shared_module.o
$O/%.shared.o: $S/%.F90 $O/shared_par.shared_module.o
${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
-$O/%.sharedmpi.o: $S/%.f90 $O/shared_par.shared_module.o
+$O/%.sharedmpi.o: $S/%.f90 $O/shared_par.shared_module.o $O/read_parameter_file.shared.o $O/read_value_parameters.shared.o
${MPIFCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
## adios
diff --git a/src/specfem3D/initialize_simulation.f90 b/src/specfem3D/initialize_simulation.f90
index 138bbf7..ce1d703 100644
--- a/src/specfem3D/initialize_simulation.f90
+++ b/src/specfem3D/initialize_simulation.f90
@@ -78,7 +78,7 @@
endif
endif
- ! distributes parameters from master to all processes
+ ! broadcast parameters read from master to all processes
call broadcast_computed_parameters(myrank)
! check that the code is running with the requested nb of processes
More information about the CIG-COMMITS
mailing list