[cig-commits] [commit] devel: removed unused variables introduced by the CUDA commits (c2dde5a)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri Jan 23 09:49:33 PST 2015


Repository : https://github.com/geodynamics/specfem2d

On branch  : devel
Link       : https://github.com/geodynamics/specfem2d/compare/8baeffbdb460a04e95ab9ceacec67a1545d6c86a...c2dde5a4d7f2ed1ea993122c3592153d791c0e8a

>---------------------------------------------------------------

commit c2dde5a4d7f2ed1ea993122c3592153d791c0e8a
Author: Dimitri Komatitsch <komatitsch at lma.cnrs-mrs.fr>
Date:   Fri Jan 23 18:39:09 2015 +0100

    removed unused variables introduced by the CUDA commits


>---------------------------------------------------------------

c2dde5a4d7f2ed1ea993122c3592153d791c0e8a
 src/specfem2D/assemble_MPI.F90         | 37 ++++++++++++++-------
 src/specfem2D/elastic_cuda.f90         |  4 +--
 src/specfem2D/exit_mpi.F90             | 60 ++++++++--------------------------
 src/specfem2D/prepare_timerun_body.F90 |  5 +++
 4 files changed, 46 insertions(+), 60 deletions(-)

diff --git a/src/specfem2D/assemble_MPI.F90 b/src/specfem2D/assemble_MPI.F90
index 4e0d19a..3cfeaa7 100644
--- a/src/specfem2D/assemble_MPI.F90
+++ b/src/specfem2D/assemble_MPI.F90
@@ -539,6 +539,7 @@
 #endif
 
 
