diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index f00546af..1af459b9 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -30,3 +30,50 @@ jobs: with: doc_target: "tensorwrapper_cxx_api" secrets: inherit + + platform_matrix: + uses: NWChemEx/.github/.github/workflows/platform_matrix.yaml@master + + build_pypi_dist: + needs: [tag-commit, platform_matrix] + strategy: + fail-fast: false + matrix: + include: ${{ fromJSON(needs.platform_matrix.outputs.release_matrix) }} + runs-on: ${{ matrix.os }} + steps: + - name: Build PyPI Distribution + uses: NWChemEx/.github/.github/actions/build_pypi_dist@master + with: + cibw_build: ${{ matrix.cibw_build }} + build_sdist: ${{ matrix.os == 'ubuntu-latest' && 'true' || 'false' }} + needs_mpi: "true" + needs_boost: "true" + + - name: Upload Distribution Artifact + uses: actions/upload-artifact@v4 + with: + name: dist-${{ matrix.os }} + path: dist/ + + # A separate, ubuntu-only publish job (rather than a publish step per + # build_pypi_dist leg) because pypa/gh-action-pypi-publish only runs on + # Linux, and because PyPI trusted publishing does not support reusable + # workflows (this job must be defined directly here, not delegated). + deploy_to_pypi: + needs: build_pypi_dist + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - name: Download All Distributions + uses: actions/download-artifact@v4 + with: + pattern: dist-* + path: dist + merge-multiple: true + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist/ diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index e6fa7276..b9009396 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -14,19 +14,26 @@ # name: Nightly Workflow +# Re-runs the same build/test jobs pull_request.yaml runs, on a schedule, to +# catch breakage that originates outside the repo (upstream dependency +# releases, refreshed GitHub runner images) rather than from a code change. +# Keep the job list below in sync with pull_request.yaml. on: schedule: - cron: "0 6 * * *" # Every day at 06:00 UTC (00:00 CST) jobs: - test_library: - uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master + test_cmake_build: + uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master with: - compilers: '["gcc-14", "clang-18"]' + run_python_tests: "true" - test_library_with_sigma: - uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master + test_cmake_build_with_sigma: + uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master with: - compilers: '["gcc-14", "clang-18"]' - repo_toolchain: ".github/enable_sigma.cmake" + run_python_tests: "true" + cmake_opts: "-DENABLE_SIGMA=ON" + + test_pip_build: + uses: NWChemEx/.github/.github/workflows/test_nwx_pip_build.yaml@master diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 18dd6915..60f35e32 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -29,13 +29,16 @@ jobs: with: doc_target: "tensorwrapper_cxx_api" - test_library: - uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master + test_cmake_build: + uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master with: - compilers: '["gcc-14", "clang-18"]' + run_python_tests: "true" - test_library_with_sigma: - uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master + test_cmake_build_with_sigma: + uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master with: - compilers: '["gcc-14", "clang-18"]' - repo_toolchain: ".github/enable_sigma.cmake" + run_python_tests: "true" + cmake_opts: "-DENABLE_SIGMA=ON" + + test_pip_build: + uses: NWChemEx/.github/.github/workflows/test_nwx_pip_build.yaml@master diff --git a/.gitignore b/.gitignore index 2715503b..b858a256 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,9 @@ install/ toolchain.cmake .devcontainers/ + +# These are MacOS files +.DS_Store + +# Automatically installed in dev mode +.pre-commit-config.yaml diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b1f5624..ee965c40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2022 NWChemEx-Project +# Copyright 2026 NWChemEx-Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,168 +14,68 @@ cmake_minimum_required(VERSION 3.14) -# Downloads common CMake modules used throughout NWChemEx +# Downloads common CMake modules used throughout NWChemEx. Included before +# project() so nwx_set_version() is available to compute the version. include(cmake/get_nwx_cmake.cmake) -#Sets the version to whatever git thinks it is -include(get_version_from_git) -get_version_from_git(tensorwrapper_version "${CMAKE_CURRENT_LIST_DIR}") -set(CMAKE_CXX_STANDARD 20) -project(tensorwrapper VERSION "${tensorwrapper_version}" LANGUAGES CXX) +# Version from scikit-build-core (wheels/sdists) or the latest git tag. +include(nwx_set_version) +nwx_set_version(tw_version "${CMAKE_CURRENT_LIST_DIR}") +project(tensorwrapper VERSION "${tw_version}" LANGUAGES CXX) -include(get_cmaize) +include(disable_in_source_builds) +include(set_default_nwx_options) +option(ENABLE_CUTENSOR "Enable cuTENSOR GPU backend" OFF) -# Work out full paths to the project's include/src dirs -set(project_inc_dir "${CMAKE_CURRENT_LIST_DIR}/include/${PROJECT_NAME}") -set(project_src_dir "${CMAKE_CURRENT_LIST_DIR}/src/${PROJECT_NAME}") - -# Documentation +# Documentation target include(nwx_cxx_api_docs) -nwx_cxx_api_docs("${project_inc_dir}" "${project_src_dir}") - -## Extensions ## -set(SOURCE_EXTS "cpp") -set(INCLUDE_EXTS "hpp") +nwx_cxx_api_docs("cxx/include" "cxx/src") -### Options ### -cmaize_option_list( - BUILD_TESTING OFF "Should we build the tests?" - BUILD_PYBIND11_PYBINDINGS ON "Should we build Python3 bindings?" - ENABLE_SIGMA OFF "Should we enable Sigma for uncertainty tracking?" - ENABLE_CUTENSOR OFF "Should we enable cuTENSOR?" -) +# Dependencies +include(get_dependencies) +get_dependencies(utilities parallelzone wtf eigen boost) -if("${ENABLE_CUTENSOR}") - if("${ENABLE_SIGMA}") - set(MSG "Sigma is not compatible with cuTENSOR. Turning Sigma OFF.") - message(WARNING ${MSG}) - set(ENABLE_SIGMA OFF) - endif() - enable_language(CUDA) - set(SOURCE_EXTS ${SOURCE_EXTS} cu) - set(INCLUDE_EXTS ${INCLUDE_EXTS} cuh hu) - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr") -endif() +# TODO: ENABLE_CUTENSOR handling -### Dependendencies ### -include(get_utilities) +# Build the library +include(nwx_library) +nwx_library(${PROJECT_NAME} "cxx/include" "cxx/src" + utilities parallelzone wtf + PUBLIC eigen boost) -include(get_parallelzone) +# Generated config headers (e.g. from configure_file) live in binary dir +target_include_directories(${PROJECT_NAME} PUBLIC + $) -find_package(Boost REQUIRED) +# Python module +include(nwx_python_module) +nwx_python_module(${PROJECT_NAME} "cxx/src") -cmaize_find_or_build_dependency( - eigen - NAME Eigen3 - URL https://www.gitlab.com/libeigen/eigen - VERSION 2e76277bd049f7bec36b0f908c69734a42c5234f - BUILD_TARGET eigen - FIND_TARGET Eigen3::Eigen -) - -cmaize_find_or_build_optional_dependency( - sigma - ENABLE_SIGMA - URL github.com/QCUncertainty/sigma - VERSION main - BUILD_TARGET sigma - FIND_TARGET sigma::sigma - CMAKE_ARGS BUILD_TESTING=OFF - ENABLE_EIGEN_SUPPORT=ON -) - -cmaize_find_or_build_dependency( - WeaklyTypedFloat - NAME wtf - URL https://www.github.com/NWChemEx/weaklytypedfloat - VERSION master - BUILD_TARGET wtf - FIND_TARGET nwx::wtf - CMAKE_ARGS BUILD_TESTING=OFF -) - -set(DEPENDENCIES - utilities parallelzone Boost::boost eigen sigma WeaklyTypedFloat +# C++ tests +include(catch2_tests_from_dir) +catch2_tests_from_dir( + "unit_test_${PROJECT_NAME}" + "tests/cxx/unit_tests/${PROJECT_NAME}" + ${PROJECT_NAME} + PRIVATE_INCLUDES cxx/src ) - -if("${ENABLE_CUTENSOR}") - include(cmake/FindcuTENSOR.cmake) - list(APPEND DEPENDENCIES cuTENSOR::cuTENSOR) -endif() - -cmaize_add_library( +catch2_tests_from_dir( + "test_acceptance_${PROJECT_NAME}" + "tests/cxx/acceptance_tests/${PROJECT_NAME}" ${PROJECT_NAME} - SOURCE_DIR "${project_src_dir}" - SOURCE_EXTS "${SOURCE_EXTS}" - INCLUDE_DIRS "${project_inc_dir}" - INCLUDE_EXTS "${INCLUDE_EXTS}" - DEPENDS "${DEPENDENCIES}" + PRIVATE_INCLUDES cxx/src ) -target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") - -if("${ENABLE_CUTENSOR}") - target_compile_definitions("${PROJECT_NAME}" PUBLIC ENABLE_CUTENSOR) -endif() - -include(nwx_pybind11) -nwx_add_pybind11_module( +catch2_tests_from_dir( + "test_performance_${PROJECT_NAME}" + "tests/cxx/performance_tests/${PROJECT_NAME}" ${PROJECT_NAME} - SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/src/python" - DEPENDS "${PROJECT_NAME}" + PRIVATE_INCLUDES cxx/src ) - -if("${BUILD_TESTING}") - set(cxx_test_dir "${CMAKE_CURRENT_LIST_DIR}/tests/cxx") - set(cxx_unit_test_dir "${cxx_test_dir}/unit_tests/${PROJECT_NAME}") - set( - cxx_acceptance_test_dir - "${cxx_test_dir}/acceptance_tests/${PROJECT_NAME}" - ) - set( - cxx_performance_test_dir - "${cxx_test_dir}/performance_tests/${PROJECT_NAME}" - ) - set(python_test_dir "${CMAKE_CURRENT_LIST_DIR}/tests/python") - set(python_unit_test_dir "${python_test_dir}/unit_tests") - - include(get_catch2) - - cmaize_add_tests( - test_unit_${PROJECT_NAME} - SOURCE_DIR "${cxx_unit_test_dir}" - INCLUDE_DIRS "${project_src_dir}" - DEPENDS Catch2 ${PROJECT_NAME} - ) - - cmaize_add_tests( - test_performance_${PROJECT_NAME} - SOURCE_DIR "${cxx_performance_test_dir}" - INCLUDE_DIRS "${project_src_dir}" - DEPENDS Catch2 ${PROJECT_NAME} - ) - - cmaize_add_tests( - acceptance_test_${PROJECT_NAME} - SOURCE_DIR "${cxx_acceptance_test_dir}" - INCLUDE_DIRS "${project_src_dir}" - DEPENDS Catch2 ${PROJECT_NAME} - ) - - - nwx_add_pybind11_module( - py_test_${PROJECT_NAME} - INSTALL OFF - SOURCE_DIR "${python_unit_test_dir}" - INCLUDE_DIRS "${project_inc_dir}" - DEPENDS ${PROJECT_NAME} - ) - - nwx_pybind11_tests( - py_${PROJECT_NAME} ${python_unit_test_dir}/test_tensorwrapper.py - SUBMODULES parallelzone pluginplay - DEPENDS py_test_${PROJECT_NAME} - ) +# py_test_tensorwrapper: a pybind11 module exposing C++ test fixtures to +# tests/python/unit_tests/*.py (e.g. tensor/test_tensor.py imports +# py_test_tensorwrapper.testing). Not part of the installed package -- +# test-only, built in place alongside the other test binaries. +if(BUILD_PYBIND11_BINDINGS AND BUILD_TESTING) + nwx_python_module(py_test_tensorwrapper "tests/python/unit_tests" NO_INSTALL) endif() - -cmaize_add_package(${PROJECT_NAME} NAMESPACE nwx::) diff --git a/cmake/get_nwx_cmake.cmake b/cmake/get_nwx_cmake.cmake index de8c4bca..9188ad48 100644 --- a/cmake/get_nwx_cmake.cmake +++ b/cmake/get_nwx_cmake.cmake @@ -14,18 +14,66 @@ include_guard() +# Puts the shared NWXCMake modules on CMAKE_MODULE_PATH. This runs *before* +# project() so factored helpers (e.g. nwx_set_version) are available to feed +# project(VERSION ...). +# +# Resolution order: +# 1. A pip-installed `nwxcmake` package (query it for its cmake/ dir). An +# editable install (`pip install -e /path/to/NWXCMake`) points at a local +# working copy, so NWXCMake edits are picked up with no git push. +# 2. Fallback: FetchContent from github.com/NWChemEx/NWXCMake. macro(get_nwx_cmake) - include(FetchContent) - FetchContent_Declare( - nwx_cmake - GIT_REPOSITORY https://github.com/NWChemEx/NWXCMake - ) - FetchContent_MakeAvailable(nwx_cmake) - set( - CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${nwx_cmake_SOURCE_DIR}/cmake" - CACHE STRING "" - FORCE - ) + if(NOT _NWX_CMAKE_MODULE_DIR) + # find_package(Python) needs no enabled language, so it is safe here, + # before project(). Request only the interpreter to avoid a dev/compiler + # probe this early. + find_package(Python QUIET COMPONENTS Interpreter) + + set(_gnc_local_dir "") + if(Python_Interpreter_FOUND) + execute_process( + COMMAND "${Python_EXECUTABLE}" -c + "import nwxcmake,sys;sys.stdout.write(nwxcmake.cmake_dir())" + OUTPUT_VARIABLE _gnc_local_dir + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE _gnc_rc + ERROR_QUIET + ) + if(NOT _gnc_rc EQUAL 0) + set(_gnc_local_dir "") + endif() + endif() + + if(_gnc_local_dir AND IS_DIRECTORY "${_gnc_local_dir}") + message(STATUS + "NWXCMake: using local pip package at ${_gnc_local_dir}" + ) + set(_gnc_resolved "${_gnc_local_dir}") + else() + message(STATUS + "NWXCMake: pip package not found; fetching from git" + ) + include(FetchContent) + FetchContent_Declare( + nwx_cmake + GIT_REPOSITORY https://github.com/NWChemEx/NWXCMake + ) + FetchContent_MakeAvailable(nwx_cmake) + set(_gnc_resolved "${nwx_cmake_SOURCE_DIR}/cmake") + endif() + + # Cache the resolved directory (not CMAKE_MODULE_PATH itself) so + # reconfigures are stable. Clear this var (or the build dir) to + # re-resolve after switching between the pip and git sources. + set(_NWX_CMAKE_MODULE_DIR "${_gnc_resolved}" + CACHE INTERNAL "Resolved NWXCMake module directory" + ) + endif() + + # Prepend so NWXCMake modules win; set in the caller's scope (macro), do not + # FORCE-cache CMAKE_MODULE_PATH (avoids accumulating stale entries). + list(PREPEND CMAKE_MODULE_PATH "${_NWX_CMAKE_MODULE_DIR}") endmacro() get_nwx_cmake() diff --git a/include/tensorwrapper/buffer/buffer.hpp b/cxx/include/tensorwrapper/buffer/buffer.hpp similarity index 100% rename from include/tensorwrapper/buffer/buffer.hpp rename to cxx/include/tensorwrapper/buffer/buffer.hpp diff --git a/include/tensorwrapper/buffer/buffer_base.hpp b/cxx/include/tensorwrapper/buffer/buffer_base.hpp similarity index 100% rename from include/tensorwrapper/buffer/buffer_base.hpp rename to cxx/include/tensorwrapper/buffer/buffer_base.hpp diff --git a/include/tensorwrapper/buffer/buffer_base_common.hpp b/cxx/include/tensorwrapper/buffer/buffer_base_common.hpp similarity index 100% rename from include/tensorwrapper/buffer/buffer_base_common.hpp rename to cxx/include/tensorwrapper/buffer/buffer_base_common.hpp diff --git a/include/tensorwrapper/buffer/buffer_fwd.hpp b/cxx/include/tensorwrapper/buffer/buffer_fwd.hpp similarity index 100% rename from include/tensorwrapper/buffer/buffer_fwd.hpp rename to cxx/include/tensorwrapper/buffer/buffer_fwd.hpp diff --git a/include/tensorwrapper/buffer/buffer_view_base.hpp b/cxx/include/tensorwrapper/buffer/buffer_view_base.hpp similarity index 100% rename from include/tensorwrapper/buffer/buffer_view_base.hpp rename to cxx/include/tensorwrapper/buffer/buffer_view_base.hpp diff --git a/include/tensorwrapper/buffer/contiguous.hpp b/cxx/include/tensorwrapper/buffer/contiguous.hpp similarity index 100% rename from include/tensorwrapper/buffer/contiguous.hpp rename to cxx/include/tensorwrapper/buffer/contiguous.hpp diff --git a/include/tensorwrapper/buffer/detail_/buffer_view_base_pimpl.hpp b/cxx/include/tensorwrapper/buffer/detail_/buffer_view_base_pimpl.hpp similarity index 100% rename from include/tensorwrapper/buffer/detail_/buffer_view_base_pimpl.hpp rename to cxx/include/tensorwrapper/buffer/detail_/buffer_view_base_pimpl.hpp diff --git a/include/tensorwrapper/buffer/local.hpp b/cxx/include/tensorwrapper/buffer/local.hpp similarity index 100% rename from include/tensorwrapper/buffer/local.hpp rename to cxx/include/tensorwrapper/buffer/local.hpp diff --git a/include/tensorwrapper/buffer/replicated.hpp b/cxx/include/tensorwrapper/buffer/replicated.hpp similarity index 100% rename from include/tensorwrapper/buffer/replicated.hpp rename to cxx/include/tensorwrapper/buffer/replicated.hpp diff --git a/include/tensorwrapper/buffer/replicated_common.hpp b/cxx/include/tensorwrapper/buffer/replicated_common.hpp similarity index 100% rename from include/tensorwrapper/buffer/replicated_common.hpp rename to cxx/include/tensorwrapper/buffer/replicated_common.hpp diff --git a/include/tensorwrapper/buffer/replicated_view.hpp b/cxx/include/tensorwrapper/buffer/replicated_view.hpp similarity index 100% rename from include/tensorwrapper/buffer/replicated_view.hpp rename to cxx/include/tensorwrapper/buffer/replicated_view.hpp diff --git a/include/tensorwrapper/concepts/floating_point.hpp b/cxx/include/tensorwrapper/concepts/floating_point.hpp similarity index 100% rename from include/tensorwrapper/concepts/floating_point.hpp rename to cxx/include/tensorwrapper/concepts/floating_point.hpp diff --git a/include/tensorwrapper/concepts/has_begin_end.hpp b/cxx/include/tensorwrapper/concepts/has_begin_end.hpp similarity index 100% rename from include/tensorwrapper/concepts/has_begin_end.hpp rename to cxx/include/tensorwrapper/concepts/has_begin_end.hpp diff --git a/include/tensorwrapper/detail_/detail_.hpp b/cxx/include/tensorwrapper/detail_/detail_.hpp similarity index 100% rename from include/tensorwrapper/detail_/detail_.hpp rename to cxx/include/tensorwrapper/detail_/detail_.hpp diff --git a/include/tensorwrapper/detail_/dsl_base.hpp b/cxx/include/tensorwrapper/detail_/dsl_base.hpp similarity index 100% rename from include/tensorwrapper/detail_/dsl_base.hpp rename to cxx/include/tensorwrapper/detail_/dsl_base.hpp diff --git a/include/tensorwrapper/detail_/dsl_base.ipp b/cxx/include/tensorwrapper/detail_/dsl_base.ipp similarity index 100% rename from include/tensorwrapper/detail_/dsl_base.ipp rename to cxx/include/tensorwrapper/detail_/dsl_base.ipp diff --git a/include/tensorwrapper/detail_/integer_utilities.hpp b/cxx/include/tensorwrapper/detail_/integer_utilities.hpp similarity index 100% rename from include/tensorwrapper/detail_/integer_utilities.hpp rename to cxx/include/tensorwrapper/detail_/integer_utilities.hpp diff --git a/include/tensorwrapper/detail_/polymorphic_base.hpp b/cxx/include/tensorwrapper/detail_/polymorphic_base.hpp similarity index 100% rename from include/tensorwrapper/detail_/polymorphic_base.hpp rename to cxx/include/tensorwrapper/detail_/polymorphic_base.hpp diff --git a/include/tensorwrapper/detail_/unique_ptr_utilities.hpp b/cxx/include/tensorwrapper/detail_/unique_ptr_utilities.hpp similarity index 100% rename from include/tensorwrapper/detail_/unique_ptr_utilities.hpp rename to cxx/include/tensorwrapper/detail_/unique_ptr_utilities.hpp diff --git a/include/tensorwrapper/detail_/view_traits.hpp b/cxx/include/tensorwrapper/detail_/view_traits.hpp similarity index 100% rename from include/tensorwrapper/detail_/view_traits.hpp rename to cxx/include/tensorwrapper/detail_/view_traits.hpp diff --git a/include/tensorwrapper/diis/diis.hpp b/cxx/include/tensorwrapper/diis/diis.hpp similarity index 98% rename from include/tensorwrapper/diis/diis.hpp rename to cxx/include/tensorwrapper/diis/diis.hpp index 3e94d55d..0625569e 100644 --- a/include/tensorwrapper/diis/diis.hpp +++ b/cxx/include/tensorwrapper/diis/diis.hpp @@ -15,9 +15,9 @@ */ #pragma once -#include "tensorwrapper/tensor/tensor.hpp" #include #include +#include /** TODO: This should probably be moved to TensorWrapper at a point when things * are more stable there. Also, this makes Eigen an explicit dependency of diff --git a/include/tensorwrapper/dsl/dsl.hpp b/cxx/include/tensorwrapper/dsl/dsl.hpp similarity index 100% rename from include/tensorwrapper/dsl/dsl.hpp rename to cxx/include/tensorwrapper/dsl/dsl.hpp diff --git a/include/tensorwrapper/dsl/dsl_forward.hpp b/cxx/include/tensorwrapper/dsl/dsl_forward.hpp similarity index 100% rename from include/tensorwrapper/dsl/dsl_forward.hpp rename to cxx/include/tensorwrapper/dsl/dsl_forward.hpp diff --git a/include/tensorwrapper/dsl/dummy_indices.hpp b/cxx/include/tensorwrapper/dsl/dummy_indices.hpp similarity index 100% rename from include/tensorwrapper/dsl/dummy_indices.hpp rename to cxx/include/tensorwrapper/dsl/dummy_indices.hpp diff --git a/include/tensorwrapper/dsl/labeled.hpp b/cxx/include/tensorwrapper/dsl/labeled.hpp similarity index 100% rename from include/tensorwrapper/dsl/labeled.hpp rename to cxx/include/tensorwrapper/dsl/labeled.hpp diff --git a/include/tensorwrapper/dsl/pairwise_parser.hpp b/cxx/include/tensorwrapper/dsl/pairwise_parser.hpp similarity index 100% rename from include/tensorwrapper/dsl/pairwise_parser.hpp rename to cxx/include/tensorwrapper/dsl/pairwise_parser.hpp diff --git a/include/tensorwrapper/forward_declarations.hpp b/cxx/include/tensorwrapper/forward_declarations.hpp similarity index 100% rename from include/tensorwrapper/forward_declarations.hpp rename to cxx/include/tensorwrapper/forward_declarations.hpp diff --git a/include/tensorwrapper/generate/add_noise.hpp b/cxx/include/tensorwrapper/generate/add_noise.hpp similarity index 100% rename from include/tensorwrapper/generate/add_noise.hpp rename to cxx/include/tensorwrapper/generate/add_noise.hpp diff --git a/include/tensorwrapper/generate/generate.hpp b/cxx/include/tensorwrapper/generate/generate.hpp similarity index 100% rename from include/tensorwrapper/generate/generate.hpp rename to cxx/include/tensorwrapper/generate/generate.hpp diff --git a/include/tensorwrapper/generate/generate_eigen_system.hpp b/cxx/include/tensorwrapper/generate/generate_eigen_system.hpp similarity index 100% rename from include/tensorwrapper/generate/generate_eigen_system.hpp rename to cxx/include/tensorwrapper/generate/generate_eigen_system.hpp diff --git a/include/tensorwrapper/generate/generate_eigenvalues.hpp b/cxx/include/tensorwrapper/generate/generate_eigenvalues.hpp similarity index 100% rename from include/tensorwrapper/generate/generate_eigenvalues.hpp rename to cxx/include/tensorwrapper/generate/generate_eigenvalues.hpp diff --git a/include/tensorwrapper/generate/generate_utils.hpp b/cxx/include/tensorwrapper/generate/generate_utils.hpp similarity index 100% rename from include/tensorwrapper/generate/generate_utils.hpp rename to cxx/include/tensorwrapper/generate/generate_utils.hpp diff --git a/include/tensorwrapper/generate/identity_matrix.hpp b/cxx/include/tensorwrapper/generate/identity_matrix.hpp similarity index 100% rename from include/tensorwrapper/generate/identity_matrix.hpp rename to cxx/include/tensorwrapper/generate/identity_matrix.hpp diff --git a/include/tensorwrapper/generate/random_orthogonal_matrix.hpp b/cxx/include/tensorwrapper/generate/random_orthogonal_matrix.hpp similarity index 100% rename from include/tensorwrapper/generate/random_orthogonal_matrix.hpp rename to cxx/include/tensorwrapper/generate/random_orthogonal_matrix.hpp diff --git a/include/tensorwrapper/interfaces/sliceable.hpp b/cxx/include/tensorwrapper/interfaces/sliceable.hpp similarity index 100% rename from include/tensorwrapper/interfaces/sliceable.hpp rename to cxx/include/tensorwrapper/interfaces/sliceable.hpp diff --git a/include/tensorwrapper/layout/layout.hpp b/cxx/include/tensorwrapper/layout/layout.hpp similarity index 100% rename from include/tensorwrapper/layout/layout.hpp rename to cxx/include/tensorwrapper/layout/layout.hpp diff --git a/include/tensorwrapper/layout/layout_base.hpp b/cxx/include/tensorwrapper/layout/layout_base.hpp similarity index 100% rename from include/tensorwrapper/layout/layout_base.hpp rename to cxx/include/tensorwrapper/layout/layout_base.hpp diff --git a/include/tensorwrapper/layout/layout_common.hpp b/cxx/include/tensorwrapper/layout/layout_common.hpp similarity index 100% rename from include/tensorwrapper/layout/layout_common.hpp rename to cxx/include/tensorwrapper/layout/layout_common.hpp diff --git a/include/tensorwrapper/layout/layout_fwd.hpp b/cxx/include/tensorwrapper/layout/layout_fwd.hpp similarity index 100% rename from include/tensorwrapper/layout/layout_fwd.hpp rename to cxx/include/tensorwrapper/layout/layout_fwd.hpp diff --git a/include/tensorwrapper/layout/logical.hpp b/cxx/include/tensorwrapper/layout/logical.hpp similarity index 100% rename from include/tensorwrapper/layout/logical.hpp rename to cxx/include/tensorwrapper/layout/logical.hpp diff --git a/include/tensorwrapper/layout/physical.hpp b/cxx/include/tensorwrapper/layout/physical.hpp similarity index 100% rename from include/tensorwrapper/layout/physical.hpp rename to cxx/include/tensorwrapper/layout/physical.hpp diff --git a/include/tensorwrapper/operations/approximately_equal.hpp b/cxx/include/tensorwrapper/operations/approximately_equal.hpp similarity index 100% rename from include/tensorwrapper/operations/approximately_equal.hpp rename to cxx/include/tensorwrapper/operations/approximately_equal.hpp diff --git a/include/tensorwrapper/operations/norm.hpp b/cxx/include/tensorwrapper/operations/norm.hpp similarity index 100% rename from include/tensorwrapper/operations/norm.hpp rename to cxx/include/tensorwrapper/operations/norm.hpp diff --git a/include/tensorwrapper/operations/operations.hpp b/cxx/include/tensorwrapper/operations/operations.hpp similarity index 100% rename from include/tensorwrapper/operations/operations.hpp rename to cxx/include/tensorwrapper/operations/operations.hpp diff --git a/include/tensorwrapper/operations/power.hpp b/cxx/include/tensorwrapper/operations/power.hpp similarity index 100% rename from include/tensorwrapper/operations/power.hpp rename to cxx/include/tensorwrapper/operations/power.hpp diff --git a/include/tensorwrapper/shape/shape.hpp b/cxx/include/tensorwrapper/shape/shape.hpp similarity index 100% rename from include/tensorwrapper/shape/shape.hpp rename to cxx/include/tensorwrapper/shape/shape.hpp diff --git a/include/tensorwrapper/shape/shape_base.hpp b/cxx/include/tensorwrapper/shape/shape_base.hpp similarity index 100% rename from include/tensorwrapper/shape/shape_base.hpp rename to cxx/include/tensorwrapper/shape/shape_base.hpp diff --git a/include/tensorwrapper/shape/shape_fwd.hpp b/cxx/include/tensorwrapper/shape/shape_fwd.hpp similarity index 100% rename from include/tensorwrapper/shape/shape_fwd.hpp rename to cxx/include/tensorwrapper/shape/shape_fwd.hpp diff --git a/include/tensorwrapper/shape/smooth.hpp b/cxx/include/tensorwrapper/shape/smooth.hpp similarity index 99% rename from include/tensorwrapper/shape/smooth.hpp rename to cxx/include/tensorwrapper/shape/smooth.hpp index 679b0210..7546fb49 100644 --- a/include/tensorwrapper/shape/smooth.hpp +++ b/cxx/include/tensorwrapper/shape/smooth.hpp @@ -17,8 +17,8 @@ #pragma once #include #include -#include #include +#include #include #include diff --git a/include/tensorwrapper/shape/smooth_common.hpp b/cxx/include/tensorwrapper/shape/smooth_common.hpp similarity index 100% rename from include/tensorwrapper/shape/smooth_common.hpp rename to cxx/include/tensorwrapper/shape/smooth_common.hpp diff --git a/include/tensorwrapper/shape/smooth_view.hpp b/cxx/include/tensorwrapper/shape/smooth_view.hpp similarity index 99% rename from include/tensorwrapper/shape/smooth_view.hpp rename to cxx/include/tensorwrapper/shape/smooth_view.hpp index 3dd24961..2f050df2 100644 --- a/include/tensorwrapper/shape/smooth_view.hpp +++ b/cxx/include/tensorwrapper/shape/smooth_view.hpp @@ -15,8 +15,8 @@ */ #pragma once -#include #include +#include #include namespace tensorwrapper::shape { diff --git a/include/tensorwrapper/sparsity/pattern.hpp b/cxx/include/tensorwrapper/sparsity/pattern.hpp similarity index 100% rename from include/tensorwrapper/sparsity/pattern.hpp rename to cxx/include/tensorwrapper/sparsity/pattern.hpp diff --git a/include/tensorwrapper/sparsity/sparsity.hpp b/cxx/include/tensorwrapper/sparsity/sparsity.hpp similarity index 100% rename from include/tensorwrapper/sparsity/sparsity.hpp rename to cxx/include/tensorwrapper/sparsity/sparsity.hpp diff --git a/include/tensorwrapper/sparsity/sparsity_fwd.hpp b/cxx/include/tensorwrapper/sparsity/sparsity_fwd.hpp similarity index 100% rename from include/tensorwrapper/sparsity/sparsity_fwd.hpp rename to cxx/include/tensorwrapper/sparsity/sparsity_fwd.hpp diff --git a/include/tensorwrapper/symmetry/group.hpp b/cxx/include/tensorwrapper/symmetry/group.hpp similarity index 100% rename from include/tensorwrapper/symmetry/group.hpp rename to cxx/include/tensorwrapper/symmetry/group.hpp diff --git a/include/tensorwrapper/symmetry/operation.hpp b/cxx/include/tensorwrapper/symmetry/operation.hpp similarity index 100% rename from include/tensorwrapper/symmetry/operation.hpp rename to cxx/include/tensorwrapper/symmetry/operation.hpp diff --git a/include/tensorwrapper/symmetry/permutation.hpp b/cxx/include/tensorwrapper/symmetry/permutation.hpp similarity index 100% rename from include/tensorwrapper/symmetry/permutation.hpp rename to cxx/include/tensorwrapper/symmetry/permutation.hpp diff --git a/include/tensorwrapper/symmetry/symmetry.hpp b/cxx/include/tensorwrapper/symmetry/symmetry.hpp similarity index 100% rename from include/tensorwrapper/symmetry/symmetry.hpp rename to cxx/include/tensorwrapper/symmetry/symmetry.hpp diff --git a/include/tensorwrapper/symmetry/symmetry_fwd.hpp b/cxx/include/tensorwrapper/symmetry/symmetry_fwd.hpp similarity index 100% rename from include/tensorwrapper/symmetry/symmetry_fwd.hpp rename to cxx/include/tensorwrapper/symmetry/symmetry_fwd.hpp diff --git a/include/tensorwrapper/tensor/detail_/tensor_input.hpp b/cxx/include/tensorwrapper/tensor/detail_/tensor_input.hpp similarity index 100% rename from include/tensorwrapper/tensor/detail_/tensor_input.hpp rename to cxx/include/tensorwrapper/tensor/detail_/tensor_input.hpp diff --git a/include/tensorwrapper/tensor/tensor.hpp b/cxx/include/tensorwrapper/tensor/tensor.hpp similarity index 100% rename from include/tensorwrapper/tensor/tensor.hpp rename to cxx/include/tensorwrapper/tensor/tensor.hpp diff --git a/include/tensorwrapper/tensor/tensor_class.hpp b/cxx/include/tensorwrapper/tensor/tensor_class.hpp similarity index 100% rename from include/tensorwrapper/tensor/tensor_class.hpp rename to cxx/include/tensorwrapper/tensor/tensor_class.hpp diff --git a/include/tensorwrapper/tensorwrapper.hpp b/cxx/include/tensorwrapper/tensorwrapper.hpp similarity index 100% rename from include/tensorwrapper/tensorwrapper.hpp rename to cxx/include/tensorwrapper/tensorwrapper.hpp diff --git a/include/tensorwrapper/types/buffer_traits.hpp b/cxx/include/tensorwrapper/types/buffer_traits.hpp similarity index 100% rename from include/tensorwrapper/types/buffer_traits.hpp rename to cxx/include/tensorwrapper/types/buffer_traits.hpp diff --git a/include/tensorwrapper/types/class_traits.hpp b/cxx/include/tensorwrapper/types/class_traits.hpp similarity index 100% rename from include/tensorwrapper/types/class_traits.hpp rename to cxx/include/tensorwrapper/types/class_traits.hpp diff --git a/include/tensorwrapper/types/common_types.hpp b/cxx/include/tensorwrapper/types/common_types.hpp similarity index 100% rename from include/tensorwrapper/types/common_types.hpp rename to cxx/include/tensorwrapper/types/common_types.hpp diff --git a/include/tensorwrapper/types/floating_point.hpp b/cxx/include/tensorwrapper/types/floating_point.hpp similarity index 100% rename from include/tensorwrapper/types/floating_point.hpp rename to cxx/include/tensorwrapper/types/floating_point.hpp diff --git a/include/tensorwrapper/types/il_traits.hpp b/cxx/include/tensorwrapper/types/il_traits.hpp similarity index 100% rename from include/tensorwrapper/types/il_traits.hpp rename to cxx/include/tensorwrapper/types/il_traits.hpp diff --git a/include/tensorwrapper/types/layout_traits.hpp b/cxx/include/tensorwrapper/types/layout_traits.hpp similarity index 95% rename from include/tensorwrapper/types/layout_traits.hpp rename to cxx/include/tensorwrapper/types/layout_traits.hpp index 570f2218..c6c8864a 100644 --- a/include/tensorwrapper/types/layout_traits.hpp +++ b/cxx/include/tensorwrapper/types/layout_traits.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include "layout/layout_base.hpp" +#include #include #include #include diff --git a/include/tensorwrapper/types/preserve_const.hpp b/cxx/include/tensorwrapper/types/preserve_const.hpp similarity index 100% rename from include/tensorwrapper/types/preserve_const.hpp rename to cxx/include/tensorwrapper/types/preserve_const.hpp diff --git a/include/tensorwrapper/types/shape_traits.hpp b/cxx/include/tensorwrapper/types/shape_traits.hpp similarity index 100% rename from include/tensorwrapper/types/shape_traits.hpp rename to cxx/include/tensorwrapper/types/shape_traits.hpp diff --git a/include/tensorwrapper/types/sparsity_traits.hpp b/cxx/include/tensorwrapper/types/sparsity_traits.hpp similarity index 100% rename from include/tensorwrapper/types/sparsity_traits.hpp rename to cxx/include/tensorwrapper/types/sparsity_traits.hpp diff --git a/include/tensorwrapper/types/symmetry_traits.hpp b/cxx/include/tensorwrapper/types/symmetry_traits.hpp similarity index 100% rename from include/tensorwrapper/types/symmetry_traits.hpp rename to cxx/include/tensorwrapper/types/symmetry_traits.hpp diff --git a/include/tensorwrapper/types/types.hpp b/cxx/include/tensorwrapper/types/types.hpp similarity index 100% rename from include/tensorwrapper/types/types.hpp rename to cxx/include/tensorwrapper/types/types.hpp diff --git a/include/tensorwrapper/utilities/block_diagonal_matrix.hpp b/cxx/include/tensorwrapper/utilities/block_diagonal_matrix.hpp similarity index 100% rename from include/tensorwrapper/utilities/block_diagonal_matrix.hpp rename to cxx/include/tensorwrapper/utilities/block_diagonal_matrix.hpp diff --git a/include/tensorwrapper/utilities/diagonal_matrix.hpp b/cxx/include/tensorwrapper/utilities/diagonal_matrix.hpp similarity index 100% rename from include/tensorwrapper/utilities/diagonal_matrix.hpp rename to cxx/include/tensorwrapper/utilities/diagonal_matrix.hpp diff --git a/include/tensorwrapper/utilities/make_tensor.hpp b/cxx/include/tensorwrapper/utilities/make_tensor.hpp similarity index 100% rename from include/tensorwrapper/utilities/make_tensor.hpp rename to cxx/include/tensorwrapper/utilities/make_tensor.hpp diff --git a/include/tensorwrapper/utilities/to_json.hpp b/cxx/include/tensorwrapper/utilities/to_json.hpp similarity index 100% rename from include/tensorwrapper/utilities/to_json.hpp rename to cxx/include/tensorwrapper/utilities/to_json.hpp diff --git a/include/tensorwrapper/utilities/utilities.hpp b/cxx/include/tensorwrapper/utilities/utilities.hpp similarity index 100% rename from include/tensorwrapper/utilities/utilities.hpp rename to cxx/include/tensorwrapper/utilities/utilities.hpp diff --git a/src/tensorwrapper/backends/backends.hpp b/cxx/src/tensorwrapper/backends/backends.hpp similarity index 100% rename from src/tensorwrapper/backends/backends.hpp rename to cxx/src/tensorwrapper/backends/backends.hpp diff --git a/src/tensorwrapper/backends/cutensor/cuda_tensor.cpp b/cxx/src/tensorwrapper/backends/cutensor/cuda_tensor.cpp similarity index 100% rename from src/tensorwrapper/backends/cutensor/cuda_tensor.cpp rename to cxx/src/tensorwrapper/backends/cutensor/cuda_tensor.cpp diff --git a/src/tensorwrapper/backends/cutensor/cuda_tensor.cu b/cxx/src/tensorwrapper/backends/cutensor/cuda_tensor.cu similarity index 100% rename from src/tensorwrapper/backends/cutensor/cuda_tensor.cu rename to cxx/src/tensorwrapper/backends/cutensor/cuda_tensor.cu diff --git a/src/tensorwrapper/backends/cutensor/cuda_tensor.cuh b/cxx/src/tensorwrapper/backends/cutensor/cuda_tensor.cuh similarity index 100% rename from src/tensorwrapper/backends/cutensor/cuda_tensor.cuh rename to cxx/src/tensorwrapper/backends/cutensor/cuda_tensor.cuh diff --git a/src/tensorwrapper/backends/cutensor/cuda_tensor.hpp b/cxx/src/tensorwrapper/backends/cutensor/cuda_tensor.hpp similarity index 100% rename from src/tensorwrapper/backends/cutensor/cuda_tensor.hpp rename to cxx/src/tensorwrapper/backends/cutensor/cuda_tensor.hpp diff --git a/src/tensorwrapper/backends/cutensor/cutensor_traits.cuh b/cxx/src/tensorwrapper/backends/cutensor/cutensor_traits.cuh similarity index 100% rename from src/tensorwrapper/backends/cutensor/cutensor_traits.cuh rename to cxx/src/tensorwrapper/backends/cutensor/cutensor_traits.cuh diff --git a/src/tensorwrapper/backends/eigen/eigen_tensor.hpp b/cxx/src/tensorwrapper/backends/eigen/eigen_tensor.hpp similarity index 100% rename from src/tensorwrapper/backends/eigen/eigen_tensor.hpp rename to cxx/src/tensorwrapper/backends/eigen/eigen_tensor.hpp diff --git a/src/tensorwrapper/backends/eigen/eigen_tensor_impl.cpp b/cxx/src/tensorwrapper/backends/eigen/eigen_tensor_impl.cpp similarity index 100% rename from src/tensorwrapper/backends/eigen/eigen_tensor_impl.cpp rename to cxx/src/tensorwrapper/backends/eigen/eigen_tensor_impl.cpp diff --git a/src/tensorwrapper/backends/eigen/eigen_tensor_impl.hpp b/cxx/src/tensorwrapper/backends/eigen/eigen_tensor_impl.hpp similarity index 100% rename from src/tensorwrapper/backends/eigen/eigen_tensor_impl.hpp rename to cxx/src/tensorwrapper/backends/eigen/eigen_tensor_impl.hpp diff --git a/src/tensorwrapper/buffer/buffer_base.cpp b/cxx/src/tensorwrapper/buffer/buffer_base.cpp similarity index 100% rename from src/tensorwrapper/buffer/buffer_base.cpp rename to cxx/src/tensorwrapper/buffer/buffer_base.cpp diff --git a/src/tensorwrapper/buffer/contiguous.cpp b/cxx/src/tensorwrapper/buffer/contiguous.cpp similarity index 100% rename from src/tensorwrapper/buffer/contiguous.cpp rename to cxx/src/tensorwrapper/buffer/contiguous.cpp diff --git a/src/tensorwrapper/buffer/contraction_planner.hpp b/cxx/src/tensorwrapper/buffer/contraction_planner.hpp similarity index 100% rename from src/tensorwrapper/buffer/contraction_planner.hpp rename to cxx/src/tensorwrapper/buffer/contraction_planner.hpp diff --git a/src/tensorwrapper/buffer/detail_/binary_operation_visitor.hpp b/cxx/src/tensorwrapper/buffer/detail_/binary_operation_visitor.hpp similarity index 100% rename from src/tensorwrapper/buffer/detail_/binary_operation_visitor.hpp rename to cxx/src/tensorwrapper/buffer/detail_/binary_operation_visitor.hpp diff --git a/src/tensorwrapper/buffer/detail_/hash_utilities.hpp b/cxx/src/tensorwrapper/buffer/detail_/hash_utilities.hpp similarity index 100% rename from src/tensorwrapper/buffer/detail_/hash_utilities.hpp rename to cxx/src/tensorwrapper/buffer/detail_/hash_utilities.hpp diff --git a/src/tensorwrapper/buffer/detail_/replicated_view_pimpl.hpp b/cxx/src/tensorwrapper/buffer/detail_/replicated_view_pimpl.hpp similarity index 100% rename from src/tensorwrapper/buffer/detail_/replicated_view_pimpl.hpp rename to cxx/src/tensorwrapper/buffer/detail_/replicated_view_pimpl.hpp diff --git a/src/tensorwrapper/buffer/detail_/slice_pimpl.hpp b/cxx/src/tensorwrapper/buffer/detail_/slice_pimpl.hpp similarity index 100% rename from src/tensorwrapper/buffer/detail_/slice_pimpl.hpp rename to cxx/src/tensorwrapper/buffer/detail_/slice_pimpl.hpp diff --git a/src/tensorwrapper/buffer/detail_/unary_operation_visitor.hpp b/cxx/src/tensorwrapper/buffer/detail_/unary_operation_visitor.hpp similarity index 100% rename from src/tensorwrapper/buffer/detail_/unary_operation_visitor.hpp rename to cxx/src/tensorwrapper/buffer/detail_/unary_operation_visitor.hpp diff --git a/src/tensorwrapper/buffer/einsum_planner.hpp b/cxx/src/tensorwrapper/buffer/einsum_planner.hpp similarity index 100% rename from src/tensorwrapper/buffer/einsum_planner.hpp rename to cxx/src/tensorwrapper/buffer/einsum_planner.hpp diff --git a/src/tensorwrapper/buffer/replicated_view.cpp b/cxx/src/tensorwrapper/buffer/replicated_view.cpp similarity index 100% rename from src/tensorwrapper/buffer/replicated_view.cpp rename to cxx/src/tensorwrapper/buffer/replicated_view.cpp diff --git a/src/tensorwrapper/diis/diis.cpp b/cxx/src/tensorwrapper/diis/diis.cpp similarity index 100% rename from src/tensorwrapper/diis/diis.cpp rename to cxx/src/tensorwrapper/diis/diis.cpp diff --git a/src/tensorwrapper/dsl/pairwise_parser.cpp b/cxx/src/tensorwrapper/dsl/pairwise_parser.cpp similarity index 100% rename from src/tensorwrapper/dsl/pairwise_parser.cpp rename to cxx/src/tensorwrapper/dsl/pairwise_parser.cpp diff --git a/src/python/module.cpp b/cxx/src/tensorwrapper/export_tensorwrapper.cpp similarity index 100% rename from src/python/module.cpp rename to cxx/src/tensorwrapper/export_tensorwrapper.cpp diff --git a/src/python/export_tensorwrapper.hpp b/cxx/src/tensorwrapper/export_tensorwrapper.hpp similarity index 100% rename from src/python/export_tensorwrapper.hpp rename to cxx/src/tensorwrapper/export_tensorwrapper.hpp diff --git a/src/tensorwrapper/generate/add_noise.cpp b/cxx/src/tensorwrapper/generate/add_noise.cpp similarity index 100% rename from src/tensorwrapper/generate/add_noise.cpp rename to cxx/src/tensorwrapper/generate/add_noise.cpp diff --git a/src/tensorwrapper/generate/generate_eigen_system.cpp b/cxx/src/tensorwrapper/generate/generate_eigen_system.cpp similarity index 100% rename from src/tensorwrapper/generate/generate_eigen_system.cpp rename to cxx/src/tensorwrapper/generate/generate_eigen_system.cpp diff --git a/src/tensorwrapper/generate/generate_eigenvalues.cpp b/cxx/src/tensorwrapper/generate/generate_eigenvalues.cpp similarity index 100% rename from src/tensorwrapper/generate/generate_eigenvalues.cpp rename to cxx/src/tensorwrapper/generate/generate_eigenvalues.cpp diff --git a/src/tensorwrapper/generate/random_orthogonal_matrix.cpp b/cxx/src/tensorwrapper/generate/random_orthogonal_matrix.cpp similarity index 100% rename from src/tensorwrapper/generate/random_orthogonal_matrix.cpp rename to cxx/src/tensorwrapper/generate/random_orthogonal_matrix.cpp diff --git a/src/tensorwrapper/layout/converter.hpp b/cxx/src/tensorwrapper/layout/converter.hpp similarity index 100% rename from src/tensorwrapper/layout/converter.hpp rename to cxx/src/tensorwrapper/layout/converter.hpp diff --git a/src/tensorwrapper/layout/layout_base.cpp b/cxx/src/tensorwrapper/layout/layout_base.cpp similarity index 100% rename from src/tensorwrapper/layout/layout_base.cpp rename to cxx/src/tensorwrapper/layout/layout_base.cpp diff --git a/src/tensorwrapper/operations/approximately_equal.cpp b/cxx/src/tensorwrapper/operations/approximately_equal.cpp similarity index 100% rename from src/tensorwrapper/operations/approximately_equal.cpp rename to cxx/src/tensorwrapper/operations/approximately_equal.cpp diff --git a/src/tensorwrapper/operations/norm.cpp b/cxx/src/tensorwrapper/operations/norm.cpp similarity index 100% rename from src/tensorwrapper/operations/norm.cpp rename to cxx/src/tensorwrapper/operations/norm.cpp diff --git a/src/tensorwrapper/operations/power.cpp b/cxx/src/tensorwrapper/operations/power.cpp similarity index 100% rename from src/tensorwrapper/operations/power.cpp rename to cxx/src/tensorwrapper/operations/power.cpp diff --git a/src/tensorwrapper/shape/detail_/smooth_alias.hpp b/cxx/src/tensorwrapper/shape/detail_/smooth_alias.hpp similarity index 100% rename from src/tensorwrapper/shape/detail_/smooth_alias.hpp rename to cxx/src/tensorwrapper/shape/detail_/smooth_alias.hpp diff --git a/src/tensorwrapper/shape/detail_/smooth_view_pimpl.hpp b/cxx/src/tensorwrapper/shape/detail_/smooth_view_pimpl.hpp similarity index 100% rename from src/tensorwrapper/shape/detail_/smooth_view_pimpl.hpp rename to cxx/src/tensorwrapper/shape/detail_/smooth_view_pimpl.hpp diff --git a/src/tensorwrapper/shape/shape_from_labels.hpp b/cxx/src/tensorwrapper/shape/shape_from_labels.hpp similarity index 100% rename from src/tensorwrapper/shape/shape_from_labels.hpp rename to cxx/src/tensorwrapper/shape/shape_from_labels.hpp diff --git a/src/tensorwrapper/shape/smooth.cpp b/cxx/src/tensorwrapper/shape/smooth.cpp similarity index 100% rename from src/tensorwrapper/shape/smooth.cpp rename to cxx/src/tensorwrapper/shape/smooth.cpp diff --git a/src/tensorwrapper/shape/smooth_view.cpp b/cxx/src/tensorwrapper/shape/smooth_view.cpp similarity index 100% rename from src/tensorwrapper/shape/smooth_view.cpp rename to cxx/src/tensorwrapper/shape/smooth_view.cpp diff --git a/src/tensorwrapper/sparsity/pattern.cpp b/cxx/src/tensorwrapper/sparsity/pattern.cpp similarity index 100% rename from src/tensorwrapper/sparsity/pattern.cpp rename to cxx/src/tensorwrapper/sparsity/pattern.cpp diff --git a/src/tensorwrapper/symmetry/group.cpp b/cxx/src/tensorwrapper/symmetry/group.cpp similarity index 100% rename from src/tensorwrapper/symmetry/group.cpp rename to cxx/src/tensorwrapper/symmetry/group.cpp diff --git a/src/tensorwrapper/symmetry/permutation.cpp b/cxx/src/tensorwrapper/symmetry/permutation.cpp similarity index 100% rename from src/tensorwrapper/symmetry/permutation.cpp rename to cxx/src/tensorwrapper/symmetry/permutation.cpp diff --git a/src/tensorwrapper/tensor/detail_/il_utils.hpp b/cxx/src/tensorwrapper/tensor/detail_/il_utils.hpp similarity index 100% rename from src/tensorwrapper/tensor/detail_/il_utils.hpp rename to cxx/src/tensorwrapper/tensor/detail_/il_utils.hpp diff --git a/src/tensorwrapper/tensor/detail_/tensor_factory.cpp b/cxx/src/tensorwrapper/tensor/detail_/tensor_factory.cpp similarity index 100% rename from src/tensorwrapper/tensor/detail_/tensor_factory.cpp rename to cxx/src/tensorwrapper/tensor/detail_/tensor_factory.cpp diff --git a/src/tensorwrapper/tensor/detail_/tensor_factory.hpp b/cxx/src/tensorwrapper/tensor/detail_/tensor_factory.hpp similarity index 100% rename from src/tensorwrapper/tensor/detail_/tensor_factory.hpp rename to cxx/src/tensorwrapper/tensor/detail_/tensor_factory.hpp diff --git a/src/tensorwrapper/tensor/detail_/tensor_pimpl.hpp b/cxx/src/tensorwrapper/tensor/detail_/tensor_pimpl.hpp similarity index 100% rename from src/tensorwrapper/tensor/detail_/tensor_pimpl.hpp rename to cxx/src/tensorwrapper/tensor/detail_/tensor_pimpl.hpp diff --git a/src/python/tensor/export_tensor.cpp b/cxx/src/tensorwrapper/tensor/export_tensor.cpp similarity index 100% rename from src/python/tensor/export_tensor.cpp rename to cxx/src/tensorwrapper/tensor/export_tensor.cpp diff --git a/src/python/tensor/export_tensor.hpp b/cxx/src/tensorwrapper/tensor/export_tensor.hpp similarity index 100% rename from src/python/tensor/export_tensor.hpp rename to cxx/src/tensorwrapper/tensor/export_tensor.hpp diff --git a/src/tensorwrapper/tensor/tensor_class.cpp b/cxx/src/tensorwrapper/tensor/tensor_class.cpp similarity index 100% rename from src/tensorwrapper/tensor/tensor_class.cpp rename to cxx/src/tensorwrapper/tensor/tensor_class.cpp diff --git a/src/tensorwrapper/types/floating_point.cpp b/cxx/src/tensorwrapper/types/floating_point.cpp similarity index 100% rename from src/tensorwrapper/types/floating_point.cpp rename to cxx/src/tensorwrapper/types/floating_point.cpp diff --git a/src/tensorwrapper/utilities/block_diagonal_matrix.cpp b/cxx/src/tensorwrapper/utilities/block_diagonal_matrix.cpp similarity index 100% rename from src/tensorwrapper/utilities/block_diagonal_matrix.cpp rename to cxx/src/tensorwrapper/utilities/block_diagonal_matrix.cpp diff --git a/src/tensorwrapper/utilities/diagonal_matrix.cpp b/cxx/src/tensorwrapper/utilities/diagonal_matrix.cpp similarity index 100% rename from src/tensorwrapper/utilities/diagonal_matrix.cpp rename to cxx/src/tensorwrapper/utilities/diagonal_matrix.cpp diff --git a/src/tensorwrapper/utilities/to_json.cpp b/cxx/src/tensorwrapper/utilities/to_json.cpp similarity index 100% rename from src/tensorwrapper/utilities/to_json.cpp rename to cxx/src/tensorwrapper/utilities/to_json.cpp diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..28195fc4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,56 @@ +# Copyright 2026 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[build-system] +requires = [ + "scikit-build-core>=0.10", + "setuptools-scm>=8", +] +build-backend = "scikit_build_core.build" + +[project] +name = "nwchemex-tensorwrapper" +dynamic = ["version"] +description = "Tensor abstraction library for the NWChemEx ecosystem" +license = { text = "Apache-2.0" } +requires-python = ">=3.8" +dependencies = [ + "pybind11", + "nwchemex-nwxcmake>=0.1.0", + "nwchemex-utilities>=0.1.45", + "nwchemex-parallelzone>=0.1.43", +] + +[project.optional-dependencies] +# numpy is needed at test time: py_test_tensorwrapper (built when +# BUILD_PYBIND11_BINDINGS and BUILD_TESTING are both ON, i.e. DEVELOPER_SETUP) +# is exercised by tests/python/unit_tests/tensor/test_tensor.py, which imports +# numpy directly. +dev = ["pytest", "pre-commit", "numpy"] + +[tool.scikit-build] +metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" +cmake.build-type = "Release" +cmake.args = ["-DBUILD_PYBIND11_BINDINGS=ON", "-DBUILD_TESTING=OFF"] +# All installed content comes from the CMake install; no pure-Python packages. +wheel.packages = [] +build-dir = "build" + +[tool.setuptools_scm] +fallback_version = "0.0.0" + +# For editable (developer) installs, also build the tests. +[[tool.scikit-build.overrides]] +if.state = "editable" +cmake.args = ["-DDEVELOPER_SETUP=ON"] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..24ce15ab --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +numpy diff --git a/tests/python/conftest.py b/tests/python/conftest.py new file mode 100644 index 00000000..9ca83291 --- /dev/null +++ b/tests/python/conftest.py @@ -0,0 +1,45 @@ +# +# Copyright 2026 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import pathlib +import sys + +import parallelzone as pz +import pytest + +# py_test_tensorwrapper is a NO_INSTALL pybind11 module (test-only fixtures) +# that only ever lands in the CMake build directory, never in site-packages. +# Make it importable here. +_build_dir = pathlib.Path(__file__).resolve().parents[2] / "build" +if _build_dir.is_dir(): + sys.path.insert(0, str(_build_dir)) + + +@pytest.fixture(scope="session", autouse=True) +def _session_runtime_view(): + """ + Holds a single RuntimeView for the whole pytest session. + + MPI may only be initialized/finalized once per process. The first + RuntimeView constructed owns that responsibility; individual test + modules construct their own RuntimeView per test (e.g. in setUp), + which is safe only as long as this session-scoped instance is still + alive to keep MPI initialized in between. Without this, pytest would + run each test module independently and MPI would be finalized after + the first module's tests finished, breaking every module after it. + """ + rv = pz.runtime.RuntimeView() + yield rv diff --git a/tests/python/unit_tests/test_tensorwrapper.cpp b/tests/python/unit_tests/export_test_tensorwrapper.cpp similarity index 100% rename from tests/python/unit_tests/test_tensorwrapper.cpp rename to tests/python/unit_tests/export_test_tensorwrapper.cpp diff --git a/tests/python/unit_tests/tensor/test_tensor.py b/tests/python/unit_tests/tensor/test_tensor.py index ca99ba21..2c8c2aaf 100644 --- a/tests/python/unit_tests/tensor/test_tensor.py +++ b/tests/python/unit_tests/tensor/test_tensor.py @@ -16,7 +16,6 @@ import numpy as np import py_test_tensorwrapper.testing as testing - import tensorwrapper