[cig-commits] [commit] devel: adds tool addition_sem to src/tomography (9fd2f43)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Mon Dec 8 08:42:35 PST 2014
Repository : https://github.com/geodynamics/specfem3d_globe
On branch : devel
Link : https://github.com/geodynamics/specfem3d_globe/compare/2cc93c33966a370878432590563633b66f4a1f90...00ae7db05e62851315db5db27dab495a7ec137d3
>---------------------------------------------------------------
commit 9fd2f43b0c55324be21a560098282a1797ac985e
Author: daniel peter <peterda at ethz.ch>
Date: Mon Dec 8 15:32:02 2014 +0100
adds tool addition_sem to src/tomography
>---------------------------------------------------------------
9fd2f43b0c55324be21a560098282a1797ac985e
Makefile.in | 2 ++
.../{difference_sem.f90 => addition_sem.f90} | 38 +++++++++++-----------
src/tomography/difference_sem.f90 | 4 +--
src/tomography/rules.mk | 19 +++++++++++
4 files changed, 42 insertions(+), 21 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 2f523e0..e96bd2d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -301,6 +301,8 @@ endif
@echo " xadd_model_tiso"
@echo " xadd_model_tiso_cg"
@echo " xadd_model_tiso_iso"
+ @echo " xaddition_sem"
+ @echo " xdifference_sem"
@echo " xinterpolate_model"
@echo " xsmooth_sem"
@echo " xsum_kernels"
diff --git a/src/tomography/difference_sem.f90 b/src/tomography/addition_sem.f90
similarity index 89%
copy from src/tomography/difference_sem.f90
copy to src/tomography/addition_sem.f90
index 70c3367..29fe5d8 100644
--- a/src/tomography/difference_sem.f90
+++ b/src/tomography/addition_sem.f90
@@ -26,16 +26,16 @@
!=====================================================================
!------------------------------------------------------------------------------------------------
-! difference_sem
+! addition_sem
!
-! this runs in serial, no need to submit as parallel job.
-! takes the difference between proc***.bin from two different input directories
+! this runs in parallel, please submit as parallel job.
+! adds two proc***.bin files from two different input directories
!
-! usage: ./program_difference_kernel slice_list filename INPUT_dir_1/ INPUT_dir_2/ OUTPUT_DIFF/
+! usage: mpirun -np * ./xaddition_sem filename INPUT_dir_1/ INPUT_dir_2/ OUTPUT_DIR/ [region]
!
!------------------------------------------------------------------------------------------------
-program difference_sem
+program addition_sem
use constants,only: CUSTOM_REAL,NGLLX,NGLLY,NGLLZ,NX_BATHY,NY_BATHY,IIN,IOUT,MAX_STRING_LEN
@@ -72,7 +72,7 @@ program difference_sem
print*, 'Error number of processors supposed to run on : ',NPROCTOT_VAL
print*, 'Error number of MPI processors actually run on: ',sizeprocs
print*
- print*, 'please rerun with: mpirun -np ',NPROCTOT_VAL,' bin/xdifference_sem .. '
+ print*, 'please rerun with: mpirun -np ',NPROCTOT_VAL,' bin/xaddition_sem .. '
endif
call exit_MPI(myrank,'Error wrong number of MPI processes')
endif
@@ -85,14 +85,14 @@ program difference_sem
if (i <= 4 .and. trim(arg(i)) == '') then
if (myrank == 0) then
print *, ' '
- print *, ' Usage: difference_sem kernel_name input1_dir/ input2_dir/ output_dir/ [region]'
+ print *, ' Usage: addition_sem kernel_name input1_dir/ input2_dir/ output_dir/ [region]'
print *, ' '
print *, ' with'
print *, ' kernel_name - takes files with this kernel name'
print *, ' e.g. "vsv" for proc***_reg1_vsv.bin'
print *, ' input1_dir/ - input directory for first files'
print *, ' input2_dir/ - input directory for second files'
- print *, ' output_dir/ - output directory for (first - second) file values'
+ print *, ' output_dir/ - output directory for (first + second) file values'
print *, ' [region] - optional: if region (1/2/3) is not specified, all 3 regions will be taken,'
print *, ' otherwise, only takes region specified'
print *, ' '
@@ -138,7 +138,7 @@ program difference_sem
! user output
if (myrank == 0) then
- write(*,*) 'differencing files: ',sizeprocs,' slices'
+ write(*,*) 'adding files: ',sizeprocs,' slices'
write(*,*)
write(*,*) 'kernel name: ',trim(kernel_name)
write(*,*) 'input 1 directory: ',trim(input1dir)
@@ -205,11 +205,11 @@ program difference_sem
write(*,*)
endif
- ! stores difference between kernel files
- if (myrank == 0) write(*,*) ' difference: (data_1 - data_2)'
+ ! stores sum between kernel files
+ if (myrank == 0) write(*,*) ' addition: (data_1 + data_2)'
! absolute values
- write(file1name,'(a,i6.6,a)') trim(outputdir)//'/proc',iproc,'_'//trim(reg_name)//trim(kernel_name)//'_diff.bin'
+ write(file1name,'(a,i6.6,a)') trim(outputdir)//'/proc',iproc,'_'//trim(reg_name)//trim(kernel_name)//'_add.bin'
if (myrank == 0) write(*,*) ' file: ',trim(file1name)
open(IOUT,file=trim(file1name),form='unformatted',iostat=ier)
if (ier /= 0 ) then
@@ -217,8 +217,8 @@ program difference_sem
stop 'Error opening output data file'
endif
- ! takes the difference
- sem_data(:,:,:,1:nspec) = sem_data(:,:,:,1:nspec) - sem_data_2(:,:,:,1:nspec)
+ ! takes the sums
+ sem_data(:,:,:,1:nspec) = sem_data(:,:,:,1:nspec) + sem_data_2(:,:,:,1:nspec)
write(IOUT) sem_data(:,:,:,1:nspec)
close(IOUT)
@@ -229,8 +229,8 @@ program difference_sem
call min_all_cr(min,min_all)
call max_all_cr(max,max_all)
- ! stores relative difference (k1 - k2)/ k2 with respect to second input file
- write(file1name,'(a,i6.6,a)') trim(outputdir)//'/proc',iproc,'_'//trim(reg_name)//trim(kernel_name)//'_diff_relative.bin'
+ ! stores relative addition (k1 + k2)/ k2 with respect to second input file
+ write(file1name,'(a,i6.6,a)') trim(outputdir)//'/proc',iproc,'_'//trim(reg_name)//trim(kernel_name)//'_add_relative.bin'
if (myrank == 0) write(*,*) ' file: ',trim(file1name)
open(IOUT,file=trim(file1name),form='unformatted',iostat=ier)
if (ier /= 0 ) then
@@ -238,7 +238,7 @@ program difference_sem
stop 'Error opening output data file'
endif
- ! relative difference (k1 - k2)/ k2 with respect to second input file
+ ! relative addition (k1 + k2)/ k2 with respect to second input file
where( sem_data_2(:,:,:,1:nspec) /= 0.0_CUSTOM_REAL)
sem_data(:,:,:,1:nspec) = sem_data(:,:,:,1:nspec) / sem_data_2(:,:,:,1:nspec)
elsewhere
@@ -270,7 +270,7 @@ program difference_sem
write(*,*) ' total min/max : ',min_all,max_all
write(*,*) ' total relative min/max: ',min_rel_all,max_rel_all
write(*,*)
- write(*,*) 'done writing all difference and relative difference files'
+ write(*,*) 'done writing all additions and relative addition files'
write(*,*) 'see output directory: ',trim(outputdir)
write(*,*)
endif
@@ -278,6 +278,6 @@ program difference_sem
! stop all the MPI processes, and exit
call finalize_mpi()
-end program difference_sem
+end program addition_sem
diff --git a/src/tomography/difference_sem.f90 b/src/tomography/difference_sem.f90
index 70c3367..c015049 100644
--- a/src/tomography/difference_sem.f90
+++ b/src/tomography/difference_sem.f90
@@ -28,10 +28,10 @@
!------------------------------------------------------------------------------------------------
! difference_sem
!
-! this runs in serial, no need to submit as parallel job.
+! this runs in parallel, please submit as parallel job.
! takes the difference between proc***.bin from two different input directories
!
-! usage: ./program_difference_kernel slice_list filename INPUT_dir_1/ INPUT_dir_2/ OUTPUT_DIFF/
+! usage: mpirun -np * ./xdifference_sem filename INPUT_dir_1/ INPUT_dir_2/ OUTPUT_DIR/ [region]
!
!------------------------------------------------------------------------------------------------
diff --git a/src/tomography/rules.mk b/src/tomography/rules.mk
index d50feb8..dbe87c3 100644
--- a/src/tomography/rules.mk
+++ b/src/tomography/rules.mk
@@ -32,6 +32,7 @@ tomography_TARGETS = \
$E/xadd_model_tiso \
$E/xadd_model_tiso_cg \
$E/xadd_model_tiso_iso \
+ $E/xaddition_sem \
$E/xdifference_sem \
$E/xinterpolate_model \
$E/xsmooth_sem \
@@ -50,6 +51,7 @@ tomography_OBJECTS = \
$(xadd_model_tiso_OBJECTS) \
$(xadd_model_tiso_cg_OBJECTS) \
$(xadd_model_tiso_iso_OBJECTS) \
+ $(xaddition_sem_OBJECTS) \
$(xdifference_sem_OBJECTS) \
$(xinterpolate_model_OBJECTS) \
$(xsmooth_sem_OBJECTS) \
@@ -61,6 +63,7 @@ tomography_OBJECTS = \
# These files come from the shared directory
tomography_SHARED_OBJECTS = \
$(xadd_model_SHARED_OBJECTS) \
+ $(xaddition_sem_SHARED_OBJECTS) \
$(xdifference_sem_SHARED_OBJECTS) \
$(xinterpolate_model_SHARED_OBJECTS) \
$(xsmooth_sem_SHARED_OBJECTS) \
@@ -186,6 +189,22 @@ xconvert_model_file_adios_SHARED_OBJECTS = \
${E}/xconvert_model_file_adios: $(xconvert_model_file_adios_OBJECTS) $(xconvert_model_file_adios_SHARED_OBJECTS)
${MPIFCCOMPILE_CHECK} -o $@ $+ $(MPILIBS)
+##
+## xaddition_sem
+##
+xaddition_sem_OBJECTS = \
+ $O/addition_sem.tomo.o \
+ $(EMPTY_MACRO)
+
+xaddition_sem_SHARED_OBJECTS = \
+ $O/shared_par.shared_module.o \
+ $O/parallel.sharedmpi.o \
+ $O/exit_mpi.shared.o \
+ $(EMPTY_MACRO)
+
+${E}/xaddition_sem: $(xaddition_sem_OBJECTS) $(xaddition_sem_SHARED_OBJECTS)
+ ${MPIFCCOMPILE_CHECK} -o $@ $+
+
##
## xdifference_sem
More information about the CIG-COMMITS
mailing list