% ---------------------------------------------------------------------------------- % This file describes how to install hampath version 3 on windows 10 % Author : Stuart Rogers, University of Alberta. % Date : September 2016 % ---------------------------------------------------------------------------------- Below are instructions for installing Hampath on 64-bit Windows 10 using installation modes 0 (Fortran stand-alone), 1 (MATLAB via mex files), or 2 (MATLAB via text files). These instructions should work for any 64-bit version of Windows. Similar steps may work by installing a 32-bit version of Cygwin and a 32-bit version of Java. For installation modes 0 (Fortran stand-alone) and 2 (MATLAB via text files), follow steps 1-4 and 7-8. For installation mode 1 (MATLAB via mex files), follow steps 1 and 3-8, though step 2 doesn't hurt. 1) Download and install Cygwin: https://www.cygwin.com/. I downloaded the 64-bit version of Cygwin and installed it in C:\cygwin64 on my computer. 2) Download and install the Devel package through Cygwin: http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_cock/cygwin/part2/. This package provides a Fortran compiler for Cygwin called gfortran. This is necessary for the Hampath installation mode 0 (Fortran stand-alone) and 2 (MATLAB via text files). I don't think the Devel package is needed for the Hampath installation mode 1 (MATLAB via mex files). 3) Download and install the Windows 64-bit version of the Java Runtime Environment (JRE): https://www.java.com/en/download/manual.jsp. Make sure to download the x64 (i.e. 64-bit) version rather than the x86 (i.e. 32-bit) version! Java was installed in C:\Program Files\Java on my computer. Java is needed to run Tapenade. The version of Java must be compatible with Tapenade: https://www-sop.inria.fr/tropics/tapenade/faq.html#javaversion. 4) Download and install Tapenade: http://www-sop.inria.fr/tropics/tapenade.html. I installed Tapenade in C:\cygwin64\opt\tapenade3.11 on my computer. Below are the .bashrc, tapenade.bat (for executing Tapenade from a Windows shell) and tapenade (for executing Tapenade from a Cygwin shell) contents of the files that I used to execute Tapenade. It was a little bit tricky setting the paths correctly in these configuration files so that Windows, Cygwin, and Java could see things properly. I don't think proper configuration of these files is needed for Hampath to use Tapenade. Hampath just needs the correct path to Tapenade during installation. .bashrc: export MATLAB_HOME_MEX="C:/Progra~1/MATLAB/R2016a/bin/win64" export TAPENADE_HOME="/opt/tapenade3.11" export PATH="$TAPENADE_HOME/bin:$PATH" tapenade.bat: @echo off set JAVA_HOME="C:\Progra~1\Java\jre1.8.0_101" set JAVA_BIN="%JAVA_HOME%\bin\java.exe" set HEAP_SIZE=-mx256m set TAPENADE_HOME="C:\cygwin64\opt\tapenade3.11" set CLASSPATH="%TAPENADE_HOME%\jars\tapenade.jar" set BROWSER="C:\Progra~1\Internet Explorer\iexplore.exe" "%JAVA_BIN%" %HEAP_SIZE% -classpath %CLASSPATH% -Djava_home="%JAVA_HOME%" -Dtapenade_home=%TAPENADE_HOME% -Dbrowser=%BROWSER% topLevel.Tapenade %* tapenade: #!/bin/sh JAVA_HOME="C:/Progra~1/Java/jre1.8.0_101" JAVA_BIN="$JAVA_HOME/bin/java" HEAP_SIZE=-mx1536m TAPENADE_HOME="C:/cygwin64/opt/tapenade3.11" TCLASSPATH="$TAPENADE_HOME/jars/tapenade.jar" "$JAVA_BIN" "$HEAP_SIZE" -classpath "$TCLASSPATH" -Dfile.encoding=ISO-8859-15 -Djava_home="$JAVA_HOME" -Dtapenade_home="$TAPENADE_HOME" topLevel.Tapenade "$@" 5) Execute ''mex -setup fortran" in the Windows MATLAB command window to see if MATLAB mex is configured to compile Fortran code. If not (i.e. MATLAB gives a message like: Error using mex No supported compiler or SDK was found.), download and install a MATLAB-compatible Fortran compiler: http://www.mathworks.com/support/compilers/R2016a/index.html. Intel provides a free download of and license for IntelĀ® Parallel Studio XE Cluster Edition for Windows (which includes C/C++ and Fortran compilers) to students: https://software.intel.com/en-us/qualify-for-free-software/student. If necessary, a previous (e.g. prior to 2017) version must be downloaded by following these instructions: https://software.intel.com/en-us/articles/older-version-product. Prior to installing Intel Parallel Studio XE Cluster Edition, Microsoft Visual Studio Community 2015 needs to be downloaded and installed: https://beta.visualstudio.com/vs/community/. After installing Microsoft Visual Studio Community 2015, the setup may need to be modified (followed by a reboot) for Intel Parallel Studio XE Cluster Edition to use it properly; Intel Parallel Studio XE Cluster Edition installation setup provides a link with instructions on how to do this: https://software.intel.com/en-us/articles/intel-c-fortran-compilers-for-windows-integration-into-microsoft-visual-studio-2015. A computer reboot may be needed after installing each of Microsoft Visual Studio Community 2015 and Intel Parallel Studio XE Cluster Edition. After installing the MATLAB-compatible Fortran compiler and a system reboot, execute ''mex -setup fortran" in the Windows MATLAB command window to ensure that mex is configured to use a Fortran compiler. 6) Modify the .xml file which tells MATLAB mex how to interface with the Fortran compiler. On my computer this file is C:\Users\stuma\AppData\Roaming\MathWorks\MATLAB\R2016a\mex_FORTRAN_win64.xml. In this .xml file, change the line OBJEXT=".obj" to OBJEXT=".o" and remove "/fixed" from the COMPFLAGS line. The first change forces the Fortran compiler to create .o rather than .obj object files. The second change forces mex to compile free source format Fortran .f90 files. Attached are the original and modified .xml files. 7) In Cygwin, install Hampath. Select the Hampath installation mode 0, 1, or 2. If you select installation mode 0 (Fortran stand-alone) or 2 (MATLAB via text files), then you must provide the path to the Cygwin Fortran compiler. The Cygwin Fortran compiler path which I provided to Hampath is /usr/bin/gfortran. If you select installation mode 1 (MATLAB via mex files), then you may have to manually supply the location of the MATLAB mex executable, because Hampath by default selected the MiKTeX mex executable during my installation. Select option 2 to change the configuration and manually provide the location of the MATLAB mex executable. The MATLAB mex path which I provided to Hampath is C:/Progra~1/MATLAB/R2016a/bin/win64/mex, since MATLAB is installed in C:\Program Files\MATLAB on my computer. 8) Hampath should work on the example problems.