{"id":41245,"key":"Installing_RTM_Software_on_Linux","title":"Installing RTM Software on Linux","latest":{"id":1224847,"timestamp":"2026-01-09T01:43:04Z"},"content_model":"wikitext","license":{"url":"https://www.appropedia.org/Appropedia:Copyrights","title":"CC-BY-SA-4.0"},"source":"{{QAS notice}}\n\n[[Radiative Transfer Modelling]] software is fun stuff! Decoding cryptic fortran docs is such a great time. So here's me spoiling all that fun for you, (hopefully) making it easy. Or at least easier.\n\nI got it all going on a dual-core 64-bit AMD processor running a fresh install of Ubuntu 12.04. Most of this should be applicable to other platforms and linux-based operating system. Maybe even some other unix-based systems.\n\n== The Software ==\n\n* [http://rtweb.aer.com/rrtm_frame.html RRTM], by Atmospheric and Environmental Research, Inc.\n* [http://www.nrel.gov/rredc/smarts/about.html SMARTS], The Simple Model of the Atmospheric Radiative Transfer of Sunshine by Dr. Christian Gueymard.\n* [http://web.archive.org/web/20170329155712/http://www.dca.iag.usp.br:80/www/material/satelite/manual_sbdart.pdf SBDART], Santa Barbara DISORT\n\nAtmospheric Radiative Transfer.\n\n== System ==\n\n* Ubuntu 12.04 64-bit, running in VirtualBox OSE https://www.virtualbox.org/wiki/Downloads (windows host, though the host shouldn't matter)\n* Two processor cores and 1.5GB memory allocated to the Ubuntu OS\n\n=== Installing Fortran Compilers ===\n\nAll three RTM programs are written in Fortran, so you'll need a Fortran compiler! And actually make that three different Fortran compilers because you're awesome.\n\n==== fort77 ====\n\nSBDART is written in FORTRAN77, so we need a compiler which compiles FORTRAN77 code. No kidding. Ubuntu doesn't have one by default so we need to install it.\n\n# Check if you already have it! Open up a terminal (ctrl-alt-t) and type the following command: <tt>f77</tt>. If the output looks like this:\n\n The program 'fort77' is currently not installed. You can install it by typing:\n sudo apt-get install fort77\nThen you don't have it yet; proceed with the following instructions. If it says\n gfortran: fatal error: no input files\n compilation terminated\nthen you're already done here!\n\n# Install it! Type <tt>sudo apt-get install gfortran</tt> into the terminal.\n# Input your password at the prompt. I assume that your account has administrative power over the computer. If you installed Ubuntu yourself, you should have no issue. If you're using a machine administrated by someone else, you may need to talk to them.\n# You may encounter a confirmation asking you to confirm that you do, indeed, wish to download and install the compiler, something like\n\n After this operation, 2,986 kB of additional disk space will be used.\n Do you want to continue [Y/n]?\nIf that's still true, type <tt>'Y'</tt> and hit enter. fort77 (and its dependencies) will install. That's it. Yep, installing programs in Ubuntu rocks.\n\n==== gfortran ====\n\nGuess what? gfortran installs in exactly the same way as fort77!\n\n# Check if it's there <tt>gfortran</tt>\n# If not, install it <tt>sudo apt-get install gfortran</tt>\n\nBoom.\n\n(Tip: basically anything you want in linux installs this way. SBDART doesn't because it's a very obscure piece of software which isn't in Ubuntu's repository. But a shocking wealth of software is readily available from the repository!)\n\n==== PGILinux Fortran ====\n\nI had no luck compiling RRTM with either gfortran or fort77, but they have a makefile specifically for The Portland Group's fortran compiler. It's not free, but there is a free trial period; good enough for our purposes. (note to self: look into the license I agreed to and see if there are any extra stipulations on the use of the trial version...)\n\n# [https://www.pgroup.com/account/register.php Create a PGI account].\n# [https://www.pgroup.com/support/downloads.php Download the compiler]. I went with PGI Accelerator Fortran Workstation with Target 64-bit & 32-bit, for linux, obviously. It's massive. Find something to do while it downloads.\n# Extract the files somewhere, and then open a terminal and navigate there. I extracted them into a folder in my home directory that I named <tt>pgi</tt>, so for me that meant opening up a terminal (ctrl-alt-t), and typing <tt>cd ~/pgi</tt>.\n# The installer must be run with \"root privileges\", so you have to put <tt>sudo</tt> before the command. <tt>sudo./install</tt>... enter your password...\n# The EULA will show up in the terminal. Press Spacebar to move down page-by-page, and when you are satisfied, either accept or decline the terms at the end.\n# Assuming you accepted, You should now have a choice of type of installation. Choose the first (by entering the number 1), unless you think you might need a network install. That would be out of the scope of this document.\n# Leave the default installation directory (again unless you feel it needs to be changed, in which case I can't help you and you could have easily written this document); press enter.\n# I am running on an AMD processor, so I chose to install the ACML. I don't know if it will actually work since my operating system is running on a virtual machine, but it doesn't seem to hurt... I'll leave this one up to your judgement, however do note that there is an additional license agreement for the ACML.\n# The next screen was asking about ACML versions... I left it at the default (just hit enter)\n# I also have a nvidia video card (again, maybe this is not applicable anyway since I'm in a virtual machine), so chose to also install the CUDA stuff. Don't really know what it is... using the GPU to run parts of your code maybe? Again, there is yet another license agreement for CUDA.\n# I also installed the OpenACC drivers. The OpenACC site was down, but [http://en.wikipedia.org/wiki/OpenACC the Wikipedia page] on it said it was about parallel computing, so I figured I'd get it, even though I think I'll be using OpenMP for the purposes it fills. Guess what? There's another license to agree to!\n# Java, I chose yes... and I'm starting to remember that I'm only getting this compiler so I can compile one already-made program once and then it expires in two weeks... accept another license...\n# Hey, now it's finally installing!\n# <tt>Do you wish to update/create links in the 2012 directory? (y/n)</tt> I picked <tt>y</tt>\n# It then installs all that extra crap I agreed to...\n# <tt>Do you wish to install MPICH1? (y/n)</tt> Since I'm already installing everything, <tt>y</tt>\n# <tt>Remote execution method? (rsh,ssh)</tt> <tt>ssh</tt>\n# <tt>Do you want the files in the install directory to be read-only? (y/n)</tt> <tt>y</tt>\n\n Installation complete.\n\n'''Celebrate!'''\n\nAnd then test it\n phil@ubuntu:~/pgi$ pgf90\n No command 'pgf90' found, did you mean:\n Command 'pdf90' from package 'pdfjam' (universe)\n pgf90: command not found\n\nNooooooooooo\n\nDon't panic, bash just doesn't know where to find it yet. Let's try it with the absolute path:\n phil@ubuntu:~/pgi$ /opt/pgi/linux86-64/12.4/bin/pgf90\n pgf90-Warning-No files to process\n \n\nOk, now is the time to celebrate.\n\nI decided not to bother adding that directory to my PATH or anything, since I just need it for this one build. So we're done!\n\nNo, not actually. We need to get our license files.\n\nGet the hostid by opening a terminal and typing <tt>ifconfig eth0</tt>. My output looked like this:\n phil@ubuntu:/opt/pgi/linux86-64/12.4/bin$ /sbin/ifconfig eth0\n eth0\t Link encap:Ethernet HWaddr 00:0c:29:30:4c:1e\n \t\t\t\t inet addr:192.168.65.128 Bcast:192.168.65.255 Mask:255.255.255.0\n \t\t\t\t inet6 addr: fe80::20c:29ff:fe30:4c1e/64 Scope:Link\n \t\t\t\t UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\n \t\t\t\t RX packets:608040 errors:0 dropped:0 overruns:0 frame:0\n \t\t\t\t TX packets:310314 errors:0 dropped:0 overruns:0 carrier:0\n \t\t\t\t collisions:0 txqueuelen:1000\n \t\t\t\t RX bytes:913047840 (913.0 MB) TX bytes:17318408 (17.3 MB)\n\nIt's that HWaddr part that we need, in my case <tt>00:0c:29:30:4c:1e</tt>. Keep that code handy, and head over to https://www.pgroup.com/license/trialkey.php and copy it in. You should get a page with a link called \"Save trial keys as a file on my computer\". Click it, and you should be presented with the option to save a file called license.dat. Save it.\n\nNow move it to the right place...\n sudo cp ~/Downloads/license.dat /opt/pgi/license.dat\n(you may have to enter a password for sudo, since /opt is protected)\n\nAnd now, finally, at long last, we're there. Done.\n\n== Installing SBDART ==\n\n=== Get the code ===\n\nGet the [http://www.meto.umd.edu/~zli/METO401/AOSC625/SBDART/sbdart.f SBDART source code]. It's all in one file. Either right-click that link and <tt>Save link as...</tt>, or open it up in the browser, and then select <tt>File -> Save As...</tt>. Save it somewhere convenient, like on your desktop. Or somewhere better, like inside a folder called <tt>sbdart</tt> in your home directory.\n\n=== Compile SBDART ===\n\nIf you don't already have a terminal open, hit ctrl-alt-t to get one. Navigate to the directory where you put the sbdart code (so <tt>cd ~/Desktop</tt> if you saved it on the desktop, or <tt>cd ~/sbdart</tt> if you saved it in a folder called sbdart in your home directory. If this is confusing, you may wish to [https://www.google.ca/search?q=basic+linux+terminal+commands brush up on your linux terminal skills].)\n\nI like to double-check I'm in the right place by typing <tt>ls</tt>, which should simply return <tt>sbdart.f</tt> if you're in the right directory (there may be other things listed there as well, just make sure sbdart.f is in there!).\n\nTo compile sbdart, enter this command:\n f77 sbdart.f -o sbdart\nIt should output a couple hundred lines of stuff very quickly to the terminal, and then leave you back at a prompt after a couple moments. Get a directory listing again to see if it worked (<tt>ls</tt>), and if you now see <tt>'''sbdart''' sbdart.f</tt>, then you're done!\n\n== Installing SMARTS ==\n\nSMARTS is a little trickier than SBDART to get up and running (the source code is more than just a single file like SBDART!), but still very simple.\n\n=== Grab the code ===\n\nFirst you'll need to [http://www.nrel.gov/rredc/smarts/register.html register with NREL]. They'll email you a username and password to download the source.\n\nThen you can [http://www.nrel.gov/rredc/smarts/smarts_files.html grab the code here]. At this time of writing, the current version is 2.9.5, which is available for linux in a 3MB.tar.gz file.\n\n=== Make it go ===\n\nExtract that file somewhere, like say a new folder called <tt>smarts</tt> in your home directory.\n\n'''Make the executable, executable!'''\n\nAfter I extracted SMARTS, I found I couldn't execute the program. This is what my try looked like:\n phil@ubuntu:~/smarts/SMARTS_295_Linux$./smarts295\n bash:./smarts295: No such file or directory\nBizarre. It's there -- I can see it with <tt>ls</tt>. <tt>ll</tt> shows that it's set to executable, so doing <tt>chmod +x smarts295</tt> had no effect. I don't know why it doesn't work, but they give us the source code, so grab the gfortran compiler (see above) and let's go!\n\nNavigate into the Source_code directory. For me that meant\n cd ~/smarts/SMARTS_295_Linux/Source_code\n\nCompile\n gfortran smarts295.f -o smarts\n\nIt should complete in a couple moments. Move our new executable back out of the Source_code folder\n mv smarts../\n\nGo up a level to try it out...\n cd../\n\nHold your breath...\n./smarts\n\n phil@ubuntu:~/smarts/SMARTS_295_Linux$./smarts\n \n ***********************************\n Welcome to SMARTS, version 2.9.5!\t\t\t\n ***********************************\n $$$ SMARTS_295> Use standard mode with default input file?\n [If YES (or Y), execution will start immediately\n using the default input file smarts295.inp.txt]\n (Y/N) ==>\n\nHooray, we're done, it seems to work!\n\n== Installing RRTM ==\n\nThere are four versions of RRTM, as you can see [http://rtweb.aer.com/rrtm_frame.html here]. We wanted the Short-Wave version, and the stand-alone model, so RRTM_SW. Get the code via the <tt>Code and Examples</tt> link on the left frame. [http://rtweb.aer.com/rrtm_sw_code.html Here] is a direct link to that page (it's frame-less so that link loses all the page navigation).\n\nGrab the source code and makefiles. They'll prompt you for your email address, name, etc. If you ''really'' don't want to part with that info, they don't validate the fields (you could just enter a, b, c. But be nice).\n\nExtract that archive somewhere. I made a new folder in my home directory called (you guessed it) <tt>rrtm</tt>.\n\nCopy the appropriate makefile up a level in order to use it\n phil@ubuntu:~$ cd ~/rrtm/rrtm_sw/makefiles\n phil@ubuntu:~/rrtm/rrtm_sw/makefiles$ cp make_rrtm_sw_linux_pgi../\n phil@ubuntu:~/rrtm/rrtm_sw/makefiles$ cd../\n phil@ubuntu:~/rrtm/rrtm_sw$ ls\n linux_pgi_pgf90_dbl.o '''make_rrtm_sw_linux_pgi''' src\n makefiles\t\t\t rrtm_sw_instructions\tupdate_rrtm_sw_v2.5.txt\n\nAt this point make sure you've installed the PGLinux Fortran compiler. See a couple sections up in this document for help with that.\n\nIf you remember, bash didn't know where to find the executable pgf90 after we installed it, and since we haven't fixed that issue, it's easier to just edit the makefile. Lets open it up in gedit:\n phil@ubuntu:~$ cd ~/rrtm/rrtm_sw/\n phil@ubuntu:~/rrtm/rrtm_sw$ gedit make_rrtm_sw_linux_pgi\n\nNow find the lines where it says <tt>FC = pgf90</tt> and <tt>CDOTO = $(PLATFORM)_$(FC)_dbl.o</tt>\n\n ###############################\n # Set variables\n ###############################\n \n PLATFORM = linux_pgi\n VERSION = v2.5\n \n '''FC = pgf90'''\n FCFLAG = -fast -r8 -i8\n OUTPUT = rrtm_sw_$(PLATFORM)_$(VERSION)\n CPATH = src\n CDOTO = $(PLATFORM)_$(FC)_dbl.o\n\nAnd change them to <tt>FC = /opt/pgi/linux86-64/12.4/bin/pgf90</tt> and <tt>CDOTO = $(PLATFORM)_pgf90_dbl.o</tt>, respectively.\n\n ###############################\n # Set variables\n ###############################\n \n PLATFORM = linux_pgi\n VERSION = v2.5\n \n '''FC = /opt/pgi/linux86-64/12.4/bin/pgf90'''\n FCFLAG = -fast -r8 -i8\n OUTPUT = rrtm_sw_$(PLATFORM)_$(VERSION)\n CPATH = src\n CDOTO = $(PLATFORM)_pgf90_dbl.o\n\nAnd finally....\n\n phil@ubuntu:~/rrtm/rrtm_sw$ make -f make_rrtm_sw_linux_pgi\n \n -----------------\n \trrtm_sw_linux_pgi_v2.5 Makefile\n -----------------\n \n This Makefile was designed for the linux_pgi platform.\n \n It uses the /opt/pgi/linux86-64/12.4/bin/pgf90 compiler, with the following options:\n \t\t\t-fast -r8 -i8\n \n The object files used are as follows:\n \n \t\t\trrtm.o RDI1MACH.o rtrdis.o rrtatm.o setcoef.o taumoldis.o ErrPack.o util_linux_pgi.o extra.o LINPAK.o disort.o cldprop.o k_g.o\n \n \n rrtm_sw_linux_pgi_v2.5 make in progress...\n \n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n PGF90-W-0155-The type of FLOAT is now double precision with -r8 (src/setcoef.f: 140)\n \t0 inform, 1 warnings, 0 severes, 0 fatal for setcoef\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n PGF90-W-0155-The type of FLOAT is now double precision with -r8 (src/disort.f: 473)\n \t0 inform, 1 warnings, 0 severes, 0 fatal for disort\n NOTE: your trial license will expire in 14 days, 7.45 hours.\n NOTE: your trial license will expire in 14 days, 7.44 hours.\n PGF90-W-0155-The type of FLOAT is now double precision with -r8 (src/cldprop.f: 155)\n \t0 inform, 1 warnings, 0 severes, 0 fatal for cldprop\n NOTE: your trial license will expire in 14 days, 7.44 hours.\n NOTE: your trial license will expire in 14 days, 7.44 hours.\n NOTE: your trial license will expire in 14 days, 7.44 hours.\n \n =================\n \tMakefile done\n =================\n phil@ubuntu:~/rrtm/rrtm_sw$ ls\n linux_pgi_pgf90_dbl.o make_rrtm_sw_linux_pgi~ src\n makefiles\t\t\t rrtm_sw_instructions\t update_rrtm_sw_v2.5.txt\n make_rrtm_sw_linux_pgi rrtm_sw_linux_pgi_v2.5\n phil@ubuntu:~/rrtm/rrtm_sw$./rrtm_sw_linux_pgi_v2.5\n INVALID INPUT_RRTM\n\nWOOOOOOOOOOOOHOOOOOOOOOOO!!!! Now is celebration time.\n\n{{Page data\n| license = CC-BY-SA-3.0\n| description = Install RTM software on Linux with a simple Appropedia guide. Learn compilers, steps, and setup tips for smooth installation.\n}}\n\n[[Category:Queens Applied Sustainability Group Lab Protocols]]\n[[Category:MOST methods]]"}