Skip to content

Commit

Permalink
Merge pull request #232 from rmodrak/master
Browse files Browse the repository at this point in the history
Installation on ARM64 systems
  • Loading branch information
rmodrak committed Oct 25, 2023
2 parents 895a438 + 9408df5 commit f698c11
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 34 deletions.
55 changes: 55 additions & 0 deletions docs/install/arm64.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

Installation on ARM64 systems
=============================

To install MTUQ on ARM64 systems, create a conda virtual environment:

.. code::
conda create -n mtuq python=3
Download the MTUQ source code:

.. code::
git clone https://github.com/uafgeotools/mtuq.git
cd mtuq
Install MTUQ in editable mode:

.. code::
conda activate mtuq
conda env update --file env_arm64.yaml
Unpack seismic waveforms used by examples:

.. code::
bash ./data/examples/unpack.bash
bash ./data/tests/unpack.bash
Finally, install PyGMT:

.. code::
conda install 'pygmt>=0.9'
.. note::

Users may receive the following Instaseis warning message:

`UserWarning: Please don't install from a tarball. Use the proper pypi release or install from git.`

Now that Instaseis PyPI releases are no longer maintained, the above message can be ignored.


.. note::

If `linux-aarch64` or `osx-arm64` builds are ever added to the Instaseis `conda-forge channel <https://anaconda.org/conda-forge/instaseis>`_, the above workaround may become unnecessary.

15 changes: 4 additions & 11 deletions docs/install/index.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
Installation
============

We recommend installing MTUQ under Anaconda or Miniconda, which can be obtained following these `instructions <https://conda.io/projects/conda/en/latest/user-guide/install/index.html>`_, if not already present.
We recommend installing MTUQ under Anaconda or Miniconda, which if not already present can be obtained following `these instructions <https://conda.io/projects/conda/en/latest/user-guide/install/index.html>`_.


To install MTUQ, first create a conda virtual environment:
To install MTUQ, create a conda virtual environment:

.. code::
conda config --prepend channels conda-forge
conda create -n mtuq python=3
Expand Down Expand Up @@ -47,14 +46,8 @@ Finally, install PyGMT:
PyGMT installation has been finicky at times, so we include it as a separate step after the main env.yaml-based installation.


.. note::

If PyGMT installation fails, most MTUQ functions will still work, but some plotting functions will fall back to GMT or ObsPy. We note that some versions of GMT and ObsPy do not plot `full moment tensors <https://github.com/obspy/obspy/issues/2388>`_ correctly.



**Alternative method**
**Troubleshooting**

For installation under `virtualenv` instead, see `here <https://uafgeotools.github.io/mtuq/install/env_virtualenv.html>`_.
For troubleshooting common installation issues, please `see here <https://uafgeotools.github.io/mtuq/install/issues.html>`_.


51 changes: 51 additions & 0 deletions docs/install/issues.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@


Installation on Apple M1 and Apple M2 Macs
------------------------------------------

Newer Mac computers use proprietary Apple processors based on the ARM64 architecture. On these and other ARM64 systems, a modified `conda env` command is necessary

.. code::
conda env update --file env_arm64.yaml
but otherwise users can follow the normal installation procedure.

For more information, please see:

`MTUQ installation on ARM64 systems <https://uafgeotools.github.io/mtuq/install/arm64.html>`_


Installation under virutalenv
-----------------------------

For most users, we recommend installing MTUQ under conda. However, in rare cases it seems that MTUQ can be more easily installed under virtualenv.

For more information, please see:

`MTUQ installation under virtualenv <https://uafgeotools.github.io/mtuq/install/virtualenv.html>`_


Troubleshooting PyGMT installation
----------------------------------

MTUQ uses full moment tensor plotting functions from the PyGMT graphics library.

To avoid a known issue with PyGMT installation under conda, it is necessary to specify a minimum PyGMT version as follows:

.. code::
conda install 'pygmt>=0.9'
A more conservative approach, which avoids suspected problems with PyGMT 0.10 releases, is to specify the more stable PyGMT 0.9 version:

.. code::
conda install 'pygmt=0.9'
If PyGMT installation fails, most MTUQ functions will still work, but some plotting functions will fall back to GMT or ObsPy.

We note that some versions of GMT and ObsPy do not plot `full moment tensors <https://github.com/obspy/obspy/issues/2388>`_ correctly.

File renamed without changes.
22 changes: 0 additions & 22 deletions env.yaml

This file was deleted.

1 change: 1 addition & 0 deletions env.yaml
29 changes: 29 additions & 0 deletions env_arm64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# for installation on ARM64 systems, including Apple M1 and Apple M2

channels:
- defaults
- conda-forge

dependencies:
- conda-build
- python=3
- numpy
- scipy
- obspy
- pandas
- xarray
- netCDF4
- h5py
- mpi4py
- retry
- flake8
- nose
- pytest
- pip
- pip:
- git+https://github.com/sstaehler/instaseis.git
- tables
- seisgen
- seishmc
- -e .

27 changes: 27 additions & 0 deletions env_default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

channels:
- defaults
- conda-forge

dependencies:
- conda-build
- python=3
- numpy
- scipy
- obspy
- instaseis
- pandas
- xarray
- netCDF4
- h5py
- mpi4py
- retry
- flake8
- nose
- pytest
- pip
- pip:
- tables
- seisgen
- seishmc
- -e .
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ def get_compile_args():
if compiler.endswith("icc"):
compile_args += ['-fast']
compile_args += ['-march=native']
else:

elif compiler.endswith("gcc"):
compile_args += ['-Ofast']
compile_args += ['-march=native']

elif compiler.endswith("clang"):
compile_args += ['-Ofast']

else:
compile_args += ['-Ofast']

return compile_args


Expand Down

0 comments on commit f698c11

Please sign in to comment.