|
[Sponsors] | |||||
|
|
|
#1 |
|
Senior Member
BastiL
Join Date: Mar 2009
Posts: 462
Rep Power: 9 ![]() |
Hi all,
because of this: http://www.hpcwire.com/features/17885244.html?viewAll=y it might make sense to generate a mixed sp/dp solver. I found all mesh operations to be very critical for meshes with short edge length but I want to do all calculations in single precision. How can this be done? As far as I can see this needs some quite basic changes in OpenFOAM? Thanks and regards Bastian |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,877
Rep Power: 23 ![]() |
Hi,
what the article is saying is that they keep double precision accuracy, using single precision operations on the machine. Clearly I don't know the details of their implementation, however what they do seems to manipulate a double type as a set of floats, which, as a concept is not new. Similar ideas are used, with a different goal, in arbitrary precision libraries (GNU MP http://gmplib.org/ for example). Best,
__________________
Alberto GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image. GeekoCFD 32bit - The 32bit edition of GeekoCFD. GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats. |
|
|
|
|
|
|
|
|
#3 | |
|
Senior Member
BastiL
Join Date: Mar 2009
Posts: 462
Rep Power: 9 ![]() |
Quote:
Regards Bastian |
||
|
|
|
||
|
|
|
#4 |
|
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,877
Rep Power: 23 ![]() |
Not that I know. In your case you actually care of double precision accuracy. If you need a mesh in double precision (can't you simply scale it? or is the aspect ratio extreme?), you need, for example, to compute differential operators in double precision too for example, or you end up in large errors.
Best,
__________________
Alberto GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image. GeekoCFD 32bit - The 32bit edition of GeekoCFD. GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats. |
|
|
|
|
|
|
|
|
#5 | |
|
Senior Member
BastiL
Join Date: Mar 2009
Posts: 462
Rep Power: 9 ![]() |
Quote:
I don't really understand how you want to scale the mesh? Yes, I have high aspect ratios. I have the following observations:
Regards Bastian |
||
|
|
|
||
|
|
|
#6 |
|
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 723
Rep Power: 10 ![]() |
Hi Bastian,
Unfortunately, what you want is not possible without a hell of a lot of effort. Every single number in foam is templated on the scalar type, which can be compiled for either float or double, but not a mix of both (as you probably know). To have only the mesh work in double precision, you would have to redefine every single scalar or scalar derived variable used in the mesh. This would mean duplicating a massive number of foam data structures. This is not something you can do on the weekend. However, arbitrary variable precision would be a really useful thing to have. I know that the code Xflow uses 10 bit precision as part of its acceleration strategy. It would be fantastic if we could get say 40% speed-up by doing the same kind of thing. Eugene |
|
|
|
|
|
|
|
|
#7 | ||||
|
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,877
Rep Power: 23 ![]() |
Quote:
One doubt/suggestion. What happens if you increase the accuracy used to write the mesh in OpenFOAM? Check in controlDict the writePrecision option. The default is 6 digits if you use ASCII format. As an alternative, try the binary format. Quote:
Quote:
Quote:
Alberto
__________________
Alberto GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image. GeekoCFD 32bit - The 32bit edition of GeekoCFD. GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats. |
|||||
|
|
|
|||||
|
|
|
#8 |
|
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 723
Rep Power: 10 ![]() |
A more viable option might be to translate only some specific matrix solution components to reduced precision and see how that works out. Interestingly, GMP is already included with the foam distribution as a Gcc dependency. Seems criminal not to take advantage of it!
You could also check whether it is possible to use gmp to template the scalars in foam onto something like a 48bit number. This obviously won't give you quite the speed-up of a 32bit float or the accuracy of a 64bit double, but the compromise might be acceptable and it would be much easier than re-writing large chunks of code. Eugene |
|
|
|
|
|
|
|
|
#9 |
|
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 342
Rep Power: 13 ![]() |
Did it already. Not sure how useful this would be, but I guess it doesn't hurt to post it:
http://www.ecs.umass.edu/~smenon/tarballs/multiPrecision.tgz Basically wraps around the MPFR library to provide arbitrary precision arithmetic. You can replace the scalar class with this.
__________________
Sandeep Menon University of Massachusetts Amherst http://www.ecs.umass.edu/~smenon |
|
|
|
|
|
|
|
|
#10 | |
|
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 723
Rep Power: 10 ![]() |
Quote:
|
||
|
|
|
||
|
|
|
#11 |
|
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 342
Rep Power: 13 ![]() |
Well, at least not at the linear-solvers level. The performance would go through the floor if I tried that, but I don't see why not.
I was mainly using it for geometric intersection calculations, since those tend to be finicky about round-off. Clearly, this is intended for numerical robustness, and not performance.
__________________
Sandeep Menon University of Massachusetts Amherst http://www.ecs.umass.edu/~smenon |
|
|
|
|
|
|
|
|
#12 |
|
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 723
Rep Power: 10 ![]() |
I will put it on my list of things to try. Thanks for the wrapper code Sandeep.
|
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Parallel User Defined Real Gas Model | aeroman | FLUENT | 3 | October 21, 2010 15:04 |
| Switch from single precision to double precision | kk81 | OpenFOAM Bugs | 0 | March 11, 2010 06:14 |
| OpenFOAM Double precision vs Single Precision | alexandrepereira | OpenFOAM Running, Solving & CFD | 1 | June 11, 2008 14:30 |
| Single or double precision | Jonas Larsson | Main CFD Forum | 15 | March 26, 2007 23:15 |
| Single v.s. double precision | Confused | CFX | 9 | April 19, 2004 18:33 |