One of my recent research tasks has been to port GCAM (Global Change Assessment Model) on to the Cube, our groups HPC cluster, and some of the TACC resources. This turned out to be more challenging than I had anticipated, so I wanted to share my experiences in the hopes that it will save you all some time in the future. This post might be a bit pedestrian for some readers, but I hope it’s helpful to folks that are new to C++ and Linux.
Before getting started, some background on GCAM. GCAM was developed by researches at the Joint Global Change Research Institute (JGCRI) at the Pacific Northwest National Lab (PNNL). GCAM is an integrated assesment model (IAM), which means it pairs a climate model with a global economic model. GCAM is unique from many IAMs in that it has a fairly sophisticated representation of various sectors of the global economy modeled on a regional level…meaning the model is a beast compared to other IAMs (like DICE). I’ll be writing a later post on IAMs more generally. GCAM is coded in C++ and makes extensive use of xml databases for both input and output. The code is open source (available here), has a Wiki (here), and a community listserve where researches can pose questions to their peers.
There are three flavors of the model available: one for Windows users, one for Mac users, and one for Unix users. The Windows version comes compiled, with a nice user-interface for post-processing the results. The Unix version comes as uncompiled code, and requires the installation of some third party C++ libraries. For those who’d like to sniff around GCAM the Windows or Mac versions are a good starting point, but if you’re going to be doing HPC heavy lifting, you’ll need to work with the Unix code.
The GCAM Wiki and the detailed user manual provide excellent documentation about running GCAM the Model Interface tools, but are a bit limited when describing how to compile the Unix version of the code. One helpful page on the Wiki can be found here. GCAM comes with a version of the Boost C++ library in the standard Unix download (located in Main_User_Workspace/libs). GCAM also uses the Berkeley DBXML library, which can be downloaded here. You’ll want to download version 2.5.16 to be sure it runs well with GCAM.
Once you’ve downloaded DBXML, you’ll need to build the library. As it turns out, this is fairly easy. Once you’ve ported the DBXML library onto your Unix cluster, simply navigate into the main directory and run the script buildall.sh. The buildall.sh script accepts flags that allow you to customize your build. We’re going to use the -b flag to build the 64-bit version of DBXML:
sh buildall.sh -b 64
once you’ve build the DBXML library, you are nearly ready to build GCAM, but must first export the paths to the Boost library and to the DBXML include and lib directories. It seems that the full paths must be declared. In other words, they should read something like:
export BOOST_INCLUDE=/home/fs02/pmr82_0001/jrl276/GCAM_Haewon_trans/libs/boost_1_43_0/ export DBXML_INCLUDE=/home/fs02/pmr82_0001/jrl276/dbxml-2.5.16/install/include/ export DBXML_LIB=/home/fs02/pmr82_0001/jrl276/dbxml-2.5.16/install/lib/
One tricky point here is that the full path must be typed out instead of using ‘~’ as a short-cut (I’m not sure why). Once this is done, you are ready to compile gcam. Navigate into the ‘Main_User_Workspace’ directory and type the command:
Compiling GCAM takes several minutes, but at the end there should be a gcam.exe executable file located in the ‘/exe/’ folder of the ‘Main_User_Workspace’. It should be noted that there is a multi-thread version of gcam (more info here), which I’ll be compiling in the next few days. If there are any tricks to that process, I’ll post again with some tips.
That’s it for now.