Skip to content

Commit

Permalink
Merge branch 'master' into jinxin/annotate_arrival_time
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaoMaWHU committed May 31, 2024
2 parents 1351480 + 91addbb commit 6c8425c
Show file tree
Hide file tree
Showing 73 changed files with 5,935 additions and 468 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Conda build

on:
schedule:
- cron: '21 21 * * 5'
push:
branches: [ master ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
release:
types: [published]

jobs:
conda-build-arm64:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'schedule' || github.event_name == 'release' }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

# Setup for Multi-platform image
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and publish conda package arm64
uses: docker/build-push-action@v4
with:
context: .
file: scripts/Dockerfile_conda_build
platforms: linux/arm64
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
ANACONDA_API_TOKEN=${{ secrets.CONDA_TOKEN }}
conda-build-amd64:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

# Setup for Multi-platform image
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and publish conda package amd64
uses: docker/build-push-action@v4
with:
context: .
file: scripts/Dockerfile_conda_build
platforms: linux/amd64
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
ANACONDA_API_TOKEN=${{ secrets.CONDA_TOKEN }}
conda-build-osx:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
os: ["macos-14", "macos-13"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
auto-update-conda: true
channels: conda-forge,defaults
activate-environment: anaconda-client-env
- shell: bash -el {0}
run: |
export PYTHON_VERSION=${{ matrix.python-version }}
conda install -y conda-build anaconda-client
conda config --set anaconda_upload no
export ANACONDA_API_TOKEN=${{ secrets.CONDA_TOKEN }}
PACKAGE_PATH=$(conda build . --python ${{ matrix.python-version }} --output)
conda build . --python ${{ matrix.python-version }}
if [ "${{ matrix.python-version }}" == "3.11" ]; then
anaconda -t $ANACONDA_API_TOKEN upload $PACKAGE_PATH --label main --label py3.11 --force
else
anaconda -t $ANACONDA_API_TOKEN upload $PACKAGE_PATH --label py${{ matrix.python-version }} --force
fi
22 changes: 15 additions & 7 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ on:
tags: [ 'v*.*.*' ]
pull_request:
branches: [ master ]
release:
types: [published]

env:
# Use docker.io for Docker Hub if empty
Expand All @@ -32,7 +34,9 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

# Setup for Multi-platform image
- name: Set up QEMU
Expand Down Expand Up @@ -86,7 +90,7 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image (amd64 only)
uses: docker/build-push-action@v4
if: ${{ github.event_name != 'schedule' }}
if: ${{ github.event_name != 'schedule' || github.event_name != 'release' }}
with:
context: .
platforms: linux/amd64
Expand All @@ -98,7 +102,7 @@ jobs:

- name: Build and push Docker image (amd64 and arm64)
uses: docker/build-push-action@v4
if: ${{ github.event_name == 'schedule' }}
if: ${{ github.event_name == 'schedule' || github.event_name == 'release' }}
with:
context: .
platforms: linux/amd64,linux/arm64
Expand All @@ -125,7 +129,9 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

# Setup for Multi-platform image
- name: Set up QEMU
Expand Down Expand Up @@ -173,7 +179,7 @@ jobs:
# Build and push dev image
- name: Build and push dev image (amd64 only)
uses: docker/build-push-action@v4
if: ${{ github.event_name != 'schedule' }}
if: ${{ github.event_name != 'schedule' || github.event_name != 'release' }}
with:
context: .
file: Dockerfile_dev
Expand All @@ -188,7 +194,7 @@ jobs:

- name: Build and push dev image (amd64 amd arm64)
uses: docker/build-push-action@v4
if: ${{ github.event_name == 'schedule' }}
if: ${{ github.event_name == 'schedule' || github.event_name == 'release' }}
with:
context: .
file: Dockerfile_dev
Expand Down Expand Up @@ -218,7 +224,9 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

# Setup for Multi-platform image
- name: Set up QEMU
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ jobs:
pytest --cov=mspasspy python/tests/
make test -C build/temp.*/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }} # required
env_vars: OS,PYTHON
verbose: true
- name: Build Documentation
Expand All @@ -78,3 +80,4 @@ jobs:
BRANCH: gh-pages
FOLDER: docs/build/html
CLEAN: false

3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ ADD setup.py /mspass/setup.py
ADD pyproject.toml /mspass/pyproject.toml
ADD requirements.txt /mspass/requirements.txt
ADD python /mspass/python
ADD .git /mspass/.git
RUN pip3 install /mspass -v \
&& rm -rf /mspass/build && docker-clean
&& rm -rf /mspass/build /mspass/.git && docker-clean

