|
[Sponsors] |
October 4, 2021, 18:19 |
Openfoam v2106 on MacOS M1 chip
|
#1 |
New Member
Tural Mammadli
Join Date: Oct 2021
Posts: 1
Rep Power: 0 |
Hi everyone,
Have anyone been able to install v2106 version on M1 chip MacOS? I have been trying to get this v2106 on my laptop for two days but havent been succesfull yet. On my laptop i already have a version of openfoam8 but in some cases there have been some errors appearing in which some functions are not matching properly. Here I put the errors that I came across running "Allrun". So the solution seems like either I have to install v2106 version or correct these errors according to Openfoam 8 syntax. Below I attach the "Allrun", and log files that errors appeared in. Any help would be highly appreciated. |
|
October 17, 2021, 19:29 |
|
#2 |
Member
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 14 |
Hello All
I am able to use OpenFOAM-v2106 on my M1 Mac. Here are the build instructions for your reference. https://ttsyshmz.github.io/howtoFoam...2106-on-m1mac/ |
|
October 29, 2021, 04:59 |
|
#3 |
New Member
Join Date: Nov 2020
Posts: 5
Rep Power: 6 |
Could you give us more information, please? How did you build the OpenFOAM environment on the M1?
@LongGe Do you have any information about the performance on the M1 chip? How fast does OpenFOAM work on the Mac? |
|
October 30, 2021, 01:43 |
|
#4 |
Member
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 14 |
Hello All
My development environment is M1 Mac mini and M1 Macbook Air. Here is the development environment in which I built the OpenCFD-ESI version of OpenFOAM-v2106. All 3rdParties have the arm64 version installed in brew. I usually do a code development on a Mac, but I don't care about the computational speed of the M1 Mac because I put calculation into the Xeon cluster. For your reference, here are the results of the tutorial case calculated on an M1 Mac, so you can compare them with the results on your machine. OS: Darwin 20.6.0 Darwin Kernel Version 20.6.0: arm64 Disk: /Volumes/home3 Case-sensitive APFS XCode Command Line Tools: Apple clang version 12.0.5 (clang-1205.0.22.11) Target: arm64-apple-darwin20.6.0 3rdParty: /opt/homebrew/Cellar/cgal/5.3 /opt/homebrew/Cellar/fftw/3.3.10 /opt/homebrew/Cellar/adios2/2.7.1_1 /opt/homebrew/Cellar/cmake/3.21.3_1 /opt/homebrew/Cellar/kahip/3.11 /opt/homebrew/Cellar/metis/5.1.0 /opt/homebrew/Cellar/open-mpi/4.1.1_2 /opt/homebrew/Cellar/scotch/6.1.1 Benchmark test: case: OpenFOAM-v2106/tutorials/incompressible/simpleFoam/backwardFacingStep2D 1 core: ExecutionTime = 58.18 s ClockTime = 59 s (simpleFoam only) 4 cores: ExecutionTime = 23.51 s ClockTime = 25 s (simpleFoam only) |
|
November 2, 2021, 22:57 |
|
#5 | |
Senior Member
Join Date: Jun 2016
Posts: 102
Rep Power: 10 |
Quote:
Also, for third-party path, you can use /opt/homebrew/opt/*** so it won't change after updates. |
||
November 3, 2021, 21:51 |
|
#6 | |
Member
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 14 |
Quote:
The sigFpe is different in these two versions. And I only use OpenCFD-ESI, and this is the only version I have tested. |
||
November 3, 2021, 22:01 |
|
#7 | |
Senior Member
Join Date: Jun 2016
Posts: 102
Rep Power: 10 |
Quote:
Shall we move to this page to discuss? https://github.com/mrklein/openfoam-os-x/issues/68 |
||
November 4, 2021, 21:22 |
|
#8 | |
Member
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 14 |
Quote:
In other words, if you use M1 Mac + clang, you will need to implement the FPCR access functions yourself. It may or may not work, but you will need at least the following accessors. __attribute__((always_inline)) uint64_t getFpcr(){ uint64_t fpcr; asm volatile("mrs %0, fpcr" : "=r"(fpcr)); return fpcr; } __attribute__((always_inline)) void setFpcr(uint64_t x){ asm volatile("msr fpcr, %0" : : "r"(x)); } |
||
November 5, 2021, 05:08 |
|
#9 |
Member
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 14 |
Hello xuegy
Here is some additional information for your reference. If you put "#pragma STDC FENV_ACCESS ON" in "feexceptErsatz.H", "feexceptErsatz.H" will work correctly. This is a common practice for everyone. Build this "feexceptErsatz.H" with clang. Then you will see the following message, which means that you have to implement the accessor yourself. POSIX % ./Allwmake wmake libo (POSIX) ....... ....... In file included from signals/sigFpe.C:48: signals/feexceptErsatz.H:28:14: warning: pragma STDC FENV_ACCESS ON is not supported, ignoring pragma [-Wunknown-pragmas] There are two philosophies when implementing an accessor. One is to put it in fenv.h as a macro, and the other is to put it in feexceptErsatz.H. There is a non-zero chance that clang will support it in the near future, so implementing it in feexceptErsatz.H is also delicate. Therefore, I am aiming to make v2106 buildable first, and then include a mechanism to trap floating point exceptions. |
|
November 5, 2021, 10:26 |
|
#10 |
Senior Member
Join Date: Jun 2016
Posts: 102
Rep Power: 10 |
Thanks for the information. I've already made it buildable by totally disabling sigfpe. Let me try gcc first then go for clang.
|
|
November 9, 2021, 00:52 |
|
#11 |
Senior Member
Join Date: Jun 2016
Posts: 102
Rep Power: 10 |
I've managed to build with gcc (homebrew gcc can't find flex, gmp & mpfr) but still got this error message when running
Code:
dyld[2145]: symbol not found in flat namespace '__ZN4Foam9Function1IiE30dictionaryConstructorTablePtr_B5cxx11E' [1] 2145 abort blockMesh |
|
November 9, 2021, 01:20 |
|
#12 | |
Member
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 14 |
Quote:
https://stackoverflow.com/questions/...-actually-mean |
||
November 9, 2021, 02:12 |
|
#13 |
Senior Member
Join Date: Jun 2016
Posts: 102
Rep Power: 10 |
Could you please share your compiler flags of gcc? Also is that from homebrew or you compiled it yourself?
|
|
December 14, 2021, 05:23 |
|
#14 | |
New Member
Xutong
Join Date: Nov 2018
Posts: 3
Rep Power: 8 |
Quote:
Thanks so much for sharing this instruction. I am quite new with code developing and currently trying to compile OF on my M1 chip following your instruction. When I did ./Allwamke, it somehow returns: Code:
/Users/zhxutong/OpenFOAM-v2106/src/OpenFOAM/lnInclude/wchar.h:65:45: error: no type named 'wstring' in namespace 'std' Ostream& operator<<(Ostream& os, const std::wstring& wstr); Code:
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/c++/v1/iosfwd:219:14: error: reference to unresolved using declaration typedef fpos<mbstate_t> streampos; ^ /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/c++/v1/cwchar:117:1: note: using declaration annotated with 'using_if_exists' here _LIBCPP_USING_IF_EXISTS(::mbstate_t); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/c++/v1/__config:232:39: note: expanded from macro '_LIBCPP_USING_IF_EXISTS' # define _LIBCPP_USING_IF_EXISTS(...) using __VA_ARGS__ __attribute__((using_if_exists)) Here is my clang version Code:
clang++ --version Apple clang version 13.0.0 (clang-1300.0.27.3) Target: arm64-apple-darwin21.1.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin |
||
December 15, 2021, 01:07 |
|
#15 |
Member
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 14 |
Hello Zhong
My guess is that it's either a clang version or a case-sensitive issue. |
|
January 1, 2022, 15:45 |
Working (partially at the moment) in M1Pro
|
#16 |
Member
Sourav Mandal
Join Date: Jul 2019
Posts: 55
Rep Power: 7 |
With the help of the helpful volunteers in the community I am able to run v2106 in M1Pro, posting here the link, thinking it might help some people who might face similar issues:
OpenFOAM-AppleM1-issues Last edited by sourav90; January 1, 2022 at 19:46. |
|
January 3, 2022, 13:58 |
|
#17 |
New Member
Gabriel Gerlero
Join Date: Jan 2022
Posts: 21
Rep Power: 4 |
If you're willing to use Docker, I've made pre-built images of OpenFOAM for ARM, which I make available here in this GitHub project. They run just fine on my M1 Mac, and much faster than the official OpenFOAM x86 Docker images due to the lack of emulation.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Frequently Asked Questions about Installing OpenFOAM | wyldckat | OpenFOAM Installation | 3 | November 14, 2023 12:58 |
UNIGE February 13th-17th - 2107. OpenFOAM advaced training days | joegi.geo | OpenFOAM Announcements from Other Sources | 0 | October 1, 2016 20:20 |
[OpenFOAM.org] paraFoam, for OpenFOAM 2.3.x on MacOS X? | ajmas | OpenFOAM Installation | 3 | March 15, 2015 19:27 |
OpenFOAM Foundation releases OpenFOAM 2.2.2 | opencfd | OpenFOAM Announcements from ESI-OpenCFD | 0 | October 14, 2013 08:18 |
64bitrhel5 OF installation instructions | mirko | OpenFOAM Installation | 2 | August 12, 2008 19:07 |