Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Apple Silicon

More
3 years 5 months ago #3317 by joachim
Apple Silicon was created by joachim
Please let us know if someone is going to get an Apple computer with the new CPU, and likes to build and test NGSolve on it.

Joachim
More
3 years 5 months ago - 3 years 5 months ago #3377 by alex.v
Replied by alex.v on topic Apple Silicon
Hi Joachim,

I recently got one of the new computers and I'll take a stab at this. I'll follow along with the instructions here .

I will post back with updates.

Alex

EDIT 2:

Python was support was not a core requirement right now, I wanted it to compile so I turned it off with
Code:
cmake -DUSE_PYTHON=OFF $NGROOT/ngsolve-src
to focus on just the c++ version.

the cmake command now works without crashing. The same can't me said about make:
Code:
-- Found Git: /usr/bin/git (found version "2.24.3 (Apple Git-128)") [ 0%] Built target ng_generate_version_file [ 1%] Building CXX object libsrc/core/CMakeFiles/ngcore.dir/archive.cpp.o clang: error: the clang compiler does not support '-march=native' make[8]: *** [libsrc/core/CMakeFiles/ngcore.dir/archive.cpp.o] Error 1 make[7]: *** [libsrc/core/CMakeFiles/ngcore.dir/all] Error 2 make[6]: *** [all] Error 2 make[5]: *** [dependencies/src/netgen-stamp/netgen-build] Error 2 make[4]: *** [CMakeFiles/netgen.dir/all] Error 2 make[3]: *** [all] Error 2 make[2]: *** [dependencies/Stamp/netgen_project/netgen_project-build] Error 2 make[1]: *** [CMakeFiles/netgen_project.dir/all] Error 2 make: *** [all] Error 2

I don't know what to replace '-march=native' with.

EDIT 1:

Having problems with the "cmake $NGROOT/ngsolve-src"
Code:
CMake Error at /usr/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message): Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is at least version "3") Call Stack (most recent call first): /usr/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:577 (_FPHSA_FAILURE_MESSAGE) /usr/local/share/cmake-3.19/Modules/FindPythonLibs.cmake:310 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) cmake/SuperBuild.cmake:54 (find_package) CMakeLists.txt:73 (include)

The python headers (PythonLibs) are usually handled by installing python through Homebrew (mac's 3rd party package manager), but Homebrew is not yet available been updated to the new architecture ( and it might take a while ).

I am going to see how homebrew usually installs those headers and see if I can do it manually.

That, or if anyone has ideas I am open to them.
Last edit: 3 years 5 months ago by alex.v.
More
3 years 5 months ago #3378 by joachim
Replied by joachim on topic Apple Silicon
Hi Alex,

thank you very much for testing.

Can you install Python (I would try version 3.9 first) natively from python.org ?

To avoid the '-march=native' problem, you can call cmake with
-DUSE_NATIVE_ARCH=OFF
(or just remove it from CMakeLists.txt).

Joachim
More
3 years 5 months ago #3380 by alex.v
Replied by alex.v on topic Apple Silicon
Hi Joachim,

I tried just c++ again with that flag since it would be quick. It threw out a large number of errors and then stopped compiling. I have attached the output for the cmake and make commands.

I will try installing python and see if I can get that part running.

Alex
More
3 years 5 months ago #3381 by joachim
Replied by joachim on topic Apple Silicon
can you replace the files in netgen/libsrc/core by these two files and try again:

1. replace rdtsc intrinsic by __builtin_readcyclecounter()
2. remove _mm_pause (not necessary, only optimization)

I found it from here:
stackoverflow.com/questions/44349757/rdtsc-equivalent-for-ios

Joachim
More
3 years 4 months ago #3436 by matthiash
Replied by matthiash on topic Apple Silicon
The latest git version is now supporting the Apple M1 device!

NGSolve can be compiled with the following steps:

- Install Python Installer (note that this is thew new "universal2" installer, opposed to the "intel" one)
- Install CMake Installer (same as above, a new universal installer)
- Install Xcode command line tools:
Code:
sudo xcode-select --install

Run the following code to download/build/install NGSolve
Code:
git clone https://github.com/ngsolve/ngsolve.git cd ngsolve git submodule update --init --recursive mkdir build cd build /Applications/CMake.app/Contents/bin/cmake .. make -j5 install

Currently the linker issues a lot of warnings about different visibilities, we are about to fix this.

As usual, set some environment variables to use NGSolve from the command line. Put these lines in the .bash_profile file in your home directory:
Code:
export PATH=/Applications/Netgen.app/Contents/MacOS:$PATH export PYTHONPATH=/Applications/Netgen.app/Contents/Resources/lib/python3.9/site-packages:$PYTHONPATH

Any feedback is welcome :)

Best,
Matthias
Time to create page: 0.154 seconds