-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile elmerFEM natively for apple silicon? #503
Comments
Switching to clang for compiling elmer really means trouble. Problems with fortran, openmpi... |
There is no problem compiling Open MPI with Clang and you are free to combine Clang as the C and C++ compiler with |
Normally when people say something doesn't compile, they include the error messages and log files associated with said failure. |
Maybe you can share the steps you take on compiling elmer then? I spent 4 hours yesterday and one solved problem led to another. First openmpi was not compatible, then openmpi was not found, then gfortran was not working, then umfpack. So I think its easier if you got it working to share how you did it?
This cant be the correct cmake command. Id suppose just typing cmake .. from the build directory would work but it does not. |
The MacOS build on M2 is almost trivial:
|
You should not set OpenMP options on MacOS if you use Apple Clang. Apple Clang does not support OpenMP. Both Clang and GCC from Homebrew do, on the other hand. |
Will it even compile with MPI without setting
? Now I get this error when using your command:
|
But that is the command I used... Id like to compile elmer with GUI and with OpenMPI |
Sometimes Apple breaks their C toolchain. If the C standard headers aren't found, try reinstalling XCode command-line tools. |
I got it to seemingly correctly compile with:
however the shell setting seems to be crucial:
however
Again. Anything else than trivial. I'm not a programmer tho and I wanted it to compile with OpenMPI and elmerGUI |
Hi, I'm also hoping to run Elmer on apple silicon with the GUI enabled. My system is an M1 running macOS 12.6.3, using:
I got a much simpler config to work than @ghostforest 's above:
(SDKROOT solves a bizarre compile error, click to see full message)
but am also seeing failing tests:
click for a full list
I notice that the most recent Regardless, I got a tutorial to run all the way through, so if you (or any future travelers) need an exemplar, the above can serve. |
Thanks for that addition. Yes mine is quite complicated. What does -DWITH_PARAVIEW:BOOL=ON do?
Btw your command does not work for me. Interesting is that enabling Paraview will lead to more tests failing later. |
Paraview is a postprocessor/visualization engine that lets you display the results of a solve; it's referenced in the GUI tutorials (http://www.nic.funet.fi/pub/sci/physics/elmer/doc/ElmerTutorials.pdf) and has to be installed separately (https://www.paraview.org/download/) in such a way that running As far as multicore goes, parallelization does work and does help, but I'm not super familiar with the differences between Open MPI, OpenMP, and MPI and I'm not certain it's strictly speaking using OpenMP to do it. When I do Run -> Parallel settings -> Use parallel solver, it claims to be using |
Afaik MPI is for clustering multiple machines whereas OpenMP is a parallelization library for a single machine. It is a million times easier to implement than pthread since the parallelization of OpenMP happens at compile time. Pthread provides more control but requires much more code |
MPI is historically the way to go with Elmer (and many other FEM codes). Once the problem is distributed the parallelization is trivial (meaning all the physics, assembly etc.). Only solution of linear system requires communication but this is more or less transparent from the user. There is some stuff that has not been implemented with MPI (e.g. viewfactors and general mortar methods). OpenMP is easier but should be done at every bottle-neck. If you consider that there is 500 k lines of code you can understand that it has not been implemented everywhere and lots of code is run on single thread. |
Yes! Nobody is complaining about the state of elmer or that it should provide more parallelization. Thank you for the insight this was very interesting to read. |
Elmer is now being built regularly on macOS (Intel and Apple Silicon) in CI: More tests are passing when using OpenBLAS instead of Apple Accelerate. |
Is elmer supposed to compile natively for M1 M2 M3 macs? I did not get it working. I switched to rosetta environment for compilation.
This is what worked:
arch -x86_64 /usr/bin/env bash --login
cmake -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/14.1.0_2/bin/gcc-14
-DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/14.1.0_2/bin/g++-14
-DCMAKE_Fortran_COMPILER=/usr/local/Cellar/gcc/14.1.0_2/bin/gfortran
-DWITH_ELMERGUI=TRUE
-DWITH_OpenMP=TRUE
-DWITH_MPI=TRUE
-DMPI_C_COMPILER=/usr/local/opt/open-mpi/bin/mpicc
-DMPI_CXX_COMPILER=/usr/local/opt/open-mpi/bin/mpicxx
-DMPI_Fortran_COMPILER=/usr/local/opt/open-mpi/bin/mpifort
-DWITH_QT5=TRUE
-DWITH_QWT=FALSE
-DQWT_INCLUDE_DIR=/usr/local/opt/qwt/lib/qwt.framework/Headers
-DQWT_LIBRARY=/usr/local/opt/qwt/lib/qwt.framework/qwt
-DOCC_INCLUDE_DIR=$(brew --prefix opencascade)/include/opencascade
-DOCC_LIBRARY_DIR=$(brew --prefix opencascade)/lib
-DCMAKE_PREFIX_PATH=$(brew --prefix qt@5)
-DCMAKE_INSTALL_PREFIX=../install .. --log-level=DEBUG
make -j$(sysctl -n hw.logicalcpu)
make install
The text was updated successfully, but these errors were encountered: