Machine issues & portability

From Geos-chem
Revision as of 19:59, 4 November 2009 by Bmy (Talk | contribs) (Problems with IFORT 11)

Jump to: navigation, search

On this page we list the compiler-dependent and platform-dependent issues that we have recently encountered.

IFORT Compiler

Optimization options for faster runs

Yuxuan Wang ( told us about the optimization options: -ipo and -static and said these options would speed up the simulations. I've tested these options on our system at Harvard. The run with the new options show very tiny differences (much less than 1% over 1 month) compared to a run with the old options only. For a full-chemistry run (43 tracers) on 4x5 resolution and 4 processors, the run time is about 10% shorter than previously.

These options are especially efficient to handle the transport. So in simulations with a faster chemistry (like tagged tracers simulations), we expect to see a higher gain in time. For example, the time for a methane run is shorten by about 30 %.

To use these options, in Makefile.ifort, change:

 FFLAGS = -cpp -w -O2 -auto -noalign -convert big_endian


 FFLAGS = -cpp -w -O2 -auto -noalign -convert big_endian -ipo -static

--Ccarouge 15:54, 8 September 2009 (EDT)

Problems with IFORT 11

Tzung-May Fu ( wrote:

I tested the Intel Fortran v11.0.074 compiler, but found that it is incompatible with the GC code. This is related to the partition.f bug that I reported earlier. (Actually, I'm not sure there is a bug in partition.f any more, unless you have also run into it with IFORT v10).
I ran a 1-day simulation, using Bob's v8-01-03 standard run release, with no change at all. Using Intel Fortran v10.1.015, I was able to replicate Bob's standard run. However, when I switched to Intel Fortran v11.0.074, I ran into the error in partition.f, due to the CONCNOX-SUM1 < 0d0 check. Here's the error message in log:
   STOP at partition.f
I then tried Bob's fix to partition.f. This time the run finishes, warning the user about the CONCNOX-SUM1 < 0d0 issue. But the output result is completely wacky!!! Below you can compare the surface Ox concentrations, using
The (B) spatial pattern is completely off. NOx is also affected and shows the similar weird pattern.
I'm pretty sure the problem is in the chemistry part. I've tried turning off the optimization but the problem persists. Perhaps there is some problem with the way IFORTv11 treats floating points? Also, I am not sure if IFORTv11 caused the weird model result, or if IFORTv11 caused some issues in chemistry, and the partition.f 'fix' subsequently lead to the weird result.
Long story short, it seems like IFORTv11 is not a good choice for now, and that the 'fix' to partition.f should not be implemented.

Philippe Le Sager ( wrote:

Thanks for testing Ifort11. We did run into the partition bug with Ifort10 after fixing tpcore. So I doubt that the weird result is related to that partition fix, and it is probably just a problem with IFORT 11.

Bob Yantosca ( wrote:

You might have to go thru the IFORT 11 manuals to see if any default behavior has changed (i.e. optimization, compiler options, etc). It may not just be the concnox thing but something else in the numerics that is particular to IFORT 11.
There is usually a "What's new" document w/ every Intel compiler release. Maybe that has some more information, you could look at it.

Bob Yantosca ( wrote:

I've also heard from some folks @ NASA that IFORT 11.0 was problematic. They claim that IFORT 11.1 is much better. You may want to look into this in the meantime.

--Bob Y. 16:50, 7 October 2009 (EDT)

Eric Sofen ( wrote:

Both Becky Alexander and I have run into problems with IFORT 11.1. When either of us run offline aerosol simulations compiled on IFORT 11.1, the simulation compiles and runs without errors, but the sulfur budgets are way off. The problems seem to be occurring in the deposition code, as Becky's simulations end up with very little deposition, but at the same time, the S burdens are too low. In my case, the deposition ends up being an order of magnitude too high. Changing back to IFORT 10 fixed both of these problems.

--Eric Sofen 13:32, 22 October 2009

Yuxuan Wang( wrote:

From our interaction with the Intel people, ifort 11.1.056 should work for GEOS-Chem. The GC version we tested at Tsinghua is v8-02-01 (nested-grid China with GEOS-5 meteorology). The platform we tested is Nehalem from Intel, with the following compilation options:
 -cpp -w -static -fno-alias -O2 -safe_cray_ptr -no-prec-sqrt -no-prec-div -auto -noalign -convert big_endian
Not sure whether these options will work for Mac OSX. From the testing, we found that codes compiled with ifort 11.1.056 ran at 2% faster than ifort 10.1.008.

--Bob Y. 14:59, 4 November 2009 (EST)

Comparison between IFORT 9.1 and IFORT 10.1

The table shows the wallclock time and mean OH for several GEOS-Chem simulations that were done in order to compare Intel Fortran Compiler (IFORT) v9.1 vs. v10.1.013. The simulations had all these things in common:

  • GEOS-Chem v8-01-01
  • 4x5 GEOS-5 met fields
  • 1-week of simulation (0 GMT 2008/01/01 to 0 GMT 2008/01/08)
  • Base compiler options: -cpp -w -auto -noalign -convert big_endian
  • Runs were done on the Harvard "Ceres" cluster (OS type "linux-rhel5-x86_64")

# CPUs Optimization options Wall clock
Speedup from
IFORT 9.1 to
IFORT 10.1
Speedup from
4 to 8 CPUs w/
the same compiler
Mean OH
(1e5 molec/cm3)
1 9.1 4 -O2 36:16     11.2913755849576
2 10.1 4 -O2 33:55 6.48%   11.2913755842197
3 9.1 4 -O3 37:26     11.2913755849576
4 10.1 4 -O3 33:36 10.24%   11.2913755838124
5 9.1 8 -O2 24:15   33.13% 11.2913755849576
6 10.1 8 -O2 22:46 6.12% 32.88% 11.2913755842197
7 9.1 8 -O3 23:36   36.95% 11.2913755849576
8 10.1 8 -O3 22:31 4.59% 32.99% 11.2913755838124
9 9.1 8 -O3 -ipo -no-prec-div -static 23:03     11.2913764967223
10 10.1 8 -O3 -ipo -no-prec-div -static 21:56 4.84%   11.0809209646817

NOTES about the table:

  1. The column Speedup from IFORT 9.1 to IFORT 10.1 compares the wall clock time of equivalent runs done with IFORT 9.1 and IFORT 10.1. For example, the 6.48% speedup listed for Run #2 is comparing Run #2 to Run #1. Similarly Run #4 is compared against Run #3, etc.
  2. The column Speedup from 4 to 8 CPUs w/ the same compiler compares the wall clock time between runs with 4 CPUs and 8 CPUs for the same compiler (i.e. 4 CPUs on IFORT 9 vs 8 CPUs on IFORT 9, and ditto for IFORT 10). For example, the 33.13% speedup listed for Run #5 is comparing Run #5 to Run #1. Similarly, Run #6 is compared against Run #2, etc.
  3. The compiler options -O3 -ipo -non-prec-div -static correspond to IFORT's -fast optimization option. Using this option results in a mean OH concentration that is different than with the simpler optimization options of -O2 and -O3. This is because the -fast option sacrifices numerical accuracy for speed.
  4. With IFORT 9.1, switching from -O2 to -O3 does not change the mean OH concentration. Thus the bpch files of the runs were binary identical to each other.
  5. With IFORT 10.1, switching from -O2 to -O3 changes the mean OH concentration slightly. This implies that there are slight differences in the chemistry. However all runs done with -O2 have the same mean OH, as do all runs done with -O3.


  1. Run #2 vs Run #1 (i.e. IFORT 9.1 vs IFORT 10.1 w/ -O2 on 4 CPUs)
  2. Run #3 vs Run #4 (i.e. IFORT 9.1 vs IFORT 10.1 w/ -O3 on 4 CPUs)
  3. Run #5 vs Run #9 (i.e. -O2 vs -fast with IFORT 9.1)
  4. Run #6 vs Run #10 (i.e. -O2 vs -fast with IFORT 10.1)


  1. IFORT 10.1 is always faster than the equivalent run with IFORT 9.1.
    • IFORT 10.1 does indeed seem to optimize code better on machines with multi-core chipsets.
    • For example: Run #6 (w/ IFORT 10) is 89 seconds faster per week than Run #5 (w/ IFORT 9) on 8 CPUs. This implies that a 52-week simulation with IFORT 10 on 8 CPUs would finish ~1hr 15m earlier than the equivalent IFORT 9 run.
  2. Switching from 4 to 8 CPU's results in a ~33% speedup for both IFORT 9.1 and IFORT 10.1.
  3. In general, switching from -O2 to -O3 (while using the same # of CPU's) does not result in a significant speedup. This is true for both IFORT 9.1 and IFORT 10.1.


  1. If possible, use IFORT 10.1 instead of IFORT 9.1
  2. Use the following compiler options (see Makefile.ifort):
    • FFLAGS = -cpp -w -O2 -auto -noalign -convert big_endian

--Bob Y. 16:46, 16 April 2008 (EDT)

Upgrading to IFORT 10.1 does not seem to fix the stacksize problem listed below. You still need to manually reset the stacksize limit to a large positive number for both Linux and Altix platforms.

--Bob Y. 12:41, 25 April 2008 (EDT)

Resetting stacksize for Linux

If you are using IFORT on a Linux machine, you will have to make a similar fix to your .cshrc file as was as was described below for the Altix/Itanium platform.

  • Harvard users: you do not have to do anything anymore. The default software configuration is set up to set the stacksize automatically on all nodes of Ceres, Tethys, and Terra so that you don't have to do this manually.
  • Non-Harvard users: add these lines of code into your .cshrc.
   # Due to a limitation in the glibc library that is used by the Intel IFORT
   # v9.x and v10.x compilers, you must do the following in order to avoid 
   # potential memory problems with OpenMP:
   # (1) Explicitly set the "KMP_STACKSIZE" environment variable to a large
   #      positive number (but not so large that you get an error msg.)
   # For more information see the Intel IFORT release notes:
   # The symptom will be that GEOS-Chem will appear to be out of memory and 
   # will die with a segmentation fault.
   setenv KMP_STACKSIZE 100000000

--Bob Y. 15:39, 24 October 2008 (EDT)

Resetting stacksize for Altix

(1) As described above, the IFORT compiler has an error that can cause the GEOS-Chem to appear that it is running out of memory when it actually isn't. The symptom that we have noticed is that it seems to choke right when the TPCORE is called. This may tend to happen more often IFORT v9 or v10 on Linux Boxes, but it can also happen on Altix/Itanium systems.

If GEOS-Chem still crashes with the this error, then you may need to set the stacksize variable to a large positive # instead of unlimited. This is a known issue with the POSIX glibc library that is used by IFORT.

Try adding this code to your .cshrc file as well under the "Altix" section:

   # Due to a limitation in the glibc library that is used by the Intel IFORT 
   # v9.x compilers, you must do the following in order to avoid potential 
   # memory problems with OpenMP:
   # (1) Explicitly set the "KMP_STACKSIZE" environment variable to a 
   #      large positive number (e.g. 209715200).
   # For more information see the Intel IFORT release notes:
   # The symptom will be that GEOS-Chem will appear to be out of memory and 
   # will die with a segmentation fault.  This may happen especially if you
   # are running GEOS-Chem with GEOS-5 met on Altix or Titan.
   # (bmy, 8/16/07, 9/9/08)
   setenv KMP_STACKSIZE 209715200

The 2097152 is the maximum allowable stacksize on the Harvard Altix/Itanium system. This may be different on your system. You can find out the maximum stacksize on your machine by typing "limit" at the Unix prompt. On your machine the number may vary. Then just cut-n-paste this number and replace the "2097152 kbytes" in the text above and put that into your .cshrc or .bashrc.

(2) If you are using the IFORT 10.x compilers, then you might also need to tell the compiler to put automatic arrays into heap memory instead of on the stack.

Mike Seymour ( wrote:

I found this Intel page regarding stack sizes and ifort >=8.0:

It suggests for ifort 10.0 to use the heap for temporary storage with -heap-arrays <size>, where arrays known at compile-time to be larger than <size> are allocated on the heap instead of the stack.

However, setting <size> to be 1000 does not change things. I don't know if smaller values will have an effect, or if there will be performance issues.

--Bob Y. 16:13, 9 September 2008 (EDT)

Resetting stacksize on other platforms

Win Trivitayanurak ( wrote:

I'm running a 4x5 resolution with 310 tracers. Recent development was few subroutines and an additional allocation of 30 elements in an array -- not in STT array, so it's not like 30x(72x46x30) more memory, but still probably enough to reach the stacksize limit. Now the "ulimit" solves the problem.
I found that I can set environment in my shell-runscript (e.g. .cshrc file) to have the large enough stacksize. I found good suggestions from this website and for different platforms, the lines are:
      limit stacksize unlimited
      setenv MP_STACK_SIZE 17000000

      limit stack size unlimited
      setenv XLSMPOPTS "stack=40000000"

   SGI origin
      limit stack size unlimited
      setenv MP_SLAVE_STACKSIZE 40000000

      limit stacksize unlimited

      limit stacksize unlimited
      setenv MPSTKZ 40000000

--Bob Y. 10:41, 17 October 2008 (EDT)

PGI Compiler

Error with ADJUSTL and ADJUSTR

Win Trivitayanurak ( wrote:

In short, TRIM and ADJUSTL or ADJUSTR do not work together properly when compiled with Portland Group Fortran. I propose removing TRIM inside the subroutine StrSqueeze. This is not urgent and relevant to only the few PGI users.

So if you are using the PGI compiler, then you will have to modify the code in routine STRSQUEEZE "charpak_mod.f" such that the statements


are now replaced with


and this will solve the problem. We will incorporate this into a future release of GEOS-Chem.

SGI-MIPS Compiler

Sun Studio Compiler

Use "sunf90" and "sunf95"

Jack Yatteau ( wrote:

In order to do the (Baselibs) installation, I had to make the gfortran (gnu) version of f90 the default . This conflicts with the name f90 in the SunStudio12 path. I also discovered that there was already a name conflict between the gnu version of f95 and SunStudio12 version.
Users can avoid this by using the names sunf90 and sunf95 (e.g. in their makefile). Sun must have placed the names sunf90 and sunf95 in the Linux installation of SunStudio12 to cover just this situation.

Apparent "out of memory" error

Colette Heald ( wrote:

I started a 2x2.5 v8-01-01 run with 54 tracers (including SOA) this morning. It gets through initialization and then fails when chemistry starts (I've attached the log so you can see how far it gets). The error message that gets dumped out by my system is as follows:
   ******  FORTRAN RUN-TIME SYSTEM  ******
   Error 12:  Not enough space
   Location:  the AUTOMATIC variable declaration at line 586 of "tpcore_fvdas_mod.f90"
I didn't run into this with an almost identical v7-04-13 run and I double-checked that all my directories are not close to quota. I repeated the v8-01-01 run at 4x5 and it also ran no problem. Have either of you tested v8-01-01 at 2x2.5? Have you seen any tpcore related problems?

Philippe Le Sager ( replied:

You are using GEOS-5 met field and your simulation has 47 levels instead of 30 with GEOS3 and 4. This is more than 50% increase, which affect the memory requirement. Using GEOS5 with secondary aerosols at 2x2.5 requires a lot of memory, and it seems you break the bank. You should try to turn off some diagnostic, particularly those (like met fields) you can get with another quick run without chemistry/transport.

Colette Heald ( replied:

Thanks for your email. That certainly makes sense and I have managed to get it to run (slowly!) by removing diagnostics. What memory is the issue here? I've got 8 Gb of RAM on the Sun 4200's (2 dual-core = 4 proc) I'm running with which seems comparable/superior to what other folks are using with GEOS-Chem. Should I be looking for more RAM for future system purchases? Or is there something else that would improve the model performance?

Bob Yantosca ( replied:

I think the relevant memory limit is the stacksize. This is the part of the memory where all automatic variables (i.e. variables in a subroutine or function that aren't in a common block, SAVE, or at the top of a module) are created on most compilers.
Also, one of the issues is that when you enter parallel loops, then your memory use will increase. For example, if you are using 4 processors then you need to make 4 copies of every PRIVATE variable in the DO-loop. Most compilers (at least I know IFORT does) will use the stack memory for this.
The -stackvar option in the SunStudio compiler puts automatic arrays on the stack whenever possible.
Maybe you can play w/ the stacksize limit on your machine (set it to "unlimited" in your .cshrc) and that might help.

Colette Heald ( replied:

Setting the stacksize to unlimited in my run script did the trick - I now have a GEOS5 run with a full suite of diagnostics running on my SUN machines no problem.

--Bob Y. 09:21, 2 May 2008 (EDT)

"Not enough space" error in TPCORE

Colette Heald ( wrote:

I just replaced the tpcore_fvdas_mod.f90 with the patch for v8-01-04 to speed up the code. However with this update my code is crashing during the run. I'm running with Solaris on Sun machines. The last entry in the log is:
   TPCORE_FVDAS (based on GMI) Tracer Transport Module successfully initialized
The error file I get out from the run indicates:
   ******  FORTRAN RUN-TIME SYSTEM  ******
   Error 12:  Not enough space
   Location:  the AUTOMATIC variable declaration at line 565 of "tpcore_fvdas_mod.f90"
Have you folks seen anything like this? Any suggestions for how to proceed?

Bob Yantosca ( wrote:

This is traced to:
   ! fx, fy, fz and qtemp are now 4D arrays for parallelization purposes.
   ! (ccc, 4/1/09)
   REAL*8             :: fx (im, jm, km, nq)
   REAL*8             :: fy (im, jm+1, km, nq)           ! one more for edges
   REAL*8             :: fz  (im, jm, km, nq)
   REAL*8             :: qtemp (im, jm, km, nq)
   <<< it dies here>>>      
   REAL*8             :: DTC(IM,JM,KM)               ! up/down flux temp array
so what that means is that you don't have enough memory to make this array. That may be expected since we now have a bunch more 4-D arrays than before. You've maxed out your stacksize setting, right? Otherwise it may be a system or compiler dependent error.

Colette Heald ( replied:

Just an fyi, it turns out that my memory issue arose because my code was compiled as 32-bit instead of 64-bit (apparently with 64-bit I can access more swap space). I added the -m64 switch to the compile options and that did the trick.

Bob Yantosca ( replied:

Another thing you can the Makefile.ifort we have:
   # Generic flags for all machines
   FFLAGS = -fpp -fast -stackvar -xfilebyteorder=big16:%all

   # Flags specific to TERRA
   FARCH  = -xtarget=opteron -xchip=opteron -xarch=generic64

   # Flags specific to TETHYS or CERES
   #FARCH  = -xtarget=opteron -xchip=opteron -xarch=sse3a

   # Flags specific to the older SPARC machines
   #FARCH  = -fpp -O4 -xarch=v9

   # Compile command -- multiprocessor
   F90    = f90 $(FFLAGS) $(FARCH) -openmp=parallel -Dmultitask

   # Compile command -- single processor
   #F90   = f90 $(FFLAGS) $(FARCH)
The $(FARCH) variable sets stuff up for the specific chipset that you have. This varies from machine to machine, we had a couple of options for our machines at Harvard.
However, you can figure this out the proper options settings for your system with the following command:
   > sunf90 -native -dryrun
   ###     command line files and options (expanded):
   ### -xarch=ssse3 -xcache=32/64/8:4096/64/16 -xchip=core2 -dryrun
so then you can use those values for the -xarch, -xchip, -xcache, etc. keywords. That may obviate the need for having to use -m64, and you'll get precisely the options that will optimize well for your chipset.

--Bob Y. 11:22, 24 April 2009 (EDT)