From d3352bef2b16582a60026e4476ca690bf75cd410 Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Mon, 25 Nov 2024 10:03:14 -0500 Subject: [PATCH 01/17] Update pyproject.toml for scikt-build --- pyproject.toml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a7a9ba341..791c8591a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,9 @@ [tool.poetry] -name = "specfem2d_kokkos" +name = "SPECFEMPP" version = "0.1.0" description = "Kokkos implementation of SpecFEM2D code" -authors = ["Your Name "] +authors = ["Rohit R Kakodkar ", "Lucas Sawade ", "Congyue Cui "] +package-mode = false [tool.poetry.dependencies] python = ">=3.12,<4.0" @@ -25,5 +26,5 @@ line_length = 90 include = '\.smk$|^Snakefile|\.py|^Snakefile.in$' [build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +requires = ["scikit-build-core>=0.10", "pybind11"] +build-backend = "scikit_build_core.build" From 73aa0c0b87f3a51fb5c3b0654869f6dc92923439 Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Mon, 25 Nov 2024 15:21:08 -0500 Subject: [PATCH 02/17] Basic build configuration with scikit-build-core --- CMakeLists.txt | 2 +- poetry.lock | 272 +++++++++++++++++++++++++------------------------ pyproject.toml | 42 ++++++-- 3 files changed, 177 insertions(+), 139 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20ba188fd..d7f0880d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.17.5) -project(specfem2d_kokkos VERSION 0.1.0) +project(SPECFEMPP VERSION 0.1.0) set(CMAKE_CXX_STANDARD 17) option(HDF5_CXX_BUILD "Build HDF5 C++" ON) diff --git a/poetry.lock b/poetry.lock index cdaa792bf..34b2296f6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand. [[package]] name = "alabaster" @@ -325,13 +325,13 @@ sphinx-basic-ng = ">=1.0.0.beta2" [[package]] name = "identify" -version = "2.6.1" +version = "2.6.2" description = "File identification library for Python" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "identify-2.6.1-py2.py3-none-any.whl", hash = "sha256:53863bcac7caf8d2ed85bd20312ea5dcfc22226800f6d6881f232d861db5a8f0"}, - {file = "identify-2.6.1.tar.gz", hash = "sha256:91478c5fb7c3aac5ff7bf9b4344f803843dc586832d5f110d672b19aa1984c98"}, + {file = "identify-2.6.2-py2.py3-none-any.whl", hash = "sha256:c097384259f49e372f4ea00a19719d95ae27dd5ff0fd77ad630aa891306b82f3"}, + {file = "identify-2.6.2.tar.gz", hash = "sha256:fab5c716c24d7a789775228823797296a2994b075fb6080ac83a102772a98cbd"}, ] [package.extras] @@ -497,13 +497,13 @@ files = [ [[package]] name = "packaging" -version = "24.1" +version = "24.2" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, - {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, + {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, + {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, ] [[package]] @@ -553,22 +553,19 @@ virtualenv = ">=20.10.0" [[package]] name = "pydantic" -version = "2.9.2" +version = "2.10.1" description = "Data validation using Python type hints" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic-2.9.2-py3-none-any.whl", hash = "sha256:f048cec7b26778210e28a0459867920654d48e5e62db0958433636cde4254f12"}, - {file = "pydantic-2.9.2.tar.gz", hash = "sha256:d155cef71265d1e9807ed1c32b4c8deec042a44a50a4188b25ac67ecd81a9c0f"}, + {file = "pydantic-2.10.1-py3-none-any.whl", hash = "sha256:a8d20db84de64cf4a7d59e899c2caf0fe9d660c7cfc482528e7020d7dd189a7e"}, + {file = "pydantic-2.10.1.tar.gz", hash = "sha256:a4daca2dc0aa429555e0656d6bf94873a7dc5f54ee42b1f5873d666fb3f35560"}, ] [package.dependencies] annotated-types = ">=0.6.0" -pydantic-core = "2.23.4" -typing-extensions = [ - {version = ">=4.12.2", markers = "python_version >= \"3.13\""}, - {version = ">=4.6.1", markers = "python_version < \"3.13\""}, -] +pydantic-core = "2.27.1" +typing-extensions = ">=4.12.2" [package.extras] email = ["email-validator (>=2.0.0)"] @@ -576,100 +573,111 @@ timezone = ["tzdata"] [[package]] name = "pydantic-core" -version = "2.23.4" +version = "2.27.1" description = "Core functionality for Pydantic validation and serialization" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic_core-2.23.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:b10bd51f823d891193d4717448fab065733958bdb6a6b351967bd349d48d5c9b"}, - {file = "pydantic_core-2.23.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4fc714bdbfb534f94034efaa6eadd74e5b93c8fa6315565a222f7b6f42ca1166"}, - {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63e46b3169866bd62849936de036f901a9356e36376079b05efa83caeaa02ceb"}, - {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ed1a53de42fbe34853ba90513cea21673481cd81ed1be739f7f2efb931b24916"}, - {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cfdd16ab5e59fc31b5e906d1a3f666571abc367598e3e02c83403acabc092e07"}, - {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:255a8ef062cbf6674450e668482456abac99a5583bbafb73f9ad469540a3a232"}, - {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a7cd62e831afe623fbb7aabbb4fe583212115b3ef38a9f6b71869ba644624a2"}, - {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f09e2ff1f17c2b51f2bc76d1cc33da96298f0a036a137f5440ab3ec5360b624f"}, - {file = "pydantic_core-2.23.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e38e63e6f3d1cec5a27e0afe90a085af8b6806ee208b33030e65b6516353f1a3"}, - {file = "pydantic_core-2.23.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0dbd8dbed2085ed23b5c04afa29d8fd2771674223135dc9bc937f3c09284d071"}, - {file = "pydantic_core-2.23.4-cp310-none-win32.whl", hash = "sha256:6531b7ca5f951d663c339002e91aaebda765ec7d61b7d1e3991051906ddde119"}, - {file = "pydantic_core-2.23.4-cp310-none-win_amd64.whl", hash = "sha256:7c9129eb40958b3d4500fa2467e6a83356b3b61bfff1b414c7361d9220f9ae8f"}, - {file = "pydantic_core-2.23.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:77733e3892bb0a7fa797826361ce8a9184d25c8dffaec60b7ffe928153680ba8"}, - {file = "pydantic_core-2.23.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1b84d168f6c48fabd1f2027a3d1bdfe62f92cade1fb273a5d68e621da0e44e6d"}, - {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df49e7a0861a8c36d089c1ed57d308623d60416dab2647a4a17fe050ba85de0e"}, - {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ff02b6d461a6de369f07ec15e465a88895f3223eb75073ffea56b84d9331f607"}, - {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:996a38a83508c54c78a5f41456b0103c30508fed9abcad0a59b876d7398f25fd"}, - {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d97683ddee4723ae8c95d1eddac7c192e8c552da0c73a925a89fa8649bf13eea"}, - {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:216f9b2d7713eb98cb83c80b9c794de1f6b7e3145eef40400c62e86cee5f4e1e"}, - {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6f783e0ec4803c787bcea93e13e9932edab72068f68ecffdf86a99fd5918878b"}, - {file = "pydantic_core-2.23.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:d0776dea117cf5272382634bd2a5c1b6eb16767c223c6a5317cd3e2a757c61a0"}, - {file = "pydantic_core-2.23.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d5f7a395a8cf1621939692dba2a6b6a830efa6b3cee787d82c7de1ad2930de64"}, - {file = "pydantic_core-2.23.4-cp311-none-win32.whl", hash = "sha256:74b9127ffea03643e998e0c5ad9bd3811d3dac8c676e47db17b0ee7c3c3bf35f"}, - {file = "pydantic_core-2.23.4-cp311-none-win_amd64.whl", hash = "sha256:98d134c954828488b153d88ba1f34e14259284f256180ce659e8d83e9c05eaa3"}, - {file = "pydantic_core-2.23.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:f3e0da4ebaef65158d4dfd7d3678aad692f7666877df0002b8a522cdf088f231"}, - {file = "pydantic_core-2.23.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f69a8e0b033b747bb3e36a44e7732f0c99f7edd5cea723d45bc0d6e95377ffee"}, - {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:723314c1d51722ab28bfcd5240d858512ffd3116449c557a1336cbe3919beb87"}, - {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bb2802e667b7051a1bebbfe93684841cc9351004e2badbd6411bf357ab8d5ac8"}, - {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d18ca8148bebe1b0a382a27a8ee60350091a6ddaf475fa05ef50dc35b5df6327"}, - {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:33e3d65a85a2a4a0dc3b092b938a4062b1a05f3a9abde65ea93b233bca0e03f2"}, - {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:128585782e5bfa515c590ccee4b727fb76925dd04a98864182b22e89a4e6ed36"}, - {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:68665f4c17edcceecc112dfed5dbe6f92261fb9d6054b47d01bf6371a6196126"}, - {file = "pydantic_core-2.23.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:20152074317d9bed6b7a95ade3b7d6054845d70584216160860425f4fbd5ee9e"}, - {file = "pydantic_core-2.23.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:9261d3ce84fa1d38ed649c3638feefeae23d32ba9182963e465d58d62203bd24"}, - {file = "pydantic_core-2.23.4-cp312-none-win32.whl", hash = "sha256:4ba762ed58e8d68657fc1281e9bb72e1c3e79cc5d464be146e260c541ec12d84"}, - {file = "pydantic_core-2.23.4-cp312-none-win_amd64.whl", hash = "sha256:97df63000f4fea395b2824da80e169731088656d1818a11b95f3b173747b6cd9"}, - {file = "pydantic_core-2.23.4-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:7530e201d10d7d14abce4fb54cfe5b94a0aefc87da539d0346a484ead376c3cc"}, - {file = "pydantic_core-2.23.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:df933278128ea1cd77772673c73954e53a1c95a4fdf41eef97c2b779271bd0bd"}, - {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0cb3da3fd1b6a5d0279a01877713dbda118a2a4fc6f0d821a57da2e464793f05"}, - {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:42c6dcb030aefb668a2b7009c85b27f90e51e6a3b4d5c9bc4c57631292015b0d"}, - {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:696dd8d674d6ce621ab9d45b205df149399e4bb9aa34102c970b721554828510"}, - {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2971bb5ffe72cc0f555c13e19b23c85b654dd2a8f7ab493c262071377bfce9f6"}, - {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8394d940e5d400d04cad4f75c0598665cbb81aecefaca82ca85bd28264af7f9b"}, - {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:0dff76e0602ca7d4cdaacc1ac4c005e0ce0dcfe095d5b5259163a80d3a10d327"}, - {file = "pydantic_core-2.23.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:7d32706badfe136888bdea71c0def994644e09fff0bfe47441deaed8e96fdbc6"}, - {file = "pydantic_core-2.23.4-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ed541d70698978a20eb63d8c5d72f2cc6d7079d9d90f6b50bad07826f1320f5f"}, - {file = "pydantic_core-2.23.4-cp313-none-win32.whl", hash = "sha256:3d5639516376dce1940ea36edf408c554475369f5da2abd45d44621cb616f769"}, - {file = "pydantic_core-2.23.4-cp313-none-win_amd64.whl", hash = "sha256:5a1504ad17ba4210df3a045132a7baeeba5a200e930f57512ee02909fc5c4cb5"}, - {file = "pydantic_core-2.23.4-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:d4488a93b071c04dc20f5cecc3631fc78b9789dd72483ba15d423b5b3689b555"}, - {file = "pydantic_core-2.23.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:81965a16b675b35e1d09dd14df53f190f9129c0202356ed44ab2728b1c905658"}, - {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ffa2ebd4c8530079140dd2d7f794a9d9a73cbb8e9d59ffe24c63436efa8f271"}, - {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:61817945f2fe7d166e75fbfb28004034b48e44878177fc54d81688e7b85a3665"}, - {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:29d2c342c4bc01b88402d60189f3df065fb0dda3654744d5a165a5288a657368"}, - {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5e11661ce0fd30a6790e8bcdf263b9ec5988e95e63cf901972107efc49218b13"}, - {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d18368b137c6295db49ce7218b1a9ba15c5bc254c96d7c9f9e924a9bc7825ad"}, - {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ec4e55f79b1c4ffb2eecd8a0cfba9955a2588497d96851f4c8f99aa4a1d39b12"}, - {file = "pydantic_core-2.23.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:374a5e5049eda9e0a44c696c7ade3ff355f06b1fe0bb945ea3cac2bc336478a2"}, - {file = "pydantic_core-2.23.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5c364564d17da23db1106787675fc7af45f2f7b58b4173bfdd105564e132e6fb"}, - {file = "pydantic_core-2.23.4-cp38-none-win32.whl", hash = "sha256:d7a80d21d613eec45e3d41eb22f8f94ddc758a6c4720842dc74c0581f54993d6"}, - {file = "pydantic_core-2.23.4-cp38-none-win_amd64.whl", hash = "sha256:5f5ff8d839f4566a474a969508fe1c5e59c31c80d9e140566f9a37bba7b8d556"}, - {file = "pydantic_core-2.23.4-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:a4fa4fc04dff799089689f4fd502ce7d59de529fc2f40a2c8836886c03e0175a"}, - {file = "pydantic_core-2.23.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0a7df63886be5e270da67e0966cf4afbae86069501d35c8c1b3b6c168f42cb36"}, - {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dcedcd19a557e182628afa1d553c3895a9f825b936415d0dbd3cd0bbcfd29b4b"}, - {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f54b118ce5de9ac21c363d9b3caa6c800341e8c47a508787e5868c6b79c9323"}, - {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86d2f57d3e1379a9525c5ab067b27dbb8a0642fb5d454e17a9ac434f9ce523e3"}, - {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:de6d1d1b9e5101508cb37ab0d972357cac5235f5c6533d1071964c47139257df"}, - {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1278e0d324f6908e872730c9102b0112477a7f7cf88b308e4fc36ce1bdb6d58c"}, - {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9a6b5099eeec78827553827f4c6b8615978bb4b6a88e5d9b93eddf8bb6790f55"}, - {file = "pydantic_core-2.23.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:e55541f756f9b3ee346b840103f32779c695a19826a4c442b7954550a0972040"}, - {file = "pydantic_core-2.23.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a5c7ba8ffb6d6f8f2ab08743be203654bb1aaa8c9dcb09f82ddd34eadb695605"}, - {file = "pydantic_core-2.23.4-cp39-none-win32.whl", hash = "sha256:37b0fe330e4a58d3c58b24d91d1eb102aeec675a3db4c292ec3928ecd892a9a6"}, - {file = "pydantic_core-2.23.4-cp39-none-win_amd64.whl", hash = "sha256:1498bec4c05c9c787bde9125cfdcc63a41004ff167f495063191b863399b1a29"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:f455ee30a9d61d3e1a15abd5068827773d6e4dc513e795f380cdd59932c782d5"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1e90d2e3bd2c3863d48525d297cd143fe541be8bbf6f579504b9712cb6b643ec"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e203fdf807ac7e12ab59ca2bfcabb38c7cf0b33c41efeb00f8e5da1d86af480"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e08277a400de01bc72436a0ccd02bdf596631411f592ad985dcee21445bd0068"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f220b0eea5965dec25480b6333c788fb72ce5f9129e8759ef876a1d805d00801"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:d06b0c8da4f16d1d1e352134427cb194a0a6e19ad5db9161bf32b2113409e728"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:ba1a0996f6c2773bd83e63f18914c1de3c9dd26d55f4ac302a7efe93fb8e7433"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:9a5bce9d23aac8f0cf0836ecfc033896aa8443b501c58d0602dbfd5bd5b37753"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:78ddaaa81421a29574a682b3179d4cf9e6d405a09b99d93ddcf7e5239c742e21"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:883a91b5dd7d26492ff2f04f40fbb652de40fcc0afe07e8129e8ae779c2110eb"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:88ad334a15b32a791ea935af224b9de1bf99bcd62fabf745d5f3442199d86d59"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:233710f069d251feb12a56da21e14cca67994eab08362207785cf8c598e74577"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:19442362866a753485ba5e4be408964644dd6a09123d9416c54cd49171f50744"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:624e278a7d29b6445e4e813af92af37820fafb6dcc55c012c834f9e26f9aaaef"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f5ef8f42bec47f21d07668a043f077d507e5bf4e668d5c6dfe6aaba89de1a5b8"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:aea443fffa9fbe3af1a9ba721a87f926fe548d32cab71d188a6ede77d0ff244e"}, - {file = "pydantic_core-2.23.4.tar.gz", hash = "sha256:2584f7cf844ac4d970fba483a717dbe10c1c1c96a969bf65d61ffe94df1b2863"}, + {file = "pydantic_core-2.27.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:71a5e35c75c021aaf400ac048dacc855f000bdfed91614b4a726f7432f1f3d6a"}, + {file = "pydantic_core-2.27.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f82d068a2d6ecfc6e054726080af69a6764a10015467d7d7b9f66d6ed5afa23b"}, + {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:121ceb0e822f79163dd4699e4c54f5ad38b157084d97b34de8b232bcaad70278"}, + {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4603137322c18eaf2e06a4495f426aa8d8388940f3c457e7548145011bb68e05"}, + {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a33cd6ad9017bbeaa9ed78a2e0752c5e250eafb9534f308e7a5f7849b0b1bfb4"}, + {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:15cc53a3179ba0fcefe1e3ae50beb2784dede4003ad2dfd24f81bba4b23a454f"}, + {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:45d9c5eb9273aa50999ad6adc6be5e0ecea7e09dbd0d31bd0c65a55a2592ca08"}, + {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8bf7b66ce12a2ac52d16f776b31d16d91033150266eb796967a7e4621707e4f6"}, + {file = "pydantic_core-2.27.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:655d7dd86f26cb15ce8a431036f66ce0318648f8853d709b4167786ec2fa4807"}, + {file = "pydantic_core-2.27.1-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:5556470f1a2157031e676f776c2bc20acd34c1990ca5f7e56f1ebf938b9ab57c"}, + {file = "pydantic_core-2.27.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f69ed81ab24d5a3bd93861c8c4436f54afdf8e8cc421562b0c7504cf3be58206"}, + {file = "pydantic_core-2.27.1-cp310-none-win32.whl", hash = "sha256:f5a823165e6d04ccea61a9f0576f345f8ce40ed533013580e087bd4d7442b52c"}, + {file = "pydantic_core-2.27.1-cp310-none-win_amd64.whl", hash = "sha256:57866a76e0b3823e0b56692d1a0bf722bffb324839bb5b7226a7dbd6c9a40b17"}, + {file = "pydantic_core-2.27.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:ac3b20653bdbe160febbea8aa6c079d3df19310d50ac314911ed8cc4eb7f8cb8"}, + {file = "pydantic_core-2.27.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a5a8e19d7c707c4cadb8c18f5f60c843052ae83c20fa7d44f41594c644a1d330"}, + {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7f7059ca8d64fea7f238994c97d91f75965216bcbe5f695bb44f354893f11d52"}, + {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bed0f8a0eeea9fb72937ba118f9db0cb7e90773462af7962d382445f3005e5a4"}, + {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a3cb37038123447cf0f3ea4c74751f6a9d7afef0eb71aa07bf5f652b5e6a132c"}, + {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:84286494f6c5d05243456e04223d5a9417d7f443c3b76065e75001beb26f88de"}, + {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:acc07b2cfc5b835444b44a9956846b578d27beeacd4b52e45489e93276241025"}, + {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4fefee876e07a6e9aad7a8c8c9f85b0cdbe7df52b8a9552307b09050f7512c7e"}, + {file = "pydantic_core-2.27.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:258c57abf1188926c774a4c94dd29237e77eda19462e5bb901d88adcab6af919"}, + {file = "pydantic_core-2.27.1-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:35c14ac45fcfdf7167ca76cc80b2001205a8d5d16d80524e13508371fb8cdd9c"}, + {file = "pydantic_core-2.27.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d1b26e1dff225c31897696cab7d4f0a315d4c0d9e8666dbffdb28216f3b17fdc"}, + {file = "pydantic_core-2.27.1-cp311-none-win32.whl", hash = "sha256:2cdf7d86886bc6982354862204ae3b2f7f96f21a3eb0ba5ca0ac42c7b38598b9"}, + {file = "pydantic_core-2.27.1-cp311-none-win_amd64.whl", hash = "sha256:3af385b0cee8df3746c3f406f38bcbfdc9041b5c2d5ce3e5fc6637256e60bbc5"}, + {file = "pydantic_core-2.27.1-cp311-none-win_arm64.whl", hash = "sha256:81f2ec23ddc1b476ff96563f2e8d723830b06dceae348ce02914a37cb4e74b89"}, + {file = "pydantic_core-2.27.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:9cbd94fc661d2bab2bc702cddd2d3370bbdcc4cd0f8f57488a81bcce90c7a54f"}, + {file = "pydantic_core-2.27.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5f8c4718cd44ec1580e180cb739713ecda2bdee1341084c1467802a417fe0f02"}, + {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:15aae984e46de8d376df515f00450d1522077254ef6b7ce189b38ecee7c9677c"}, + {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:1ba5e3963344ff25fc8c40da90f44b0afca8cfd89d12964feb79ac1411a260ac"}, + {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:992cea5f4f3b29d6b4f7f1726ed8ee46c8331c6b4eed6db5b40134c6fe1768bb"}, + {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0325336f348dbee6550d129b1627cb8f5351a9dc91aad141ffb96d4937bd9529"}, + {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7597c07fbd11515f654d6ece3d0e4e5093edc30a436c63142d9a4b8e22f19c35"}, + {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:3bbd5d8cc692616d5ef6fbbbd50dbec142c7e6ad9beb66b78a96e9c16729b089"}, + {file = "pydantic_core-2.27.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:dc61505e73298a84a2f317255fcc72b710b72980f3a1f670447a21efc88f8381"}, + {file = "pydantic_core-2.27.1-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:e1f735dc43da318cad19b4173dd1ffce1d84aafd6c9b782b3abc04a0d5a6f5bb"}, + {file = "pydantic_core-2.27.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:f4e5658dbffe8843a0f12366a4c2d1c316dbe09bb4dfbdc9d2d9cd6031de8aae"}, + {file = "pydantic_core-2.27.1-cp312-none-win32.whl", hash = "sha256:672ebbe820bb37988c4d136eca2652ee114992d5d41c7e4858cdd90ea94ffe5c"}, + {file = "pydantic_core-2.27.1-cp312-none-win_amd64.whl", hash = "sha256:66ff044fd0bb1768688aecbe28b6190f6e799349221fb0de0e6f4048eca14c16"}, + {file = "pydantic_core-2.27.1-cp312-none-win_arm64.whl", hash = "sha256:9a3b0793b1bbfd4146304e23d90045f2a9b5fd5823aa682665fbdaf2a6c28f3e"}, + {file = "pydantic_core-2.27.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:f216dbce0e60e4d03e0c4353c7023b202d95cbaeff12e5fd2e82ea0a66905073"}, + {file = "pydantic_core-2.27.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a2e02889071850bbfd36b56fd6bc98945e23670773bc7a76657e90e6b6603c08"}, + {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42b0e23f119b2b456d07ca91b307ae167cc3f6c846a7b169fca5326e32fdc6cf"}, + {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:764be71193f87d460a03f1f7385a82e226639732214b402f9aa61f0d025f0737"}, + {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1c00666a3bd2f84920a4e94434f5974d7bbc57e461318d6bb34ce9cdbbc1f6b2"}, + {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3ccaa88b24eebc0f849ce0a4d09e8a408ec5a94afff395eb69baf868f5183107"}, + {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c65af9088ac534313e1963443d0ec360bb2b9cba6c2909478d22c2e363d98a51"}, + {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:206b5cf6f0c513baffaeae7bd817717140770c74528f3e4c3e1cec7871ddd61a"}, + {file = "pydantic_core-2.27.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:062f60e512fc7fff8b8a9d680ff0ddaaef0193dba9fa83e679c0c5f5fbd018bc"}, + {file = "pydantic_core-2.27.1-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:a0697803ed7d4af5e4c1adf1670af078f8fcab7a86350e969f454daf598c4960"}, + {file = "pydantic_core-2.27.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:58ca98a950171f3151c603aeea9303ef6c235f692fe555e883591103da709b23"}, + {file = "pydantic_core-2.27.1-cp313-none-win32.whl", hash = "sha256:8065914ff79f7eab1599bd80406681f0ad08f8e47c880f17b416c9f8f7a26d05"}, + {file = "pydantic_core-2.27.1-cp313-none-win_amd64.whl", hash = "sha256:ba630d5e3db74c79300d9a5bdaaf6200172b107f263c98a0539eeecb857b2337"}, + {file = "pydantic_core-2.27.1-cp313-none-win_arm64.whl", hash = "sha256:45cf8588c066860b623cd11c4ba687f8d7175d5f7ef65f7129df8a394c502de5"}, + {file = "pydantic_core-2.27.1-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:5897bec80a09b4084aee23f9b73a9477a46c3304ad1d2d07acca19723fb1de62"}, + {file = "pydantic_core-2.27.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:d0165ab2914379bd56908c02294ed8405c252250668ebcb438a55494c69f44ab"}, + {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6b9af86e1d8e4cfc82c2022bfaa6f459381a50b94a29e95dcdda8442d6d83864"}, + {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f6c8a66741c5f5447e047ab0ba7a1c61d1e95580d64bce852e3df1f895c4067"}, + {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9a42d6a8156ff78981f8aa56eb6394114e0dedb217cf8b729f438f643608cbcd"}, + {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:64c65f40b4cd8b0e049a8edde07e38b476da7e3aaebe63287c899d2cff253fa5"}, + {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9fdcf339322a3fae5cbd504edcefddd5a50d9ee00d968696846f089b4432cf78"}, + {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:bf99c8404f008750c846cb4ac4667b798a9f7de673ff719d705d9b2d6de49c5f"}, + {file = "pydantic_core-2.27.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:8f1edcea27918d748c7e5e4d917297b2a0ab80cad10f86631e488b7cddf76a36"}, + {file = "pydantic_core-2.27.1-cp38-cp38-musllinux_1_1_armv7l.whl", hash = "sha256:159cac0a3d096f79ab6a44d77a961917219707e2a130739c64d4dd46281f5c2a"}, + {file = "pydantic_core-2.27.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:029d9757eb621cc6e1848fa0b0310310de7301057f623985698ed7ebb014391b"}, + {file = "pydantic_core-2.27.1-cp38-none-win32.whl", hash = "sha256:a28af0695a45f7060e6f9b7092558a928a28553366519f64083c63a44f70e618"}, + {file = "pydantic_core-2.27.1-cp38-none-win_amd64.whl", hash = "sha256:2d4567c850905d5eaaed2f7a404e61012a51caf288292e016360aa2b96ff38d4"}, + {file = "pydantic_core-2.27.1-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:e9386266798d64eeb19dd3677051f5705bf873e98e15897ddb7d76f477131967"}, + {file = "pydantic_core-2.27.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4228b5b646caa73f119b1ae756216b59cc6e2267201c27d3912b592c5e323b60"}, + {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0b3dfe500de26c52abe0477dde16192ac39c98f05bf2d80e76102d394bd13854"}, + {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:aee66be87825cdf72ac64cb03ad4c15ffef4143dbf5c113f64a5ff4f81477bf9"}, + {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3b748c44bb9f53031c8cbc99a8a061bc181c1000c60a30f55393b6e9c45cc5bd"}, + {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5ca038c7f6a0afd0b2448941b6ef9d5e1949e999f9e5517692eb6da58e9d44be"}, + {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e0bd57539da59a3e4671b90a502da9a28c72322a4f17866ba3ac63a82c4498e"}, + {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ac6c2c45c847bbf8f91930d88716a0fb924b51e0c6dad329b793d670ec5db792"}, + {file = "pydantic_core-2.27.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:b94d4ba43739bbe8b0ce4262bcc3b7b9f31459ad120fb595627eaeb7f9b9ca01"}, + {file = "pydantic_core-2.27.1-cp39-cp39-musllinux_1_1_armv7l.whl", hash = "sha256:00e6424f4b26fe82d44577b4c842d7df97c20be6439e8e685d0d715feceb9fb9"}, + {file = "pydantic_core-2.27.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:38de0a70160dd97540335b7ad3a74571b24f1dc3ed33f815f0880682e6880131"}, + {file = "pydantic_core-2.27.1-cp39-none-win32.whl", hash = "sha256:7ccebf51efc61634f6c2344da73e366c75e735960b5654b63d7e6f69a5885fa3"}, + {file = "pydantic_core-2.27.1-cp39-none-win_amd64.whl", hash = "sha256:a57847b090d7892f123726202b7daa20df6694cbd583b67a592e856bff603d6c"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:3fa80ac2bd5856580e242dbc202db873c60a01b20309c8319b5c5986fbe53ce6"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:d950caa237bb1954f1b8c9227b5065ba6875ac9771bb8ec790d956a699b78676"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0e4216e64d203e39c62df627aa882f02a2438d18a5f21d7f721621f7a5d3611d"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:02a3d637bd387c41d46b002f0e49c52642281edacd2740e5a42f7017feea3f2c"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:161c27ccce13b6b0c8689418da3885d3220ed2eae2ea5e9b2f7f3d48f1d52c27"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:19910754e4cc9c63bc1c7f6d73aa1cfee82f42007e407c0f413695c2f7ed777f"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:e173486019cc283dc9778315fa29a363579372fe67045e971e89b6365cc035ed"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:af52d26579b308921b73b956153066481f064875140ccd1dfd4e77db89dbb12f"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:981fb88516bd1ae8b0cbbd2034678a39dedc98752f264ac9bc5839d3923fa04c"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:5fde892e6c697ce3e30c61b239330fc5d569a71fefd4eb6512fc6caec9dd9e2f"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:816f5aa087094099fff7edabb5e01cc370eb21aa1a1d44fe2d2aefdfb5599b31"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9c10c309e18e443ddb108f0ef64e8729363adbfd92d6d57beec680f6261556f3"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:98476c98b02c8e9b2eec76ac4156fd006628b1b2d0ef27e548ffa978393fd154"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c3027001c28434e7ca5a6e1e527487051136aa81803ac812be51802150d880dd"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:7699b1df36a48169cdebda7ab5a2bac265204003f153b4bd17276153d997670a"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:1c39b07d90be6b48968ddc8c19e7585052088fd7ec8d568bb31ff64c70ae3c97"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:46ccfe3032b3915586e469d4972973f893c0a2bb65669194a5bdea9bacc088c2"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:62ba45e21cf6571d7f716d903b5b7b6d2617e2d5d67c0923dc47b9d41369f840"}, + {file = "pydantic_core-2.27.1.tar.gz", hash = "sha256:62a763352879b84aa31058fc931884055fd75089cccbd9d58bb6afd01141b235"}, ] [package.dependencies] @@ -852,29 +860,29 @@ yaml = ["pyyaml (>=6.0.0)"] [[package]] name = "ruff" -version = "0.7.2" +version = "0.8.0" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.7.2-py3-none-linux_armv6l.whl", hash = "sha256:b73f873b5f52092e63ed540adefc3c36f1f803790ecf2590e1df8bf0a9f72cb8"}, - {file = "ruff-0.7.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:5b813ef26db1015953daf476202585512afd6a6862a02cde63f3bafb53d0b2d4"}, - {file = "ruff-0.7.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:853277dbd9675810c6826dad7a428d52a11760744508340e66bf46f8be9701d9"}, - {file = "ruff-0.7.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:21aae53ab1490a52bf4e3bf520c10ce120987b047c494cacf4edad0ba0888da2"}, - {file = "ruff-0.7.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ccc7e0fc6e0cb3168443eeadb6445285abaae75142ee22b2b72c27d790ab60ba"}, - {file = "ruff-0.7.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd77877a4e43b3a98e5ef4715ba3862105e299af0c48942cc6d51ba3d97dc859"}, - {file = "ruff-0.7.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:e00163fb897d35523c70d71a46fbaa43bf7bf9af0f4534c53ea5b96b2e03397b"}, - {file = "ruff-0.7.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f3c54b538633482dc342e9b634d91168fe8cc56b30a4b4f99287f4e339103e88"}, - {file = "ruff-0.7.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7b792468e9804a204be221b14257566669d1db5c00d6bb335996e5cd7004ba80"}, - {file = "ruff-0.7.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dba53ed84ac19ae4bfb4ea4bf0172550a2285fa27fbb13e3746f04c80f7fa088"}, - {file = "ruff-0.7.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b19fafe261bf741bca2764c14cbb4ee1819b67adb63ebc2db6401dcd652e3748"}, - {file = "ruff-0.7.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:28bd8220f4d8f79d590db9e2f6a0674f75ddbc3847277dd44ac1f8d30684b828"}, - {file = "ruff-0.7.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9fd67094e77efbea932e62b5d2483006154794040abb3a5072e659096415ae1e"}, - {file = "ruff-0.7.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:576305393998b7bd6c46018f8104ea3a9cb3fa7908c21d8580e3274a3b04b691"}, - {file = "ruff-0.7.2-py3-none-win32.whl", hash = "sha256:fa993cfc9f0ff11187e82de874dfc3611df80852540331bc85c75809c93253a8"}, - {file = "ruff-0.7.2-py3-none-win_amd64.whl", hash = "sha256:dd8800cbe0254e06b8fec585e97554047fb82c894973f7ff18558eee33d1cb88"}, - {file = "ruff-0.7.2-py3-none-win_arm64.whl", hash = "sha256:bb8368cd45bba3f57bb29cbb8d64b4a33f8415d0149d2655c5c8539452ce7760"}, - {file = "ruff-0.7.2.tar.gz", hash = "sha256:2b14e77293380e475b4e3a7a368e14549288ed2931fce259a6f99978669e844f"}, + {file = "ruff-0.8.0-py3-none-linux_armv6l.whl", hash = "sha256:fcb1bf2cc6706adae9d79c8d86478677e3bbd4ced796ccad106fd4776d395fea"}, + {file = "ruff-0.8.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:295bb4c02d58ff2ef4378a1870c20af30723013f441c9d1637a008baaf928c8b"}, + {file = "ruff-0.8.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:7b1f1c76b47c18fa92ee78b60d2d20d7e866c55ee603e7d19c1e991fad933a9a"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eb0d4f250a7711b67ad513fde67e8870109e5ce590a801c3722580fe98c33a99"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:0e55cce9aa93c5d0d4e3937e47b169035c7e91c8655b0974e61bb79cf398d49c"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3f4cd64916d8e732ce6b87f3f5296a8942d285bbbc161acee7fe561134af64f9"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c5c1466be2a2ebdf7c5450dd5d980cc87c8ba6976fb82582fea18823da6fa362"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2dabfd05b96b7b8f2da00d53c514eea842bff83e41e1cceb08ae1966254a51df"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:facebdfe5a5af6b1588a1d26d170635ead6892d0e314477e80256ef4a8470cf3"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87a8e86bae0dbd749c815211ca11e3a7bd559b9710746c559ed63106d382bd9c"}, + {file = "ruff-0.8.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:85e654f0ded7befe2d61eeaf3d3b1e4ef3894469cd664ffa85006c7720f1e4a2"}, + {file = "ruff-0.8.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:83a55679c4cb449fa527b8497cadf54f076603cc36779b2170b24f704171ce70"}, + {file = "ruff-0.8.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:812e2052121634cf13cd6fddf0c1871d0ead1aad40a1a258753c04c18bb71bbd"}, + {file = "ruff-0.8.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:780d5d8523c04202184405e60c98d7595bdb498c3c6abba3b6d4cdf2ca2af426"}, + {file = "ruff-0.8.0-py3-none-win32.whl", hash = "sha256:5fdb6efecc3eb60bba5819679466471fd7d13c53487df7248d6e27146e985468"}, + {file = "ruff-0.8.0-py3-none-win_amd64.whl", hash = "sha256:582891c57b96228d146725975fbb942e1f30a0c4ba19722e692ca3eb25cc9b4f"}, + {file = "ruff-0.8.0-py3-none-win_arm64.whl", hash = "sha256:ba93e6294e9a737cd726b74b09a6972e36bb511f9a102f1d9a7e1ce94dd206a6"}, + {file = "ruff-0.8.0.tar.gz", hash = "sha256:a7ccfe6331bf8c8dad715753e157457faf7351c2b69f62f32c165c2dbcbacd44"}, ] [[package]] @@ -1125,13 +1133,13 @@ test = ["pytest"] [[package]] name = "stevedore" -version = "5.3.0" +version = "5.4.0" description = "Manage dynamic plugins for Python applications" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "stevedore-5.3.0-py3-none-any.whl", hash = "sha256:1efd34ca08f474dad08d9b19e934a22c68bb6fe416926479ba29e5013bcc8f78"}, - {file = "stevedore-5.3.0.tar.gz", hash = "sha256:9a64265f4060312828151c204efbe9b7a9852a0d9228756344dbc7e4023e375a"}, + {file = "stevedore-5.4.0-py3-none-any.whl", hash = "sha256:b0be3c4748b3ea7b854b265dcb4caa891015e442416422be16f8b31756107857"}, + {file = "stevedore-5.4.0.tar.gz", hash = "sha256:79e92235ecb828fe952b6b8b0c6c87863248631922c8e8e0fa5b17b232c4514d"}, ] [package.dependencies] @@ -1139,13 +1147,13 @@ pbr = ">=2.0.0" [[package]] name = "typer" -version = "0.12.5" +version = "0.13.1" description = "Typer, build great CLIs. Easy to code. Based on Python type hints." optional = false python-versions = ">=3.7" files = [ - {file = "typer-0.12.5-py3-none-any.whl", hash = "sha256:62fe4e471711b147e3365034133904df3e235698399bc4de2b36c8579298d52b"}, - {file = "typer-0.12.5.tar.gz", hash = "sha256:f592f089bedcc8ec1b974125d64851029c3b1af145f04aca64d69410f0c9b722"}, + {file = "typer-0.13.1-py3-none-any.whl", hash = "sha256:5b59580fd925e89463a29d363e0a43245ec02765bde9fb77d39e5d0f29dd7157"}, + {file = "typer-0.13.1.tar.gz", hash = "sha256:9d444cb96cc268ce6f8b94e13b4335084cef4c079998a9f4851a90229a3bd25c"}, ] [package.dependencies] diff --git a/pyproject.toml b/pyproject.toml index 791c8591a..38b88b229 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,42 @@ -[tool.poetry] +[build-system] +requires = ["scikit-build-core>=0.10", "pybind11"] +build-backend = "scikit_build_core.build" + +[project] name = "SPECFEMPP" version = "0.1.0" description = "Kokkos implementation of SpecFEM2D code" -authors = ["Rohit R Kakodkar ", "Lucas Sawade ", "Congyue Cui "] +readme = "README.md" +authors = [ + { name = "Rohit R Kakodkar", email = "rohit_kakodkar@princeton.edu" }, + { name = "Lucas Sawade", email = "lsawade@princeton.edu" }, + { name = "Congyue Cui", email = "ccui@princeton.edu" } +] +requires-python = ">=3.9" +# classifiers = [ +# "Development Status :: 4 - Beta", +# "License :: OSI Approved :: MIT License", +# "Programming Language :: Python :: 3 :: Only", +# "Programming Language :: Python :: 3.7", +# "Programming Language :: Python :: 3.8", +# "Programming Language :: Python :: 3.9", +# "Programming Language :: Python :: 3.10", +# "Programming Language :: Python :: 3.11", +# "Programming Language :: Python :: 3.12", +# "Programming Language :: Python :: 3.13", +# ] + +[tool.scikit-build] +cmake.define.CMAKE_BUILD_TYPE = "Release" +cmake.define.BUILD_TESTS = "ON" +cmake.define.ENABLE_SIMD = "ON" +cmake.define.ENABLE_ATOMICS_BYPASS = "ON" +# cmake.define.Kokkos_ENABLE_OPENMP = "ON" +cmake.define.Kokkos_ARCH_NATIVE = "ON" +cmake.define.Kokkos_ENABLE_AGGRESSIVE_VECTORIZATION = "ON" +build-dir = "./build" + +[tool.poetry] package-mode = false [tool.poetry.dependencies] @@ -24,7 +58,3 @@ ruff = ">=0.6.7" [tool.snakefmt] line_length = 90 include = '\.smk$|^Snakefile|\.py|^Snakefile.in$' - -[build-system] -requires = ["scikit-build-core>=0.10", "pybind11"] -build-backend = "scikit_build_core.build" From 08a593460f07b40c465c5e41d71cd55f34f4c931 Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Mon, 25 Nov 2024 16:38:55 -0500 Subject: [PATCH 03/17] Add specfem2d to PATH with pip install --- CMakeLists.txt | 4 ++++ pyproject.toml | 17 +++-------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7f0880d3..71bdcda56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -533,3 +533,7 @@ if (DOXYGEN_FOUND) else (DOXYGEN_FOUND) message("Doxygen need to be installed to generate the doxygen documentation") endif (DOXYGEN_FOUND) + +if (SPECFEMPP_ENABLE_PYTHON) + install(TARGETS specfem2d DESTINATION ${SKBUILD_SCRIPTS_DIR}) +endif (SPECFEMPP_ENABLE_PYTHON) diff --git a/pyproject.toml b/pyproject.toml index 38b88b229..c8215ae4b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,27 +13,16 @@ authors = [ { name = "Congyue Cui", email = "ccui@princeton.edu" } ] requires-python = ">=3.9" -# classifiers = [ -# "Development Status :: 4 - Beta", -# "License :: OSI Approved :: MIT License", -# "Programming Language :: Python :: 3 :: Only", -# "Programming Language :: Python :: 3.7", -# "Programming Language :: Python :: 3.8", -# "Programming Language :: Python :: 3.9", -# "Programming Language :: Python :: 3.10", -# "Programming Language :: Python :: 3.11", -# "Programming Language :: Python :: 3.12", -# "Programming Language :: Python :: 3.13", -# ] [tool.scikit-build] cmake.define.CMAKE_BUILD_TYPE = "Release" -cmake.define.BUILD_TESTS = "ON" +cmake.define.BUILD_TESTS = "OFF" cmake.define.ENABLE_SIMD = "ON" cmake.define.ENABLE_ATOMICS_BYPASS = "ON" -# cmake.define.Kokkos_ENABLE_OPENMP = "ON" +cmake.define.Kokkos_ENABLE_OPENMP = "OFF" cmake.define.Kokkos_ARCH_NATIVE = "ON" cmake.define.Kokkos_ENABLE_AGGRESSIVE_VECTORIZATION = "ON" +cmake.define.SPECFEMPP_ENABLE_PYTHON = "ON" build-dir = "./build" [tool.poetry] From a14347fb6c42a6006fc59a920e9a0a3217e32427 Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Tue, 26 Nov 2024 09:11:55 -0500 Subject: [PATCH 04/17] Remove unused cmake options from pyproject.toml --- pyproject.toml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c8215ae4b..e2bdfec80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,12 +16,7 @@ requires-python = ">=3.9" [tool.scikit-build] cmake.define.CMAKE_BUILD_TYPE = "Release" -cmake.define.BUILD_TESTS = "OFF" -cmake.define.ENABLE_SIMD = "ON" -cmake.define.ENABLE_ATOMICS_BYPASS = "ON" -cmake.define.Kokkos_ENABLE_OPENMP = "OFF" -cmake.define.Kokkos_ARCH_NATIVE = "ON" -cmake.define.Kokkos_ENABLE_AGGRESSIVE_VECTORIZATION = "ON" +cmake.define.BUILD_TESTS = "ON" cmake.define.SPECFEMPP_ENABLE_PYTHON = "ON" build-dir = "./build" From 7472b94075653fea32f1295528e9a1b584078912 Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Tue, 26 Nov 2024 09:37:09 -0500 Subject: [PATCH 05/17] Add xmeshfem2D to PATH --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 71bdcda56..9199b65fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -536,4 +536,5 @@ endif (DOXYGEN_FOUND) if (SPECFEMPP_ENABLE_PYTHON) install(TARGETS specfem2d DESTINATION ${SKBUILD_SCRIPTS_DIR}) + install(FILES ${CMAKE_BINARY_DIR}/xmeshfem2D DESTINATION ${SKBUILD_SCRIPTS_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) endif (SPECFEMPP_ENABLE_PYTHON) From 3451b8fa2b9e06b4594a21d0f1013419995c17cf Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Tue, 26 Nov 2024 15:52:42 -0500 Subject: [PATCH 06/17] Hello world for pybind --- CMakeLists.txt | 56 ++++++- pyproject.toml | 3 +- python/specfempp/__init__.py | 5 + python/specfempp/__init__.pyi | 19 +++ src/specfem2d_py.cpp | 285 ++++++++++++++++++++++++++++++++++ 5 files changed, 359 insertions(+), 9 deletions(-) create mode 100644 python/specfempp/__init__.py create mode 100644 python/specfempp/__init__.pyi create mode 100644 src/specfem2d_py.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9199b65fa..5883d873f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,13 +15,26 @@ set(NUM_CHUNKS 1) set(NUM_THREADS 160) set(NUM_VECTOR_LANES 1) -if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") - set(CMAKE_CXX_FLAGS "-fp-model=precise") -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - message("-- Detected Intel classic compiler which will be deprecated soon.") - message("-- It is recommended you use IntelLLVM compiler.") - set(CMAKE_CXX_FLAGS "-diag-disable=10441 -fp-model=precise") -endif() +if (SPECFEMPP_ENABLE_PYTHON) + message("-- Adding -fPIC flag for Python binding.") + if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + set(CMAKE_CXX_FLAGS "-fp-model=precise -fPIC") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + message("-- Detected Intel classic compiler which will be deprecated soon.") + message("-- It is recommended you use IntelLLVM compiler.") + set(CMAKE_CXX_FLAGS "-diag-disable=10441 -fp-model=precise -fPIC") + else() + set(CMAKE_CXX_FLAGS "-fPIC") + endif() +else (SPECFEMPP_ENABLE_PYTHON) + if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + set(CMAKE_CXX_FLAGS "-fp-model=precise") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + message("-- Detected Intel classic compiler which will be deprecated soon.") + message("-- It is recommended you use IntelLLVM compiler.") + set(CMAKE_CXX_FLAGS "-diag-disable=10441 -fp-model=precise") + endif() +endif (SPECFEMPP_ENABLE_PYTHON) if (DEFINED Kokkos_ENABLE_CUDA) if (Kokkos_ENABLE_CUDA) @@ -534,7 +547,34 @@ else (DOXYGEN_FOUND) message("Doxygen need to be installed to generate the doxygen documentation") endif (DOXYGEN_FOUND) -if (SPECFEMPP_ENABLE_PYTHON) +if (SPECFEMPP_USE_SKBUILD) install(TARGETS specfem2d DESTINATION ${SKBUILD_SCRIPTS_DIR}) install(FILES ${CMAKE_BINARY_DIR}/xmeshfem2D DESTINATION ${SKBUILD_SCRIPTS_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) +endif (SPECFEMPP_USE_SKBUILD) + +if (SPECFEMPP_ENABLE_PYTHON) + find_package(Python REQUIRED COMPONENTS Interpreter Development.Module) + find_package(pybind11 CONFIG REQUIRED) + python_add_library(_core MODULE src/specfem2d_py.cpp WITH_SOABI) + target_link_libraries( + _core PRIVATE + specfem_mpi + Kokkos::kokkos + mesh + quadrature + compute + source_class + parameter_reader + receiver_class + writer + reader + domain + coupled_interface + kernels + solver + Boost::program_options + pybind11::headers + ) + target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION}) + install(TARGETS _core DESTINATION specfempp) endif (SPECFEMPP_ENABLE_PYTHON) diff --git a/pyproject.toml b/pyproject.toml index e2bdfec80..c3dd16974 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["scikit-build-core>=0.10", "pybind11"] build-backend = "scikit_build_core.build" [project] -name = "SPECFEMPP" +name = "specfempp" version = "0.1.0" description = "Kokkos implementation of SpecFEM2D code" readme = "README.md" @@ -17,6 +17,7 @@ requires-python = ">=3.9" [tool.scikit-build] cmake.define.CMAKE_BUILD_TYPE = "Release" cmake.define.BUILD_TESTS = "ON" +cmake.define.SPECFEMPP_USE_SKBUILD = "ON" cmake.define.SPECFEMPP_ENABLE_PYTHON = "ON" build-dir = "./build" diff --git a/python/specfempp/__init__.py b/python/specfempp/__init__.py new file mode 100644 index 000000000..15188e5cc --- /dev/null +++ b/python/specfempp/__init__.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from ._core import __doc__, __version__, add, subtract + +__all__ = ["__doc__", "__version__", "add", "subtract"] diff --git a/python/specfempp/__init__.pyi b/python/specfempp/__init__.pyi new file mode 100644 index 000000000..79a83e22f --- /dev/null +++ b/python/specfempp/__init__.pyi @@ -0,0 +1,19 @@ +""" +Pybind11 example plugin +----------------------- + +.. currentmodule:: scikit_build_example + +.. autosummary:: + :toctree: _generate + + add + subtract +""" + +def add(i: int, j: int) -> int: + """ + Add two numbers + + Some other explanation about the add function. + """ diff --git a/src/specfem2d_py.cpp b/src/specfem2d_py.cpp new file mode 100644 index 000000000..6e3dd5a81 --- /dev/null +++ b/src/specfem2d_py.cpp @@ -0,0 +1,285 @@ +#include "compute/interface.hpp" +// #include "coupled_interface/interface.hpp" +// #include "domain/interface.hpp" +#include "kokkos_abstractions.h" +#include "mesh/mesh.hpp" +#include "parameter_parser/interface.hpp" +#include "receiver/interface.hpp" +#include "solver/solver.hpp" +#include "source/interface.hpp" +#include "specfem_mpi/interface.hpp" +#include "specfem_setup.hpp" +#include "timescheme/timescheme.hpp" +#include "yaml-cpp/yaml.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define STRINGIFY(x) #x +#define MACRO_STRINGIFY(x) STRINGIFY(x) +// Specfem2d driver + +std::string print_end_message( + std::chrono::time_point start_time, + std::chrono::duration solver_time) { + std::ostringstream message; + // current date/time based on current system + const auto now = std::chrono::high_resolution_clock::now(); + + std::time_t c_now = std::chrono::high_resolution_clock::to_time_t(now); + + std::chrono::duration diff = now - start_time; + + message << "\n================================================\n" + << " Finished simulation\n" + << "================================================\n\n" + << "Total simulation time : " << diff.count() << " secs\n" + << "Total solver time (time loop) : " << solver_time.count() + << " secs\n" + << "Simulation end time : " << ctime(&c_now) + << "------------------------------------------------\n"; + + return message.str(); +} + +boost::program_options::options_description define_args() { + namespace po = boost::program_options; + + po::options_description desc{ "======================================\n" + "------------SPECFEM Kokkos------------\n" + "======================================" }; + + desc.add_options()("help,h", "Print this help message")( + "parameters_file,p", po::value(), + "Location to parameters file")( + "default_file,d", + po::value()->default_value(__default_file__), + "Location of default parameters file."); + + return desc; +} + +int parse_args(int argc, char **argv, + boost::program_options::variables_map &vm) { + + const auto desc = define_args(); + boost::program_options::store( + boost::program_options::parse_command_line(argc, argv, desc), vm); + + if (vm.count("help")) { + std::cout << desc << std::endl; + return 0; + } + + if (!vm.count("parameters_file")) { + std::cout << desc << std::endl; + return 0; + } + + return 1; +} + +void execute(const std::string ¶meter_file, const std::string &default_file, + specfem::MPI::MPI *mpi) { + + // -------------------------------------------------------------- + // Read parameter file + // -------------------------------------------------------------- + auto start_time = std::chrono::high_resolution_clock::now(); + specfem::runtime_configuration::setup setup(parameter_file, default_file); + const auto [database_filename, source_filename] = setup.get_databases(); + mpi->cout(setup.print_header(start_time)); + // -------------------------------------------------------------- + + // -------------------------------------------------------------- + // Read mesh and materials + // -------------------------------------------------------------- + const auto quadrature = setup.instantiate_quadrature(); + const specfem::mesh::mesh mesh(database_filename, mpi); + // -------------------------------------------------------------- + + // -------------------------------------------------------------- + // Read Sources and Receivers + // -------------------------------------------------------------- + const int nsteps = setup.get_nsteps(); + const specfem::simulation::type simulation_type = setup.get_simulation_type(); + auto [sources, t0] = specfem::sources::read_sources( + source_filename, nsteps, setup.get_t0(), setup.get_dt(), simulation_type); + setup.update_t0(t0); // Update t0 in case it was changed + + const auto stations_filename = setup.get_stations_file(); + const auto angle = setup.get_receiver_angle(); + auto receivers = specfem::receivers::read_receivers(stations_filename, angle); + + mpi->cout("Source Information:"); + mpi->cout("-------------------------------"); + if (mpi->main_proc()) { + std::cout << "Number of sources : " << sources.size() << "\n" << std::endl; + } + + for (auto &source : sources) { + mpi->cout(source->print()); + } + + mpi->cout("Receiver Information:"); + mpi->cout("-------------------------------"); + + if (mpi->main_proc()) { + std::cout << "Number of receivers : " << receivers.size() << "\n" + << std::endl; + } + + for (auto &receiver : receivers) { + mpi->cout(receiver->print()); + } + // -------------------------------------------------------------- + + // -------------------------------------------------------------- + // Instantiate Timescheme + // -------------------------------------------------------------- + const auto time_scheme = setup.instantiate_timescheme(); + if (mpi->main_proc()) + std::cout << *time_scheme << std::endl; + + const int max_seismogram_time_step = time_scheme->get_max_seismogram_step(); + // -------------------------------------------------------------- + + // -------------------------------------------------------------- + // Generate Assembly + // -------------------------------------------------------------- + mpi->cout("Generating assembly:"); + mpi->cout("-------------------------------"); + const type_real dt = setup.get_dt(); + specfem::compute::assembly assembly( + mesh, quadrature, sources, receivers, setup.get_seismogram_types(), + setup.get_t0(), dt, nsteps, max_seismogram_time_step, + setup.get_simulation_type()); + time_scheme->link_assembly(assembly); + + // -------------------------------------------------------------- + + // -------------------------------------------------------------- + // Read wavefields + // -------------------------------------------------------------- + + const auto wavefield_reader = setup.instantiate_wavefield_reader(assembly); + if (wavefield_reader) { + mpi->cout("Reading wavefield files:"); + mpi->cout("-------------------------------"); + + wavefield_reader->read(); + // Transfer the buffer field to device + assembly.fields.buffer.copy_to_device(); + } + // -------------------------------------------------------------- + + // -------------------------------------------------------------- + // Instantiate Solver + // -------------------------------------------------------------- + specfem::enums::element::quadrature::static_quadrature_points<5> qp5; + std::shared_ptr solver = + setup.instantiate_solver(dt, assembly, time_scheme, qp5); + // -------------------------------------------------------------- + + // -------------------------------------------------------------- + // Execute Solver + // -------------------------------------------------------------- + // Time the solver + mpi->cout("Executing time loop:"); + mpi->cout("-------------------------------"); + + const auto solver_start_time = std::chrono::high_resolution_clock::now(); + solver->run(); + const auto solver_end_time = std::chrono::high_resolution_clock::now(); + + std::chrono::duration solver_time = + solver_end_time - solver_start_time; + // -------------------------------------------------------------- + + // -------------------------------------------------------------- + // Write Seismograms + // -------------------------------------------------------------- + const auto seismogram_writer = setup.instantiate_seismogram_writer(assembly); + if (seismogram_writer) { + mpi->cout("Writing seismogram files:"); + mpi->cout("-------------------------------"); + + seismogram_writer->write(); + } + // -------------------------------------------------------------- + + // -------------------------------------------------------------- + // Write Forward Wavefields + // -------------------------------------------------------------- + const auto wavefield_writer = setup.instantiate_wavefield_writer(assembly); + if (wavefield_writer) { + mpi->cout("Writing wavefield files:"); + mpi->cout("-------------------------------"); + + wavefield_writer->write(); + } + // -------------------------------------------------------------- + + // -------------------------------------------------------------- + // Write Kernels + // -------------------------------------------------------------- + const auto kernel_writer = setup.instantiate_kernel_writer(assembly); + if (kernel_writer) { + mpi->cout("Writing kernel files:"); + mpi->cout("-------------------------------"); + + kernel_writer->write(); + } + // -------------------------------------------------------------- + + // -------------------------------------------------------------- + // Print End Message + // -------------------------------------------------------------- + mpi->cout(print_end_message(start_time, solver_time)); + // -------------------------------------------------------------- + + return; +} + +int add(int i, int j) { return i + j; } + +namespace py = pybind11; + +PYBIND11_MODULE(_core, m) { + m.doc() = R"pbdoc( + Pybind11 example plugin + ----------------------- + + .. currentmodule:: scikit_build_example + + .. autosummary:: + :toctree: _generate + + add + subtract + )pbdoc"; + + m.def("add", &add, R"pbdoc( + Add two numbers + + Some other explanation about the add function. + )pbdoc"); + + m.def("subtract", [](int i, int j) { + return i - j; }, R"pbdoc( + Subtract two numbers + + Some other explanation about the subtract function. + )pbdoc"); + +#ifdef VERSION_INFO + m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO); +#else + m.attr("__version__") = "dev"; +#endif +} From f044cd4311a59548b3795d978bec53a570482b15 Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Tue, 26 Nov 2024 16:13:42 -0500 Subject: [PATCH 07/17] Merge pybind into specfem2d.cpp --- CMakeLists.txt | 3 +- src/specfem2d.cpp | 47 +++++++ src/specfem2d_py.cpp | 285 ------------------------------------------- 3 files changed, 49 insertions(+), 286 deletions(-) delete mode 100644 src/specfem2d_py.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 5883d873f..9e32ca78b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -555,7 +555,7 @@ endif (SPECFEMPP_USE_SKBUILD) if (SPECFEMPP_ENABLE_PYTHON) find_package(Python REQUIRED COMPONENTS Interpreter Development.Module) find_package(pybind11 CONFIG REQUIRED) - python_add_library(_core MODULE src/specfem2d_py.cpp WITH_SOABI) + python_add_library(_core MODULE src/specfem2d.cpp WITH_SOABI) target_link_libraries( _core PRIVATE specfem_mpi @@ -575,6 +575,7 @@ if (SPECFEMPP_ENABLE_PYTHON) Boost::program_options pybind11::headers ) + target_compile_definitions(_core PRIVATE SPECFEMPP_ENABLE_PYTHON) target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION}) install(TARGETS _core DESTINATION specfempp) endif (SPECFEMPP_ENABLE_PYTHON) diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index 7834715db..c63ab98fc 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -19,6 +19,11 @@ #include #include #include +#ifdef SPECFEMPP_ENABLE_PYTHON +#include +#define STRINGIFY(x) #x +#define MACRO_STRINGIFY(x) STRINGIFY(x) +#endif // Specfem2d driver std::string print_end_message( @@ -243,6 +248,48 @@ void execute(const std::string ¶meter_file, const std::string &default_file, return; } +#ifdef SPECFEMPP_ENABLE_PYTHON + +int add(int i, int j) { return i + j; } + +namespace py = pybind11; + +PYBIND11_MODULE(_core, m) { + m.doc() = R"pbdoc( + Pybind11 example plugin + ----------------------- + + .. currentmodule:: scikit_build_example + + .. autosummary:: + :toctree: _generate + + add + subtract + )pbdoc"; + + m.def("add", &add, R"pbdoc( + Add two numbers + + Some other explanation about the add function. + )pbdoc"); + + m.def("subtract", [](int i, int j) { + return i - j; }, R"pbdoc( + Subtract two numbers + + Some other explanation about the subtract function. + )pbdoc"); + +#ifdef VERSION_INFO + m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO); +#else + m.attr("__version__") = "dev"; +#endif +} + +#endif + int main(int argc, char **argv) { // Initialize MPI diff --git a/src/specfem2d_py.cpp b/src/specfem2d_py.cpp deleted file mode 100644 index 6e3dd5a81..000000000 --- a/src/specfem2d_py.cpp +++ /dev/null @@ -1,285 +0,0 @@ -#include "compute/interface.hpp" -// #include "coupled_interface/interface.hpp" -// #include "domain/interface.hpp" -#include "kokkos_abstractions.h" -#include "mesh/mesh.hpp" -#include "parameter_parser/interface.hpp" -#include "receiver/interface.hpp" -#include "solver/solver.hpp" -#include "source/interface.hpp" -#include "specfem_mpi/interface.hpp" -#include "specfem_setup.hpp" -#include "timescheme/timescheme.hpp" -#include "yaml-cpp/yaml.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define STRINGIFY(x) #x -#define MACRO_STRINGIFY(x) STRINGIFY(x) -// Specfem2d driver - -std::string print_end_message( - std::chrono::time_point start_time, - std::chrono::duration solver_time) { - std::ostringstream message; - // current date/time based on current system - const auto now = std::chrono::high_resolution_clock::now(); - - std::time_t c_now = std::chrono::high_resolution_clock::to_time_t(now); - - std::chrono::duration diff = now - start_time; - - message << "\n================================================\n" - << " Finished simulation\n" - << "================================================\n\n" - << "Total simulation time : " << diff.count() << " secs\n" - << "Total solver time (time loop) : " << solver_time.count() - << " secs\n" - << "Simulation end time : " << ctime(&c_now) - << "------------------------------------------------\n"; - - return message.str(); -} - -boost::program_options::options_description define_args() { - namespace po = boost::program_options; - - po::options_description desc{ "======================================\n" - "------------SPECFEM Kokkos------------\n" - "======================================" }; - - desc.add_options()("help,h", "Print this help message")( - "parameters_file,p", po::value(), - "Location to parameters file")( - "default_file,d", - po::value()->default_value(__default_file__), - "Location of default parameters file."); - - return desc; -} - -int parse_args(int argc, char **argv, - boost::program_options::variables_map &vm) { - - const auto desc = define_args(); - boost::program_options::store( - boost::program_options::parse_command_line(argc, argv, desc), vm); - - if (vm.count("help")) { - std::cout << desc << std::endl; - return 0; - } - - if (!vm.count("parameters_file")) { - std::cout << desc << std::endl; - return 0; - } - - return 1; -} - -void execute(const std::string ¶meter_file, const std::string &default_file, - specfem::MPI::MPI *mpi) { - - // -------------------------------------------------------------- - // Read parameter file - // -------------------------------------------------------------- - auto start_time = std::chrono::high_resolution_clock::now(); - specfem::runtime_configuration::setup setup(parameter_file, default_file); - const auto [database_filename, source_filename] = setup.get_databases(); - mpi->cout(setup.print_header(start_time)); - // -------------------------------------------------------------- - - // -------------------------------------------------------------- - // Read mesh and materials - // -------------------------------------------------------------- - const auto quadrature = setup.instantiate_quadrature(); - const specfem::mesh::mesh mesh(database_filename, mpi); - // -------------------------------------------------------------- - - // -------------------------------------------------------------- - // Read Sources and Receivers - // -------------------------------------------------------------- - const int nsteps = setup.get_nsteps(); - const specfem::simulation::type simulation_type = setup.get_simulation_type(); - auto [sources, t0] = specfem::sources::read_sources( - source_filename, nsteps, setup.get_t0(), setup.get_dt(), simulation_type); - setup.update_t0(t0); // Update t0 in case it was changed - - const auto stations_filename = setup.get_stations_file(); - const auto angle = setup.get_receiver_angle(); - auto receivers = specfem::receivers::read_receivers(stations_filename, angle); - - mpi->cout("Source Information:"); - mpi->cout("-------------------------------"); - if (mpi->main_proc()) { - std::cout << "Number of sources : " << sources.size() << "\n" << std::endl; - } - - for (auto &source : sources) { - mpi->cout(source->print()); - } - - mpi->cout("Receiver Information:"); - mpi->cout("-------------------------------"); - - if (mpi->main_proc()) { - std::cout << "Number of receivers : " << receivers.size() << "\n" - << std::endl; - } - - for (auto &receiver : receivers) { - mpi->cout(receiver->print()); - } - // -------------------------------------------------------------- - - // -------------------------------------------------------------- - // Instantiate Timescheme - // -------------------------------------------------------------- - const auto time_scheme = setup.instantiate_timescheme(); - if (mpi->main_proc()) - std::cout << *time_scheme << std::endl; - - const int max_seismogram_time_step = time_scheme->get_max_seismogram_step(); - // -------------------------------------------------------------- - - // -------------------------------------------------------------- - // Generate Assembly - // -------------------------------------------------------------- - mpi->cout("Generating assembly:"); - mpi->cout("-------------------------------"); - const type_real dt = setup.get_dt(); - specfem::compute::assembly assembly( - mesh, quadrature, sources, receivers, setup.get_seismogram_types(), - setup.get_t0(), dt, nsteps, max_seismogram_time_step, - setup.get_simulation_type()); - time_scheme->link_assembly(assembly); - - // -------------------------------------------------------------- - - // -------------------------------------------------------------- - // Read wavefields - // -------------------------------------------------------------- - - const auto wavefield_reader = setup.instantiate_wavefield_reader(assembly); - if (wavefield_reader) { - mpi->cout("Reading wavefield files:"); - mpi->cout("-------------------------------"); - - wavefield_reader->read(); - // Transfer the buffer field to device - assembly.fields.buffer.copy_to_device(); - } - // -------------------------------------------------------------- - - // -------------------------------------------------------------- - // Instantiate Solver - // -------------------------------------------------------------- - specfem::enums::element::quadrature::static_quadrature_points<5> qp5; - std::shared_ptr solver = - setup.instantiate_solver(dt, assembly, time_scheme, qp5); - // -------------------------------------------------------------- - - // -------------------------------------------------------------- - // Execute Solver - // -------------------------------------------------------------- - // Time the solver - mpi->cout("Executing time loop:"); - mpi->cout("-------------------------------"); - - const auto solver_start_time = std::chrono::high_resolution_clock::now(); - solver->run(); - const auto solver_end_time = std::chrono::high_resolution_clock::now(); - - std::chrono::duration solver_time = - solver_end_time - solver_start_time; - // -------------------------------------------------------------- - - // -------------------------------------------------------------- - // Write Seismograms - // -------------------------------------------------------------- - const auto seismogram_writer = setup.instantiate_seismogram_writer(assembly); - if (seismogram_writer) { - mpi->cout("Writing seismogram files:"); - mpi->cout("-------------------------------"); - - seismogram_writer->write(); - } - // -------------------------------------------------------------- - - // -------------------------------------------------------------- - // Write Forward Wavefields - // -------------------------------------------------------------- - const auto wavefield_writer = setup.instantiate_wavefield_writer(assembly); - if (wavefield_writer) { - mpi->cout("Writing wavefield files:"); - mpi->cout("-------------------------------"); - - wavefield_writer->write(); - } - // -------------------------------------------------------------- - - // -------------------------------------------------------------- - // Write Kernels - // -------------------------------------------------------------- - const auto kernel_writer = setup.instantiate_kernel_writer(assembly); - if (kernel_writer) { - mpi->cout("Writing kernel files:"); - mpi->cout("-------------------------------"); - - kernel_writer->write(); - } - // -------------------------------------------------------------- - - // -------------------------------------------------------------- - // Print End Message - // -------------------------------------------------------------- - mpi->cout(print_end_message(start_time, solver_time)); - // -------------------------------------------------------------- - - return; -} - -int add(int i, int j) { return i + j; } - -namespace py = pybind11; - -PYBIND11_MODULE(_core, m) { - m.doc() = R"pbdoc( - Pybind11 example plugin - ----------------------- - - .. currentmodule:: scikit_build_example - - .. autosummary:: - :toctree: _generate - - add - subtract - )pbdoc"; - - m.def("add", &add, R"pbdoc( - Add two numbers - - Some other explanation about the add function. - )pbdoc"); - - m.def("subtract", [](int i, int j) { - return i - j; }, R"pbdoc( - Subtract two numbers - - Some other explanation about the subtract function. - )pbdoc"); - -#ifdef VERSION_INFO - m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO); -#else - m.attr("__version__") = "dev"; -#endif -} From 75cb108f9db1631501f98178559c6edb61592c99 Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Tue, 26 Nov 2024 16:55:23 -0500 Subject: [PATCH 08/17] Call main specfem workflow with Python --- python/specfempp/__init__.py | 4 ++-- src/specfem2d.cpp | 40 +++++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/python/specfempp/__init__.py b/python/specfempp/__init__.py index 15188e5cc..2be7a8a3d 100644 --- a/python/specfempp/__init__.py +++ b/python/specfempp/__init__.py @@ -1,5 +1,5 @@ from __future__ import annotations -from ._core import __doc__, __version__, add, subtract +from ._core import __doc__, __version__, run -__all__ = ["__doc__", "__version__", "add", "subtract"] +__all__ = ["__doc__", "__version__", "run"] diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index c63ab98fc..588573b44 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -21,6 +21,7 @@ #include #ifdef SPECFEMPP_ENABLE_PYTHON #include +#include #define STRINGIFY(x) #x #define MACRO_STRINGIFY(x) STRINGIFY(x) #endif @@ -250,35 +251,40 @@ void execute(const std::string ¶meter_file, const std::string &default_file, #ifdef SPECFEMPP_ENABLE_PYTHON -int add(int i, int j) { return i + j; } - namespace py = pybind11; +void run(py::str parameters_file) { + int argc = 0; + char **argv = NULL; + // Initialize MPI + specfem::MPI::MPI *mpi = new specfem::MPI::MPI(&argc, &argv); + // Initialize Kokkos + Kokkos::initialize(argc, argv); + { + execute(parameters_file.cast(), + parameters_file.cast(), mpi); + } + // Finalize Kokkos + Kokkos::finalize(); + // Finalize MPI + delete mpi; +} + PYBIND11_MODULE(_core, m) { m.doc() = R"pbdoc( - Pybind11 example plugin + SPECfem++ core module ----------------------- - .. currentmodule:: scikit_build_example + .. currentmodule:: specfempp .. autosummary:: :toctree: _generate - add - subtract + run )pbdoc"; - m.def("add", &add, R"pbdoc( - Add two numbers - - Some other explanation about the add function. - )pbdoc"); - - m.def("subtract", [](int i, int j) { - return i - j; }, R"pbdoc( - Subtract two numbers - - Some other explanation about the subtract function. + m.def("run", &run, R"pbdoc( + Execute the main SPECFEM++ workflow. )pbdoc"); #ifdef VERSION_INFO From af583cdf1124365de47c96f2f86c8d2037d44eb3 Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Wed, 27 Nov 2024 15:49:48 -0500 Subject: [PATCH 09/17] Add argv input for Python --- python/specfempp/__init__.py | 4 +-- src/specfem2d.cpp | 68 +++++++++++++++++++----------------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/python/specfempp/__init__.py b/python/specfempp/__init__.py index 2be7a8a3d..ac49a43db 100644 --- a/python/specfempp/__init__.py +++ b/python/specfempp/__init__.py @@ -1,5 +1,5 @@ from __future__ import annotations -from ._core import __doc__, __version__, run +from ._core import __doc__, __version__, _run -__all__ = ["__doc__", "__version__", "run"] +__all__ = ["__doc__", "__version__", "_run"] diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index 588573b44..b24f3de27 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -249,25 +249,49 @@ void execute(const std::string ¶meter_file, const std::string &default_file, return; } -#ifdef SPECFEMPP_ENABLE_PYTHON - -namespace py = pybind11; - -void run(py::str parameters_file) { - int argc = 0; - char **argv = NULL; +int run(int argc, char **argv) { // Initialize MPI specfem::MPI::MPI *mpi = new specfem::MPI::MPI(&argc, &argv); // Initialize Kokkos Kokkos::initialize(argc, argv); { - execute(parameters_file.cast(), - parameters_file.cast(), mpi); + boost::program_options::variables_map vm; + if (parse_args(argc, argv, vm)) { + const std::string parameters_file = + vm["parameters_file"].as(); + const std::string default_file = vm["default_file"].as(); + execute(parameters_file, default_file, mpi); + } } // Finalize Kokkos Kokkos::finalize(); // Finalize MPI delete mpi; + return 0; +} + +#ifdef SPECFEMPP_ENABLE_PYTHON + +namespace py = pybind11; + +int _run(py::list argv_py) { + // parse argc and argv from Python + int argc = argv_py.size(); + char **argv = new char *[argc]; + + for (size_t i = 0; i < argc; i++) { + std::string str = + argv_py[i].cast(); // Convert Python string to std::string + argv[i] = + new char[str.length() + 1]; // Allocate memory for each C-style string + std::strcpy(argv[i], str.c_str()); // Copy the string content + } + + int return_code = run(argc, argv); + + delete[] argv; + + return return_code; } PYBIND11_MODULE(_core, m) { @@ -280,10 +304,10 @@ PYBIND11_MODULE(_core, m) { .. autosummary:: :toctree: _generate - run + _run )pbdoc"; - m.def("run", &run, R"pbdoc( + m.def("_run", &_run, R"pbdoc( Execute the main SPECFEM++ workflow. )pbdoc"); @@ -296,24 +320,4 @@ PYBIND11_MODULE(_core, m) { #endif -int main(int argc, char **argv) { - - // Initialize MPI - specfem::MPI::MPI *mpi = new specfem::MPI::MPI(&argc, &argv); - // Initialize Kokkos - Kokkos::initialize(argc, argv); - { - boost::program_options::variables_map vm; - if (parse_args(argc, argv, vm)) { - const std::string parameters_file = - vm["parameters_file"].as(); - const std::string default_file = vm["default_file"].as(); - execute(parameters_file, default_file, mpi); - } - } - // Finalize Kokkos - Kokkos::finalize(); - // Finalize MPI - delete mpi; - return 0; -} +int main(int argc, char **argv) { return run(argc, argv); } From 250236b70ee7a1190409cb90ef2729dc5754ee9f Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Mon, 2 Dec 2024 11:01:04 -0500 Subject: [PATCH 10/17] Update for MPI_PARALLEL flag --- include/specfem_mpi/specfem_mpi.hpp | 10 +++++++--- src/specfem2d.cpp | 8 +++++++- src/specfem_mpi/specfem_mpi.cpp | 10 ++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/include/specfem_mpi/specfem_mpi.hpp b/include/specfem_mpi/specfem_mpi.hpp index ac1724373..93a7f0e44 100644 --- a/include/specfem_mpi/specfem_mpi.hpp +++ b/include/specfem_mpi/specfem_mpi.hpp @@ -18,7 +18,10 @@ namespace MPI { * Incase specfem is compiled without MPI then I need placeholders for reducer * types */ -enum reduce_type { sum = MPI_SUM, min = MPI_MIN, max = MPI_MAX }; +using reduce_type = MPI_Op; +const MPI_Op sum = MPI_SUM; +const MPI_Op min = MPI_MIN; +const MPI_Op max = MPI_MAX; #else /** * @brief MPI reducer type @@ -224,8 +227,9 @@ class MPI { void bcast(double &val, int root) const; private: - int world_size; ///< total number of MPI processes - int my_rank; ///< rank of my process + int world_size; ///< total number of MPI processes + int my_rank; ///< rank of my process + int extern_init; ///< flag to check if MPI was initialized outside SPECFEM #ifdef MPI_PARALLEL MPI_Comm comm; ///< MPI communicator #endif diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index b24f3de27..614044339 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -277,7 +277,7 @@ namespace py = pybind11; int _run(py::list argv_py) { // parse argc and argv from Python int argc = argv_py.size(); - char **argv = new char *[argc]; + char **argv = new char *[argc + 1]; for (size_t i = 0; i < argc; i++) { std::string str = @@ -287,8 +287,14 @@ int _run(py::list argv_py) { std::strcpy(argv[i], str.c_str()); // Copy the string content } + argv[argc] = nullptr; // Null-terminate argv following the specification + int return_code = run(argc, argv); + for (int i = 0; i < argc; i++) { + delete[] argv[i]; // Free each individual string + } + delete[] argv; return return_code; diff --git a/src/specfem_mpi/specfem_mpi.cpp b/src/specfem_mpi/specfem_mpi.cpp index 993d48500..529f7e32a 100644 --- a/src/specfem_mpi/specfem_mpi.cpp +++ b/src/specfem_mpi/specfem_mpi.cpp @@ -7,13 +7,17 @@ specfem::MPI::MPI::MPI(int *argc, char ***argv) { #ifdef MPI_PARALLEL - MPI_Init(argc, argv); + MPI_Initialized(&this->extern_init); + if (!this->extern_init) { + MPI_Init(argc, argv); + } this->comm = MPI_COMM_WORLD; MPI_Comm_size(this->comm, &this->world_size); MPI_Comm_rank(this->comm, &this->my_rank); #else this->world_size = 1; this->my_rank = 0; + this->extern_init = 0; #endif } @@ -25,7 +29,9 @@ void specfem::MPI::MPI::sync_all() const { specfem::MPI::MPI::~MPI() { #ifdef MPI_PARALLEL - MPI_Finalize(); + if (!this->extern_init) { + MPI_Finalize(); + } #endif } From d48d5503cf68132db134a6576869ca62e931528e Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Tue, 3 Dec 2024 12:02:13 -0500 Subject: [PATCH 11/17] Make MPI_Op static --- include/specfem_mpi/specfem_mpi.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/specfem_mpi/specfem_mpi.hpp b/include/specfem_mpi/specfem_mpi.hpp index 93a7f0e44..fa7ff07b7 100644 --- a/include/specfem_mpi/specfem_mpi.hpp +++ b/include/specfem_mpi/specfem_mpi.hpp @@ -19,9 +19,9 @@ namespace MPI { * types */ using reduce_type = MPI_Op; -const MPI_Op sum = MPI_SUM; -const MPI_Op min = MPI_MIN; -const MPI_Op max = MPI_MAX; +const static MPI_Op sum = MPI_SUM; +const static MPI_Op min = MPI_MIN; +const static MPI_Op max = MPI_MAX; #else /** * @brief MPI reducer type From 370773eaa1a429a4ad7b82523aa6a2234ffc64fb Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Wed, 4 Dec 2024 16:34:02 -0500 Subject: [PATCH 12/17] Move python/specfempp to submodule --- python/specfempp/__init__.py | 5 ----- python/specfempp/__init__.pyi | 19 ------------------- 2 files changed, 24 deletions(-) delete mode 100644 python/specfempp/__init__.py delete mode 100644 python/specfempp/__init__.pyi diff --git a/python/specfempp/__init__.py b/python/specfempp/__init__.py deleted file mode 100644 index ac49a43db..000000000 --- a/python/specfempp/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from __future__ import annotations - -from ._core import __doc__, __version__, _run - -__all__ = ["__doc__", "__version__", "_run"] diff --git a/python/specfempp/__init__.pyi b/python/specfempp/__init__.pyi deleted file mode 100644 index 79a83e22f..000000000 --- a/python/specfempp/__init__.pyi +++ /dev/null @@ -1,19 +0,0 @@ -""" -Pybind11 example plugin ------------------------ - -.. currentmodule:: scikit_build_example - -.. autosummary:: - :toctree: _generate - - add - subtract -""" - -def add(i: int, j: int) -> int: - """ - Add two numbers - - Some other explanation about the add function. - """ From f24d8d1469891f1805df5418dc5434ae8cab840d Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Wed, 4 Dec 2024 16:34:56 -0500 Subject: [PATCH 13/17] Add python submodule --- .gitmodules | 3 +++ python/specfempp | 1 + 2 files changed, 4 insertions(+) create mode 160000 python/specfempp diff --git a/.gitmodules b/.gitmodules index 32a82c8d6..3ef86956f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "boost-cmake"] path = boost-cmake url = https://github.com/Orphis/boost-cmake.git +[submodule "python/specfempp"] + path = python/specfempp + url = https://github.com/PrincetonUniversity/specfempp-py.git diff --git a/python/specfempp b/python/specfempp new file mode 160000 index 000000000..803ab9f23 --- /dev/null +++ b/python/specfempp @@ -0,0 +1 @@ +Subproject commit 803ab9f23523b22e710332be069a862e2a1c1cd4 From ef6d3c4f2f9cf66616df63488d04118a1781395f Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Fri, 6 Dec 2024 09:39:12 -0500 Subject: [PATCH 14/17] Remove submodule --- .gitmodules | 3 --- python/specfempp | 1 - 2 files changed, 4 deletions(-) delete mode 160000 python/specfempp diff --git a/.gitmodules b/.gitmodules index 3ef86956f..32a82c8d6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "boost-cmake"] path = boost-cmake url = https://github.com/Orphis/boost-cmake.git -[submodule "python/specfempp"] - path = python/specfempp - url = https://github.com/PrincetonUniversity/specfempp-py.git diff --git a/python/specfempp b/python/specfempp deleted file mode 160000 index 803ab9f23..000000000 --- a/python/specfempp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 803ab9f23523b22e710332be069a862e2a1c1cd4 From ab970d189a8caa7cb4ce51fd3a85ad64c661baa1 Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Fri, 6 Dec 2024 10:02:42 -0500 Subject: [PATCH 15/17] rename python package to specfempp_core --- CMakeLists.txt | 6 +++--- pyproject.toml | 2 +- python/specfempp_core/__init__.py | 5 +++++ python/specfempp_core/__init__.pyi | 20 ++++++++++++++++++++ 4 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 python/specfempp_core/__init__.py create mode 100644 python/specfempp_core/__init__.pyi diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e32ca78b..ee56c0443 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -547,10 +547,10 @@ else (DOXYGEN_FOUND) message("Doxygen need to be installed to generate the doxygen documentation") endif (DOXYGEN_FOUND) -if (SPECFEMPP_USE_SKBUILD) +if (SPECFEMPP_USE_SKBUILD AND EXISTS ${SKBUILD_SCRIPTS_DIR}) install(TARGETS specfem2d DESTINATION ${SKBUILD_SCRIPTS_DIR}) install(FILES ${CMAKE_BINARY_DIR}/xmeshfem2D DESTINATION ${SKBUILD_SCRIPTS_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) -endif (SPECFEMPP_USE_SKBUILD) +endif () if (SPECFEMPP_ENABLE_PYTHON) find_package(Python REQUIRED COMPONENTS Interpreter Development.Module) @@ -577,5 +577,5 @@ if (SPECFEMPP_ENABLE_PYTHON) ) target_compile_definitions(_core PRIVATE SPECFEMPP_ENABLE_PYTHON) target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION}) - install(TARGETS _core DESTINATION specfempp) + install(TARGETS _core DESTINATION specfempp_core) endif (SPECFEMPP_ENABLE_PYTHON) diff --git a/pyproject.toml b/pyproject.toml index c3dd16974..1788df8f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["scikit-build-core>=0.10", "pybind11"] build-backend = "scikit_build_core.build" [project] -name = "specfempp" +name = "specfempp_core" version = "0.1.0" description = "Kokkos implementation of SpecFEM2D code" readme = "README.md" diff --git a/python/specfempp_core/__init__.py b/python/specfempp_core/__init__.py new file mode 100644 index 000000000..ac49a43db --- /dev/null +++ b/python/specfempp_core/__init__.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from ._core import __doc__, __version__, _run + +__all__ = ["__doc__", "__version__", "_run"] diff --git a/python/specfempp_core/__init__.pyi b/python/specfempp_core/__init__.pyi new file mode 100644 index 000000000..5b21b9ea8 --- /dev/null +++ b/python/specfempp_core/__init__.pyi @@ -0,0 +1,20 @@ +""" +SPECFEM++ Python +----------------------- + +.. currentmodule:: specfempp + +.. autosummary:: + :toctree: _generate + + _run + subtract +""" + +def _run(argv: list[str]) -> int: + """ + Run main specfem workflow + + Args: + argv: list of command line arguments for initializing MPI and Kokkos + """ From de957895a127389186c9a87bec1277583a17736e Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Fri, 6 Dec 2024 10:15:12 -0500 Subject: [PATCH 16/17] Rename MPI type --- include/specfem_mpi/specfem_mpi.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/specfem_mpi/specfem_mpi.hpp b/include/specfem_mpi/specfem_mpi.hpp index fa7ff07b7..9843f2642 100644 --- a/include/specfem_mpi/specfem_mpi.hpp +++ b/include/specfem_mpi/specfem_mpi.hpp @@ -19,9 +19,9 @@ namespace MPI { * types */ using reduce_type = MPI_Op; -const static MPI_Op sum = MPI_SUM; -const static MPI_Op min = MPI_MIN; -const static MPI_Op max = MPI_MAX; +const static reduce_type sum = MPI_SUM; +const static reduce_type min = MPI_MIN; +const static reduce_type max = MPI_MAX; #else /** * @brief MPI reducer type From 57de45b675de3043bb2dec0986f3d3d3ab752c28 Mon Sep 17 00:00:00 2001 From: Congyue Cui Date: Fri, 6 Dec 2024 11:22:07 -0500 Subject: [PATCH 17/17] Add cmake option for python --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee56c0443..beabef630 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ option(BUILD_TESTS "Tests included" OFF) option(BUILD_EXAMPLES "Examples included" OFF) option(ENABLE_SIMD "Enable SIMD" OFF) option(ENABLE_PROFILING "Enable profiling" OFF) +option(SPECFEMPP_ENABLE_PYTHON "Enable Python binding" OFF) # set(CMAKE_BUILD_TYPE Release) set(CHUNK_SIZE 32) set(NUM_CHUNKS 1)