+#ifdef USE_MPI
  subroutine assemble_MPI_scalar_send_cuda(NPROC, &
                                            buffer_send_scalar_ext_mesh,buffer_recv_scalar_ext_mesh, &
                                            num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh, &
@@ -565,7 +566,7 @@
   integer, dimension(2*num_interfaces_ext_mesh) :: tab_requests_send_recv_ext_mesh
 integer, dimension(num_interfaces_ext_mesh), intent(in)  :: inum_interfaces_acoustic
   ! local parameters
-  integer :: iinterface,i,num_interface
+  integer :: iinterface,num_interface
 
   tab_requests_send_recv_ext_mesh(:) = 0
 
@@ -581,9 +582,6 @@ integer, dimension(num_interfaces_ext_mesh), intent(in)  :: inum_interfaces_acou
 
      num_interface=inum_interfaces_acoustic(iinterface)
 
-
-
-
       call isend_cr(buffer_send_scalar_ext_mesh(1,num_interface), &
                     nibool_interfaces_ext_mesh(num_interface), &
                     my_neighbours_ext_mesh(num_interface), &
@@ -601,6 +599,7 @@ integer, dimension(num_interfaces_ext_mesh), intent(in)  :: inum_interfaces_acou
   endif
 
   end subroutine assemble_MPI_scalar_send_cuda
+#endif
 
 !
 !-------------------------------------------------------------------------------------------------
@@ -642,12 +641,14 @@ integer, dimension(num_interfaces_ext_mesh), intent(in)  :: inum_interfaces_acou
     do iinterface = 1, ninterface_acoustic
    num_interface=inum_interfaces_acoustic(iinterface)
 
+#ifdef USE_MPI
       call wait_req(tab_requests_send_recv_ext_mesh(num_interface+num_interfaces_ext_mesh))
+#else
+!! DK DK this dummy statement just to avoid a compiler warning about an unused variable
+      tab_requests_send_recv_ext_mesh(num_interface+num_interfaces_ext_mesh) = 0
+#endif
     enddo
 
-
-
-
     ! adding contributions of neighbours
     call transfer_asmbl_pot_to_device(Mesh_pointer,buffer_recv_scalar_ext_mesh,FORWARD_OR_ADJOINT)
 
@@ -655,7 +656,9 @@ integer, dimension(num_interfaces_ext_mesh), intent(in)  :: inum_interfaces_acou
      do iinterface = 1, ninterface_acoustic
        num_interface=inum_interfaces_acoustic(iinterface)
 
+#ifdef USE_MPI
       call wait_req(tab_requests_send_recv_ext_mesh(num_interface))
+#endif
     enddo
 
   endif
@@ -669,6 +672,7 @@ integer, dimension(num_interfaces_ext_mesh), intent(in)  :: inum_interfaces_acou
 !
 
 
+#ifdef USE_MPI
   subroutine assemble_MPI_vector_send_cuda(NPROC, &
                                           buffer_send_vector_ext_mesh,buffer_recv_vector_ext_mesh, &
                                           num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh, &
@@ -683,7 +687,7 @@ integer, dimension(num_interfaces_ext_mesh), intent(in)  :: inum_interfaces_acou
 
   implicit none
 
-  integer :: NPROC,i
+  integer :: NPROC
 
   integer :: num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh,ninterface_elastic
 
@@ -719,13 +723,14 @@ integer, dimension(num_interfaces_ext_mesh), intent(in)  :: inum_interfaces_acou
   endif
 
   end subroutine assemble_MPI_vector_send_cuda
+#endif
 
 
 !
 !-------------------------------------------------------------------------------------------------
 !
 
-  subroutine assemble_MPI_vector_write_cuda(NPROC,NGLOB_AB, Mesh_pointer, &
+  subroutine assemble_MPI_vector_write_cuda(NPROC,Mesh_pointer, &
                                             buffer_recv_vector_ext_mesh, &
                                             num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh, &
                                             nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, &
@@ -739,7 +744,6 @@ integer, dimension(num_interfaces_ext_mesh), intent(in)  :: inum_interfaces_acou
   implicit none
 
   integer :: NPROC
-  integer :: NGLOB_AB
   integer(kind=8) :: Mesh_pointer
 
 
@@ -766,7 +770,12 @@ integer, dimension(num_interfaces_ext_mesh), intent(in)  :: inum_interfaces_acou
     ! wait for communications completion (recv)
 do iinterface = 1, ninterface_elastic
        num_interface=inum_interfaces_elastic(iinterface)
+#ifdef USE_MPI
       call wait_req(tab_requests_send_recv_vector(num_interface + num_interfaces_ext_mesh))
+#else
+!! DK DK this dummy statement just to avoid a compiler warning about an unused variable
+      tab_requests_send_recv_vector(num_interface + num_interfaces_ext_mesh) = 0
+#endif
 enddo
 
 
@@ -789,7 +798,9 @@ enddo
     ! wait for communications completion (send)
     do iinterface = 1, ninterface_elastic
        num_interface=inum_interfaces_elastic(iinterface)
+#ifdef USE_MPI
       call wait_req(tab_requests_send_recv_vector(num_interface))
+#endif
     enddo
 
   endif
@@ -826,7 +837,6 @@ enddo
        buffer_recv_vector_ext_mesh
 
   integer, dimension(2*num_interfaces_ext_mesh) :: tab_requests_send_recv_vector
-  integer, dimension(num_interfaces_ext_mesh) :: nibool_interfaces_ext_mesh
   integer, dimension(num_interfaces_ext_mesh), intent(in)  :: inum_interfaces_elastic
   ! local parameters
   integer :: iinterface,num_interface
@@ -842,7 +852,12 @@ enddo
     !write(IMAIN,*) "sending MPI_wait"
     do iinterface = 1, ninterface_elastic
        num_interface=inum_interfaces_elastic(iinterface)
+#ifdef USE_MPI
       call wait_req(tab_requests_send_recv_vector(num_interface+num_interfaces_ext_mesh))
+#else
+!! DK DK this dummy statement just to avoid a compiler warning about an unused variable
+      tab_requests_send_recv_vector(num_interface+num_interfaces_ext_mesh) = 0
+#endif
     enddo
 
 
diff --git a/src/specfem2D/elastic_cuda.f90 b/src/specfem2D/elastic_cuda.f90
index 2a8852c..43d5a86 100644
--- a/src/specfem2D/elastic_cuda.f90
+++ b/src/specfem2D/elastic_cuda.f90
@@ -172,7 +172,7 @@ subroutine compute_forces_elastic_GPU()
     else
 
 !       waits for send/receive requests to be completed and assembles values
-         call assemble_MPI_vector_write_cuda(NPROC,NGLOB_AB, Mesh_pointer,&
+         call assemble_MPI_vector_write_cuda(NPROC,Mesh_pointer,&
                       buffer_recv_vector_ext_mesh,ninterface,&
                       max_nibool_interfaces_ext_mesh, &
                       nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, &
@@ -180,7 +180,7 @@ subroutine compute_forces_elastic_GPU()
                       1,ninterface_elastic,inum_interfaces_elastic)
          ! adjoint simulations
          if( SIMULATION_TYPE == 3 ) then
-         call assemble_MPI_vector_write_cuda(NPROC,NGLOB_AB, Mesh_pointer,&
+           call assemble_MPI_vector_write_cuda(NPROC,Mesh_pointer,&
                               b_buffer_recv_vector_ext_mesh,ninterface,&
                               max_nibool_interfaces_ext_mesh, &
                               nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, &
diff --git a/src/specfem2D/exit_mpi.F90 b/src/specfem2D/exit_mpi.F90
index e418f81..e158633 100644
--- a/src/specfem2D/exit_mpi.F90
+++ b/src/specfem2D/exit_mpi.F90
@@ -72,9 +72,6 @@ subroutine exit_MPI(error_msg)
 
 end subroutine exit_MPI
 
-
-
-
 !-------------------------------------------------------------------------------------------------
 !
 ! I/O wrapper function
@@ -106,31 +103,26 @@ end subroutine exit_MPI
 !----
 !
 
+#ifdef USE_MPI
 
   subroutine isend_cr(sendbuf, sendcount, dest, sendtag, req)
 
 ! standard include of the MPI library
-#ifdef USE_MPI
   use mpi
-#endif
 
   implicit none
 
   include "constants.h"
 
-#ifdef USE_MPI
   include "precision.h"
-#endif
 
   integer sendcount, dest, sendtag, req
   real(kind=CUSTOM_REAL), dimension(sendcount) :: sendbuf
 
   integer ier
 
-#ifdef USE_MPI
-  call MPI_ISEND(sendbuf,sendcount,CUSTOM_MPI_TYPE,dest,sendtag, &
-                  MPI_COMM_WORLD,req,ier)
-#endif
+  call MPI_ISEND(sendbuf,sendcount,CUSTOM_MPI_TYPE,dest,sendtag,MPI_COMM_WORLD,req,ier)
+
   end subroutine isend_cr
 
 !
@@ -140,25 +132,20 @@ end subroutine exit_MPI
   subroutine irecv_cr(recvbuf, recvcount, dest, recvtag, req)
 
 ! standard include of the MPI library
-#ifdef USE_MPI
   use mpi
-#endif
 
   implicit none
 
   include "constants.h"
-#ifdef USE_MPI
   include "precision.h"
-#endif
 
   integer recvcount, dest, recvtag, req
   real(kind=CUSTOM_REAL), dimension(recvcount) :: recvbuf
 
   integer ier
-#ifdef USE_MPI
-  call MPI_IRECV(recvbuf,recvcount,CUSTOM_MPI_TYPE,dest,recvtag, &
-                  MPI_COMM_WORLD,req,ier)
-#endif
+
+  call MPI_IRECV(recvbuf,recvcount,CUSTOM_MPI_TYPE,dest,recvtag,MPI_COMM_WORLD,req,ier)
+
   end subroutine irecv_cr
 
 !
@@ -168,23 +155,18 @@ end subroutine exit_MPI
   subroutine wait_req(req)
 
 ! standard include of the MPI library
-#ifdef USE_MPI
   use mpi
-#endif
 
   implicit none
 
   integer :: req
 
-#ifdef USE_MPI
   integer, dimension(MPI_STATUS_SIZE) :: req_mpi_status
-#endif
-
 
   integer :: ier
-#ifdef USE_MPI
+
   call mpi_wait(req,req_mpi_status,ier)
-#endif
+
   end subroutine wait_req
 
 !
@@ -194,20 +176,16 @@ end subroutine exit_MPI
   subroutine sync_all()
 
 ! standard include of the MPI library
-#ifdef USE_MPI
   use mpi
-#endif
 
   implicit none
 
   integer ier
-#ifdef USE_MPI
+
   call MPI_BARRIER(MPI_COMM_WORLD,ier)
-#endif
 
   end subroutine sync_all
 
-
 !
 !----
 !
@@ -215,25 +193,18 @@ end subroutine exit_MPI
   subroutine min_all_i(sendbuf, recvbuf)
 
 ! standard include of the MPI library
-#ifdef USE_MPI
   use mpi
-#endif
 
   implicit none
 
   include "constants.h"
 
-#ifdef USE_MPI
   include "precision.h"
-#endif
 
   integer:: sendbuf, recvbuf
   integer ier
 
-#ifdef USE_MPI
-  call MPI_REDUCE(sendbuf,recvbuf,1,MPI_INTEGER, &
-                  MPI_MIN,0,MPI_COMM_WORLD,ier)
-#endif
+  call MPI_REDUCE(sendbuf,recvbuf,1,MPI_INTEGER,MPI_MIN,0,MPI_COMM_WORLD,ier)
 
   end subroutine min_all_i
 
@@ -244,25 +215,20 @@ end subroutine exit_MPI
   subroutine max_all_i(sendbuf, recvbuf)
 
 ! standard include of the MPI library
-#ifdef USE_MPI
   use mpi
-#endif
 
   implicit none
 
   include "constants.h"
 
-#ifdef USE_MPI
   include "precision.h"
-#endif
 
   integer :: sendbuf, recvbuf
   integer :: ier
 
-#ifdef USE_MPI
-  call MPI_REDUCE(sendbuf,recvbuf,1,MPI_INTEGER, &
-                  MPI_MAX,0,MPI_COMM_WORLD,ier)
-#endif
+  call MPI_REDUCE(sendbuf,recvbuf,1,MPI_INTEGER,MPI_MAX,0,MPI_COMM_WORLD,ier)
 
   end subroutine max_all_i
 
+#endif
+
diff --git a/src/specfem2D/prepare_timerun_body.F90 b/src/specfem2D/prepare_timerun_body.F90
index dad76e1..bdf0e03 100644
--- a/src/specfem2D/prepare_timerun_body.F90
+++ b/src/specfem2D/prepare_timerun_body.F90
@@ -55,9 +55,14 @@ subroutine prepare_timerun()
   call initialize_cuda_device(myrank,ncuda_devices)
 
   ! collects min/max of local devices found for statistics
+#ifdef USE_MPI
   call sync_all()
   call min_all_i(ncuda_devices,ncuda_devices_min)
   call max_all_i(ncuda_devices,ncuda_devices_max)
+#else
+  ncuda_devices_min = ncuda_devices
+  ncuda_devices_max = ncuda_devices
+#endif
 
   if( myrank == 0 ) then
     write(IOUT,*) "GPU number of devices per node: min =",ncuda_devices_min



More information about the CIG-COMMITS mailing list