next up previous print clean
Next: FUTURE WORK Up: WRITING APPLICATIONS Previous: Distributing a dataset

Restarting and combining

The following examples are taken from the SEPlib WEI library(). They demonstrate how to read a dataset, recognize which elements of the dataset are locally owned, and write status parameter and how to combine a dataset.

This first code portion is executed every time a frequency has been fully migrated. The frequency number currently being processed iw are looped through. A variable named ifreq_doneX, where `X' is the frequency number is created. Then that frequency is set to to 1 by the sep3d_set_sect_param. In this case the image sep file (the sep3d structure rsep) is potentially a distributed dataset along an aritificial axis corresponding to the number of processes that are computing the image. The sep3d_set_sect_param call will automatically write this parameter to its local portion of the image.

  do i=1,size(i_w)
     par="ifreq_done"
     call parcat(par,i_w(i))
    if(adj) then
      if(.not. sep3d_set_sect_param(rsep,par,1)) then
        write(0,*) "trouble writing sect_params"
        return
      end if

The second example is from the portion of the code that checks for a restart request. Here, all of the threads are looped over. For each frequency, we check all of the sections of the image tag to see if any of the threads have processed this frequency.

  do ifreq=1,wsep%n(6) !loop over frequencies
    par="ifreq_done"
    call parcat(par,ifreq)
    iw=-1;
    if(.not. sep3d_grab_sect_param(sep,par,iw)) then
      write(0,*) "trouble grabbing section parameters"
      return
    end if
    if(any(iw==1)) then
Oftentimes we need to make a decision whether to proceed based on whether we own a specific element of the axis we spread along. This code fragment is marking whether or not it owns a given frequency.
  do i=1,wsep%n(6)
    iw_own(i)=sep3d_own(dsep,i)
  end do
In the case of migration, we need to combine all the local images into a global image. This code fragment adds all of the local data (bigc) from the distributed image (big_sep), into the standard SEP dataset (small_sep) buffer bigc2.
       if(.not. sep3d_compress_data(big_sep,small_sep,bigc,bigc2)) then
              write(0,*) "trouble combining data ", fwind
              return
          end if


next up previous print clean
Next: FUTURE WORK Up: WRITING APPLICATIONS Previous: Distributing a dataset
Stanford Exploration Project
5/23/2004