Skip to content
rburghol edited this page Feb 9, 2022 · 12 revisions

Welcome to the hspf wiki!

General Notes

  • Debug Fortran & Make tips
  • HSPF Manuals
  • Directives in the cbp_wsm archives call for "f77" and "g77" but these are actually symbollically linked to gfortran in both Ubuntu (at least 16+) and RedHat/CentOS (at least 6+). Thus, the code is actually updated to modern fortran. A handful of the errors that are encountered below are newly deprecated syntaxes that need to be brought up to date.

Using compile_all.csh

Tons of Output?! Use nohup

The model code takes a long time to compile, and has a ton of output that is NOT a problem, which sometimes makes it hard to find the source of the problems when an error finally occurs. One solution is to employ nohup to run the compile, since that will:

  • Prevent a crashed compile due to your terminal timing out in the middle
  • Send output of the compile session to a text file (of your choice or nohup.out by default) so you can search it for errors after the fact Below is the syntax to compile with nohup and follow the progress of the compile by using tail.

nohup ./compile_all.csh > compile_attempt_number_5.out 2>&1&

tail -f compile_attempt_number_5.out

Ubuntu

  • Initial compile log with lotsa errors compile_all.log.1
  • A useful way to compile is to use "nohup" which captures a log of the compile messages for tracking errors.
    • nohup ./compile_all.csh &
  • Many are easy fixes, adding decimal points to function calls that require a float not integer
  • There were two static libraries getadep.a and sumout.a that were shped as binaries and needed local compiling (and removal). Info on general properties of static libs in Fortran: https://docs.oracle.com/cd/E19205-01/819-5262/aeudm/index.html Ex:
Error: ‘a2’ argument of ‘max’ intrinsic at (1) must be REAL(4)
randomeffect.f:98:68:

                 DailyIndEff(j,nb,nBmp) = min(DailyIndEff(j,nb,nBmp),1)

Is fixed by:

diff --git a/etm/make_binary_transfer_coeffs/randomeffect.f b/etm/make_binary_transfer_coeffs/randomeffect.f
index 2556bb4..58ebe7c 100755
--- a/etm/make_binary_transfer_coeffs/randomeffect.f
+++ b/etm/make_binary_transfer_coeffs/randomeffect.f
@@ -94,7 +94,7 @@
             end do
             if (BmpEffDistParm(nBmp,nb,indHG,l,2).eq.1) then
               do j = 1,ndays
-                DailyIndEff(j,nb,nBmp) = max(DailyIndEff(j,nb,nBmp),0)
+                DailyIndEff(j,nb,nBmp) = max(DailyIndEff(j,nb,nBmp),0.0)
                 DailyIndEff(j,nb,nBmp) = min(DailyIndEff(j,nb,nBmp),1)
               end do
             end if

Compilers for hspf

RHEL

  • CBP is using AWS version of Red Hat Enterprise Linux Server release 5.11 (Tikanga) ** Supposed to be running flawlessly, with f77

Ubuntu

16.04

apt-get install csh
apt install gcc
# replaces yum gcc-c++
apt install build-essential
apt install flex
# g77 does not exist but seems to come in with one of the above steps?

CentOS

5x

 sudo yum install compat-gcc-34-g77 

Clone this wiki locally