Friday, June 22, 2018

Parflow-CLM installation guide on Widows machines using the “Windows Subsystem for Linux”

Interesting, but not surprising, many current ParFlow users one day never knew how to use the Linux environment. This post is not about you can now install and run ParFlow on Windows, but introduces a compatibility layer for running Linux binary executables on a Windows machine. This is called “Windows Subsystem for Linux” which has been included with Windows 10 version 1607 and later. The following instruction walks you through a step-by-step guide on how to install ParFlow-CLM on a Windows machine using this platform. It is pretty straightforward and has been tested successfully on different machines to assure functionality. Please notice that you must follow the steps below exactly in order, and every step must pass successfully before proceeding to the next one.

Step 1. Install the Windows Subsystem for Linux

Taken from the Microsoft page, you first need to enable the "Windows Subsystem for Linux" optional feature and reboot. To do so,
  • Open PowerShell as Administrator and run:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  • Restart your computer when prompted.
  • Open the Microsoft Store and download Ubuntu.
  • Once the download has completed, select "Launch". This will open a console window. Wait for installation to complete then you will be prompted to create your LINUX user account.
  • Create your LINUX username and password. This user account has no relationship to your Windows username and password and hence can be different.
  • You're done! Now you can use your Linux environment.
Step 2. Download ParFlow-CLM manual

This manual includes the instructions on how to install ParFlow-CLM using cmake.

Step 3. Setup environment variables 

In the terminal, navigate to your home directory and edit your ".bash_profile" as follows:

> cd ~
> vim ~/.bash_profile

Press "i" to enter the insert mode, put the cursor to the end of this file, and add the following lines: 

export PARFLOW_SILO_DIR=~/pfdir/silo/
export PARFLOW_HYPRE_DIR=~/pfdir/hypre/
export PARFLOW_DIR=~/pfdir/install/
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran
export PATH=/usr/local/bin/:$PATH

Press esc, and then :wq to save and exit the bash file. Then type:

> source ~/.bash_profile

Step 4. Download parflow-clm package

In your Ubuntu shell, type:

mkdir ~/pfdir
cd ~/pfdir
git clone

Step 5. Install gcc

In your Ubuntu shell, type:

> cd
> sudo apt-get update
> sudo apt-get install gcc
> sudo apt-get install g++
> sudo apt-get install gdc
> sudo apt-get install tcl-dev
> sudo apt-get install tk-dev
> sudo apt-get install build-essential
> sudo apt-get install libgcc1 lib32gcc1 libx32gcc1
> sudo apt-get install build-essential autoconf automake libtool
sudo apt-get install libibnetdisc-dev
> sudo apt-get install binutils
> sudo apt-get install binutils-dev
> sudo apt install gfortran

(When you use the sudo command, it probably asks for your UNIX password.)
Note that it might take a while to install all features depending on your internet speed, etc. Also, whenever asked for “Do you want to continue? [Y/n]”, press Y.

Step 6. Install or update OpenMPI

In your Ubuntu shell, type:

> cd
> cd ~/pfdir
> wget
> tar -xvf openmpi-3.1.0.tar.gz
> cd openmpi-3.1.0
> ./configure --prefix=/usr/local/
Then proceed with:

> sudo apt-get install make
> sudo make all install

Please notice that you must not face any error during the installation. Also, stay patient with OpenMPI installation; it might take a fairly good amount of time.

Step 7. Download and install SILO

In your Ubuntu shell, type:

> cd
> cd ~/pfdir
> wge
chmod 777 silo-4.10.2.tar.gz
> tar -xvf silo-4.10.2.tar.gz
> mv silo-4.10.2 silo
> cd silo
./configure --disable-silex
> sudo make all install
Step 8. Download and install HYPRE
In your Ubuntu shell, type:

> cd
> cd ~/pfdir
> wget
> tar -xvf hypre-2.9.0b.tar.gz
> mv hypre-2.9.0b hypre
> cd hypre/src
> ./configure --prefix=$PARFLOW_HYPRE_DIR --with-MPI
sudo make install

Step 9. Install Parflow-clm

In your Ubuntu shell, type:

> cd
> cd ~/pfdir
> mkdir build
> cd build
> sudo apt install cmake
> make
> make install

Note: For some reason, Ubuntu doesn't understand the dashes before each option when copying them into the shell. Hence instead of copying and pasting from this instruction, I recommend users to type the above cmake line manually. Otherwise, you might face the following error:

CMake Error: The source directory "/home/mdanesh/pfdir/build/–DHYPRE_ROOT=/home/mdanesh/pfdir/hypre" does not exist.

Step 10. Check if ParfFow-CLM is working

> make test

This will run some test cases that come with ParFlow package. If some tests fail, don't worry; they probably need a total number of processors that your machine doesn't support.

ParFlow-CLM should be now ready to go! Enjoy and let me know if you faced any issues at danesh[@]sharif[dot]edu.

1 comment:

Unknown said...

Great guide!
I just wanted to let you know I may have found a small error in step 5:hypre. I changed computation to computing because the sourced link was slightly different than in the guide. After that it downloaded.

curl "" -o "hypre-2.11.2.tar.gz"