Difference between revisions of "Work Plan In Memory Adapt"

From PHASTA Wiki
Jump to: navigation, search
(Detailed Description of Phases)
 
(20 intermediate revisions by 2 users not shown)
Line 1: Line 1:
SUMMARY of phases
+
== Summary of Phases ==
  
phase0= clean syncio (almost there)
+
*phase0 wrapper layer that supports both syncio and posix - done 7/20/2015
 
+
*phase1 PHASTA can read AND write both - done 7/22/2015
phase1=PHASTA can read AND write both
+
*phase2 PHASTA runs after chef though an in-memory read of Chef's written in-memory data - done
 
+
*phase3 PHASTA writes its field back to chef and lets chef do a UR on its mesh and transfers fields - done
phase2=PHASTA runs after chef though an in-memory read of Chef's written in-memory data
+
*phase4 bring that result back to phasta (so chef->PHASTA->chef-UR->PHASTA-UR) - done
 
+
*phase5 replace UR with local adaptation - done
phase3=PHASTA writes its field back to chef and lets chef do a UR on its mesh and transfers fields  
+
*phase6 loop and we are done - done
 
 
phase4= bring that result back to phasta (so chef->PHASTA->chef-UR->PHASTA-UR)
 
 
 
phase5=replace UR with local adaptation
 
 
 
phase6=loop and we are done
 
  
 +
== phastaIO ==
  
 
For the sake of discussion lets group phastaIO functions as follows
 
For the sake of discussion lets group phastaIO functions as follows
  
A) init
+
<pre>
 
+
init
B) open-close
+
open-close
 
+
read  (readheader, readdatablock)
C) read  (readheader, readdatablock)
+
write  (writeheader, writedatablock)
 
+
initalize
D) write  (writeheader, writedatablock)
+
</pre>
 
 
E) finalize
 
 
 
DETAIL
 
 
 
phase0
 
 
 
  0.1 Move field string construction into C)-  status:  CWS has done this for  syncio (top of routines so not yet in a syncio conditional but this is not necessary until phase1)
 
 
 
  0.2 Move file name  construction into B)-  status: not started but I think CWS indicated it was basically same work as 0.1 so leaving that with him. Note we don’t want this in init (at least for restarts) because we init only once but possibly write multiple times and the filename changes.
 
 
 
  0.3 Migrating all of PHASTA to use 0.1 dev - status:  CWS did it for readnblk.f and this built and ran (YAY), KEJ is migrating it to the balance of PHASTA (hopefully complete to  15-July-11)
 
 
 
  0.4  Repeat 0.1-0.3 for writing of files
 
 
 
phase1
 
 
 
  1.1  Migrate string constructors into  conditional for syncio
 
 
 
  1.2  Create posix counterparts and put them in the posix branch of conditional
 
 
 
  1.3 make init and finalize functions that have a universal call but, via conditionals (likely posix just returns but syncio has stuff to do but we want the PHASTA side to look the same regardless of IO chosen)
 
 
 
  1.3  Debug to be sure that at least all tet meshes can be read with both posix/syncio
 
 
 
  1.4  Debug to make sure that files written are correct (two successive runs)
 
 
 
phase2
 
 
 
  2.1 Create ability for Chef to write to memory location using posixIO pointed at a memory location instead of a file
 
 
 
  2.2 Create ability to pass the descriptor of that memory location to PHASTA  (I think it is safe to assume that since we are one “file” per part in both Chef and PHASTA that this is just the starting location of where Chef started writing)
 
 
 
  2.3 Create ability to have phasta initialize itself with posix-based PHASTAIO reads from this in-memory file/state that Chef wrote
 
 
 
phase3
 
 
 
  3.1 Create ability for PHASTA to write  adapt-fields (solution, d2wall, error, ybar) using posix-based PHASTAIO writes to a memory location
 
 
 
  3.2  Create ability to pass the descriptor of that memory location back to Chef
 
 
 
  3.3  Create ability for Chef to read adapt-fields when passed descriptor
 
 
 
  3.4  Invoke a UR with solution transfer and write files to confirm phase3 success
 
 
 
phase4
 
 
 
  4.1  Should be trivial but have Chef write result of UR to a new memory location and pass descriptor to PHASTA to read and run again (comparing to file based version of the same which we are already doing at scale)
 
 
 
phase5
 
 
 
  5.1  Demonstrate that we can do file based local adaptive refinement with Chef  (I will let Dan and Cameron described the subtask developments here but am more than happy to help plan and assist in any way I can because we really need this capability…I am fine with ignoring/freezing boundary layers to get a working case going before taking on that much tougher nut).
 
 
 
THORNY ISSUES
 
  
phase0
+
To make the interface more simple, I propose, we push init into open and finalize into close.  Furthermore I propose that we consider a wrapper layer approach
 +
where the functions that the PHASTA workflow  directly uses to perform IO are:
  
    1) extra write files.  Seems to me that there should be either
