CMAQ

28
MAC INSTALLATION OF CMAQ It is now possible to do air quality simulations on your own computer without access to a cluster or supercomputer! I am setting my MacPro to do the mesoscale meteorology (WRF), emissions processing (SMOKE), and air quality modleing (CMAQ). These instructions require a Mac with an Intel processor and OSX 10.5 (Leopard). I use Gnu C (gcc), Gnu C++ (g++) and an Intel Fortran Compiler (ifort). All of the installations are for 64-bit memory. My CMAQ, WRF, and SMOKE installations all work with the test data provided with each. I have also run WRF with real data. These instructions document my installations for CMAQ 4.6 and MCIP 3.3, The serial processing instructions are based on the work of Scott Spak of the University of Wisconsin. Carlie Coats, Jr., of Barons also provided guidance on netCDF and I/O API. I like my instructions in excruciating detail so thatʼs what youʼll find here. I have used my own file structure (/phd/basics/ioapi3.0, /phd/models/cmaq4.6, etc.). I use the UNIX tcsh shell but you are welcome to use other shells (bash is the default on Macs). I also like to use Emac to run my compilations so I can see error messages highlighted. If you donʼt use Emacs, you can enter the same instructions on the command line with a “> log.txt” added on. All the software is free except for ifort. I think this compiler is well worth the price since it has fewer problems than gfortran, has excellent support, and will better optimize your Intel processors. Academic and student pricing is available. If you run into problems, check my list of Fixes at the back. If this doesnʼt help, I suggest you use the m3users listserve (see http://www.cmascenter.org/help/listserves.cfm? temp_id=99999 ) or CMAS bugzilla http://www.cmascenter.org/help/email_support.cfm? temp_id=99999 . As of this date, CMAS does not provide support for the Apple platform. Iʼd list helpful websites but Google is the best way find help! Please let me know if you have any corrections to these instructions. E-mail them to me at [email protected] since I will be updating this draft. I am also interested in how it took you to complete the CMAQ install with these instructions. I also have instructions for Mac installations of WRF, SMOKE, ncview, AMET, NCO, and VERDI on my website: www.atmos.umd.edu/~drb . I hope these instructions will make the installation of CMAQ on Mac as painless as possible. May the computer gods be with you! Debra Baker University of Maryland Wednesday, September 24, 2008 1

Transcript of CMAQ

Page 1: CMAQ

MAC INSTALLATION OF CMAQ

It is now possible to do air quality simulations on your own computer without access to a cluster or supercomputer! I am setting my MacPro to do the mesoscale meteorology (WRF), emissions processing (SMOKE), and air quality modleing (CMAQ). These instructions require a Mac with an Intel processor and OSX 10.5 (Leopard). I use Gnu C (gcc), Gnu C++ (g++) and an Intel Fortran Compiler (ifort). All of the installations are for 64-bit memory. My CMAQ, WRF, and SMOKE installations all work with the test data provided with each. I have also run WRF with real data.

These instructions document my installations for CMAQ 4.6 and MCIP 3.3, The serial processing instructions are based on the work of Scott Spak of the University of Wisconsin. Carlie Coats, Jr., of Barons also provided guidance on netCDF and I/O API.

I like my instructions in excruciating detail so thatʼs what youʼll find here. I have used my own file structure (/phd/basics/ioapi3.0, /phd/models/cmaq4.6, etc.). I use the UNIX tcsh shell but you are welcome to use other shells (bash is the default on Macs). I also like to use Emac to run my compilations so I can see error messages highlighted. If you donʼt use Emacs, you can enter the same instructions on the command line with a “> log.txt” added on.

All the software is free except for ifort. I think this compiler is well worth the price since it has fewer problems than gfortran, has excellent support, and will better optimize your Intel processors. Academic and student pricing is available.

If you run into problems, check my list of Fixes at the back. If this doesnʼt help, I suggest you use the m3users listserve (see http://www.cmascenter.org/help/listserves.cfm?temp_id=99999) or CMAS bugzilla http://www.cmascenter.org/help/email_support.cfm?temp_id=99999. As of this date, CMAS does not provide support for the Apple platform. Iʼd list helpful websites but Google is the best way find help!

Please let me know if you have any corrections to these instructions. E-mail them to me at [email protected] since I will be updating this draft. I am also interested in how it took you to complete the CMAQ install with these instructions. I also have instructions for Mac installations of WRF, SMOKE, ncview, AMET, NCO, and VERDI on my website: www.atmos.umd.edu/~drb.

I hope these instructions will make the installation of CMAQ on Mac as painless as possible. May the computer gods be with you!

Debra BakerUniversity of MarylandWednesday, September 24, 2008

1

Page 2: CMAQ

TABLE OF CONTENTS

.....................................................................Environmental Variables and Aliases 3

Prequisite Programs................................................................................. XCode (gcc and CVS) 4

......................................................................................................... ifort 5........................................................................................................ netCDF 7......................................................................................................... I/O API 8

CMAQ.................................................................................................... Download 9

.................................................................................................... STENEX 10...................................................................................................... M3BLD 12...................................................................................................... JPROC 15

....................................................................................................... ICON 17

....................................................................................................... BCON 19....................................................................................................... CCTM 21....................................................................................................... MCIP 23

Other........................................................................................ Troubleshooting 24

.................................................................................................... Back-Up 26

2

Page 3: CMAQ

Set Up Environmental Variables and Aliases

Here is the code I used for my shell start-up file, .tcshrc. While most installations require you to enter this information in the code, I found it useful to have these presets. They incorpate recommendations from http://support.intel.com/support/performancetools/sb/CS-027812.htm (Intel), http://macwrf.blogspot.com/2007_09_01_archive.html (Fovell) and netCDF http://www.unidata.ucar.edu/software/netcdf/:

echo "Setting compilers variables"setenv CC "/usr/bin/gcc -arch x86_64 -mmacosx-version-min=10.5" setenv CXX /usr/bin/g++ setenv FC ifort setenv F90 ifort setenv F77 ifort setenv PERL /usr/bin/perlecho "Setting code generation options"setenv CPPFLAGS "-O3 -DNDEBUG -DpgiFortran" setenv CFLAGS "-g -O3" setenv CXXFLAGS "-g -O3" setenv FFLAGS '-O3 -xT -ip -no-prec-div -m64' setenv F90FLAGS echo “Setting CMAQ environmental variables”setenv M3HOME /phd/models/cmaq4.6setenv M3DATA $M3HOME/datasetenv M3MODEL $M3HOME/modelssetenv M3LIB $M3HOME/libsetenv M3WORK $M3HOME/workecho "Setting ifort environmental variables"source /opt/intel/fce/10.1.006/bin/ifortvars.cshsource /opt/intel/idbe/10.1.006/bin/idbvars.cshalias edit emacs -nw -qalias here ls -ltGalias cmaq cd /phd/models/cmaq4.6

To restart .tcshrc after making changes, enter “su - ” followed by your Mac user name (the dash should one space before and after it). Enter your password when prompted.

3

Page 4: CMAQ

Install Xcode

1. Download Xcode 3.0 for Leopard for free from the Apple Developers Connection (ADC) at http://developer.apple.com/tools/download/

2. Click on Xcode 3.0 for Leopard. 1.1 GB3. It requests a ADC login: click on sign up4. Fill out the form but choose Log In instead of creating a username and password.

This allows you to use your user name and password from Apple Registration. Make sure all categories with * are completed and press continue.

5. It would be nice if it took you back to the Xcode download page but it doesnʼt. Go to http://developer.apple.com/tools/download/ again and select Xcode 3.0. This is a large file so it will take a couple of hours to download. Be sure that Energy Saver in /System/Library/PreferencePanes is set to Never for sleep options.

6. Xcode icon is downloaded to your desktop: Click on it to install7. Click on XcodeTools.mkpg8. The Xcode Tools Installer will appear: press continue9. The software license agreement is next: press continue then agree10.Keep the install location to the default by pressing install11.Click the install button12.Supply account name and password13. Installation only takes a few minutes. When it is complete, you will hear a tone

and see “Install Succeeded” on the screen. The installer does not require you to restart your system afterwards.

14.The bulk of the installation occurs in the /Developer folder that is created at the root level of your boot volume. Here you will find all of the Xcode applications, command-line tools, example code, and documentation. Do not attempt to move or rename this folder. It installs some special development frameworks, resources, and a few patches into the /System folder. Finally, it installs several UNIX man pages and a handful of tools into the /usr and /bin folders.

15.The documentation is in /Developer/ADC Reference Library/referencelibrary/index.html

16.To uninstall Xcode developer tools on the boot volume along with the Xcode directory, from a Terminal window type: $ sudo /Developer/Library/uninstall-devtools --mode=all The uninstall is very thorough! Restart the computer before reinstalling XCode

4

Page 5: CMAQ

Install ifort1. XCode must be installed first. 2. Go to http://www.intel.com/cd/software/products/asmo-na/eng/compilers/fmac/

267426.htm and click on “Buy Product.” Choose the Professional Edition Full Product and click on Buy. Proceed to checkout.

3. Use or sign up for a Shop Intel Login and Password then enter billing information and then credit card information

4. Within two hours of ordering (during normal business hours), you should get an email from Intel Customer Service with instructions on how to download ifort.

5. Before installation, you will first have to register for Intel Premier Support at http://www.intel.com/software/products/registrationcenter/index.htm. You must enter your e-mail address and Serial Number from the e-mail. You will have to fill in your registration information again because the Registration Center login is separate from the Shop Intel login.

6. The installation will require you to enter your administrative password. Double-click the downloaded file, which will have a name of the form m_fc_x_10.1.006.dmg.

7. Open the disk image file. Locate and click Install.8. The Intel Installer will appear. Click Continue.9. Select a license option. Click Continue.10.A new screen appears. Click Install. (If the compiler is already installed, the option is

Upgrade.)11. Information about using the Intel Compiler and finding documentation will appear.

Read the information, and click Continue.12.The Software License Agreement appears. Click Continue. (You are prompted to

accept or reject the license agreement.)13.Select the Volume for the installation destination folder. The default installation

directory for 64-bit compiler is /opt/intel/fce/10.1.006, where 006 represents the compiler package revision number. This is the version number used throughout these instructions but yours may be different. Click Continue.

14.Yet another screen appears. Click Install.15.The installer installs the selected components on your system. Click Close. Click

Continue. Click Finish on the final screen to exit the installer.16.Reboot the system to make Xcode support the Intel compiler.17.The programs in the Intel Fortran Compiler product rely on the environment

variables PATH, DYLD_LIBRARY_PATH, and LD_LIBRARY_PATH. The compiler installation program creates compiler environment script files (ifortvars.sh/idbvars.sh) that set these variables. Intel strongly recommends that you add those script files into your login script. I include them in my .tcshrc (see p. 3). Once the variables are set in the ".login" file there is no need to run the script files for each session.source the script to setup the compiler environment:

source /opt/intel/fce/10.1.006/bin/ifortvars.csh #ifortsource /opt/intel/fce/10.1.006/bin/idbvars.csh #idb

18. If you have any problems running the compiler, first check you have a valid license file (*.lic) in the license directory. By default this is /Users/Shared/Library/Application\ Support/Intel/Licenses. The compiler uses the environment variable

5

Page 6: CMAQ

INTEL_LICENSE_FILE to locate the license file. If you still have problems, you can submit a help request to Intel Premier Support: http://www.intel.com/software/products/support/fmac.

19.To uninstall ifort, you must use your administrative password.a. Open Terminal.b. Change to the root directory.c. To uninstall the compiler, enter a command similar to the following:

/opt/intel/fce/10.1.006/bin/uninstall.shd. To uninstall the debugger, enter a command similar to the following:

/opt/intel/idbe/10.1.006//bin/uninstall.sh 20. If you install a new version of Xcode at any time, you must uninstall and reinstall the

Intel Fortran Compiler.

Monday, February 18, 2008

6

Page 7: CMAQ

Install netCDF

1. Prerequisites for the netCDF v. 3.6.2 build are Fortran, C, and C++ compilers.2. Download the source code from http://www.unidata.ucar.edu/software/netcdf/ as a

gzipped tar file. 3. Copy the source code into the root directory and detar it: tar -xvf netcdf.tar (Mac

automatically unzips gzip files). It will automatically create a “netcdf-3.6.2” directory. Delete the tar file. Go into the netcdf-3.6.2 directory.

4. Run ./configure --enable-v2 --enable-f77 --enable-large-file-tests --disable-compiler-recover --disable-cxx in emacs compile mode. (DO NOT USE --enable-shared when you configure it because it excludes fortran symbols from libnetcdf.a). A log called config.log is automatically created. Save the compilation as a log. Donʼt worry about error messages other than compiler failure.

5. Run make in emacs compile mode. Save the compilation as a log. An error in the make must be addressed. This step creates the library (libnetcdf.a) as well as the utilities ncgen and ncdump.

6. Run make test or make check in emacs compile mode. Save the compilation as a log. This tests whether the executables have been properly built. Compiler and linker warnings may be ignored. This takes a half hour, especially the large file tests.

7. Run sudo make install >&! ~/Documents/netcdf_install_{date}_run{#}.txt on the terminal command line.

8. You should see netCDF in usr/local/bin as well as new files in /include, /lib, /share and /man.

9. If you need to reinstall netCDF, run a make distclean. Note that this does not clean up all or even most of the files in /local subdirectories, which must be deleted manually.

Tuesday, February 19, 2008

7

Page 8: CMAQ

Install I/O API

1. Installing netCDF is a prequisites for installing I/O API iv. 3.0. 2. Download the source code at http://www.baronams.com/products/ioapi/AVAIL.html

as a gzipped tar file. Mac automatically unzips it.3. Also download Scott Spakʼs IOAPI Makeinclude file for Intel Macs using ifort

(Makeinclude.Darwin_ifcgcc ) at http://prairie.sage.wisc.edu/~spak/m3_intelflags.zip.4. From the root directory, make a ioapi3.0 directory. Copy the tar file to this directory

and detar it: tar -xvf {file}.tar. You should see ioapi, HTML, m3tools, iotest, and notcdf subdirectories. Delete the tar file. Copy Makeinclude.Darwin_ifcgcc into /ioapi.

5. Go to the /ioapi directory and copy Makeinclude.Darwin_ifcgcc as Makeinclude.Darwin_ifcgcc.default. Rename Makeinclude.Darwin_ifcgcc as Makeinclude.Darwin. Edit Makeinclude.Darwin: FC = ifort

6. Set the BIN variable at command line” “setenv BIN Darwin”. (I add BIN = Darwin to the Makefile so I do not have to reenter it for subsequent makes).

7. Go up to /ioapi3.0 and copy Makefile as Makefile.default. Edit the Makefile:BASEDIR = /phd/basics/ioapi3.0INSTALL = /phd/basics/ioapi3.0BIN = DarwinCPLMODE = nocplIOAPIDEFS =PVMINCL = /dev/null

8. In /ioapi3.0, run make dirs in emac compile mode. Save the compilation as a log. Check for the new directory named Darwin.

9. Go to Darwin directory and link the netCDF libraries in this directory: “ln -s /usr/local/lib/libnetcdf.a”.

10.Go up to /ioapi3.0, run make configure in emac compile mode. Save the compilation as a log. This will configure all Makefiles.

11.Go to ioapi3.0/ioapi and check the Makefile to make sure that BASEDIR = /phd/basics/ioapi3.0

12. In ioapi3.0/ioapi, run make in emac compile mode. Save the compilation as a log. This should build the ioapi library and precompiled object files.

13.Check for /ioapi3.0/Darwin/libioapi.a. At the command line, run “ranlib -cs libioapi.a”.14.Make sure there is the fixed_src directory required by CMAQ. If not, copy it from

ioapi3.0/ioapi to ioapi3.0/Darwin.15. If you need to recompile I/O API, use the make clean command in /ioapi3.0 or

delete all files in /Darwin except netcdf library link.16. For a full uninstall, delete the /ioapi3.0 directory using “sudo rm -r ioapi3.0” and your

password.

Friday, March 21, 2008

8

Page 9: CMAQ

Download CMAQ

1. NetCDF, CVS, and I/O API must be installed before CMAQ. If you have installed XCode, you will have CVS

2. Download CMAQ and MCIP files from the CMAS website: http://www.cmascenter.org. You must use your CMAS login and password (you can register if you donʼt have a login and password). Click on Download Center, Models. Download CMAQ 4.6 (not unified), MCIP 3.3, and benchmark input and output.

3. Check that the following aliases are in your .tcshrc:echo “Setting CMAQ environmental variables”setenv M3HOME /phd/models/cmaq4.6setenv M3DATA $M3HOME/datasetenv M3MODEL $M3HOME/modelssetenv M3LIB $M3HOME/libsetenv M3WORK $M3HOME/work

4. In the cmaq4.6 directory, create the lib and work directories. In /cmaq4.6/lib, make subdirectories for build, netcdf, ioapi_3, and stenex. (This is a serial build).

5. Go to $M3LIB/netcdf and create a directory named Darwin. Link the netCDF library in this directory: “ln -s /usr/local/lib/libnetcdf.a”.

6. Go to $M3LIB/ioapi_3 and create a directory named Darwin. Link the I/O API library in this directory: “ln -s /phd/basics/ioapi3.0/Darwin/libioapi.a”. Also make a fixed_src directory and link its contents: “ln -s /phd/basics/ioapi3.0/Darwin/fixed_src/* /$M3LIB/ioapi_3/Darwin/fixed_src”.

7. Copy and detar these tar files in $M3HOME M3MODELS.CMAQv4.6.tar M3DATA.CMAQv4.6.tar M3DOCS.CMAQv4.6.tar mcip_v33.tar M3DATA_REF.CMAQv4.6.tar M3DATA_MCIP32.tar

8. Copy and detar M3SCRIPTS.CMAQv4.6.tar in $M3WORK then check for a scripts subdirectory. Return to $M3HOME and check for the following directories: work, models, data, docs, and MCIP3. Delete all tar files.9. After installing all components, use benchmark data to test installation

Wednesday, February 20, 2008

9

Page 10: CMAQ

Install STENEX

1. To install Stencil Exchange library for serial processing, go to $M3WORK/scripts/stenex.

2. Copy bldit.se_noop.pgf as bldit.se_noop.pgf.default. 3. Change the permissions on it: “chmod ugo+rwx bldit.se_noop.pgf”. 4. Edit bldit.se_noop.pgf:

a. Comment out the block that detects and requires Linux <BEFORE>

if ($BLD_OS != 'Linux') then echo " $BLD_OS -> wrong bldit script for host\!" exit 1 endif<AFTER>

# if ($BLD_OS != 'Linux') then # echo " $BLD_OS -> wrong bldit script for host\!" # exit 1 # endif NOTE: You must leave the line setting BLD_OS because it is used to name the subdirectory.

b. Replace compiler path to point to ifort <BEFORE> set FC = /usr/pgi/linux86/bin/pgf90 <AFTER> set FC = /opt/intel/fce/10.1.006/bin/ifortc. Replace compiler options <BEFORE> set FSTD = "-Mfixed -Mextend -c" <AFTER> set FSTD = "-extend-source 132 -c -cm -w95 -O2" d. Comment out under DEBUG <BEFORE>

if ( $?DEBUG ) then set F_FLAGS = "${FSTD} -g" else set F_FLAGS = "${FSTD} -O2" endif

<AFTER> #if ( $?DEBUG ) then # set F_FLAGS = "${FSTD} -g" #else # set F_FLAGS = "${FSTD} -O2" #endif

e. Change the unused F_FLAGS to FSTD:<BEFORE>#> compile in the flist order (se_modules.f depends on the others)

10

Page 11: CMAQ

foreach file ( $flist ) $FC $F_FLAGS $file end<AFTER>#> compile in the flist order (se_modules.f depends on the others) foreach file ( $flist ) $FC $FSTD $file end

f. Make sure the library that has been created gets ranlib'd <BEFORE> ar rv $Arc *.o chmod 444 $Arc <AFTER> ar rv $Arc *.o ranlib -s $Arc chmod 444 $Arc

5. Run the edited script in emacs compile mode: ./bldit.se_noop.pgf. Save the log as ~/Documents/cmaq_stenex__{date}_run{#}.txt.

6. If it compiles successfully, you will see libsef90_noop.a in $M3LIB/stenex/Darwin. Check log for any errors or warnings (ignore “Warning: noop_data_copy_module.f, line 65: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value”).

7. If you need to rerun bldit.se_noop.pgf, delete the $M3WORK/scripts/stenex/BLD_noop directory and the $M3LIB/stenex/Darwin directory

8. Next: Install M3BLD

Thursday, February 28, 2008

11

Page 12: CMAQ

Install M3BLD

1. STENEX must be built before creating the m3bld utility. 2. Go to $M3WORK/scripts/build. 3. Copy bldit.m3bld as bldit.m3bld.default.4. Change permissions (chmod ugo+rwx) and edit bldit.m3bld:

a. Comment out the Linux checker<BEFORE>if ($BLD_OS != 'Linux') then echo " $BLD_OS -> wrong bldit script for host\!" exit 1 endif <AFTER># if ($BLD_OS != 'Linux') then # echo " $BLD_OS -> wrong bldit script for host\!" # exit 1 # endif

b. Run ./bldit.m3bld in emac compile mode. Save the buffer as ~/Documents/cmaq_build1_{date}_run{#}.txt. Expect a BLD directory (and a lot of errors).

5. Copy bldit.m3bld as bldit.m3bld .1st. Edit bldit.m3bld.a. Make sure all the code is compiled with 64-bit architecture

<BEFORE># set c compiler and flags set CC = /usr/bin/gcc set CFLAGS = " "<AFTER># set c compiler and flags set CC = “/usr/bin/gcc -arch x86_64 -mmacosx-version-min=10.5” set CFLAGS = "-O3 -m64"

b. Comment out the portion that removes source files and the part that tells cvs to reload them

<BEFORE>if ( ! -e "$Bld" ) then mkdir $Bld else if ( ! -d "$Bld" ) then echo " *** target exists, but not a directory ***" exit 1 else echo "Deleting files in $Bld" /bin/rm $Bld/* endif endif#set echo cd $Bld# extract source files from cvs archive

12

Page 13: CMAQ

cvs export -r $Rel -d $Bld includes cvs export -r $Rel -d $Bld m3bld <AFTER>#unset echo if ( ! -e "$Bld" ) then mkdir $Bld else if ( ! -d "$Bld" ) then echo " *** target exists, but not a directory ***" exit 1 else# echo "Deleting files in $Bld" # /bin/rm $Bld/* endif endif#set echo cd $Bld# extract source files from cvs archive # cvs export -r $Rel -d $Bld includes # cvs export -r $Rel -d $Bld m3bld

c. Go to new BLD directory. Edit sms.h the definition of boolean_t to be guaranteed

<BEFORE>#if defined(CRAY) || defined(__osf__) || _WIN32 || __unix__typedef unsigned char boolean_t;#endif#if defined(CRAY) || defined(__osf__) || _WIN32 || __unix__ || _AIX#define B_TRUE 1#define B_FALSE 0#endif<AFTER>//#if defined(CRAY) || defined(__osf__) || _WIN32 || __unix__ typedef unsigned char boolean_t;//#endif //#if defined(CRAY) || defined(__osf__) || _WIN32 || __unix__ || _AIX #define B_TRUE 1#define B_FALSE 0//#endif

d. In the BLD directory, edit bld_parser.c. Comment out the inclusion of values.h. (gcc doesn't recognize it and the file builds fine without it.)

<BEFORE>#ifndef _WIN32#include <values.h>#endif<AFTER>//#ifndef _WIN32

13

Page 14: CMAQ

//#include <values.h>//#endif

e. In the BLD directory, edit bld_scanner.c to change the definition of yyout stdout:

<BEFORE>#ifdef __unix__FILE *yyin;#define yyout stdout#elseFILE *yyin = {stdin}, *yyout = {stdout};#endif<AFTER>//#ifdef __unix__FILE *yyin;#define yyout stdout//#else//FILE *yyin = {stdin}, *yyout = {stdout};//#endif

6. Save a copy of bldit.m3bld as bldit.m3bld.2nd. Run ./bldit.m3bld in emacs compile mode. Save the log as ~/Documents/cmaq_build2_{date}_run{#}.txt.7. Check for m3bld in $M3LIB/build/Darwin. Check log (ignore “bld_scanner.l:138{##}: warning: cast from pointer to integer of different size”)8. If you need to recompile, first copy sms.h, bld_parser.c, and bld_scanner.c as revised to another directory. Delete $M3WORK/scripts/build/BLD directory and m3bld in $M3LIB/build.

Thursday, February 28, 2008

14

Page 15: CMAQ

Install JPROC

1. STENEX and M3BLD must be installed before creating the JPROC executable.2. Go to $M3WORK/scripts/jproc. 3. Copy bldit.jproc.pgf as bldit.jproc.pgf .default.4. Change permissions on bldit.jproc.pgf: chmod ugo+rwx bldit.jproc.pgf5. Edit bldit.jproc.pgf

a. Comment out the block that detects and requires Linux<BEFORE> if ($BLD_OS != 'Linux') then echo " $BLD_OS -> wrong makit script for host!" exit 1 endif<AFTER> #if ($BLD_OS != 'Linux') then #echo " $BLD_OS -> wrong makit script for host!" #exit 1 #endif

b. Change the directory path for Fortran compiler to ifort and reset the compiler flags:

<BEFORE>#> Set full path of Fortran 90 compiler set FC = /share/linux/pgi/linux86/5.0/bin/pgf90 set FP = $FC#> Set compiler flags set FSTD = "-Mfixed -Mextend" set F_FLAGS = "${FSTD} -O2 -I." set CPP_FLAGS = "" set C_FLAGS = "-v -O2 -I." set LINK_FLAGS = "-Bstatic"<AFTER>#> Set full path of Fortran 90 compiler set FC = /opt/intel/fce/10.1.006/bin/ifort set FP = $FC#> Set compiler flags set FSTD = "-extend-source 132 -w95 " set F_FLAGS = "${FSTD} -O3 -xT -ip -mdynamic-no-pic -warn declarations -recursive -I." set CPP_FLAGS = "" set C_FLAGS = "-O2 -m64 -I." set LINK_FLAGS = ""

c. Revise the location of the ioapi library:<BEFORE>#> Set location of libraries set IOAPI = "${M3LIB}/ioapi_3/${BLD_OS}2_x86pg -lioapi" <AFTER>

15

Page 16: CMAQ

#> Set location of libraries set IOAPI = "${M3LIB}/ioapi_3/${BLD_OS} -lioapi"

6. Run ./bldit.jproc.pgf in emac compile mode. Save the log as ~/Documents/cmaq_jproc_{date}_run{#}.txt. Check logs for problems.

7. Check for executable JPROC_d1a in the same directory.8. If you need to recompile JRPOC, delete JPROC_d1 and cfg.d1a. Delete the BLD

directory after changing permissions on its files.9. Next: Install ICON

Friday, March 21, 2008

16

Page 17: CMAQ

Install ICON

1. STENEX and M3BLD must be installed before creating the ICON executable.2. Go to $M3WORK/scripts/icon. 3. Copy bldit.icon.pgf as bldit.icon.pgf .default.4. Change permissions on bldit.icon.pgf: “chmod ugo+rwx bldit.icon.pgf”5. Edit bldit.icon.pgf

a. Comment out the block that detects and requires Linux<BEFORE> if ($BLD_OS != 'Linux') then echo " $BLD_OS -> wrong makit script for host!" exit 1 endif<AFTER> #if ($BLD_OS != 'Linux') then #echo " $BLD_OS -> wrong makit script for host!" #exit 1 #endif

b. Change the directory path for Fortran compiler to ifort and reset the compiler flags:

<BEFORE>#> Set full path of Fortran 90 compiler set FC = /share/linux/pgi/linux86/5.0/bin/pgf90 set FP = $FC#> Set compiler flags set FSTD = "-Mfixed -Mextend" set F_FLAGS = "${FSTD} -O2 -I." set CPP_FLAGS = "" set C_FLAGS = "-v -O2 -m64 -I." set LINK_FLAGS = "-Bstatic"<AFTER>#> Set full path of Fortran 90 compiler set FC = /opt/intel/fce/10.1.006/bin/ifort set FP = $FC#> Set compiler flags set FSTD = "-extend-source 132 -w95 " set F_FLAGS = "${FSTD} -module ${MODLOC} -I. -O3 -xT -ip -mdynamic-no-pic -warn declarations -recursive" set CPP_FLAGS = "" set C_FLAGS = "-v -O2 -m64 -I." set LINK_FLAGS = ""

c. Revise the location of the ioapi library:<BEFORE>#> Set location of libraries set IOAPI = "${M3LIB}/ioapi_3/${BLD_OS}2_x86pg -lioapi" set ICL_IOAPI = ${M3LIB}/ioapi_3/ioapi/fixed_src

17

Page 18: CMAQ

<AFTER>#> Set location of libraries set IOAPI = "${M3LIB}/ioapi_3/${BLD_OS} -lioapi" set ICL_IOAPI = ${M3LIB}/ioapi_3/${BLD_OS}/fixed_src

6. Run ./bldit.icon.pgf in emac compile mode. Save the log as ~/Documents/cmaq_icon_{date}_run{#}.txt. Check logs for problems.

7. Check for executable ICON_e1a in the same directory8. If you need to recompile ICON, delete cfg.d1a. Delete the BLD directory after

changing permissions on its files. Also delete MOD_DIR.9. Next: Install BCON

Friday, March 21, 2008

18

Page 19: CMAQ

Install BCON

1. STENEX and M3BLD must be installed before creating the BCON executable.2. Go to $M3WORK/scripts/bcon. 3. Copy bldit.bcon.pgf as bldit.bcon.pgf .default.4. Change permissions on bldit.bcon.pgf: chmod ugo+rwx bldit.bcon.pgf5. Edit bldit.bcon.pgf

a. Comment out the block that detects and requires Linux<BEFORE> if ($BLD_OS != 'Linux') then echo " $BLD_OS -> wrong makit script for host!" exit 1 endif<AFTER> #if ($BLD_OS != 'Linux') then #echo " $BLD_OS -> wrong makit script for host!" #exit 1 #endif

b. Change the directory path for Fortran compiler to ifort and reset the compiler flags:

<BEFORE>#> Set full path of Fortran 90 compiler set FC = /share/linux/pgi/linux86/5.0/bin/pgf90 set FP = $FC#> Set compiler flags set FSTD = "-Mfixed -Mextend" set F_FLAGS = "${FSTD} -O2 -I." set CPP_FLAGS = "" set C_FLAGS = "-v -O2 -m64 -I." set LINK_FLAGS = "-Bstatic"<AFTER>#> Set full path of Fortran 90 compiler set FC = /opt/intel/fce/10.1.006/bin/ifort set FP = $FC#> Set compiler flags set FSTD = "-extend-source 132 -w95" set F_FLAGS = "${FSTD} -I. -O3 -xT -ip -mdynamic-no-pic -warn declarations -recursive" set CPP_FLAGS = "" set C_FLAGS = "-v -O2 -m64 -I." set LINK_FLAGS = ""

c. Revise the location of the ioapi library:<BEFORE>#> Set location of libraries set IOAPI = "${M3LIB}/ioapi_3/${BLD_OS}2_x86pg -lioapi" set ICL_IOAPI = ${M3LIB}/ioapi_3/ioapi/fixed_src

19

Page 20: CMAQ

<AFTER>#> Set location of libraries set IOAPI = "${M3LIB}/ioapi_3/${BLD_OS} -lioapi" set ICL_IOAPI = ${M3LIB}/ioapi_3/${BLD_OS}/fixed_src

6. Run ./bldit.bcon.pgf in emac compile mode. Save the log as ~/Documents/cmaq_bcon_{date}_run{#}.txt. Check logs for problems.

7. Check for executable BCON_e1a in the same directory.8. If you need to recompile BCON, delete cfg.d1a. Delete the BLD directory after

changing permissions on its files. Also delete MOD_DIR.9. Next: Install CCTM

Friday, March 21, 2008

20

Page 21: CMAQ

Install CCTM

1. STENEX and M3BLD must be installed before creating the CCTM executable.2. Go to $M3WORK/scripts/cctm. 3. Copy bldit.cctm.pgf as bldit.cctm.pgf .default.4. Change permissions on bldit.cctm.pgf: “chmod ugo+rwx bldit.cctm.pgf”5. Edit bldit.cctm.pgf

a. Comment out the block that detects and requires Linux<BEFORE> if ($BLD_OS != 'Linux') then echo " $BLD_OS -> wrong makit script for host!" exit 1 endif<AFTER> #if ($BLD_OS != 'Linux') then #echo " $BLD_OS -> wrong makit script for host!" #exit 1 #endif

b. Comment out set ParOpt (serial installation)c. Change the directory path for Fortran compiler to ifort and reset the compiler

flags:<BEFORE>#> Set full path of Fortran 90 compiler set FC = /share/linux/pgi/linux86/5.0/bin/pgf90 set FP = $FC#> Set location of MPICH if using multiple processors set MPICH = /share/linux/bin/mpich-ch_p4#> Set compiler flags set FSTD = "-Mfixed -Mextend" set F_FLAGS = "${FSTD} -O2 -I." set CPP_FLAGS = "" set C_FLAGS = "-v -O2 -I${MPICH}/include" set LINK_FLAGS = "-Bstatic"<AFTER>#> Set full path of Fortran 90 compiler set FC = /opt/intel/fce/10.1.006/bin/ifort set FP = $FC#> Set location of MPICH if using multiple processors set MPICH = /share/linux/bin/mpich-ch_p4#> Set compiler flags set FSTD = "-extend-source 132 -w95 " set F_FLAGS = "${FSTD} -module ${MODLOC} -I. -O3 -xT -ip -mdynamic-no-pic -warn declarations -recursive" set CPP_FLAGS = "" set C_FLAGS = "-v -O2 -m64 -I." set LINK_FLAGS = ""

21

Page 22: CMAQ

Note that you can't comment out the MPICH setting because this environmental variable is needed in program so just leave the default setting.

c. Revise the location of the ioapi library:<BEFORE>#> Set location of libraries set IOAPI = "${M3LIB}/ioapi_3/${BLD_OS}2_x86pg -lioapi" set ICL_IOAPI = ${M3LIB}/ioapi_3/ioapi/fixed_src<AFTER>#> Set location of libraries set IOAPI = "${M3LIB}/ioapi_3/${BLD_OS} -lioapi" set ICL_IOAPI = ${M3LIB}/ioapi_3/${BLD_OS}/fixed_src

6. Run ./bldit.cctm.pgf in emac compile mode. It takes about 8 minutes to run. Save the log as ~/Documents/cmaq_cctm_{date}_run{#}.txt. Check logs for problems.

7. Check for executable CCTM_e1a in the same directory8. Copy run.cctm as run.cctm.default9. Change the permissions on run.cctm: “chmod ugo+rwx run.cctm”10.Edit the run.cctm script for serial processing:

a. Change horizontal domain:<BEFORE>#setenv NPCOL_NPROW "1 1"; set NPROCS = 1 # single processor setting setenv NPCOL_NPROW "4 2"; set NPROCS = 8<AFTER>setenv NPCOL_NPROW "1 1"; set NPROCS = 1 # single processor setting #setenv NPCOL_NPROW "4 2"; set NPROCS = 8

b. Turn off MPIRUN:<BEFORE>#> Executable call for multiple PE, set location of MPIRUN script set MPIRUN = /share/linux/bin/mpich-ch_p4/bin/mpirun set TASKMAP = $BASE/machines8 cat $TASKMAP time $MPIRUN -v -machinefile $TASKMAP -np $NPROCS $BASE/$EXEC<AFTER>#> Executable call for multiple PE, set location of MPIRUN script # set MPIRUN = /share/linux/bin/mpich-ch_p4/bin/mpirun # set TASKMAP = $BASE/machines8 # cat $TASKMAP # time $MPIRUN -v -machinefile $TASKMAP -np $NPROCS $BASE/$EXEC

11. If you need to recompile CCTM, delete cfg.d1a. Delete the BLD directory after changing permissions on its files. Also delete MOD_DIR.

12.Next: Install MCIP

Monday, March 24, 2008

22

Page 23: CMAQ

Install MCIP

1. Unlike the other components of CMAQ, the M3BLD is not used for the MCIP installation. It is a Fortran makefile.

2. Go to $M3HOME/MCIP3/mcip3.3. Copy Makefile as Makefile.default4. Change permissions on Makefile: chmod ugo+rwx Makefile5. Edit the Makefile:

a. Change path for netCDF:<BEFORE>NETCDF = /usr/local/netcdf<AFTER>NETCDF = /usr/local

b. Add compiler, flags, and libraries for Mac at line 7:#...MAC (Intel)FC = /opt/intel/fce/10.1.006/bin/ifortFFLAGS = -O3 -FR -convert big_endian -I$(NETCDF)LIBS = -L${NETCDF}/lib -lnetcdf \ -L/phd/basics/ioapi3.0/Darwin -lioapi

c. Comment out all other definitions of FC, FFLAGS, and LIBS6. Run make in emac compile mode. Save the log as ~/Documents/

cmaq_mcip_{date}_run{#}.txt. Check logs for problems.7. Check for mcip.exe in same directory ($M3HOME/MCIP3/mcip3)8. If you need to recompile, you do not have to delete any files. The make will

recognize files correctly compiled from prior makes.

Monday, March 24, 2008

23

Page 24: CMAQ

Fixes

Process: XCODE TOOLSProblem: DVD version canʼt find boot diskFix: DVD version does not work on Leopard—download from ADC

Process: TerminalProblem: refused to take my admin passwordFix: use “sudo” command not “su” command

Process: FinderProblem: hid most UNIX--could not use Time Machine to retrieve old versionsFix: In Terminal command line, entered: “defaults wrote com.apple.Finder AppleShowAllFiles YES”

Process: DarwinProblem: Found out that Darwin had been upgraded from 9.1.0 to 9.2.0 as part of the Mac OSX software update.Fix: In System Preferences →Software Update→Scheduled Check, I unchecked the box Check for Updates. However, Dave recommended I keep getting updates since he has not had it mess up his code. I reset it for Weekly updates but unchecked automatic installs fo important updates.

Process: CMAQ/SMOKEProblem: Asked for help to compile with gfortranFix: Change to ifort and use Scott Spakʼs information

Process: netCDFProblem: “checking if Fortran "byte" is C "signed char"... configure: error: Could not link conftestf.o and conftest.o --compilation exited abnormally with code 1”Fix: The problem is that the ifort is 64-bit and the gcc is 32-bit. Changed CC in .tcshrc: setenv CC "/usr/bin/gcc -arch x86_64 -mmacosx-version-min=10.5”

Process: netCDFProblem: Make Test had significant problems with libnetcdf_c++.aFix: Added --disable-cxx to configure options

Process: CMAQProblem: STENEX build unsuccessful because of an undefined symbol (_MAIN__).Fix: Added “-c” flag (no linking) to FSTD in bldit.se_noop.pgf. I think that -nofor_main (Fortran is not main program) would also have worked.

Process: CMAQProblem: M3BLD build unsuccessful because of errors in bld_scanner.Fix: Used Scott Spaks revised bld_scanner.c file

24

Page 25: CMAQ

Process:. CMAQProblem: STENEX build unsuccessful because F_FLAGS is undefinedFix: Changed F_FLAG in bldit.se_noop.pgf to FSTD

Process: CMAQProblem: M3BLD part 2 run was unsucessful because of syntax error in bldit.m3bldFix: Had an extra space above the first line (#! /bin/csh -f), when I deleted it, it ran with no errors.

Process: CMAQProblem: JPROC build had undefined symbols from ioapi library. (All are defined in libioapi according to nm -g).Fix: Ran a “ranlib -cs libioapi.a” before the bldit script for JPROC

Process: CMAQProblem: ICON build could not find $M3LIB/ioapi_3/Darwin/fixed_src files.Fix: I had changed the name of the /phd/basics/ioapi3.0/Darwin_ifcgcc to Darwin so I had to redo the soft links in the $M3LIB/ioapi_3/Darwin/fixed_src directory. I also had to edit the directory path to the this directory.

Process: CMAQProblem: ICON build error message: sh opt/intel/fce/10.1.006/binopt/intel/fce/10.1.006/bin: No such file or directory.Fix: Added backslash in front of FC pathname

Process: CMAQProblem: ICON build error message: ld: library not found for -lioapiFix: I had changed the name of the /phd/basics/ioapi3.0/Darwin_ifcgcc to Darwin so I had to redo the soft links in the $M3LIB/ioapi_3/Darwin/libioapi.a.

Process: CMAQProblem: MCIP run exited abnormally: Error: Illegal character in statement label field.Fix: Changed FFLAGS to -O3 -FR -convert big_endian -I$(NETCDF) based on Scott Spakʼs makefile

Process: CMAQ Problem: MCIP run exited abnormally because it could not find the ioapi libraryFix: Changed from $M3LIB directory for linked libioapi.a to the original libioapi.a in /phd/basics/ioapi3.0/Darwin.

25

Page 26: CMAQ

Set Up Time Machine

1. Make sure your Mac is shut down. Unpack the external hard drive you bought separately and attach it to the USB port (or Fire Wire) at the back of the Mac Pro. Plug in and then connect the AC Converter to the external hard drive. Turn on the hard drive and then the computer.

2. If the hard drive is not configured for Mac, copy all its software to your hard drive. Go to Utilities→Disk Utilities then click on your new external hard drive. Go to the Erase page. Choose the format for the drive: Mac OS Extended (Journaled). Enter a name in the space. Hit the erase button. It will ask you if you really want to erase so click yes. The disk will be reformatted and renamed and will be displayed indented under the original name on the left pane.

3. Automatically, a window will appear asking if you want it to be used for Time Machine. Hit yes.

4. Because retrieval of old files requires they appear in the Finder, set the Finder to show all files. To do this, open up Terminal and on the command line enter: defaults wrote com.apple.Finder AppleShowAllFiles YES. If you later which to turn off this option, enter defaults wrote com.apple.Finder AppleShowAllFiles NO.

5. To exclude folders from the backup, choose Sytem Preferences from the Dock. Click on the Time Machine option. Click on the lock and enter your UNIX password. Choose Options.... Click + and the Finder will appear. Select the drive or folder you want to exclude and then push the Exclude button. The excluded drive/folder will now appear in the “Do Not Backup” list. Note that the external hard drive is automatically excluded. Click Done and relock the screen. Click the red x to exit.

6. When a backup is in progress, a progress bar will appear. You can stop it by hitting the x and then it will postpone the backup. It automatically stops if you shutdown your computer and restarts after the computer is next turned on.

7. The first backup takes a long time, but after that backups are quick because only changes to the original backup are recorded. The copy is non-destructive.

8. To restore a file, use Finder to go to the folder in which it originally appeared (It also can be used in Mail and Safari). Then click the Time Machine icon from the Dock. You will see the current Window with all previous windows behind it. Use arrows. mouse, or date bar to find the old file. The Fly button will take you to the date your window was last changed. Click on the file you want to restore and then press restore.

9. To delete all backups of a file, click on the Time Machine icon, go to Preferences, and click Options. Highlight the file/folder you wish to delete and then press the button that says “Delete from all backups.”

10. When the external hard drive is full, Time Machine will warn you. You have three options:a. Delete unwanted files taking up space on the external hard driveb. Exchange your hard drive to a larger hard drive with help from Time Machine.c. Reduce the time period for the oldest backup.

11. Note that Time machine does not protect against external hard drive failure. You can use an internal RAID volume for backup to avoid this

26

Page 27: CMAQ

Wednesday, February 20, 2008

27

Page 28: CMAQ

Setting Up RAID

1. To name an unnamed hard drive, open Finder and choose preferences. Put a check next to hard drives. They will now appear in Finder and on the Desktop. Click on the hard drive and then on the blue oval around the name. Type in the new name. Note that you cannot rename the RAID drives.

2. To check if the drives are set up for RAID, open Finder and click on Utilities → Disk Utility. You should see all three drives (250, 750, 750 MB) listed. Click on Media Raid and then RAID button. This will display the RAID set made up of two RAID slices. A “mirrored” RAID set automatically copies everything from one drive to the other. A “striped” RAID does the same but adds a feature for quicker retrieval. Note that RAID only protects against one of the two hard drive failing. If data is corrupted or deleted on one drive, it will be corrupted or deleted on the other drive.

3. Next, you need to set permissions for the RAID drives. Go into Finder and click on the Media RAID icon. Go to the File dropdown menu and choose Get Info. This will show you a picture of the drive. At the bottom, open Sharing & Permissions. This lists names and privileges. Click on the lock symbol and enter your UNIX password. Change system, admin, and everyone to “Read & Write” by clicking on the up/down arrow heads. Now go down to + and click on it. Under Users & Groups, you will see your own name, choose it and click on “Select”. Now you will appear in the privileges list. Change your own permissions to “Read & Write.” This allows you to create and copy files to the RAID set.

4. On the Terminal, you can change to the /Volumes directory and see both the Main and RAID Media drives. Media RAID is a directory and Main is a link. Change directory with cd Me (tab for autocomplete). You will see Media\ Raid/. The path to this drive is /Volumes/Media Raid.

5. The RAID drives will be used for all input and output data, like the Storage drive on the mesocluster, although zipping will be unnecessary. Newly input and newly created data will remain temporarily on the Main drive and then be moved.

February 14, 2008

28