1. Cross-compile WRF for Windows Azure

For many HPC applications, porting from Linux to Windows is as straightforward as recompiling the application source code with a special toolchain. More complex applications may require a little more work, but even complex HPC applications can be ported in this way. Visit the PToolsWin page for more information.

This step of the tutorial will guide you through the process of recompiling WRF 3.3.1 with the PToolsWin development environment. PToolsWin generates native Windows code (no intermediate POSIX layer is required), so your application will perform as well as a native Windows application.

1.1. Prerequisites

Before you continue, make sure you have these software prerequisites:

  1. An installation of HPC Linux with PToolsWin.

  2. NetCDF for Windows.

1.2. Build WRF as a Windows Executable

  1. Open a command line in your HPC Linux distro and load the PToolsWin module:
       1 module load ptoolswin
       2 module list
    
  2. Begin by creating a directory for WRF:
       1 setenv WRFDIR ${HOME}/windows/WRF
       2 mkdir -p $WRFDIR
       3 cd $WRFDIR
    
  3. Download and unpack the WRF source code:
       1 wget http://www.mmm.ucar.edu/wrf/src/WRFV3.3.1.TAR.gz
       2 tar xzf WRFV3.3.1.TAR.gz
    
  4. Apply this patch to the WRF source code to fix a few known problems and add a new build configuration for PToolsWin:

       1 wget http://paratools.com/Azure/WRF/Step2/paratools-WRFV3.3.1.patch -O paratools-WRFV3.3.1.patch
       2 cd WRFV3
       3 patch -p1 < ../paratools-WRFV3.3.1.patch
    
  5. Configure your environment. WRF relies on several environment variables to locate NetCDF and select the appropriate configuration files:
       1 setenv NETCDF ${HOME}/windows/netcdf-4.1.3
       2 setenv WRFIO_NCD_LARGE_FILE_SUPPORT 1
       3 setenv WRF_EM_CORE 1 
       4 setenv WRF_OS Windows
    
  6. Configure WRF. Select Windows 64-bit, PToolsWin (dmpar) (Option 7) and basic nesting (Option 1):

       1 ./configure
    
  7. Compile WRF 1. There is a race condition in the build process, so it's a good idea to do a second, serial compilation after the first:

       1 ./compile em_real |& tee compile.log
       2 ./compile -j 1 em_real |& tee compile.log.2
    

    Important

    Verify that the ptoolswin module is loaded before you begin compiling. You can view loaded modules with the command module list

  8. You should now have several program executables in the main folder:

    [paratools07] 136 > echo $WRFDIR
    /home/livetau/windows/WRF
    [paratools07] 137 > pwd
    /home/livetau/windows/WRF/WRFV3
    [paratools07] 138 > ls main/*.exe
    main/ndown.exe  main/nup.exe  main/real.exe  main/tc.exe  main/wrf.exe
    [paratools07] 139 > 
    

    If any of these .exe files are missing from main, check configure.log.2 for errors ( (!) do a case-insensitive search for "Error") and try re-compiling. Otherwise, continue to Step 3.

1.3. Notes

  1. Check the Compile module of the WRF ARW Online Tutorial for more information on compiling WRF. (1)


MSDPE Logo