Changes between Version 25 and Version 26 of Piernik

Show
Ignore:
Timestamp:
03/24/13 17:10:05 (12 years ago)
Author:
mmamonski
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Piernik

    v25 v26  
    243243== MPI enabling == 
    244244As mentioned PIERNIK is an MPI code and there is one MUSCLE cavet that must be taken into while MUSCLEizing legacy applications: the MUSCLE Send and Receive routines must be called **only** by rank zero process. Until now we spawned only one process by kernel so no extra effort was needed. Now we will add some additional logic exploiting MPI_Bcast, MPI_Gather and MPI_Scatter calls. We need to to do this whenever MUSCLE send or receive operations are used: 
    245 {{{ 
    246  
    247   !timestep.F90 time_step routine 
     245 * timestep.F90 time_step routine 
     246{{{ 
    248247      if (master) then 
    249248         ts = set_timer("dt_mc_receive") 
     
    254253      !broadcast dt_mc value 
    255254      call MPI_Bcast(dt_mc, 1, MPI_DOUBLE_PRECISION, 0, comm, ierr) 
    256  
    257 ... 
    258  
    259    !piernik.F90 main routine 
     255}}} 
     256  * piernik.F90 main routine 
     257{{{ 
    260258#ifdef MHD_KERNEL 
    261259      call time_step(dt) 
     
    273271      call MPI_Bcast(dt, 1, MPI_DOUBLE_PRECISION, 0, comm, ierr) 
    274272#endif 
    275  
    276  
     273}}} 
     274  * piernik.F90 send_gas_state routine 
     275{{{ 
     276      call MPI_Gather(rho_gas, size(rho_gas), MPI_DOUBLE_PRECISION, rho_gas_global, size(rho_gas), MPI_DOUBLE_PRECISION, 0, comm, ierr) 
     277      call MPI_Gather(m_gas, size(m_gas), MPI_DOUBLE_PRECISION,  m_gas_global, size(m_gas), MPI_DOUBLE_PRECISION, 0, comm, ierr) 
     278 
     279      if (master) then 
     280         call MUSCLE_Send("rho_gas", rho_gas_global, %REF(size(rho_gas_global)), MUSCLE_DOUBLE) !here we assume that real is always real*8 
     281         call MUSCLE_Send("m_gas", m_gas_global, %REF(size(m_gas_global)), MUSCLE_DOUBLE) !here we assume that real is always real*8 
     282      endif 
     283}}} 
     284  * mc.F90 get_gas_state routine 
     285{{{ 
     286         if (master) then 
     287            call MUSCLE_Receive("rho_gas", rho_gas_global, %REF(size(rho_gas_global)), MUSCLE_DOUBLE) !here we assume that real is always real*8 
     288            call MUSCLE_Receive("m_gas", m_gas_global, %REF(size(m_gas_global)), MUSCLE_DOUBLE) !here we assume that real is always real*8 
     289         endif 
     290         call MPI_Scatter(rho_gas_global, size(rho_gas), MPI_DOUBLE_PRECISION, rho_gas, size(rho_gas), MPI_DOUBLE_PRECISION, 0, comm, ierr) 
     291         call MPI_Scatter(m_gas_global, size(m_gas), MPI_DOUBLE_PRECISION, m_gas, size(m_gas), MPI_DOUBLE_PRECISION, 0, comm, ierr) 
    277292 
    278293}}}