diff --git a/docs/install/arm64.rst b/docs/install/arm64.rst new file mode 100644 index 000000000..25bda73f1 --- /dev/null +++ b/docs/install/arm64.rst @@ -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 `_, the above workaround may become unnecessary. + diff --git a/docs/install/index.rst b/docs/install/index.rst index cddd5fc0a..d446601fd 100644 --- a/docs/install/index.rst +++ b/docs/install/index.rst @@ -1,14 +1,13 @@ Installation ============ -We recommend installing MTUQ under Anaconda or Miniconda, which can be obtained following these `instructions `_, if not already present. +We recommend installing MTUQ under Anaconda or Miniconda, which if not already present can be obtained following `these instructions `_. -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 @@ -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 `_ correctly. - - - -**Alternative method** +**Troubleshooting** -For installation under `virtualenv` instead, see `here `_. +For troubleshooting common installation issues, please `see here `_. diff --git a/docs/install/issues.rst b/docs/install/issues.rst new file mode 100644 index 000000000..544f20254 --- /dev/null +++ b/docs/install/issues.rst @@ -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 `_ + + +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 `_ + + +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 `_ correctly. + diff --git a/docs/install/env_virtualenv.rst b/docs/install/virtualenv.rst similarity index 100% rename from docs/install/env_virtualenv.rst rename to docs/install/virtualenv.rst diff --git a/env.yaml b/env.yaml deleted file mode 100644 index 22e2c9933..000000000 --- a/env.yaml +++ /dev/null @@ -1,22 +0,0 @@ -dependencies: - - conda-build - - python=3 - - numpy - - scipy - - obspy - - instaseis - - pandas - - xarray - - netCDF4 - - h5py - - mpi4py - - retry - - flake8 - - nose - - pytest - - pip - - pip: - - tables - - seisgen - - seishmc - - -e . diff --git a/env.yaml b/env.yaml new file mode 120000 index 000000000..1186a330b --- /dev/null +++ b/env.yaml @@ -0,0 +1 @@ +env_default.yaml \ No newline at end of file diff --git a/env_arm64.yaml b/env_arm64.yaml new file mode 100644 index 000000000..24b11f2b3 --- /dev/null +++ b/env_arm64.yaml @@ -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 . + diff --git a/env_default.yaml b/env_default.yaml new file mode 100644 index 000000000..b6f4a7a7b --- /dev/null +++ b/env_default.yaml @@ -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 . diff --git a/setup.py b/setup.py index 16a9b053e..d00b32be3 100644 --- a/setup.py +++ b/setup.py @@ -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