Difference between revisions of "For developers"

From ccrmwiki
Jump to: navigation, search
m
Line 9: Line 9:
 
If you do need to have all processes write e.g. debug messages, you’d then use channel 12 (see below).
 
If you do need to have all processes write e.g. debug messages, you’d then use channel 12 (see below).
  
Here are all I/O channel numbers used in different sub-models of SELFE (bold numbers mean they have been used by other sub-models and you’d avoid using them):
+
Below are all I/O channel numbers used in different sub-models of SELFE (bold numbers mean they have been used by other sub-models and you’d avoid using them). Please add your numbers
 +
as soon as you change the code so as to prevent others from using it. A good way to find out if a number is available is to issue the following cmd from src/:
 +
 
 +
grep "61" *.*.F90  -->Looks for '61'
  
 
* Hydro/: Channels between 8 and 200 are used by various codes for I/O. In particular:
 
* Hydro/: Channels between 8 and 200 are used by various codes for I/O. In particular:
Line 32: Line 35:
 
* No spaces between “#” (pre-processor) and if/else/end;
 
* No spaces between “#” (pre-processor) and if/else/end;
 
* Don’t use “!” inside write/print or any other non-comment portion;
 
* Don’t use “!” inside write/print or any other non-comment portion;
 +
*Try to use the I/O channel number directly, e.g., read(61, etc instead of assigning a number to a variable (e.g. read(ich,). This'd facilitate others searching for conflicts.

Revision as of 11:52, 6 March 2013

All svn account holders need to familiarize themselves with the following rules.

Sharing I/O channels in SELFE

You need to exercise caution when dealing with parallel I/O especially for writing. For writing outputs, you’d generally let only 1 process do the job, e.g.

if(myrank==0) write(10,*)…..

If you do need to have all processes write e.g. debug messages, you’d then use channel 12 (see below).

Below are all I/O channel numbers used in different sub-models of SELFE (bold numbers mean they have been used by other sub-models and you’d avoid using them). Please add your numbers

as soon as you change the code so as to prevent others from using it. A good way to find out if a number is available is to issue the following cmd from src/:

grep "61" *.*.F90 -->Looks for '61'

  • Hydro/: Channels between 8 and 200 are used by various codes for I/O. In particular:
    • 12: this channel is initialized by different processes to point to files outputs/nonfatal_xxxx, where “xxxx” are the process IDs. Therefore it’s very useful for debugging purpose; you can use it anywhere
    • 101 to 100+noutputs (inclusive of both): reserved for global outputs (including from tracers from sediment, EcoSim, ICM, as well as WWM);
    • 201-250: non-standard outputs (e.g. at sidecenters, prism centers);
    • 251 to 259: reserved for station outputs
    • 301 to 300+ntracers: reading channels for non-point source inputs for ICM
    • 10, 31, 32: used for one-off I/O – can be used by other sub-models as long as you close them immediately after use in your part of the code to dump messages to these files
    • 16: this channel points to mirror.out (on rank 0), the main message output for info about the run. You should use it with if(myrank==0)
  • WWM
    • 1100 to 1200: handles for inputs/outputs etc
  • EcoSim
    • 600: outputting some messages
  • Sediment
  • Sed2D
    • 26

Rules for contributing your code to be included in the SELFE package

Here are some rules for preparing your own code:

  • No spaces between “#” (pre-processor) and if/else/end;
  • Don’t use “!” inside write/print or any other non-comment portion;
  • Try to use the I/O channel number directly, e.g., read(61, etc instead of assigning a number to a variable (e.g. read(ich,). This'd facilitate others searching for conflicts.