Changes between Version 212 and Version 213 of DevelopmentActivities/ORCHIDEE-DOFOCO


Ignore:
Timestamp:
10/24/19 13:05:12 (17 months ago)
Author:
alanso
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DevelopmentActivities/ORCHIDEE-DOFOCO

    v212 v213  
    600600== Testing guidelines before committing new code to ORCHIDEE-CN-CAN on svn == 
    601601 
    602 In some rare cases after bugfixes or implementation of new code, problems with reproducibility or 1+1=2 might unintentionally be introduced. Often these are related to incorrect variable dimensions in different sub-routines, memory issues or the lack of variables in the restart files. Such issues are easier to catch sooner than later. Thus, to minimize the time spent on debugging reproducibility and 1+1=2 issues, the following simple test are suggested/required before each commit of substantial code changes*:  
     602In some rare cases after bugfixes or implementation of new code, problems with reproducibility or 1+1=2 might be introduced unintentionally. Often these are related to incorrect variable dimensions in different sub-routines, memory issues or the lack of variables in the restart files. Such issues are easier to catch sooner than later. Thus, to minimize the time spent on debugging reproducibility and 1+1=2 issues, the following simple test are suggested/required before each commit of substantial code changes*:  
    603603=== 1+1=2 === 
    604604If you do not run these test globally, make sure to use impose_veg=y. 
    605 The standard F2 run.def settings have been tested/are currently tested and still results in 1+1=2 issues. Thus, please always make the test for the standard settings. In case of other run.def settings during your developments, make same tests for your settings also. 
    606  
    607 1) 1Y vs. 12*1M (compare the final restart files) 
    608  
    609 Most issues should be caught with (1). In case of problems, it will make the debugging easier if you can track down the onset of difference between the files (i.e. start of year, onset of growing season, end of year etc.) Thus, continue with test like 
     605The standard F2 run.def settings have been tested and 1+1=2 from revision r6272. Thus, please always make the test for the standard settings. In case of other run.def settings during your developments, make same tests for your settings also. 
     606 
     607'''The standard test''' 
     608 
     6091) 1Y vs. 12*1M, i.e. do two simulations for a full year; one with period length of 1 year; the other with period length of 1 month. Afterwards compare their final restart files both from stomate and sechiba. 
     610 
     611Most issues should be caught with (1). In case of problems, it will make the debugging easier, if you can track down the onset of difference between the restart files (i.e. start of year, onset of growing season, end of year etc.) Thus, continue with test like 
    610612 
    6116132) 1D+1D=2D (compare the final restart files) 
     
    6136153) 1M+1M=2M (compare the final restart files) 
    614616 
    615 === Compare netcdf files === 
    616 The comparison is easiest if the same variables are contained in the two netcdf files and they are in the same order. The differ100.sh script by Josefine Ghattas, nicely does this. Moreover, it uses cdo diffv to compare the files, however 5dim variables are ignored by the cdo diffv command. 
     617=== How to compare netcdf files === 
     618The comparison is easiest if the same variables are contained in the two netcdf files and the variables are in the same order. The differ100.sh script by Josefine Ghattas, nicely does this. Moreover, it uses cdo diffv to compare the files. Howeve,r 5dim variables are ignored by the cdo diffv command, thus not all variables in the restart files can be compared by the differ100.sh 
    617619 
    618620=== Have to check for differences between to netcdf files that have variables with dimensions higher than 4 === 
    619621The matlab function nccmp are able to compare all variables contained within two netcdf files. The original version can be found here: https://fr.mathworks.com/matlabcentral/fileexchange/47857-comparing-two-netcdf-files. 
    620 I have made some small modifications such that the information produced by the script are put into a file instead of printed to the screen. The update version can be found here on IRENE:/ccc/work/cont003/dofoco/dofoco/SCRIPTS/debug/nccmp.m or here on obelix:/home/data03/dofoco/SCRIPTS_obelix/debug/nccmp.m. 
    621  
    622 Sadly, matlab is not on obelix, but on IRENE. On IRENE open matlab by typing ‘Matlab’ or to run from the terminal type matlab -nodesktop.  
     622I have made some small modifications such that the information produced by the script are put into a file instead of being printed to the screen. The update version can be found here on IRENE:/ccc/work/cont003/dofoco/dofoco/SCRIPTS/debug/nccmp.m or here on obelix:/home/data03/dofoco/SCRIPTS_obelix/debug/nccmp.m. 
     623 
     624Sadly, matlab is not on obelix, but on IRENE. To open matlab on IRENE type ''Matlab'' or if you wish to run from the terminal type ''matlab -nodesktop''.  
    623625 
    624626Next run the function by typing: 
     
    628630}}} 
    629631 
    630 Tolerance is if you allow some variation in the variables between the two files. We want identical files thus put [] here. 
    631  
    632 forceCompare can be set to true or false.  
     632''Tolerance'' is if you allow some variation in the variables between the two files. We want identical files thus put [] here. 
     633 
     634''forceCompare'' can be set to true or false.  
    633635 
    634636- True - write all occurrences of differences in a variable (specifically gives all the indices) to the file: all_diff.txt.  
     
    636638- False - only write if there is differences in a variable and its first occurrence of such differences to the file: first_diff.txt.  
    637639 
    638 For global simulation the True option can produce a large file and the information might be hard to process, if there are many differences between the compared files. In addition, the True option can make the much script slower. However, for small simulation the true option might be very useful.  
     640For global simulation the True option can produce a large file and the information might be hard to process, if there are many differences between the compared restart files. In addition, the True option makes the much script slower. However, for small simulation the true option is very useful.  
    639641 
    640642I recommend that you use the re-ordered files from the difffer100.sh script as inputs to nccmp.  
    641643 
    642 Debugging: 
     644'''Debugging suggestions:''' 
    643645- If possible limit the spatial scale (to maximize speed).  
    644 - Track down the problem. The best approach depend on the source of the problem (memory issue or lack variable in the restart file etc.). For memory issue a debugger could be the best choice. For lack of variables in restart file best to run two identical runs with different period lenghts – either manually or by Totalview while tracking down which variables are causing the differences. Hopefully, the differences in the restarts files will give you a clue on which variable to start the investigation from. 
     646- Track down the onset of the deviation between the restart files. 
     647- Track down the problem. Hopefully, the differences in the restarts files will give you a clue on which variable to start the investigation from. The best approach depend on the source of the problem (memory issue or lack variable in the restart file etc.). For memory issue a debugger could be the best choice. For lack of variables in restart file it is best to run two identical runs with different period lenghts – either manually or by Totalview while tracking down which variables are causing the differences. 
     648- Once you have fixed the problem, verify that it is also valid at the global scale (i.e. run the global tests again, if you chose to zoom in on a smaller region)  
    645649 
    646650== Merging CN-CAN into the trunk ==