Difference between revisions of "TestWyldckat"
Line 71: | Line 71: | ||
<ol> | <ol> | ||
<li>Choose which version you want to use: | <li>Choose which version you want to use: | ||
− | : | + | :'''mingw32''': for getting a 32bit version of OpenFOAM, that builds on Linux i?86, using mingw; |
− | : | + | :'''mingw-w32''': for getting a 32bit version of OpenFOAM, that builds on Linux i686 and x86_64, using mingw-w64; |
− | : | + | :'''mingw-w64''': for getting a 64bit version of OpenFOAM, that builds on Linux i686 and x86_64, using mingw-w64; |
Variants of the "bashrc" file that is inside the folder "OpenFOAM-1.6/etc", have been created, to meet the most likely options. These are: | Variants of the "bashrc" file that is inside the folder "OpenFOAM-1.6/etc", have been created, to meet the most likely options. These are: | ||
Line 179: | Line 179: | ||
OpenFOAM-1.6/doc ThirdParty-1.6/mpich2-1.1.1p1/platforms/$WM_OPTIONS \ | OpenFOAM-1.6/doc ThirdParty-1.6/mpich2-1.1.1p1/platforms/$WM_OPTIONS \ | ||
$USER-1.6/applications/bin/$WM_OPTIONS ThirdParty-1.6/mpich2-1.1.1p1/source</bash> | $USER-1.6/applications/bin/$WM_OPTIONS ThirdParty-1.6/mpich2-1.1.1p1/source</bash> | ||
− | + | </li><li> | |
'''Optional''' - In case you have built more than one OpenFOAM version ('''mingw32''' '''mingw-w32''' '''mingw-w64'''), pack the whole '''bin''' and '''lib''' folders as so: | '''Optional''' - In case you have built more than one OpenFOAM version ('''mingw32''' '''mingw-w32''' '''mingw-w64'''), pack the whole '''bin''' and '''lib''' folders as so: | ||
<bash>tar --lzma -chf OpenFOAM.mingw.tar.lzma OpenFOAM-1.6/applications/bin OpenFOAM-1.6/etc \ | <bash>tar --lzma -chf OpenFOAM.mingw.tar.lzma OpenFOAM-1.6/applications/bin OpenFOAM-1.6/etc \ | ||
Line 207: | Line 207: | ||
Now, to launch the command line, simply double-click on the file '''DOS_Mode.bat'''. In case you have built more than one version, a menu will show asking which version to use.</li> | Now, to launch the command line, simply double-click on the file '''DOS_Mode.bat'''. In case you have built more than one version, a menu will show asking which version to use.</li> | ||
− | <li>In order to get MPICH2 | + | <li>In order to get MPICH2 batch file to run in this command line, you'll have to copy the file '''pnb\gompi.bat''' to the folder '''OpenFOAM-1.6\bin\'''. |
− | MPICH2 will only work properly if you install it in Windows. If you used '''get-mpich2''' script in Linux, you should have the installation file(s) in the folder '''ThirdParty-1.6\mpich2-1.1.1p1\source''', that came with the compressed file that has the cross-compiled OpenFOAM | + | MPICH2 will only work properly if you install it in Windows. If you used '''get-mpich2''' script in Linux (see [[#Getting Windows version of MPICH2 into the ThirdParty-1.6 folder in Linux|Getting Windows version of MPICH2 into the '''ThirdParty-1.6''' folder in Linux]]), you should have the installation file(s) in the folder '''ThirdParty-1.6\mpich2-1.1.1p1\source''', that came with the compressed file that has the cross-compiled OpenFOAM. |
− | + | ||
− | + | ||
+ | Now, you have (at least) two possible solutions: | ||
+ | <ol><li>Replicate the structure as in Linux - After installing MPICH2 in Windows, you can copy the binary folder to the respective version of cross-compiled OpenFOAM. For example '''C:\Program Files\MPICH2\bin''' or '''C:\Program Files (x86)\MPICH2\bin''' for the 32bit version in Windows x64. | ||
+ | The targeted folders to hold the contents of the MPICH2 '''bin''' folder, are: | ||
+ | *'''ThirdParty-1.6\mpich2-1.1.1p1\platforms\linuxmingw32DPOpt\bin''' | ||
+ | *'''ThirdParty-1.6\mpich2-1.1.1p1\platforms\linuxmingw-w32SPOpt\bin''' | ||
+ | *'''ThirdParty-1.6\mpich2-1.1.1p1\platforms\linuxmingw-w32DPOpt\bin''' | ||
+ | *'''ThirdParty-1.6\mpich2-1.1.1p1\platforms\linuxmingw-w64DPOpt\bin''' - this should have the 64bit version of MPICH2 | ||
+ | </li> | ||
+ | <li>Edit the file '''setvars.bat''' and add the '''bin''' folder of your MPICH2 installation to the '''PATH''' variable near the end of the batch file. For example, add ''';C:\Program Files\MPICH2\bin''' to the end of line that starts with '''set PATH=%PATH%;'''. | ||
+ | '''CAUTION''': This solution will require additional tweaking to the '''setvars.bat''' in case you want to run the 64bit and 32bit versions of OpenFOAM, in order to add ''';C:\Program Files\MPICH2\bin''' or ''';C:\Program Files (x86)\MPICH2\bin''' accordingly to the desired version. | ||
+ | </li></ol> | ||
+ | <li>In order to get Paraview batch file to run in this command line, you'll have to copy the file '''pnb\paraFoam.bat''' to the folder '''OpenFOAM-1.6\bin\'''. | ||
Paraview should be installed in, or copied to, one of the following folders, according to the versions installed: | Paraview should be installed in, or copied to, one of the following folders, according to the versions installed: | ||
:'''ThirdParty-1.6\paraview-3.6.1\platforms\linuxmingw32''' | :'''ThirdParty-1.6\paraview-3.6.1\platforms\linuxmingw32''' | ||
Line 218: | Line 228: | ||
:'''ThirdParty-1.6\paraview-3.6.1\platforms\linuxmingw-w64''' | :'''ThirdParty-1.6\paraview-3.6.1\platforms\linuxmingw-w64''' | ||
The Paraview binaries themselves should be inside the folder '''bin'''. For example, for '''mingw32''' the Paraview binaries should be inside the folder '''ThirdParty-1.6\paraview-3.6.1\platforms\linuxmingw32\bin'''. | The Paraview binaries themselves should be inside the folder '''bin'''. For example, for '''mingw32''' the Paraview binaries should be inside the folder '''ThirdParty-1.6\paraview-3.6.1\platforms\linuxmingw32\bin'''. | ||
− | For more information | + | For more information on how to build Paraview for Windows with OpenFOAM file handling, see the chapter [[#Building Paraview in Windows|Building Paraview in Windows]]. |
− | + | </li> | |
− | '''Tip''': with some tweaking of the OpenFOAM scripts in the folder '''OpenFOAM-1.6\bin\''', it is possible to run OpenFOAM with [http://www.mingw.org/wiki/MSYS MSys]. This way you have more functionalities and a near Linux experience with OpenFOAM. | + | <li>'''Tip''': with some tweaking of the OpenFOAM scripts in the folder '''OpenFOAM-1.6\bin\''', it is possible to run OpenFOAM with [http://www.mingw.org/wiki/MSYS MSys]. This way you have more functionalities and a near Linux experience with OpenFOAM. And for MPICH2, you might want to make a copy of '''mpiexec.exe''' to '''mpirun.exe'''. |
</li> | </li> | ||
</ol> | </ol> | ||
Line 312: | Line 322: | ||
TODO: add refs to blueCAPE's product blueCFD, Symscape's entries for 1.4.x, 1.5.x and 1.6.x, as well as the 1.5.x version available in the forum. | TODO: add refs to blueCAPE's product blueCFD, Symscape's entries for 1.4.x, 1.5.x and 1.6.x, as well as the 1.5.x version available in the forum. | ||
− | [[User:Wyldckat|Wyldckat]] | + | [[User:Wyldckat|Wyldckat]] 11:04, 11 November 2009 (UTC) |
Revision as of 11:04, 11 November 2009
Contents
- 1 Introduction
- 2 Get OpenFOAM packages
- 3 Optional: Using a specific gcc version for building the wmake binaries
- 4 Applying patches
- 5 Getting Windows version of MPICH2 into the ThirdParty-1.6 folder in Linux
- 6 Tweaking environment options
- 7 Build the cross compiler
- 8 Cross-Compile OpenFOAM in Linux for Windows
- 9 Copying the files to your Windows installation
- 10 Building Paraview in Windows
- 11 Using MPICH2 with OpenFOAM in Windows
- 12 Creating a Compiled HTML file for the code documentation
1 Introduction
This is an exhaustive step by step guide on how to cross-compile OpenFOAM in Linux for Windows, for both 32 and 64 bits architectures (from and to), using the patches available here.
These patches were based on Symscape's "v3" patch for OpenFOAM 1.5.x available here. These differ substantially from that patch, as well as the more recent one for 1.6.x, available here. The build scripts for mingw and mingw-w64 were also based on the build-script available on the 1.5.x link.
With this guide and available patches, you should be able to cross-compile the whole and complete OpenFOAM libraries and applications, using MPICH2 instead of Open MPI for parallel computing. You can cross-compile using mingw32 and/or mingw-w64. These enable you to build OpenFOAM 1.6 for Windows 32 and 64 bit versions, from Linux 32 and 64bit architectures.
Versions these patches apply to:
2 Get OpenFOAM packages
- In your Linux machine, open a terminal window and create the folder $HOME/OpenFOAM.
- Get OpenFOAM-1.6.General.gtgz and ThirdParty-1.6.General.gtgz from the OpenCFD's website and copy/move them to the folder $HOME/OpenFOAM.
- Extract both files, by running in a terminal:
cd $HOME/OpenFOAM tar xzf OpenFOAM-1.6.General.gtgz tar xzf ThirdParty-1.6.General.gtgz
3 Optional: Using a specific gcc version for building the wmake binaries
This is optional, because the current patch will use the system's gcc for building them (more specifically gcc as compiler name).
- Edit $HOME/.bashrc and add the following line to the end of it:
. $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
NOTE: sometimes the leading dot doesn't work, so use the following instead:source $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
- You might want to edit $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc and set the Linux architecture correctly, namely WM_ARCH_OPTION to 32 or 64.
- You might want to edit $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc and set the Linux architecture correctly, namely WM_ARCH_OPTION to 32 or 64.
- Two possibilities are now available:
- Use the system's gcc - edit $HOME/OpenFOAM/OpenFOAM-1.6/etc/settings.sh and change compilerInstall=OpenFOAM to compilerInstall=System.
- Use the gcc that comes with the ThirdParty-1.6.General.gtgz package - again, two choices:
- You can compile the gcc by running the following line:
(cd $HOME/OpenFOAM/ThirdParty-1.6 && makeGcc gcc-4.3.3)
- Or by getting the available compiled version for your Linux version ( ThirdParty-1.6.linuxGcc.gtgz or ThirdParty-1.6.linux64Gcc.gtgz from OpenCFD's website).
- You can compile the gcc by running the following line:
- launch a new terminal and run the following line, thus building wmkdep and dirToString:
(cd $HOME/OpenFOAM/OpenFOAM-1.6/wmake/src && make)
4 Applying patches
- Copy/move the PatchesNBatches.tar.gz file into the $HOME/OpenFOAM folder. Then unpack it by running:
tar -xzf PatchesNBatches.tar.gz
- A new folder is created, named pnb. Now to apply the patches, run from the $HOME/OpenFOAM folder:
patch -p0 < pnb/OpenFOAM-1.6_patch patch -p0 < pnb/ThirdParty-1.6_patch
- Still have to do some chmodding, for new scripts to run properly. Run the following lines in the terminal:
chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/build-mingw32 chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/build-mingw-w32 chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/build-mingw-w64 chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/build-mingw-w64-45 chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/makeGcc44 chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/get-mpich2 chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/src/mingwFunctions chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/src/Allclean chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw32 chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w32 chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w32-prof chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w32S chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w64 chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w64-45 chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w64-prof chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/applications/utilities/parallelProcessing/Allwmake chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/bin/tutowin chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/bin/foamDiff
5 Getting Windows version of MPICH2 into the ThirdParty-1.6 folder in Linux
- There are two ways of getting MPICH2 into your Linux+OpenFOAM set up:
- Use the get-mpich2 script, that requires Wine to be installed. With Wine installed and with msiexec executable from the terminal, then the get-mpich2 script should work. To check whether you have msiexec accessible in the terminal, run:
which msiexec
If it returns the full path to the executable, then it is ready to use. - Copy MPICH2 files from a Windows Installation. Three steps for this part:
- Download and install in Windows the MPICH2, version 1.1.1p1 Win32 IA32 from here. Get and install the 64bit version, if you wish to build OpenFOAM for Windows x64.
- Create the folder ThirdParty-1.6/mpich2-1.1.1p1 in your Linux set up.
- Copy the folders bin, include and lib from the installed version of MPICH2 in Windows, into the folder ThirdParty-1.6/mpich2-1.1.1 in Linux.
- Use the get-mpich2 script, that requires Wine to be installed. With Wine installed and with msiexec executable from the terminal, then the get-mpich2 script should work. To check whether you have msiexec accessible in the terminal, run:
- The Allwmake script at the folder ThirdParty-1.6 will take care of the rest. For now, the tough part is that, this way, you can only build one version of OpenFOAM (32 or 64bit) at a time.
6 Tweaking environment options
- Choose which version you want to use:
- mingw32: for getting a 32bit version of OpenFOAM, that builds on Linux i?86, using mingw;
- mingw-w32: for getting a 32bit version of OpenFOAM, that builds on Linux i686 and x86_64, using mingw-w64;
- mingw-w64: for getting a 64bit version of OpenFOAM, that builds on Linux i686 and x86_64, using mingw-w64;
- sample - <bashrc-version>
- configured for <compiler>, <mingw version>, <MPI option>, <WM_COMPILE_OPTION>, <WM_ARCH_OPTION>
- bashrc-mingw32
- configured for gcc-4.3.3, mingw32, MPI with MPICH2, Opt, DP, 32
- bashrc-mingw-w32
- configured for gcc-4.4.2, mingw-w32, MPI with MPICH2, Opt, DP, 32
- bashrc-mingw-w32-prof
- configured for gcc-4.4.2, mingw-w32, No MPI, Prof, DP, 32
- bashrc-mingw-w32S
- configured for gcc-4.4.2, mingw-w32, MPI with MPICH2, Opt, SP, 32
- bashrc-mingw-w64
- configured for gcc-4.4.2, mingw-w64, MPI with MPICH2, Opt, DP, 64
- bashrc-mingw-w64-prof
- configured for gcc-4.4.2, mingw-w64, No MPI, Prof, DP, 64
- bashrc-mingw-w64-45
- configured for gcc-4.5.0, mingw-w64, MPI with MPICH2, Opt, DP, 64
- After choosing the version you wish to build, edit the file $HOME/.bashrc and add to the end of it, a line analogous to the following line:
. $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw32
NOTE: sometimes the leading dot doesn't work, so use the following instead:
source $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw32
- Before launching a new terminal, edit the picked file $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw version. You have two additional variables that are configurable and non standard to the original OpenFOAM version:
- WM_PSTREAMLINK - this variable allows control over the linking method that is with the Pstream library. Two options are available:
- If set to DONTLINKTOPSTREAM, then depending on the variable WM_MPLIB being set to "NONE" or "MPICH", then OpenFOAM will be statically linked with that version, being able only without MPI capabilities or only to run with MPICH2 installed, respectively.
- If LINKTOPSTREAM, then DLLs of the library Pstream are created, both dummy and MPICH2 versions; this allows you to choose which version to use in Windows, without rebuilding OpenFOAM again, allowing one build to be used in multiple installations.
- WM_GETMPICH2 - this variable controls whether MPICH2 is setup automatically or manually. The two options are:
- If set to GETMPICH2, then wget is used for downloading the MPICH2 installation packages, and Wine will be used to unpack the ".msi" files.
- If DONTGETMPICH2, then the script will assume that the steps at 4.1.2 were taken.
- WM_PSTREAMLINK - this variable allows control over the linking method that is with the Pstream library. Two options are available:
7 Build the cross compiler
- Open a new terminal window or tab, so the edited file $HOME/.bashrc is executed, thus setting up the chosen OpenFOAM development environment (see Tweaking environment options).
- Now go to the ThirdParty-1.6 folder, in your new terminal:
cd $WM_THIRD_PARTY_DIR
- Now you have to build the cross-compiler. Accordingly to the version you picked, you have type one of the following versions:
- to build the mingw32 version, run:
./build-mingw32 gcc-4.3.3
- to build the mingw-w32 version, run:
./build-mingw-w32
- to build the mingw-w64 version, run:
./build-mingw-w64
- to build the mingw-w64-45 version, run:
./build-mingw-w64-45
./makeGcc gcc-4.3.3
This will launch the respective build-mingw* script, according to the environment settings, but gcc-4.3.3 will only be used for mingw32; and the script build-mingw-w64-45 isn't called from makeGcc.
NOTE: updates are bound to be done to the packages that these scripts use. Therefore, you should edit the script you have chosen, and check accordingly:- mingw32 - search for:
BINUTILS_ARCHIVE="binutils-2.19.1-src.tar.gz" MINGW_ARCHIVE="mingwrt-3.15.2-mingw32-dev.tar.gz" W32API_ARCHIVE="w32api-3.13-mingw32-dev.tar.gz" REGEX_ARCHIVE="mingw-libgnurx-2.5.1-bin.tar.gz" REGEX2_ARCHIVE="mingw-libgnurx-2.5.1-dev.tar.gz"
And check if they still exist or newer exists, on their website. - mingw-w?? - search for:
MINGW64PACKAGE="mingw-w64-src_4.4.1-1"
And check here for new versions. Usually the package is around 80MB in size. The line:
MINGW64PACKAGE2="mingw-w64-crt-release-1.0"
Relates to the stable run-time source version, available at cadforte. For the package mingw-w64-src_4.4.1-1, this was necessary, because this wasn't the stable version yet. You can change both and comment MINGW64PACKAGE2 and related items if you deem the package indicated in MINGW64PACKAGE stable enough.
- to build the mingw32 version, run:
8 Cross-Compile OpenFOAM in Linux for Windows
- Open a new terminal window or tab, so it will reset environment variables and add the newly built cross-compiling gcc into the executable path variable (see Tweaking environment options). Go to the project folder as so:
cd $WM_PROJECT_DIR
- Go to the folder "OpenFOAM-1.6" and run "Allwmake":
./Allwmake
This will build the entire OpenFOAM package. This does not include: Paraview, ccm26ToFoam, OpenMPI and code documentation. - Optional - For code documentation, you should add doc to ./Allwmake, as such:
./Allwmake doc
Or run afterward:
./doc/Allwmake
NOTE: if you want to create a CHM file in Windows, that will have the whole documentation in a single Compressed HTML index.chm file, then copy the file at the folder pnb, as such:
cp ../pnb/Doxyfile ./doc/Doxygen/
In the chapter Creating a Compiled HTML file for the code documentation is explained how to finish this step. - Optional - To build the mesh conversion utility ccm26ToFoam, just run:
$FOAM_APP/utilities/mesh/conversion/Optional/Allwmake
The rest is done automatically, including downloading the libraries used for handling ccm files, and patching where necessary. - Optional - Build the parallel test application:
cd $WM_PROJECT_DIR wmake applications/test/parallel
The built executable will be placed in the folder OpenFOAM/$USER-1.6/application/bin/$WM_OPTIONS.
9 Copying the files to your Windows installation
- The folders from "$HOME/OpenFOAM" you have to copy are:
- OpenFOAM-1.6/applications/bin/$WM_OPTIONS
- OpenFOAM-1.6/etc
- OpenFOAM-1.6/bin
- OpenFOAM-1.6/tutorials
- OpenFOAM-1.6/lib/$WM_OPTIONS
- OpenFOAM-1.6/doc (optional)
- ThirdParty-1.6/mpich2-1.1.1p1/platforms/$WM_OPTIONS (or the version you chose)
- ThirdParty-1.6/mpich2-1.1.1p1/source (optional, only if "get-mpich2" is used)
- $USER-1.6/applications/bin/$WM_OPTIONS (created in step 5 of the chapter Cross-Compile OpenFOAM in Linux for Windows)
tar -chjf OpenFOAM.$WM_OPTIONS.tar.bz2 OpenFOAM-1.6/applications/bin/$WM_OPTIONS \ OpenFOAM-1.6/etc OpenFOAM-1.6/bin OpenFOAM-1.6/tutorials OpenFOAM-1.6/lib/$WM_OPTIONS \ OpenFOAM-1.6/doc ThirdParty-1.6/mpich2-1.1.1p1/platforms/$WM_OPTIONS \ $USER-1.6/applications/bin/$WM_OPTIONS ThirdParty-1.6/mpich2-1.1.1p1/source
Or for an even smaller package:
tar --lzma -chf OpenFOAM.$WM_OPTIONS.tar.lzma OpenFOAM-1.6/applications/bin/$WM_OPTIONS \ OpenFOAM-1.6/etc OpenFOAM-1.6/bin OpenFOAM-1.6/tutorials OpenFOAM-1.6/lib/$WM_OPTIONS \ OpenFOAM-1.6/doc ThirdParty-1.6/mpich2-1.1.1p1/platforms/$WM_OPTIONS \ $USER-1.6/applications/bin/$WM_OPTIONS ThirdParty-1.6/mpich2-1.1.1p1/source
-
Optional - In case you have built more than one OpenFOAM version (mingw32 mingw-w32 mingw-w64), pack the whole bin and lib folders as so:
tar --lzma -chf OpenFOAM.mingw.tar.lzma OpenFOAM-1.6/applications/bin OpenFOAM-1.6/etc \ OpenFOAM-1.6/bin OpenFOAM-1.6/tutorials OpenFOAM-1.6/lib OpenFOAM-1.6/doc \ ThirdParty-1.6/mpich2-1.1.1p1/platforms $USER-1.6/applications/bin
- In order to recreate a folder base folder similar to the Linux setup, do the following steps:
- Copy the resulting compressed file to your Windows installation.
- Create a folder named OpenFOAM, wherever you wish to have OpenFOAM running in Windows.
- Copy/Move the file compressed file into that folder.
- Unpack it using a compatible application. In case you don't know or have any, a suggestion is 7zip, available here.
- Unpack the PatchesNBatches.tar.gz file to your OpenFOAM base folder in Windows. The following files should be copied from the folder pnb to the base folder OpenFOAM:
- DOS_Mode.bat
- setvars.bat
- set USER=ofuser
- set USERNAME=ofuser
- rem PICK ONE: dummy or MPICH
- rem set WM_MPLIB=dummy
- set WM_MPLIB=MPICH
- In order to get MPICH2 batch file to run in this command line, you'll have to copy the file pnb\gompi.bat to the folder OpenFOAM-1.6\bin\.
MPICH2 will only work properly if you install it in Windows. If you used get-mpich2 script in Linux (see Getting Windows version of MPICH2 into the ThirdParty-1.6 folder in Linux), you should have the installation file(s) in the folder ThirdParty-1.6\mpich2-1.1.1p1\source, that came with the compressed file that has the cross-compiled OpenFOAM.
Now, you have (at least) two possible solutions:
- Replicate the structure as in Linux - After installing MPICH2 in Windows, you can copy the binary folder to the respective version of cross-compiled OpenFOAM. For example C:\Program Files\MPICH2\bin or C:\Program Files (x86)\MPICH2\bin for the 32bit version in Windows x64.
The targeted folders to hold the contents of the MPICH2 bin folder, are:
- ThirdParty-1.6\mpich2-1.1.1p1\platforms\linuxmingw32DPOpt\bin
- ThirdParty-1.6\mpich2-1.1.1p1\platforms\linuxmingw-w32SPOpt\bin
- ThirdParty-1.6\mpich2-1.1.1p1\platforms\linuxmingw-w32DPOpt\bin
- ThirdParty-1.6\mpich2-1.1.1p1\platforms\linuxmingw-w64DPOpt\bin - this should have the 64bit version of MPICH2
- Edit the file setvars.bat and add the bin folder of your MPICH2 installation to the PATH variable near the end of the batch file. For example, add ;C:\Program Files\MPICH2\bin to the end of line that starts with set PATH=%PATH%;. CAUTION: This solution will require additional tweaking to the setvars.bat in case you want to run the 64bit and 32bit versions of OpenFOAM, in order to add ;C:\Program Files\MPICH2\bin or ;C:\Program Files (x86)\MPICH2\bin accordingly to the desired version.
- Replicate the structure as in Linux - After installing MPICH2 in Windows, you can copy the binary folder to the respective version of cross-compiled OpenFOAM. For example C:\Program Files\MPICH2\bin or C:\Program Files (x86)\MPICH2\bin for the 32bit version in Windows x64.
The targeted folders to hold the contents of the MPICH2 bin folder, are:
- In order to get Paraview batch file to run in this command line, you'll have to copy the file pnb\paraFoam.bat to the folder OpenFOAM-1.6\bin\.
Paraview should be installed in, or copied to, one of the following folders, according to the versions installed:
- ThirdParty-1.6\paraview-3.6.1\platforms\linuxmingw32
- ThirdParty-1.6\paraview-3.6.1\platforms\linuxmingw-w32
- ThirdParty-1.6\paraview-3.6.1\platforms\linuxmingw-w64
- Tip: with some tweaking of the OpenFOAM scripts in the folder OpenFOAM-1.6\bin\, it is possible to run OpenFOAM with MSys. This way you have more functionalities and a near Linux experience with OpenFOAM. And for MPICH2, you might want to make a copy of mpiexec.exe to mpirun.exe.
10 Building Paraview in Windows
- This is a pain to do, and yet, quite simple once you get the handle of it. Nonetheless, here won't be described the full building procedure. You can follow the tutorial available here in this wiki and use that plug-in for reading .foam files directly from Paraview, without building the original plug-ins that come with OpenFOAM and be able to handle large and/or parallelized cases. On that tutorial page, you also have a link to an already built version of Paraview 3.4.0 with the plug-in. This way it is less one thing to worry about building.
- Tips for building a 64bit version of Paraview - Follow the instructions available here and here. This way you can get Visual Studio Express to build x64 applications and also build Qt 64bit for Windows, as well as Paraview with the multi-platform plug-in!
11 Using MPICH2 with OpenFOAM in Windows
This is valid for each computer with Windows where you installed the cross-compiled OpenFOAM. Be advised that you install it in an identical folder path on each machine, or in a network shared drive. User accounts should be of the same name and password. Currently we haven't tested running with different user accounts.
- Go to into your administrative account and:
- Open a command line (Start->Run... -> cmd.exe or Winkey+R).
- Go to the bin folder where MPICH2 is installed (e.g. cd C:\Program Files\MPICH2\bin).
- Type:
smpd -install
to install the MPICH2 smpd service.
- Type:
mpiexec.exe -register
And when it asks your user name just press Enter key; and when it asks your user password, introduce your password... it'll ask you twice to make sure. This will allow future calls to mpiexec to be done without requiring password. MPICH will encrypt your password into the Windows Registry, so it should be safe.
CAUTION: the MSys terminal version will make visible your password visible on screen! - Test the parallel system. For that, you'll have to:
- Go to the folder ofuser-1.6 (or $USER-1.6) and unpack the test case PTestCase.tar.gz;
- Type:
gompi parallelTest
It will test communications between two instances of parallelTest.exe. If successful, it should display something like this:
C:\Program Files\blueCFD\ofuser-1.6\PTestCase>mpiexec -n 2 -genvlist HOME,PATH,USERNAME, WM_PROJECT_DIR,WM_PROJECT_INST_DIR,WM_OPTIONS,FOAM_LIBBIN,FOAM_APPBIN,FOAM_USER_APPBIN, MPI_BUFFER_SIZE parallelTest -parallel /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ /* Windows 32 and 64 bit porting by blueCAPE: http://www.bluecape.com.pt *\ | Based on Windows porting (1.5.x v3) by Symscape: http://www.symscape.com/ | \*---------------------------------------------------------------------------*/ Build : 1.6-f802ff2d6c5a Exec : C:\Program Files\blueCFD\ofuser-1.6\applications\bin\linuxmingw-w 32DPOpt\parallelTest.exe -parallel Date : Oct 23 2009 Time : 16:21:16 Host : THE_MACHINE PID : 712 Case : C:/Program Files/blueCFD/ofuser-1.6/pTestCase nProcs : 2 Slaves : 1 ( THE_MACHINE.5024 ) Pstream initialized with: floatTransfer : 0 nProcsSimpleSum : 0 commsType : nonBlocking // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time [1] Starting transfers [1] [1] slave sending to master 0 [1] slave receiving from master 0 [0] Starting transfers [0] [0] master receiving from slave 1 [0] (0 1 2) [0] master sending to slave 1 End [1] (0 1 2) Finalising parallel run
12 Creating a Compiled HTML file for the code documentation
TODO: Still have to describe how to compile these
TODO: Still missing Stuff that doesn't work and relevant additions to OpenFOAM...
TODO: add refs to blueCAPE's product blueCFD, Symscape's entries for 1.4.x, 1.5.x and 1.6.x, as well as the 1.5.x version available in the forum.
Wyldckat 11:04, 11 November 2009 (UTC)