+
*phio_openfile_[read|write] (in addition to specializing filename string for particular library, this function can call queryphmpiio and initphmpiio in the case of syncio)
 +
*phio_readheader
 +
*phio_readdatablock
 +
*phio_writeheader
 +
*phio_writedatablock
 +
*phio_closefile_[read|write]
  
        a) only 2 write_restart and write_field, or
+
These functions will be called by readnblk (and a few others) for reading and Write_restart (and a few clones) for writing.  Principally, these eight functions will be wrappers that take in partial strings and the usual arguments for their PhastaIO functions and then perform the necessary string specializations for the particular flavor of PhastaIO being used (e.g,, syncio or posix) before then ultimately calling the PhastaIO function (that already has a branching based on the two flavors).  Cameron has proposed housing those seven wrappers in phIO.cc which seems fine to me.  Helper functions can go in the same file.
  
        b) an init function and then only write_field
+
Initially, <code>setIOparam()</code> counting of syncio files will be used to determine if sync or posix files will be used.  If the count is zero then assume posix.  Use the count as a switch for file format everywhere (can be replaced later by agreed upon flag for file format...candidates: iotype= binary-posix, binary-mpiio instead of binary (not sure we want to preserve ascii unless it easy to do)
  
    2) dwall currently has two modes (in restart or in a separate file….do we really need to preserve this)
+
== Detailed Description of Phases ==
  
    3) usr.c opens restart to read saved projection vectors. Not a problem per se but might be better to read this while we have the restart already open so that the IO code is more compact. This may involve moving more leslib stuff forward in the code
+
# phase0
 +
## Move field string construction into phio layer - hardcoded in phasta - see https://github.com/cwsmith/phastaChef/issues/17
 +
## Move file name  construction into - done
 +
## Move query and init into phio_opefile_* - done
 +
## Migrating all of PHASTA to use wrapper apis - done
 +
#phase1
 +
## Migrate string constructors into conditional for syncio - done
 +
## Create posix counterparts and put them in the posix branch of conditional - done
 +
## Debug to be sure that at least all tet meshes can be read with both posix/syncio - done
 +
## Debug to make sure that files written are correct (two successive runs) - done
 +
#phase2
 +
## Create ability for Chef to write to memory location using posixIO pointed at a memory location instead of a file - done
 +
## Create ability to pass the descriptor of that memory location to PHASTA  (I think it is safe to assume that since we are one “file” per part in both Chef and PHASTA that this is just the starting location of where Chef started writing) - done
 +
## Create ability to have phasta initialize itself with posix-based PHASTAIO reads from this in-memory file/state that Chef wrote - done
 +
#phase3
 +
## Create ability for PHASTA to write adapt-fields (solution, d2wall, error, ybar) using posix-based PHASTAIO writes to a memory location - done
 +
## Create ability to pass the descriptor of that memory location back to Chef - done
 +
## Create ability for Chef to read adapt-fields when passed descriptor - done
 +
## Invoke a UR with solution transfer and write files to confirm phase3 success - done
 +
#phase4
 +
## Should be trivial but have Chef write result of UR to a new memory location and pass descriptor to PHASTA to read and run again (comparing to file based version of the same which we are already doing at scale) - done
 +
#phase5
 +
## Demonstrate that we can do file based local adaptive refinement with Chef  (I will let Dan and Cameron described the subtask developments here but am more than happy to help plan and assist in any way I can because we really need this capability…I am fine with ignoring/freezing boundary layers to get a working case going before taking on that much tougher nut). - done
  
    4) KEJ is still trying to sort out the roles of {query,init}phmpiio. 
+
==Thorny Issues==
        a) query is called before file is read the first time (same file read again can get by without it  e.g., readlesprojection reads restart a second time)
 
        b) init is called for both reads and writes of syncio files
 
  
        preliminary design plan
+
#phase0
        i) use setIOparam() to count syncio files.  If count=0 then assume posix.  use the count as a switch for file format everywhere (can be replaced later by agreed upon flag for file format...candidates: iotype= binary-posix, binary-mpiio instead of binary (not sure we want to preserve ascii unless it easy to do)
+
## extra write files.  Seems to me that there should be either
        ii) make new function called init and it will basically return doing nothing for posix but for syncio it will call query if it is init for read and then just do what initphmpiio currently does
+
### only 2  write_restart and write_field, or
        iii) this should allow us to push all init stuff into a single function or potentially all the way into openfile so that there are only 6 functions that any users sees in phastaIO for either syncio or posix
+
### an init function and then only write_field
        openfile, closefile, {read,write}X{header,datablock}
+
## dwall currently has two modes (in restart or in a separate file….do we really need to preserve this)
 +
## usr.c opens restart to read saved projection vectors.  Not a problem per se but might be better to read this while we have the restart already open so that the IO code is more compact.  This may involve moving more leslib stuff forward in the code
 +
