CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Announcements from Other Sources

Cross-compiling OpenFOAM 1.6 on Linux for Windows 32 and 64bits with Mingw-w64

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 13, 2009, 08:21
Default Cross-compiling OpenFOAM 1.6 on Linux for Windows 32 and 64bits with Mingw-w64
  #1
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 7,511
Blog Entries: 33
Rep Power: 74
wyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the rough
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
wyldckat is offline   Reply With Quote

Old   November 13, 2009, 14:39
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 918
Rep Power: 16
akidess will become famous soon enough
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!
akidess is offline   Reply With Quote

Old   November 15, 2009, 00:32
Default
  #3
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 7,511
Blog Entries: 33
Rep Power: 74
wyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the rough
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
wyldckat is offline   Reply With Quote

Old   November 16, 2009, 05:23
Default
  #4
New Member
 
Sören
Join Date: Oct 2009
Location: Bremen, Germany
Posts: 15
Rep Power: 7
soeren87 is on a distinguished road
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 ?
soeren87 is offline   Reply With Quote

Old   November 16, 2009, 07:55
Default You can, but you'll have to port/tweak headers by hand
  #5
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 7,511
Blog Entries: 33
Rep Power: 74
wyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the rough
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.
wyldckat is offline   Reply With Quote

Old   November 18, 2009, 15:00
Default
  #6
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 7,511
Blog Entries: 33
Rep Power: 74
wyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the rough
Quote:
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.
Well, after some testing, I've only managed to build up to libOpenFOAM.dll, not including it

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
- do:
Code:
ln -s /usr/lib/cpp /lib/cpp
- then do the rest like in the tutorial(s).

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
wyldckat is offline   Reply With Quote

Old   November 22, 2009, 18:39
Default OpenFOAM+Cygwin+MSys+Windows = less Linux...
  #7
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 7,511
Blog Entries: 33
Rep Power: 74
wyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the rough
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
wyldckat is offline   Reply With Quote

Old   January 19, 2010, 16:39
Default Wiki page updated, as well as patches
  #8
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 7,511
Blog Entries: 33
Rep Power: 74
wyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the rough
Greetings to all,

Just dropping by to report the latest updates to patches and the wiki page:
  • fixes made based on Symscape's version v9 for 1.6.x, because many of the solvers that use LES and RAS turbulence models need their libraries to be forced to load under Windows.
  • chtMultiRegionFoam now works, with KK instead of K for Windows builds.
  • Instructions on how to get OpenFOAM 1.6.x directly from repository using git under cygwin. (The problem wasn't from cygwin being in a beta stage )
  • reconstructParMesh wasn't being built because it wasn't in the respective Allwmake script.
  • Linking OpenFOAM to MPICH2 no longer requires Wine to work straight out of the boxed up patch.
  • Added link to tutorials that are known to work with these patches.
edit: Since I didn't want to steal the attention from the other announcers on this part of the forum, I've edited my last post to refer any questions related to this announced wiki page to this dedicated thread.

Best Regards,
Bruno

Last edited by wyldckat; February 18, 2010 at 11:30.
wyldckat is offline   Reply With Quote

Reply
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 15:29.