|
[Sponsors] |
Cross-compiling OpenFOAM 1.6 on Linux for Windows 32 and 64bits with Mingw-w64 |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 13, 2009, 07:21 |
Cross-compiling OpenFOAM 1.6 on Linux for Windows 32 and 64bits with Mingw-w64
|
#1 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,980
Blog Entries: 45
Rep Power: 128 |
Dear FOAMers and Windows users,
We at blueCAPE have worked on getting OpenFOAM 1.6 being cross-compiled to the fullest, from Linux to Windows, from and to either 32 or 64 bit architectures. Thanks to the Mingw-w64 project, the MPICH2 project and Symscape's efforts on cross-compiling OpenFOAM since version 1.4.1, we have been able to make another step forward and making possible of getting OpenFOAM cross-compiled to the fullest, thus bringing parallel computing, libmetis and libscotch to the working grounds of Windows. We've also worked on the openfoamwiki.net, in order to bring you a detailed step by step guide to the patches available there. The patches were based on Symscape's version 3 for OpenFOAM 1.5.x, as well with the experience gathered when creating the patches available here and here. Unfortunately, there still are some limitations to this cross-compiling version and we also haven't been able to fully test the resulting product, due to insufficient knowledge of all solvers and utilities that OpenFOAM has. These limitations are also described on the wiki here. Also, these patches are still only for the version 1.6. Version 1.6.x will only be worked on if there is a need on our part or some auxiliary support in making these. Hopefully, with these patches, as well as Symscape's patches, anyone can do the step of mixing the two together and coming up with updated versions. And there is a script named foamDiff, that can aid in making patches, without requiring to clean up the binaries and objects. This script was made because we didn't use the git version of OpenFOAM. Also, we've tried to respect, to the best of our knowledge, the policies of the openfoamwiki. We added this page, added a link to this page and updated this section of the FAQ. We've tried to do the best we could, to give the up-to-date information there is on cross-compiled and natively compiled OpenFOAM versions for Windows. We've also made some timings with the motorBike case from OpenFOAM 1.6.x, with single and dual core, 32 and 64bit, Linux and Windows (sorry, no Wine). Unfortunately, we probably didn't do a good job on getting a good mesh decomposition for the parallel runs, since the performance increase with dual core was only of about 30%. Feel free to comment! Best Regards and happy mass paralleling on Windows Bruno Santos |
|
November 13, 2009, 13:39 |
|
#2 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30 |
I'm not planning to use OpenFOAM on Windows in the near future, but nevertheless I'm impressed with your efforts, especially the exhaustive documentation you put up on the wiki. Thumbs up!
|
|
November 14, 2009, 23:32 |
|
#3 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,980
Blog Entries: 45
Rep Power: 128 |
Thank you Akidess!
But I'm still on a personal quest to improve upon what has already been done. I've been rattling my brain for solutions on how to get OpenFOAM built directly in Windows, without having to change substantially the code. But so far the best deduction I've come up with, was to use Cygwin's managed mounts to do the cross-compiling directly in Windows, and possibly also using Cygwin's git, but I still have to check if it's really possible. And sadly, we at blueCAPE can't spend more time on this in the near future (already took a month), unless there is plausible reasons to do so Best Regards, Bruno |
|
November 16, 2009, 04:23 |
|
#4 |
New Member
Sören
Join Date: Oct 2009
Location: Bremen, Germany
Posts: 15
Rep Power: 17 |
very good tutorial !
is it possible to build new solvers in windows directly ? Or do I have to build it in Linux and use the cross-compiler to make it windows compatible ? |
|
November 16, 2009, 06:55 |
You can, but you'll have to port/tweak headers by hand
|
#5 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,980
Blog Entries: 45
Rep Power: 128 |
The big reason for having to resort to cross-compiling, is the fact that Windows is by default case-insensitive/case-preserving. And the headers of the OpenFOAM libraries are no exception, just look at the folder src/OpenFOAM/lnInclude, and you will find vector.H and Vector.H.
In the tutorial, this section explicitly lists the tutorials that have to be cross-compiled, for them to work in Windows. Nonetheless, after cross-compiling the bulk of OpenFOAM, you can do some porting of just the headers for the libraries, and then use the native versions of mingw32/mingw-w64 gcc compilers. You could even remake the library ".a" objects files in Windows, just by using pexports and dlltool, as explained here. But the cross-compiled ".a" files might be enough. The get-mpich2 script in the patches available in the tutorial, actually uses this for creating the .a files for MPICH2 x86_64! The pexports application is compiled explicitly by the build-mingw-w64 script, so you can use the code left from there to compile it for using in Windows. But the tutorial and patches don't cover those issues... at least for now. I'm personally currently exploring the possibility of using Cygwin 1.7 for cross-compiling directly in Windows, but so far it seems about 2-3x slower than using Linux in a Virtual Machine. So, even if it works, it'll be more convenient, but much slower. Hopefully this week I'll managed to report on it. |
|
November 18, 2009, 14:00 |
|
#6 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,980
Blog Entries: 45
Rep Power: 128 |
Quote:
Apparently Cygwin 1.7 is still too beta for it to work fully on this part. The make application jams on sorting the file dependencies for libOpenFOAM... looks like it stays put waiting for something... Cygwin 1.5 has managed mounts, but their special compatibility system fails with loooooooong file paths, so no dice with this version. So, in a nutshell, you will need: - install the tools needed, just like in Linux; - to switch the obcaseinsensitive flag to 0 in the Windows registry... reboot; - in Cygwin, mount the OpenFOAM with posix=1; - mount the /tmp with posix=1 too, for patch to work... and also do: Code:
export TMP=/tmp export TEMP=/tmp Code:
ln -s /usr/lib/cpp /lib/cpp Oh, and mingw32 jams with a missing "langinfo.h" header file, that apparently cygwin doesn't have a proper one yet. But I did get a full cross-compiling gcc-mingw-w32 Well... and that's that for now. As soon as Cygwin releases 1.7.1 officially... and I get the time to get around it... I'll post new results about it. Ah, almost forgot: build timings... running the whole build-mingw-w32 script took 2h30 in Cygwin, and should take about 30-40min in Linux. I think the most guilty layer is the file interpretation system, but I'm not sure of it... since the software Comodo is installed and is a bit picky on what applications are doing with Windows and disks. Best Regards, Bruno |
||
November 22, 2009, 17:39 |
OpenFOAM+Cygwin+MSys+Windows = less Linux...
|
#7 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,980
Blog Entries: 45
Rep Power: 128 |
Fellow Foamers,
Thou who art binded to Windows, I give you the unholy grail of cross-compiling OpenFOAM directly in Windows, using Cygwin, now available on the wiki page here. See the subsection "Advantages and Disadvantages with using Cygwin for cross-compiling" as to why you might want to do such a grueling thing Now, the only thing missing is for git to work properly in Cygwin 1.7... so OpenFOAM 1.6.x can also become a reality! Well, that and getting MinGW/MSys to do POSIX mounts on their own too... Best regards, Bruno |
|
January 19, 2010, 15:39 |
Wiki page updated, as well as patches
|
#8 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,980
Blog Entries: 45
Rep Power: 128 |
Greetings to all,
Just dropping by to report the latest updates to patches and the wiki page:
Best Regards, Bruno Last edited by wyldckat; February 18, 2010 at 10:30. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|