Wiki

Clone wiki

pflotran / Depreciated / Installation / Windows

Windows Installation Instructions

Author: Glenn Hammond

Note that I have been working with PETSc within the Windows environment since 2000. At first, setting up and programming a PETSc-based code in Windows is not trivial. Relax, ask questions, and it will come to you.

Thanks to the followiing for input over the years:

  • Satish Balay
  • Luis Manuel

Required Third-Party Libraries

  • Cygwin: a collection of tools which provide a Linux look and feel environment for Windows. I recommend the 32-bit version.
  • PETSc
  • HDF5: for binary I/O

Installation Instructions

You may find PETSc's instructions to be helpful, too.

  1. Download and install Cygwin. The link to setup.exe will take you to the most recent version. Step through the setup program. I typically select the following options:
  • Choose a Download Source Dialog: Install from Internet
  • Select Root Install Directory Dialog: C:\software\cygwin and install for "All Users".
  • Select Local Package Directory: C:\Temp.
  • Select Your Internet Connection: Direct Connection
  • Choose A Download Site: ftp://mirror.mcs.anl.gov has always worked well, but you may desire a closer site.
  • Select Packages: Ensure that at least the following are selected (we may have to iterate on this as I do not have a clean install of which to work in provding guidance).
  • All default packages (some of the below may be default)
  • bash (default) (for bash users)
  • diffutils
  • gcc
  • g++
  • git
  • gzip (default)
  • make
  • mercurial
  • patch and patchutils
  • python
  • tar (default)
  • tcsh (for t-shell users)
  • Create Icons: Be sure to uncheck the annoying icons at the end.
  • After installed, rename the cygwin linker as it will conflict with PETSc: "mv /usr/bin/link.exe /usr/bin/link-cygwin.exe". This must be repeated any time cygwin is updated.
  1. Install C/C++ and Fortran compilers.
  • Microsoft Visual C++ 2010 and Intel Fortran (14 or later!). I suggest installing everything in its default location. The hints that I provide below will assume this.
  • Setup Cygwin bash/tcsh shell. A file Cygwin.bat should exist in the $CYGWIN_INSTALL directory. You need to modify that file to include the environment variables for the compilers. Note that these modifications may trip you up. With Windows 7, you may need to create a shortcut pointing to the new .bat file and specify that the shortcut Run as Administrator under properties. Since I cannot attach files on the Bitbucket wiki, the contents of two example files may be copied from:
  1. Install HDF5. Note that petsc-dev has the option to download and install HDF5. However, this capability is not yet supported on Windows. I recommend downloading the Windows 32-bit static version of the library from hdfgroup. Current zip files.
  2. Install ParMETIS/METIS. (required for unstructured grids only). Chen Shapira has provided notes for installing ParMETIS on Windows.
  1. Install PETSc. Follow instructions at PETSc website. PETSc should be installed using a cygwin terminal using the batch files above. Be sure to check out the Git hash defined in the Linux installation instructions. My configure script is attached. Remember to define PETSC_DIR and PETSC_ARCH in the system environment variables (Start -> Control Panel -> System -> Advanced System Settings -> Environment Variables).
  • Be sure to remove cygwin link.exe (follow instructions from PETSc).
  1. Create a new project named pflotran with Intel Fortran (empty project).
  2. Add the PFLOTRAN source files listed in the pflotran/src/pflotran/makefile
  3. Set a boat load of settings under Project -> pflotran Properties. I list my settings as displayed through the Command Line entry under Fortran and Linker. You must figure out how these are set within the dialogs. Note that the SERIAL_HDF5 preprocessor definition is only required if using serial HDF5.

Fortran:

/nologo /debug:full /Od /fpp /I"c:\software\petsc-dev"
/I"c:\software\petsc-dev\include"
/I"c:\software\petsc-dev\cygwin-c-debug-parmetis\include"
/I"C:\software\include32"
/I"C:\Program Files (x86)\MPICH2 \include"
/I"C:\Users\ghammond\Documents\code\pflotran\src\pflotran"
/DSERIAL_HDF5 /DPETSC_HAVE_HDF5 /recursive /debug- parameters:used
/module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc100.pdb"  /traceback
/check:all /libs:static /threads /dbglibs /c

Linker:

/OUT:"Debug\pflotran.exe" /INCREMENTAL:NO /NOLOGO
/LIBPATH:"c:\software\petsc-dev\cygwin-c-debug-parmetis\lib"
/LIBPATH:"C:\software\lib32"
/LIBPATH:"C:\Program Files (x86)\MPICH2\lib"
/LIBPATH:"C:\Program Files (x86)\Intel\Composer XE\mkl\lib\ia32"
/NODEFAULTLIB:"LIBCMT" /MANIFEST:NO /DEBUG
/PDB:"C:\Users\ghammond\Documents\Visual Studio 2010\Projects\pflotran\pflotran\Debug\pflotran.pdb"
/SUBSYSTEM:CONSOLE
/IMPLIB:"C:\Users\ghammond\Documents\Visual Studio 2010\Projects\pflotran\pflotran\Debug\pflotran.lib"
libpetsc.lib hdf5d.lib hdf5_fortrand.lib szlib.lib zlib.lib
fmpich2.lib fmpich2g.lib fmpich2s.lib mpi.lib
mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib
libiomp5md.lib Ws2_32.lib Kernel32.lib Advapi32.lib User32.lib
Gdi32.lib
  1. Build the project.

Updated