# Install jedi
RUN pip3 --no-cache-dir install jedi==0.17.2 && docker-clean
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile_dev
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ ADD setup.py /mspass/setup.py
ADD python /mspass/python
ADD pyproject.toml /mspass/pyproject.toml
ADD requirements.txt /mspass/requirements.txt
ADD .git /mspass/.git
RUN pip3 install -C--global-option=build -C--global-option=--debug /mspass -v \
&& rm -rf /mspass/build && docker-clean
&& rm -rf /mspass/build /mspass/.git && docker-clean

# Add docs and dependencies to build docs
ADD docs /mspass/docs
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile_mpi
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ ADD setup.py /mspass/setup.py
ADD python /mspass/python
ADD pyproject.toml /mspass/pyproject.toml
ADD requirements.txt /mspass/requirements.txt
ADD .git /mspass/.git
RUN pip3 install /mspass -v \
&& rm -rf /mspass/build && docker-clean
&& rm -rf /mspass/build /mspass/.git && docker-clean

# Install jedi
RUN pip3 --no-cache-dir install jedi==0.17.2 && docker-clean
Expand Down
33 changes: 27 additions & 6 deletions cxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ endif ()
message (STATUS "YAML_CPP_LIBRARIES = ${YAML_CPP_LIBRARIES}")
message (STATUS "YAML_CPP_INCLUDE_DIR = ${YAML_CPP_INCLUDE_DIR}")


