WFN NONMEM Version Switching System

Home | Installation | Control Streams | Bootstrap | Randomization Test | Visual Predictive Check | Autocovariate | Files | References


Last Updated: 3 April 2012

The standard installation for NONMEM places all the source and compiled object files in the same directory for each of the components (nm, pr, tr, tl) of the NONMEM system.

WFN provides support for maintaining different NONMEM source code versions and different NONMEM named compilation versions. The compilation versions may differ because you choose to use different compiler options or because you are using different source code.

Using NMinstall to Make Different NONMEM Compilation Size Versions

There are 3 files that need to be changed: nminstall.bat, wfn.bat and the WFN shortcut you wish to use with multiple compiled versions.


nminstall.bat is used to create different NONMEM compilation size versions which are then recognized by WFN.  Open %WFNHOME%\nminstall.txt in a text editor and save it as %WFNHOME%\nminstall.bat.

Check the options shown at the start of nminstall.bat to indicate the NONMEM source (e.g. a CDROM on drive D: with the path D:\). Choose the compiler type (gfortran, ifort, g95) to match the compiler you have specified in wfn.bat (gf, ivf, g95). Note that the compiler type given here is the same as that required by the NONMEM setup72.bat. Pick the compilation size you wish to create (e.g. reg is the NONMEM standard installation and big uses the maximum number of THETA, ETA and EPS parameters). Select rec or norec for the recompile option.


rem ************* check this ************************************

rem change this to NONMEM source path (drive and path)


rem change this to NONMEM source drive (without path!)


rem specify compiler (or compilers) from gfortran, ifort, g95

set compilers=gfortran

rem specify NONMEM size from reg, big

set sizes=reg

rem specify whether to recompile (rec) or only compile if not already done (norec)

set recompile=norec

rem ************* end check this ************************************


Save nminstall.bat with your options.


Open wfn.bat and find this section then remove rem before set NMBINHOME as follows. This allows WFN to find different compiled versions of NONMEM. Save wfn.bat.


rem **** Uncomment for Multiple Compiled Versions *******


rem *****************************************************


Change the WFN shortcut properties (right click on the WFN shortcut) so that the target includes the desired compiler and compilation size option e.g. use gf for the gfortran compiler and reg for standard compilation size:


%SystemRoot%\system32\cmd.exe /k C:\nm720\wfn7\bin\wfn.bat gf reg


Open the WFN shortcut and change to the %WFNHOME% directory then run nminstall.bat e.g.




This will install NONMEM by running a modified version of setup72.bat called setup72_F77OPT.bat. This version uses the WFN Fortran compiler options to ensure that the compilation of NONMEM uses the same options as those used when nmgo is used.

Using More than One Compiler

wfn.bat can be modified  to support more than one compiler. There are 2 ways of doing this.

The first involves finding the compiler version specific sections and setting F77HOME to the appropriate value. e.g. if you are currently using the gfortran compiler and want to also use the ivf compiler then find this section in wfn.bat, uncomment the F77HOME line so that it refers to the location of the Intel version 10 compiler e.g.


rem ******* Check Installation Paths ************

set F77HOME=C:\Program Files\Intel\Compiler\Fortran\10.1.024

This overrides the setting of F77HOME at the start of wfn.bat if the ivf compiler code is used as an argument to start wfn.bat.


The second method can be convenient if you have installed your compilers in sub-directories of a common home directory and use the %F77VER% version codes to distinguish the sub-directories. If you do this then you should set F77HOME to the common home directory at the start of wfn.bat e.g. you might have your Fortran compilers installed as sub-directories of C:\f77 like this C:\f77\gf, C:\f77\ivf. In that case set F77HOME=C:\f77 and uncomment the line referring to F77VERHOME as shown below:


rem **** Uncomment for Multiple Compilers ***************
rem *****************************************************

With either method you can then select the compiler version you want by invoking the wfn command from the Windows command prompt e.g.

wfn gf


wfn ivf


You can add the compiler version code after wfn.bat in the shortcut target property if you want to be able to automatically set up the environment for each compiler by opening a shortcut.


C:\nm720\wfn7\bin\wfn.bat gf


C:\nmvi\wfn7\bin\wfn.bat ivf


Home | Installation | Control Streams | Bootstrap | Randomization Test | Visual Predictive Check | Autocovariate | Files | References