[gmx-users] On multi-core PCs and gromacs installation

Mirco Wahab mirco.wahab at chemie.tu-freiberg.de
Mon Jul 4 17:08:23 CEST 2011

>> I will be installing gromacs 4.5.x in another computer but this time with four cores. The PC runs in windows and I will be using cygwin.
>> ... Do I still need to install MPI using cygwin?
> Probably not, but I haven't tested threading on Cygwin.

I just did a test for fun and it worked remarkably good,
even on Cygwin 1.7 +  Win7/x64U box. I'ts very simple
using 'make', didn't check cmake (seems more complicated

The following sequence will lead to success for
fully functional Gromacs 4.5.4 for the CYGWIN_i686
target on windows:

Install Cygwin 1.7.9 from its page, add
  + gcc/g++ 4.x and 3.x (but not mingw-gcc variants)
  + make/cmake
  + lapack, lapack-devel, lapack-libs
  + fftw3, *-devel, *-libs
  + gsl, *-devel, *-libs
  + wget, tar, vim
  + bash, rxvt
(do not install the 'pthread library stub' entry)

Open a cygwin bash shell, create a gromacs base directory
and change to it(!):
$> mkdir gromacs; cd gromacs

Download source and unpack it:
$> wget ftp://ftp.gromacs.org/pub/gromacs/gromacs-4.5.4.tar.gz
$> tar xzf gromacs-4.5.4.tar.gz

Write a fancy build control file:
$> cat > mk_gromacs.sh
../gromacs-4.5.4/configure CC=gcc CXX=g++ \
             LDFLAGS="-L/usr/lib64 -llapack -lblas -lpthread" \
             --prefix=/usr/local/gromacs454 \
	    --with-fft=fftw3     \
             --with-external-blas  \
             --with-external-lapack \

   if [ $? -eq 0 ]; then
      make -j 4
      if [ $? -eq 0 ]; then
	 echo "********************"
	 echo "Success!"
	 echo "********************"
	 echo "now: ==>  make install (as root) / exit"

Modify the number in 'make -j 4' to match the number of
your processor cores, which is the output of:

Create a build directory and change to it(!):
$> mkdir build; cd build

Run your control script (see above):
$> sh ../mk_gromacs.sh

Wait and check error messages during configuration (if any),
otherwise: go and get a large cup of coffee and lay back.

If its ready (without errors), install it by:
$> make install

Initialize Gromacs environment variables in
your shell by modifying your .bashrc file:

$> vi .bashrc
  - go some lines down, at the start of an empty line
  - press 'i' (insert)
  - insert the following text

   if [ -e /usr/local/gromacs454/bin/GMXRC.bash ] ; then
    source /usr/local/gromacs454/bin/GMXRC.bash

  - press 'Escape' ':' 'x' (to write and close the file)

After leaving the shell and opening a new one,
mdrun, grommp and friends should be available
and working fine.

> Nothing will do MPI for you. Threading and MPI are complementary approaches to achieving parallelism, and which is better depends on your execution environment.

On Cygwin, OpenMPI would't even work anymore as
they require MS Visual Studio Library linkage
nowadays. One could try MPICH2 which compiled
on Cygwin last time I tried (2 years ago?),
but why? Gromacs threading works perfectly
on Cygwin.



More information about the gromacs.org_gmx-users mailing list