-
Notifications
You must be signed in to change notification settings - Fork 35
Build ~ macOS
- Install macOS Development Tools. This can be done one of two ways:
- Install Xcode using the Mac AppStore
- Using the terminal, install the command line tools and accept the license
sudo xcode-select --install
- It is recommended to use a package manager to install other prerequisites. The following directions will assume Homebrew has been installed, but alternative methods could be used.
- Install prerequisites
brew install cmake autoconf automake libtool libpng pkg-config clang-format gcc-
There is a bug on macOS 14.0 and later that prevents gcc/gfortran from working. Please uninstall if previously installed and fortran components in PETSc cannot be used:This is no longer true.brew uninstall gcc. If there is refusal to uninstall gcc because it is required by other libraries (like numpy), you can override this withbrew uninstall --ignore-dependencies gcc.gccis required for a fortran complier.
PETSc can be built in two primary configurations, optimized/release and debug. In short, the debug build makes it easier to debug but is slower. The release/optimized build is faster to execute. Microsoft provides a more detailed overview of the differences. The framework requires that PETSc be configured and built with additional options/modules. Detailed instructions for installing PETSc are available at petsc.org, but an abbreviated guide is provided for convenience. Check petsc.org for additional configuration and compiler flags specific to your system.
- Clone PETSc
git clone https://gitlab.com/petsc/petsc.git- To checkout a specific version or commit
git checkout main - The latest version of PETSc that has been tested against ABLATE is listed on ablate.dev
- To checkout a specific version or commit
- Configure PETSc to be built in both debug and optimized configurations
-
Configure PETSc with the following options from the petsc directory to build the debug configuration. Visit the ABLATE wiki for OS specific commands. Run the following make command.
# Configure debug PETSc ./configure PETSC_ARCH=arch-ablate-debug --with-debugging=1 --download-mpich --download-mpich-configure-arguments=--disable-two-level-namespace --download-ctetgen --download-tetgen --download-egads --download-fftw --download-hdf5 --download-metis --download-ml --download-parmetis --download-slepc --download-suitesparse --download-superlu_dist --download-superlu_dist-commit=v6.4.0 --download-triangle --with-slepc --download-zlib --download-libpng --download-opencascade --download-f2cblaslapack --download-kokkos --download-kokkos-commit=3.7.01 # Follow the on screen directions to make PETSc
-
Configure PETSc with the following options from the petsc directory to build the release configuration. Run the following make command.
# Configure opt PETSc ./configure PETSC_ARCH=arch-ablate-opt --with-debugging=0 --download-mpich --download-mpich-configure-arguments=--disable-two-level-namespace --download-ctetgen --download-tetgen --download-egads --download-fftw --download-hdf5 --download-metis --download-ml --download-parmetis --download-slepc --download-suitesparse --download-superlu_dist --download-superlu_dist-commit=v6.4.0 --download-triangle --with-slepc --download-zlib --download-libpng --download-opencascade --download-f2cblaslapack --download-kokkos --download-kokkos-commit=3.7.01 # Follow the on screen directions to make PETSc
-
- Set up the environmental variables so that ABLATE can locate PETSc. The PETSC_DIR path should be the path to the downloaded PETSc files. This value is reported in the output of the configure command.
# Add the following environment variables where PETSC_DIR and PETSC_ARCH are replaced with specified values from the configure command. On macOS this means putting the following in the ~/.zshrc or ~/.bashrc hidden file (depending on version). export PETSC_DIR="/path/to/petsc-install"
Some packages in ABLATE require that TensorFlow be available, specially the c library must be available. For most systems this is available as a download, but can be build from source when not available (such as m1 macOS). Follow the directions Build from source and Install TensorFlow for C for step-by-step directions. Specific condition should be paid to python and the python environment. On macOS follow the Getting Started directions to setup the environment and make sure to install full Xcode.
When building tensor flow you may have to specify the macOS SDK Version like the following (depending upon installed version)
bazel build --macos_sdk_version=13.3 //tensorflow/tools/lib_package:libtensorflow
There is also a bug with the latest version of tensor flow and macOS, see https://github.com/tensorflow/tensorflow/issues/60179
Once TensorFlow is installed ablate must be reconfigured using cmake with the TENSORFLOW_DIR=/path/to/tensor/flow option. The directory should be the directory with the include and library directories. This can be set as an environmental variable (.bashrc, .profile, .zshrc, .etc) or passed to cmake configure directly -DENSORFLOW_DIR=/path/to/tensor/flow.
Follow the step-by-step guide on ablate.dev/content/installation/LocalInstall to download, configure, and build ABLATE locally.