## KEJ is still trying to sort out the roles of {query,init}phmpiio. 
 +
### query is called before file is read the first time (same file read again can get by without it  e.g., readlesprojection reads restart a second time)
 +
### init is called for both reads and writes of syncio files

Latest revision as of 16:01, 20 November 2015

Summary of Phases

  • phase0 wrapper layer that supports both syncio and posix - done 7/20/2015
  • phase1 PHASTA can read AND write both - done 7/22/2015
  • phase2 PHASTA runs after chef though an in-memory read of Chef's written in-memory data - done
  • phase3 PHASTA writes its field back to chef and lets chef do a UR on its mesh and transfers fields - done
  • phase4 bring that result back to phasta (so chef->PHASTA->chef-UR->PHASTA-UR) - done
  • phase5 replace UR with local adaptation - done
  • phase6 loop and we are done - done

phastaIO

For the sake of discussion lets group phastaIO functions as follows

init
open-close
read  (readheader, readdatablock)
write  (writeheader, writedatablock)
initalize

To make the interface more simple, I propose, we push init into open and finalize into close. Furthermore I propose that we consider a wrapper layer approach where the functions that the PHASTA workflow directly uses to perform IO are:

  • phio_openfile_[read|write] (in addition to specializing filename string for particular library, this function can call queryphmpiio and initphmpiio in the case of syncio)
  • phio_readheader
  • phio_readdatablock
  • phio_writeheader
  • phio_writedatablock
  • phio_closefile_[read|write]

These functions will be called by readnblk (and a few others) for reading and Write_restart (and a few clones) for writing. Principally, these eight functions will be wrappers that take in partial strings and the usual arguments for their PhastaIO functions and then perform the necessary string specializations for the particular flavor of PhastaIO being used (e.g,, syncio or posix) before then ultimately calling the PhastaIO function (that already has a branching based on the two flavors). Cameron has proposed housing those seven wrappers in phIO.cc which seems fine to me. Helper functions can go in the same file.

Initially, setIOparam() counting of syncio files will be used to determine if sync or posix files will be used. If the count is zero then assume posix. Use the count as a switch for file format everywhere (can be replaced later by agreed upon flag for file format...candidates: iotype= binary-posix, binary-mpiio instead of binary (not sure we want to preserve ascii unless it easy to do)

Detailed Description of Phases

  1. phase0
    1. Move field string construction into phio layer - hardcoded in phasta - see https://github.com/cwsmith/phastaChef/issues/17
    2. Move file name construction into - done
    3. Move query and init into phio_opefile_* - done
    4. Migrating all of PHASTA to use wrapper apis - done
  2. phase1
    1. Migrate string constructors into conditional for syncio - done
    2. Create posix counterparts and put them in the posix branch of conditional - done
    3. Debug to be sure that at least all tet meshes can be read with both posix/syncio - done
    4. Debug to make sure that files written are correct (two successive runs) - done
  3. phase2
    1. Create ability for Chef to write to memory location using posixIO pointed at a memory location instead of a file - done
    2. Create ability to pass the descriptor of that memory location to PHASTA (I think it is safe to assume that since we are one “file” per part in both Chef and PHASTA that this is just the starting location of where Chef started writing) - done
    3. Create ability to have phasta initialize itself with posix-based PHASTAIO reads from this in-memory file/state that Chef wrote - done
  4. phase3
    1. Create ability for PHASTA to write adapt-fields (solution, d2wall, error, ybar) using posix-based PHASTAIO writes to a memory location - done
    2. Create ability to pass the descriptor of that memory location back to Chef - done
    3. Create ability for Chef to read adapt-fields when passed descriptor - done
    4. Invoke a UR with solution transfer and write files to confirm phase3 success - done
  5. phase4
    1. Should be trivial but have Chef write result of UR to a new memory location and pass descriptor to PHASTA to read and run again (comparing to file based version of the same which we are already doing at scale) - done
  6. phase5
    1. Demonstrate that we can do file based local adaptive refinement with Chef (I will let Dan and Cameron described the subtask developments here but am more than happy to help plan and assist in any way I can because we really need this capability…I am fine with ignoring/freezing boundary layers to get a working case going before taking on that much tougher nut). - done

Thorny Issues

  1. phase0
    1. extra write files. Seems to me that there should be either
      1. only 2 write_restart and write_field, or
      2. an init function and then only write_field
    2. dwall currently has two modes (in restart or in a separate file….do we really need to preserve this)
    3. usr.c opens restart to read saved projection vectors. Not a problem per se but might be better to read this while we have the restart already open so that the IO code is more compact. This may involve moving more leslib stuff forward in the code
    4. KEJ is still trying to sort out the roles of {query,init}phmpiio.
      1. query is called before file is read the first time (same file read again can get by without it e.g., readlesprojection reads restart a second time)
      2. init is called for both reads and writes of syncio files