find_package (Boost 1.64.0 COMPONENTS serialization)
if (NOT Boost_FOUND)
message (STATUS "Building Boost")
Expand Down Expand Up @@ -111,9 +110,31 @@ fetch_mseed (
message (STATUS "MSEED_LIBRARIES = ${MSEED_LIBRARIES}")
message (STATUS "MSEED_INCLUDE_DIR = ${MSEED_INCLUDE_DIR}")

find_package (PythonInterp 3)

if (PYTHONINTERP_FOUND)
find_program(MY_PYTHON_EXECUTABLE NAMES python3 python)

if(NOT MY_PYTHON_EXECUTABLE)
message(WARNING "Python interpreter not found.")
find_package(Python COMPONENTS Interpreter Development)
else()

# Get the version of the Python interpreter
execute_process(
COMMAND ${MY_PYTHON_EXECUTABLE} --version
OUTPUT_VARIABLE PYTHON_VERSION_OUTPUT
ERROR_VARIABLE PYTHON_VERSION_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)

string(REGEX MATCH "Python ([0-9]+\\.[0-9]+)" _ ${PYTHON_VERSION_OUTPUT})
set(MY_PYTHON_VERSION ${CMAKE_MATCH_1})

message(STATUS "Found Python version: ${MY_PYTHON_VERSION}")
find_package(Python ${MY_PYTHON_VERSION} EXACT COMPONENTS Interpreter Development)
endif()

if (Python_FOUND)
find_package (pybind11)
if (NOT pybind11_FOUND)
message (STATUS "Building Pybind11")
Expand All @@ -123,9 +144,9 @@ if (PYTHONINTERP_FOUND)
${PROJECT_BINARY_DIR}/pybind11
)
endif ()
message (STATUS "PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}")
message (STATUS "PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}")
message (STATUS "PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}")
message (STATUS "Python_LIBRARIES = ${Python_LIBRARIES}")
message (STATUS "Python_EXECUTABLE = ${Python_EXECUTABLE}")
message (STATUS "Python_INCLUDE_DIRS = ${Python_INCLUDE_DIRS}")
message (STATUS "pybind11_LIBRARIES = ${pybind11_LIBRARIES}")
message (STATUS "pybind11_INCLUDE_DIR= ${pybind11_INCLUDE_DIR}")
add_subdirectory (python)
Expand Down
6 changes: 3 additions & 3 deletions cxx/cmake/openblas-download.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ ExternalProject_Add(
openblas
SOURCE_DIR "@OPENBLAS_DOWNLOAD_ROOT@/openblas-src"
GIT_REPOSITORY
https://github.com/xianyi/OpenBLAS.git
https://github.com/OpenMathLib/OpenBLAS.git
GIT_TAG
v0.3.7
v0.3.27
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND make libs -j 8 PREFIX=${PROJECT_BINARY_DIR} NO_SHARED=1 USE_THREAD=0 USE_OPENMP=0
BUILD_COMMAND make libs -j 8 PREFIX=${PROJECT_BINARY_DIR} NO_SHARED=1 USE_THREAD=0 USE_OPENMP=0 DYNAMIC_ARCH=1 DYNAMIC_OLDER=1 TARGET=GENERIC
BUILD_IN_SOURCE 1
INSTALL_COMMAND make install PREFIX=${PROJECT_BINARY_DIR} NO_SHARED=1
TEST_COMMAND ""
Expand Down
19 changes: 11 additions & 8 deletions cxx/python/algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@ include_directories(
${Boost_INCLUDE_DIRS}
${GSL_INCLUDE_DIRS}
${pylib11_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}
${Python_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR}/include)

#add_library(mspasspython STATIC ${sources_python})
#target_link_libraries(mspasspython PRIVATE mspass ${PYTHON_LIBRARIES})
#target_link_libraries(mspasspython PRIVATE mspass ${Python_LIBRARIES})

pybind11_add_module(pybasic basic_py.cc)
target_link_libraries(pybasic PRIVATE mspass ${Boost_LIBRARIES})
#pybind11_add_module(pybasic basic_py.cc)
Python_add_library(pybasic basic_py.cc)
target_link_libraries(pybasic PRIVATE mspass ${Boost_LIBRARIES} pybind11::headers)
set_target_properties(pybasic PROPERTIES OUTPUT_NAME "basic")

pybind11_add_module(pyamplitudes amplitudes_py.cc)
target_link_libraries(pyamplitudes PRIVATE mspass ${Boost_LIBRARIES})
#pybind11_add_module(pyamplitudes amplitudes_py.cc)
Python_add_library(pyamplitudes amplitudes_py.cc)
target_link_libraries(pyamplitudes PRIVATE mspass ${Boost_LIBRARIES} pybind11::headers)
set_target_properties(pyamplitudes PROPERTIES OUTPUT_NAME "amplitudes")

pybind11_add_module(pydeconvolution deconvolution_py.cc)
target_link_libraries(pydeconvolution PRIVATE mspass ${Boost_LIBRARIES})
#pybind11_add_module(pydeconvolution deconvolution_py.cc)
Python_add_library(pydeconvolution deconvolution_py.cc)
target_link_libraries(pydeconvolution PRIVATE mspass ${Boost_LIBRARIES} pybind11::headers)
set_target_properties(pydeconvolution PROPERTIES OUTPUT_NAME "deconvolution")

if(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
Expand Down
10 changes: 5 additions & 5 deletions cxx/python/io/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
include_directories(
${MSEED_INCLUDE_DIR}
${pylib11_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}
${Python_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR}/include
${Boost_INCLUDE_DIRS}
)

#add_library(mspasspython STATIC ${sources_python})
#target_link_libraries(mspasspython PRIVATE mspass ${PYTHON_LIBRARIES})
#target_link_libraries(mspasspython PRIVATE mspass ${Python_LIBRARIES})

pybind11_add_module(pyio io_py.cc)

target_link_libraries(pyio PRIVATE mspass ${MSEED_LIBRARIES})
#pybind11_add_module(pyio io_py.cc)
Python_add_library(pyio io_py.cc)
target_link_libraries(pyio PRIVATE mspass ${MSEED_LIBRARIES} ${Boost_LIBRARIES} pybind11::headers)
set_target_properties(pyio PROPERTIES OUTPUT_NAME "io")
if(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set_target_properties(pyio PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/ccore)
Expand Down
2 changes: 1 addition & 1 deletion cxx/python/io/io_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ PYBIND11_MODULE(io,m){
"Builds an index for a miniseed file returning std::pair with index and ErrorLogger object",
py::return_value_policy::copy,
py::arg("file"),
py::arg("segment") = false,
py::arg("segment") = true,
py::arg("verbose") = false
)
;
Expand Down
10 changes: 5 additions & 5 deletions cxx/python/seismic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ include_directories(
${Boost_INCLUDE_DIRS}
${GSL_INCLUDE_DIRS}
${pylib11_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}
${Python_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR}/include)

#add_library(mspasspython STATIC ${sources_python})
#target_link_libraries(mspasspython PRIVATE mspass ${PYTHON_LIBRARIES})
#target_link_libraries(mspasspython PRIVATE mspass ${Python_LIBRARIES})

pybind11_add_module(pyseismic seismic_py.cc)

target_link_libraries(pyseismic PRIVATE mspass ${Boost_LIBRARIES})
#pybind11_add_module(pyseismic seismic_py.cc)
Python_add_library(pyseismic seismic_py.cc)
target_link_libraries(pyseismic PRIVATE mspass ${Boost_LIBRARIES} pybind11::headers)
set_target_properties(pyseismic PROPERTIES OUTPUT_NAME "seismic")
if(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set_target_properties(pyseismic PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/ccore)
Expand Down
Loading

0 comments on commit 6c8425c

Please sign in to comment.