Showing posts with label Compiler. Show all posts
Showing posts with label Compiler. Show all posts

Saturday, April 23, 2011

Building AmberTools 1.5 on a 10.5.x or 10.6.x with gcc/gfortran 4.3

I'll be using BASH environment in my examples here. Although I am a die-hard TCSH fan, I also speak BASH. I envision this document is for first time users who are somehow macports savvy. To learn more about macports, see http://guide.macports.org/ .

10.5.x / 10.6.x

Macports gcc45 is a set of stable compilers that you should be trying first. You are also advised to unset MKL_HOME since MKL gives some bad results for certain tests.

Supposed that you downloaded the source code of AmberTools 1.5 with your web-browser, the normal place of the source code archive file was saved is probably your own Downloads folder. ( ~/Downloads )

Now uncompress the archive and put it into the /opt directory. The reason that I chose this path is that I can always remove the whole contents of /opt folder without interfering your daily operations with your Macintosh.

 $ tar jxvf ~/Download/AmberTools-1.5.tar.bz2 -C /opt

Set up the environment variable, if these variables have already been set in your ~/.bashrc file, please just verify the values of variable and modify accordingly, and then open a new terminal session.

        $ export AMBERHOME=/opt/amber11
        $ export PATH="$AMBERHOME/bin:$PATH"
        $ export MPI_HOME=$AMBERHOME
        $ unset MKL_HOME
        (note: "unset" doesn't work on CSH, please use "unsetenv" instead)
        $ echo 'export AMBERHOME=/opt/amber11' >> ~/.bashrc
        $ echo 'export PATH="$AMBERHOME/bin:$PATH"' >> ~/.bashrc
        $ echo 'export MPI_HOME=$AMBERHOME' >> ~/.bashrc
        $ cd /opt/amber11/AmberTools/src

Configure for building serial amber

        $ ./configure -macAccelerate gnu

Build the serial AT15

        $ make

Test the serial build

        $ cd ../test

Clean the file after the serial build is finished.

        $ cd ../src
        $ make clean

Download the openmpi source code from open-mpi.org

        $ cd ~/Downloads
        $ curl -O http://www.open-mpi.org/software/ompi/v1.4/downloads/openmpi-1.4.3.tar.bz2

Uncompress this source archive

        $ cd /opt/amber11/AmberTools/src
        $ tar jxvf ~/Downloads/openmpi-1.4.3.tar.bz2

Build amber's own openmpi

        $ ./configure_openmpi
( If you use TCSH/CSH as your login shell, you'd need to run "rehash" command before continue following procedures. )

Configure parallel ambertools

        $ ./configure -mpi -macAccelerate gnu

Build some parallel components of ambertools

        $ make

Test parallel set

        $ cd ../test
        $ export DO_PARALLEL='mpirun -np 2'
        $ ./test_at_parallel.sh

Saturday, May 15, 2010

Building AmberTools 1.4 with pre-built compilers on Mac OS X 10.6 Snow Leopard

I have been using the pre-built compilers for Amber projects from time to time, but I've never settled down with any of these binary packages. The most obvious reason was that I really like to build it by myself, part of me deep inside my paranoid mind, I was just afraid of pre-built packages.

However when it comes to preparing documentation for the broad range of Amber users, suggesting an solution of requiring users to build compilers themselves seems to be ridiculous in some level a hassle for users. If you want to change the status quo, go to Apple's bugs report website and suggest them to bundle gfortran with Xcode. I can even envision Professors writing letter to Steve Jobs and having a very civilized discussion back and forth.

Before we convince Apple to begin hiring FORTRAN people, for users with limited experience of mac and unix, I can only introduce pre-built binary packages from third-party providers. Now I am going to write down the steps I have tried to work on Amber with a pre-built compiler package. Gaurav Khanna of "HPC on Mac OS X" project has done a great job providing binary packages for Mac community for a long time. To download the package, you can visit the homepage at http://hpc.sf.net and find the download link. My experience on the gfortran-only package was not successful, it failed on linking the fftw and nab. I also failed to finish the configure script with the other "llvm-gfortran-intel-bin.tar.gz" package. So I am going to recommend you to use the gcc+gfortran package.

Here are the steps:

  1. If you already tried MacPorts and fink, you should uninstall them to prevent them interfering your following procedures. (updated: no I am not bad mouthing MacPorts or fink in the previous version of the document, I was trying to be funny.)
  2. If you want to keep your gcc/gfortran from MacPorts, try this:
    sudo gcc_select gcc42
    sudo port deactivate gcc44
    (for more information, do man gcc_select and man port, please.)
  3. If you already install the package of "gfortran-snwleo-intel-bin.tar.gz (Snow Leopard gfortran only)", you should uninstall it. To uninstall it, do
    cd /; tar ztf ~/Downloads/gfortran-snwleo-intel-bin.tar.gz | grep -v -e '/$' -e '/\._' | xargs sudo rm -f
  4. gcc+gfortran binary package "gcc-snwleo-intel-bin.tar.gz (Snow Leopard)" from the same site indeed does work, so you should download that gcc-snwleo-intel-bin.tar.gz file. To install it, do:
    sudo tar zxvf ~/Downloads/gcc-snwleo-intel-bin.tar.gz -C /
    (this will extract the files in /usr/local )
  5. Now it comes to be the tedious part of the work, try to make sure you are running the right compilers when you type gcc and gfortran. First type gcc -v command, if your output looks like this, you are using the right C compiler:
    [localhost:amber11/AmberTools/src] mjhsieh% gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin10/4.5.0/lto-wrapper
    Target: x86_64-apple-darwin10
    Configured with: ../gcc-4.5-20100107/configure --enable-languages=fortran --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10 : (reconfigured) ../gcc-4.5-20100107/configure --enable-languages=fortran,c++ --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10
    Thread model: posix
    gcc version 4.5.0 20100107 (experimental) (GCC)
  6. If your gfortran -v output looks like this, you are using the right gfortran.
    [localhost:amber11/AmberTools/src] mjhsieh% gfortran -v
    Using built-in specs.
    COLLECT_GCC=gfortran
    COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin10/4.5.0/lto-wrapper
    Target: x86_64-apple-darwin10
    Configured with: ../gcc-4.5-20100107/configure --enable-languages=fortran --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10 : (reconfigured) ../gcc-4.5-20100107/configure --enable-languages=fortran,c++ --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10
    Thread model: posix
    gcc version 4.5.0 20100107 (experimental) (GCC)
  7. If they are not what you got, please make sure you have set the correct path environment variable, it should contain "/usr/local/bin"; my path variable looks like this:
    % echo $PATH
    /opt/local/bin:/opt/local/sbin:/opt/intel/Compiler/11.1/084/bin/intel64:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/X11/bin:/Users/mjhsieh/bin
  8. If you still can't have the correct output, ask us in the Amber mail reflector.
  9. start to configure:
    cd /usr/local/amber11
    cd AmberTools/src; ./configure -macAccelerate gnu
  10. If everything printed out looks okay, start building AmberTools by typing make install
  11. Also go to the path where amber11 is at, start the building process:
    cd ../../src; make install
  12. Now you have it, please make sure it passes the test cases in amber11/test and amber11/AmberTools/test.
  13. GOOD LUCK playing AMBER/AMBERTOOLS!
  14. This is my result:
    Finished test suite for AmberTools at Sun May 16 02:58:11 PDT 2010.
    
         318 file comparisons passed
           0 file comparisons failed
           0 tests experienced errors
    
    Finished serial test suite for Amber 11 at Sun May 16 03:53:37 PDT 2010.
    
         492 file comparisons passed
           0 file comparisons failed
           0 tests experienced errors
    
  15. If you are not satisfied with this binary package, do this to uninstall:
    cd /; tar ztf ~/Downloads/gcc-snwleo-intel-bin.tar.gz | grep -v -e '/$' -e '/\._' | xargs sudo rm -f

Thursday, May 06, 2010

AmberTools 1.4 and Amber 11 on Snow Leopard with the Intel compilers

In this post, I describe how to compile and install Amber 11 on Snow Leopard with the Intel compilers. Some suggest that the Intel compilers should be passed over in favour of the GNU compilers for the time being; in my experience, on the whole, the two give comparable output. This post is written as though you have installed the most recent versions of the Intel Mac compilers, which at the time of writing are 11.1.088. For earlier (or later) versions, you will need to modify your paths accordingly. I also assume you have downloaded and installed the Intel compilers. The installation process for these is straightforward, and should in any case be documented by Intel.

  1. Set up the Intel compiler environment. Note: These commands are intended for the Bourne shell and its variants (e.g., bash). If you are using the C shell or a variant (e.g., tcsh), you will need to use the scripts with a .csh extension instead of those ending in .sh. Also, if you are using an ia32 processor instead of a 64-bit processor, the argument to the script should be modified accordingly.
  2. . /opt/intel/Compiler/11.1/088/bin/iccvars.sh intel64
    . /opt/intel/Compiler/11.1/088/bin/ifortvars.sh intel64
  3. If you wish to compile a parallel (MPI) version of Amber and/or AmberTools, download MPICH2 from here. WARNING: While other MPI implementations such as Open MPI exist, some are untested, and Open MPI fails.
  4. Untar the mpich2 installation file:
    tar xzvf mpich2-1.2.1p1.tar.gz
  5. Configure MPICH2 for installation and build it:
    cd mpich2-1.2.1p1 ./configure --prefix=your_chosen_mpich2_directory \ --enable-f77 --enable-f90 --enable-cxx \ CC=icc CXX=icpc F77=ifort F90=ifort
  6. Follow the rest of the MPICH2 installation and testing instructions in the README file.
  7. Make sure that your_chosen_mpich2_directory/bin and your_chosen_mpich2_directory/lib are in your PATH and DYLD_LIBRARY_PATH respectively, and that they are ahead of other possible MPI installations such as the default system MPI.
  8. Follow steps 1 to 5 here. Step 6 should not be necessary.
  9. Configure Amber:
    ./configure intel
  10. Follow steps 8 to 10 here.
  11. If you have also installed Amber 11, go to $AMBERHOME/src and run make there.
  12. Before continuing, we recommend testing the serial executables, as outlined in the AmberTools and Amber documentation.
  13. To build parallel, return to the AmberTools source directory and re-configure:
    ./configure -mpi intel
  14. Clean up the previous object files by running make clean in both the AmberTools and Amber directories.
  15. Make parallel executables by running make parallel in both the AmberTools and Amber directories.
  16. Finally, test the parallel executables, as outlined in the AmberTools and Amber documentation.
If you have any questions, please feel free to direct them to the AMBER mailing list.

Monday, April 26, 2010

Step-by-Step AmberTools 1.4 Installation on Mac OS X 10.5/10.6 with GNU Compilers

Here I am going to write something about the steps to install your own AmberTools 1.4 on your Mac OS X using GNU compilers. Previously we already had several blog entries about installing the compilers, so I am not going to spend too much effort on that issue. Now if you are not sure your Macintosh have the necessary compilers to build AmberTools, please read the previous posts in this blog and find some unix buddies to help. Also this tutorial is based on the assumption that you are using BASH as your default shell. For other shells, please consult your local unix guys or system administrator for equivalent commands.

If you have installed MacPorts but have not yet installed the gfortran:

sudo port install gcc44
sudo port install gcc_select
sudo gcc_select mp-gcc44
If you are using gfortran from fink, please note that you don't have gcc_select, but you can still use following steps to make sure you are using both gcc and gfortran from fink.
  1. Of course, install gfortran with "sudo fink install gfortran".
  2. Check which gcc is default in your environment:
    "which gcc" and "gcc -v" commands.
  3. If the result says "/usr/bin/gcc", and you later encounter this issue you probably need to change the configure script later in the directory of $AMBERHOME/AmberTools/src/ by replacing "gcc" to "gcc-4" and "g++" to "g++-4".

Now here comes the fun part, please make sure that you already downloaded the AmberTools (and also know where did the file you downloaded go!).

  1. We first change the current directory to /usr/local,
    cd /usr/local
  2. and then extract the AmberTools archive you just downloaded, presumably at ~/Downloads/.
    sudo tar xvfj ~/Downloads/AmbeTools-1.4.tar.bz2
  3. And then fix the permission for you can build it without using root privilege:
    sudo chown -R $USER:$GROUP amber11
  4. Run this command and make sure to put this command to your $HOME/.bashrc:
    export AMBERHOME=/usr/local/amber11
  5. Change the current directory to where the configure script is:
    cd amber11/AmberTools/src
  6. Now it would be a good time to modify the configure script if you are required to do that because of this and that. THIS IS NORMALLY NOT NECESSARY.
    perl -pi -e 's/cc=gcc/cc=gcc-4/;s/g++/g++-4/g' configure
  7. Following the manual, do the configuration. This takes about 1~3 minutes to finish.
    ./configure -macAccelerate gnu
  8. And start to build the program:
    make install
    This will take a while, make yourself a cup of tea. If you see any problem or message during the building process that prevent you from finishing, please report it to the Amber mail reflector.
  9. After that, change your current directory to the testing directory:
    cd ../test
  10. And start testing!
    make test

After finish building the AmberTools above, you might want to build a parallel version of some commands. About the decision of whether or not making a parallel version of them, please refer to the AmbetTools manual. If you want to build parallel version of AmberTools 1.4 or even Amber11 in general I'd recommend to build an openmpi software by yourself under the AMBER directory. Here is how to build an openmpi inside AMBER.

  1. First change current directory to the AmberTools source:
    cd $AMBERHOME/AmberTools/src
  2. Important! Clean-up the left-over from previous non-parallel building work.
    make clean
  3. Then download the source code of openmpi from here and extract the files for openmpi.
    tar xvfj ~/Downloads/openmpi-1.4.1.tar.bz2
  4. Now start to build the openmpi:
    ./configure_openmpi gnu
  5. Here comes the tricky part, by default your Mac OS X 10.6/10.5 bundled openmpi with the developer Tools without FORTRAN support (yes, sadly mpif90/mpif77 in the /usr/bin are disabled by Apple.), so you have to make sure $AMBERHOME/bin in the PATH and also it has to be prior to /usr/bin. If you have macports installed, your $PATH in the BASH should look something similar to this:
    bash-3.2$ echo $PATH
    /usr/local/amber11/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/X11/bin
    bash-3.2$ 
  6. Now configure a parallel environment for building parallel commands in AmberTools:
    env MPI_HOME=$AMBERHOME/AmberTools ./configure -mpi -macAccelerate gnu
  7. And then build the things:
    make parallel
  8. Before you do some tests on parallel programs, be advised to turn off the firewall (consider this temporary), since the tests will give you a lot of pop-up prompts if you are using application based firewall rules...
  9. And do some tests:
    cd ../test
    env DO_PARALLEL="mpirun -np 2" make test.parallel

Now you have it! If you still do not know what you are doing, please stop-by the Amber mail reflector and ask us questions and we are more than happy to help!

(Update: if your other compiling activities are broken by gcc_select, for example you no longer are able to build iphone app with Xcode, just do "sudo gcc_select gcc42" to reset the setting.)

Thursday, January 28, 2010

Some tips of Amber10 installation on Mac OS X 10.6 with GNU compilers

The question was whether or not Amber10 is compatible with Mac OS X 10.6, Jason's answer from the Amber reflector mailing list is very sufficient:

Amber10 should work on Snow Leopard (as well as ambertools 1.3).However, you should make sure that you have compatible compilers (i.e. a gfortran compiler that builds 64-bit binaries, that you can get either from MacPorts or hpc.sourceforge.net).
I just want to add some extra tips for people wondering the same questions:
  1. If you are using MacPorts, do what I did: install gcc44 and gcc_select and select mp-gcc44
  2. do whatever manual told you to do, but right after the configure scripts (e.g. ./configure_amber or ./configure_at), get rid of every '-m32' from the config_amber.h and config.h files.
  3. After that you are good to go.

Wednesday, December 23, 2009

Step-by-step procedure of building MacPorts gfortran and AmberTools 1.3 in Mac OS X 10.6

This is what I would do if I got a brand new Mac OS X machine using gfortran to build AmberTools 1.3 on it.

  1. Find the Mac OS X installation CDs/DVD, start to install Xcode Developer Tools.
    If you left it at home, try to download it at the Apple Developer Connection site. Make sure you have installed "Unix Development" (default)
  2. Download the MacPorts Disk Image from the MacPorts' website.
  3. Mount the disk image and install the pkg, running the system's Installer by double-clicking on the pkg contained therein, following the on-screen instructions until completion.
  4. Open a new shell window and do later stuff in this shell, this is to make sure that changes to the environment variables have taken effect.
  5. check if your PATH environment variable really contains /opt/local/bin and /opt/local/sbin by running "echo $PATH"
  6. check upgrades to MacPorts: "sudo port -v selfupdate"
  7. run "sudo port install gcc44"
  8. run "mkdir ${HOME}/bin"(not necessary)
  9. append this line to the end your ~/.bashrc (If you are using CSH/TCSH, you must be very savvy, so you don't need no documentation...
    export PATH=${HOME}/bin:$PATH
  10. run "export PATH=${HOME}/bin:$PATH"
  11. run "ln -s /opt/local/bin/gfortran-mp-4.4 ~/bin/gfortran"
    (Original steps were stupid, try following steps:) run "sudo port install gcc_select; sudo gcc_select mp-gcc44"
  12. Download AmberTools from http://ambermd.org/#AmberTools (Safari will place it to ~/Downloads)
  13. run "tar jxvf ~/Downloads/AmberTools-1.3.tar.bz2 -C ~/", this will extract an amber11 folder in your home directory.
  14. Now it would be a good time to append this line to your ~/.bashrc
    export AMBERHOME=${HOME}/amber11
  15. run "export AMBERHOME=${HOME}/amber11" as well
  16. run "cd ~/amber11/src; ./configure -macAccelerate gnu"
  17. run "make -f Makefile_at" and wait
  18. After "make" stops, check to see if there is any error. If your building process indeed stopped prematurely, report it to the Amber mailing list. Please mention your OS version and compiler you used.
  19. run "cd ~/amber11/test; make -f Makefile_at" to check the testing cases result. Please make sure your environment variable $AMBERHOME is correct before you run the test.

After thought

If you want to use macports without problem after above operation, make sure to "sudo gcc_select" back to gcc42 or llvm-gcc42, or you might encounter some incompatibility with building some certain ports.

Monday, December 07, 2009

Installing g95 or gfortran with MacPorts

(Original blog entry posted on 7/27/09)

Besides a C compiler, AMBER installation requires a FORTRAN 90 compiler, this has been the case since AMBER 8. FORTRAN 90 compilers are not provided by Apple in developer environment therefore FORTRAN developers need to acquire a third party compiler by themselves. AbSoft PRO Fortran, NAG Fortran 90, IBM XL Fortran 9 and Intel Fortran are some fine compilers that require some funding. There are two popular open source licensed FORTRAN 90 compilers, g95 and gfortran. These two compilers originates from the same group of people but the diverged due to the difference of project managing styles. g95 is more conservatively and independently developed while gfortran integrates itself to the mothership -- gcc source tree. G95 has some advanced feature like coarrays, but gfortran does have something g95 doesn't have: OpenMP.

There are many ways to install these open source FORTRAN compilers on Mac OS X, you could build the compilers from the source or just install the binary packages, or from the way between: using porting system to build them automatically.

Before I write anything about the getting the compilers for your Mac OS X, you should at least have installed:

  1. Apple's Xcode Developer Tools (at least version 3.2 for Snow Leaopard, version 3.1 for Leopard, or 2.4 for Tiger, ), found at the Apple Developer Connection site or on your Mac OS X installation CDs/DVD.
  2. (You need this for Amber.) The X11 windowing environment (A.K.A. “X11 User”) and its related SDK package (“X11SDK”) for ports that depend on the functionality they provide to compile and run.
    • the “X11 User” package is an optional installation on your system CDs/DVD for Panther and Tiger, enabled through the “Customize” button of the installer, whereas it is included by default on Leopard.
    • the “X11 SDK” package from the Xcode installer will be automatically selected if “X11 User” is already installed, so be sure to install that first.

I personally recommend against porting things from the source trees. If you really do have that kind of skills and free time, you can skip this little note of mine, go ahead and do it already!

For the fans of binary packages, you should try the links from hpc.sourceforge.net/ or from MacResearch group, although I normally don't take this path, this is due to my inner geekiness that preventing me from installing 3rd party packages. Nevertheless, I strongly recommend this way to install your tools if you want to get over it fast.

For utilizing the porting system, you got the options of fink and macports. If you are a fan of Ubuntu or Debian Linux, you should try fink first. For me, I chose macports just because I got some friends in the founding team.

Here is how I did it:

  1. Download the dmg file from http://www.macports.org/install.php, open and mount the dmg and launch the installer by double clicking the pkg file. This requires administrator's permission.
  2. Read the port(1) manual page and http://guide.macports.org for help, http://www.macports.org/contact.php if you need to get in touch with The MacPorts Project.
  3. $ sudo port install g95 g95 in latest macports repository seems to be broken in Tiger
  4. $ sudo port install gcc45 +gfortran (gcc45 is an experimental version, please use gcc44 for stability.) On Mac OS X 10.4 Tiger, the only choices are gcc43 and gcc42.
  5. Viola!

See the next note for more elaborated steps.

Tuesday, August 04, 2009

[FYI] my config_amber.h file

Check this out if you like to install Amber10 with bundled lammpi source, g95, and Intel Math Kernel Library installed on your Mac OS X. download.

For non-parallel configureation: download it from here
This was tested on Mac OS X 10.4.9 with g95 0.91_1 and Intel MKL 10.0.4.022.

Wednesday, December 05, 2007

g95 works on leopard now

Ever since the release of Mac OS X 10.5 (leopard), g95 had been broken on Macintosh for a while, part of the reasons are some incompatibility issues of cctools. Although the MacPorts version is still broken, but I think Takeshi (the port maintainer) has already submitted the required patches so it's just a matter of time. If you want to skip MacPorts compiling and just want to install the binary built, it would be a good time to do it now.
Last night I checked the 2007-11-29 version of g95 and binary package started to work.
Get the binary from the g95 project now.

Bonus:

Recent version of g95 does having some annoying warning like this:
mjhsieh% /opt/g95-install/bin/i386-apple-darwin8.11.1-g95 hello.f90 -o f90hello.exe
/var/folders/vQ/vQ6BYbLsHSGVwgPZR0sF6++++TI/-Tmp-//cc1UyeY8.s:59:indirect jmp without `*'
/var/folders/vQ/vQ6BYbLsHSGVwgPZR0sF6++++TI/-Tmp-//cc1UyeY8.s:78:indirect jmp without `*'
/var/folders/vQ/vQ6BYbLsHSGVwgPZR0sF6++++TI/-Tmp-//cc1UyeY8.s:97:indirect jmp without `*'
/var/folders/vQ/vQ6BYbLsHSGVwgPZR0sF6++++TI/-Tmp-//cc1UyeY8.s:112:indirect jmp without `*'

You can use this script to get rid of the warning:
#!/bin/sh
myg95="/opt/g95-install/bin/i386-apple-darwin*g95"
exec 3>&1
$myg95 $* 2>&1 >&3 | grep -v "indirect jmp without " 1>&2
exec 3>&-
Save it as g95 in your path, make it executable and then you can run g95 without this kind of warnings.

Tuesday, October 23, 2007

[amber9] rdc test error with XL Fortran

Yes, I am late reading the AMBER reflector again. This time Dr. Langsetmo brought up this issue in May 2007:

everything went well, and in the testing most things passed, till a failure at:
cd rdc; ./Run.dip
STOP 1
  ./Run.dip:  Program error
make: *** [test.sander.BASIC] Error 1
if look at rdc/gcg.dip.o i find at the end of the file:
Alignment info will be read from file: RST.dip
Here are comments from the alignment input file:
namelist reports error reading &align
i do have the environment variable:
XLFRTEOPTS=namelist=old:xrf_messages=no
so i don't understand the error. any help would be appreciated.
My PASSED rdc test on absoft Pro fortran compiled sander shows that the problem is on XL Fortran. After several small scale searches, I found that it can be avoid by getting rid of the old namelist compatible flag from the XLFRTEOPTS options. Normally the environment XLFRTEOPTS was set to "namelist=old:xrf_messages=no", I used "xrf_messages=no" for this test:
% env XLFRTEOPTS="xrf_messages=no" ./Run.dip
STOP 0
diffing gcg.dip.o.save with gcg.dip.o
PASSED
==============================================================

Monday, October 22, 2007

Old News: Discontinued XL Fortran and XL C/C++ on Macintosh

The Announcement from IBM

Effective April 30, 2007, IBM is discontinuing program services for XL C/C++ Advanced Edition for Mac OS X V6.0 (5724-G12) and XL Fortran Advanced Edition for Mac OS X V8.1 (5724-G13).

Friday, December 15, 2006

Getting Compilers for AMBER 9

Related Question:

  1. (Dec 7, 2006) Mr. Heil asked about Installing Amber 9 on Mac Pro in the AMBER mail reflector.

In order to install AMBER 9 on Mac OS X operating system, you need to compile the program by yourselves. Therefore a working FORTRAN 90 compiler and a working C compiler are required. Macintosh machines nowadays come with a developer package in the DVD of Mac OS X. You can get a free and working C compiler from the disc.

For FORTRAN 90 compiler, you can get free (as in free beer / freedom) g95 executables package from the ftp site of g95. Remember you might need the cctools provided at the same place if you are using Mac OS X 10.3.

And for gnu fortran (also free as in free beer / freedom), you probably need to compile the stuff by yourself with darwinports or fink to get newer version. Of course, it's always easier just getting the pre-built binaries from here despite I prefer doing it by myself. I personally haven't checked the current version of gfortran and therefore you are on your own to check if it's working with AMBER 9.

For IBM XL compilers, both C++ and FORTRAN compilers are available for reasonable educational price (for a computing lab) from ABSoft fortran store.

Also check out the intel compilers if you have Intel CPU based Macintosh like Mac Pro or new iMac. As a matter of fact, I highly recommend this compiler!

(updated: added a related question entry in the front)

Tuesday, October 31, 2006

AMBER config.h for g95 on intel mac

Just for your information:

AMBER_SRC=~/amber9/src
AMBERBUILDFLAGS=
LOCALFLAGS=
USE_BLASLIB=$(VENDOR_SUPPLIED)
USE_LAPACKLIB=$(VENDOR_SUPPLIED)
USE_LMODLIB=$(LMOD_UNAVAILABLE)
CC= gcc
CPLUSPLUS=g++
CFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O2 -m32
CPPFLAGS= $(AMBERBUILDFLAGS)
FPPFLAGS= -P -xassembler-with-cpp -DHASSECOND $(AMBERBUILDFLAGS)
FPP= cpp -traditional $(FPPFLAGS)
FC= g95
FFLAGS= -O0 -fno-second-underscore $(LOCALFLAGS) $(AMBERBUILDFLAGS)
FOPTFLAGS= -O3 -fno-second-underscore $(LOCALFLAGS) $(AMBERBUILDFLAGS)
FREEFORMAT_FLAG= -ffree-form
LOAD= g95  $(LOCALFLAGS) $(AMBERBUILDFLAGS)
LOADCC= gcc  $(LOCALFLAGS) $(AMBERBUILDFLAGS)
LOADLIB=-Wl,-framework -Wl,Accelerate
LM= -lm
LOADPTRAJ= g95 $(LOCALFLAGS) $(AMBERBUILDFLAGS)
XHOME= /usr/X11R6
XLIBS= -L/usr/X11R6/lib
#------------------------------------------------------------------------------
#  Other stuff:
#------------------------------------------------------------------------------
.SUFFIXES:  .f90
EMPTY=
AR=ar rv $(EMPTY)
M4=m4
RANLIB=ranlib
SFX=
NETCDF=
NETCDFLIB=
MODULEDIR=-I
MAKEDEPEND=$(AMBER_SRC)/../bin/amber_makedepend
SLKO=skipDFTB

#  default rules for Fortran and C compilation:

.f.o:   $$<
        $(FPP) $$< $> _$$<
        $(FC) -c $(FFLAGS) -o $@ _$$<

.c.o:   
        $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<

Wednesday, June 07, 2006

Single thread AMBER 9 with Absoft Pro Fortran

Basically AMBER 9 compiles perfectly with Absoft Pro Fortran (my evaluation copy is version 9.2), you can just launch:

% ./configure -nopar absoft
% make serial
The binaries generated from here passed most of the test under amber9 except noesy related tests and antechamber tests. These two can be problematic even in other compilers, so I'll leave it there for now. If anyone has any further problem, just post in the amber user mailing list.

Monday, May 15, 2006

Building LAM-MPI Libraries without Root Permission

This example has been tested on ppc machine with XL FORTRAN compiler. Strange enough, xlc is not working at this point, AMBER 9 only needs F90 compiler support from LAM anyway. These are the commands:
% env FC=xlf_r F77=xlf_r LDFLAGS=-lSystemStubs ./configure --with-rsh="/usr/bin/ssh -x" --prefix=/Users/johndoe/opt/lam --with-memory-manager=none
% make
% make install

Following example has been tested on intel core duo machine with Intel FORTRAN compiler. These are the commands:
% env FC=ifort F77=ifort ./configure --with-rsh="/usr/bin/ssh -x" --prefix=/Users/johndoe/opt/lam
% make
% make install

Later you just need to add ~/opt/lam into your path, no root permission needed.

Wednesday, May 10, 2006

Building MPICH Libraries without Root Permission

On PowerPC (G4/G5)

This article is based on Warner's documentation.

I am using mpich-1.2.7p1 from the mpich homepage. Here, C++ interface is disabled for now, I have no idea why xlc failed to be used as c++ compiler by the configure script.
% env FC=xlf_r CC=xlc_r F90=xlf90_r RSHCOMMAND=ssh SOCKSIZE=65536 ./configure --disable-cxx --without-romio --without-mpe --with-device=ch_p4 --with-device=ch_shmem --enable-sharedlib --prefix=/Users/johndoe/opt/mpich
% make
% make install
% find /Users/johndoe/opt/mpich -name '*.a' -exec ranlib -c {} \;

(This is for just in case that linking problem shows up later in amber compilation. It might generate "no symbols" message, don't worry about it.)

Later I'll finish the part for Intel CPU based Macintosh.

env SOCKSIZE=65536 RSHCOMMAND=ssh CC=icc CXX=icpc FC=ifort F90=ifort ./configure --with-device=ch_p4 --with-device=ch_shmem --prefix=/home/software/mpich

Wednesday, May 03, 2006

Solving nmr_aux problem with IBM XL C compiler

According to the AMBER reflector, there were several people reporting[1], [2] compilation problem in nmr_aux directory.

/usr/bin/ld: can't open: NULL (No such file or directory, errno = 2)

Although for some reason it doesn't seem to be affecting me, but the solution can be found at ABSoft's technical archives[3]. Basically it's like changing /etc/opt/ibmcmp/vac/6.0 from the line crtbegin = NULL to #crtbegin = NULL

Then try to compile it again. If you don't have the permission to change the file, you can copy the vac.cfg file to your own directory and modify that file. (say, your home directory) Then change the xlc argument to

xlc -F/Users/youraccountname/vac.cfg
in amber9/src/config.h file....

Monday, April 10, 2006

Compiling AMBER 9 on g4/g5 with XL compiler

Basically AMBER9 provides you an out of box compatibility on PPC Macintosh if you use IBM XL compilers. What you need to do is:

% ./configure -nopar xlf90_macosx
% make serial
With this modification, the test (make test.serial) passes without failure. However, even if you don't apply this patch, you can still get an almost working config.h ...

One noticeable change of this patch is that the underscore extension name for blas/lapack function calls are no long required probably because the current library provided by Apple (10.4.5) already took care of that.

If you don't have XL C compiler, you might have trouble compiling it. This issue is fixable, but if you are having trouble modifying config.h by yourself, please drop your question in the AMBER mail reflector.

For parallel computing, I recommend LAM-MPI for now. See Warner's tutorial when compiling LAM. As to the linking issue, I'll address this more later.

Also some might experience the problem of not finding a NULL file with XL C. Please read the later post here.

Wednesday, July 20, 2005

AMBER 8 PMEMD Benchmarks on Xserve G5 Cluster

(2005-07-01 11:41:03 Update: The original benchmark did not use any code modifications for G5. New benchmark is faster.)(Update: files posted)
The contributions have been made by Apple Computer are really nice! Thank you guys!
Recently I got some chances to access Xserve G5 clusters in UC Irvine and in Apple Computer. The Research Computing group in Apple Computer is kind enough to share their progress on optimizing PMEMD with me. The modification seems to be very nice also maintaining good double precision accuracy. Here is a tarball of the files got modified during this test: pmemd_modification.tgz. Of course, md5 and filelist are here
MD5 (pmemd_modification.tgz) = 4600a2f66e40995bb087e6eb21b8a360
pmemd/configure
pmemd/src/ew_direct_cit.f90
pmemd/src/short_ene_G5_opt.f90
pmemd/config_data/macosx_g4.xlf90.nopar
pmemd/config_data/macosx_g5.xlf90.lam
pmemd/config_data/macosx_g5.xlf90.mpich_gm
pmemd/config_data/macosx_g5.xlf90.nopar
Also, the usages of this modified configure script for the g5 can be found here:
./configure macosx_g4 xlf90 nopar
./configure macosx_g5 xlf90 nopar
./configure macosx_g5 xlf90 lam
./configure macosx_g5 xlf90 mpich_gm
*Important* Please make sure to backup the old source files before untar this tarball.

As to the AltiVec patch I proposed last year, I don't think it really matters because of the precision issue --- AltiVec is a floating point monster, but it's not even a double precision animal.

This benchmark is following the way we do in AMBER 8 benchmark page. In default JAC benchmark, the simulation undergoes 1 pico second time scale. So the performance measure ppd (ps per day) would be the ratio of 86400 over the time consumed by the simulation.

JAC Benchmark on Xserve G5 Cluster
This plot clearly shows that the code optimization for G5 does improve the performance. It also tells us that mpich-gm scales pretty well.

In this table, NACS_UCI is the demo Xserve Dual G5 cluster hosted by Research Computing Support, NACS, UC Irvine while RC_AAPL is the demo Xserve Dual G5 cluster kindly provided by the Research Computing group in Apple Computer.

  =============================================================================
  "jac" == Joint Amber/Charrm DHFR benchmark.  This is the protein DHFR,
  solvated with TIP3 water, in a periodic box.  There are 23,558 total atoms,
  and PME used with a direct space cutoff of 9 Ang.  This is the benchmark
  in benchmarks/jac subdirectory of the Amber 8 distribution.  Results
  here are for pmemd.

  --------------------------------------------------------------------------------
  name   date      CPU              OS         compiler  npcu    ps per day
  --------------------------------------------------------------------------------
NACS_UCI  6/05 2.0 Ghz G5        MacOS X 10.3   xlf8.1    2        336
               GbE, LAM/MPI
 RC_AAPL  7/05 2.0 Ghz G5        MacOS X 10.3   xlf8.1    1        180
               GbE, LAM/MPI                               2        324
                                                          4        561
                                                          6        758
                                                          8       1005
                                                         10       1168
                                                         12       1290
                                                         14       1440
                                                         16       1516
 RC_AAPL  7/05 2.0 Ghz G5        MacOS X 10.3   xlf8.1    1        180
               myrinet, MPICH-GM                          2        325
                                                          4        596
                                                          6        873
                                                          8       1094
                                                         10       1371
                                                         12       1600
                                                         14       1878
                                                         16       2057

Saturday, May 22, 2004

Early AMBER8 PMEMD bench with AltiVec wrapper.

(originally posted on 05/19 18:32)
(updated 05/22) Added single precision modification version with vecLib support!
(updated 05/20) Finally I realized that I didn't successfully link to vecLib for PMEMD. We will see if we can do it later.

  =============================================================================
  "jac" == Joint Amber/Charrm DHFR benchmark.  This is the protein DHFR,
  solvated with TIP3 water, in a periodic box.  There are 23,558 total atoms,
  and PME used with a direct space cutoff of 9 Ang.  This is the benchmark
  in benchmarks/jac subdirectory of the Amber 8 distribution.  Results
  here are for pmemd.

  --------------------------------------------------------------------------------
  name   date      CPU              OS         compiler  npcu    ps per day
  --------------------------------------------------------------------------------
bluefish 12/03 SGI Origin 3800                  f90      2        115
  loyd    4/04 2.4 Ghz PIV Xeon   RH 9          ifc8     2        210
  apple   5/04   2 Ghz G5        MacOS X 10.3   xlf8.1   2        293 (double)
  apple   5/21   2 Ghz G5        MacOS X 10.3   xlf8.1   2        324 (single)
 unc/duke 4/04 3.2 GHz PIV Xeon  RH E3smp       ifc7     2        330
  apple   5/21   2 Ghz G5        MacOS X 10.3   xlf8.1   2        344 (single)*
  yt      2/04 altix/itanium 1.3GHz linux       ifort8   2        465
    Notice:
  1. single precision means partial of the variables in short_ene are real*4.
  2. G5 results were pmemd results.
  3. *: altivec was used.
  4. 2 cpu results were done with LAM/MPI library.