howto:compile_on_macos
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howto:compile_on_macos [2023/12/01 12:28] – krack | howto:compile_on_macos [2024/06/10 11:35] (current) – GCC 14 krack | ||
---|---|---|---|
Line 2: | Line 2: | ||
This page describes how CP2K can be installed under [[https:// | This page describes how CP2K can be installed under [[https:// | ||
- | ). This howto has last been tested on an Apple M1 under macOS Sonoma 14.1.1 (Darwin Kernel Version 23.1.0, Homebrew 4.1.22). For further details check the corresponding Darwin-gnu-arm64 [[https:// | + | ). This howto has last been tested on an Apple M1 under macOS Sonoma 14.5 (Darwin Kernel Version 23.5.0, Homebrew 4.3.4). For further details check the corresponding Darwin-gnu-arm64 [[https:// |
==== 1. Install Homebrew ==== | ==== 1. Install Homebrew ==== | ||
Line 10: | Line 10: | ||
/bin/bash -c " | /bin/bash -c " | ||
</ | </ | ||
- | which will install the latest Homebrew version. This howto was tested with Homebrew 3.6.11 as well as with newer versions up to 4.0.19. | + | which will install the latest Homebrew version. This howto was tested with Homebrew 3.6.11 as well as with newer versions up to 4.3.4. |
=== a) The easy way === | === a) The easy way === | ||
Line 22: | Line 22: | ||
=== b) Compile CP2K under macOS from scratch === | === b) Compile CP2K under macOS from scratch === | ||
- | If you installed CP2K with '' | + | For best performance or code development, |
e.g. with | e.g. with | ||
< | < | ||
Line 32: | Line 32: | ||
Create the following links | Create the following links | ||
< | < | ||
- | ln -s / | + | ln -s / |
- | ln -s / | + | ln -s / |
- | ln -s / | + | ln -s / |
</ | </ | ||
- | to make Homebrew' | + | to make Homebrew' |
+ | < | ||
+ | gcc -v | ||
+ | </ | ||
+ | if that is the case. | ||
==== 2. Obtain CP2K ==== | ==== 2. Obtain CP2K ==== | ||
Line 79: | Line 83: | ||
make -j ARCH=Darwin-arm64 VERSION=psmp test | make -j ARCH=Darwin-arm64 VERSION=psmp test | ||
</ | </ | ||
- | to validate the generated CP2K binary. This will more than 4000 test cases. At the end of that test, a summary is printed which should indicate that there are no '' | + | to validate the generated CP2K binary. This will run more than 4000 test cases. At the end of that test, a summary is printed which should indicate that there are no '' |
< | < | ||
make -j ARCH=Darwin-arm64 VERSION=psmp TESTOPTS=" | make -j ARCH=Darwin-arm64 VERSION=psmp TESTOPTS=" | ||
Line 89: | Line 93: | ||
All data generated by '' | All data generated by '' | ||
< | < | ||
- | make ARCH=local VERSION=ssmp testclean | + | make ARCH=Darwin-arm64 |
</ | </ | ||
whereas | whereas | ||
< | < | ||
- | make ARCH=local VERSION=ssmp realclean | + | make ARCH=Darwin-arm64 |
</ | </ | ||
and | and | ||
Line 100: | Line 104: | ||
</ | </ | ||
will remove all data from '' | will remove all data from '' | ||
+ | |||
+ | ==== Last but not least ==== | ||
+ | |||
+ | Before using CP2K, do not forget to '' | ||
+ | < | ||
+ | source tools/ | ||
+ | </ | ||
+ | |||
+ | It is also suggested to increase the '' | ||
+ | < | ||
+ | export OMP_STACKSIZE=16M | ||
+ | ulimit -s 65000 | ||
+ | </ | ||
+ | and the '' | ||
+ | |||
+ | Adding the '' | ||
+ | < | ||
+ | export PATH=$PATH: | ||
+ | </ | ||
+ | will allow for running CP2K just with | ||
+ | < | ||
+ | cp2k.ssmp | ||
+ | </ | ||
+ | and likewise with '' | ||
+ | |||
+ | CP2K MPI/OpenMP parallel runs are launched with '' | ||
+ | < | ||
+ | mpiexec -n 4 -genv OMP_NUM_THREADS=2 cp2k.psmp H2O-32.inp | ||
+ | </ | ||
+ | will use 4 MPI ranks with 2 OpenMP threads each (i.e. it will consume 8 CPU cores) to run the input file '' | ||
+ | |||
+ | The '' | ||
+ | < | ||
+ | mpiexec -n 4 -genv OMP_NUM_THREADS=1 cp2k.psmp H2O-32.inp | ||
+ | mpiexec -n 4 | ||
+ | </ | ||
+ | are basically equivalent. | ||
**Enjoy CP2K under macOS!** | **Enjoy CP2K under macOS!** |
howto/compile_on_macos.1701433683.txt.gz · Last modified: 2023/12/01 12:28 by krack