From 1dc846997ddc898e01f11461be6fe1f6233008fb Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Wed, 1 Jul 2026 15:50:32 -0500 Subject: [PATCH 01/29] build overhaul --- CMakeLists.txt | 211 +++++------------- cmake/get_nwx_cmake.cmake | 70 +++++- .../include}/tensorwrapper/buffer/buffer.hpp | 0 .../tensorwrapper/buffer/buffer_base.hpp | 0 .../buffer/buffer_base_common.hpp | 0 .../tensorwrapper/buffer/buffer_fwd.hpp | 0 .../tensorwrapper/buffer/buffer_view_base.hpp | 0 .../tensorwrapper/buffer/contiguous.hpp | 0 .../buffer/detail_/buffer_view_base_pimpl.hpp | 0 .../include}/tensorwrapper/buffer/local.hpp | 0 .../tensorwrapper/buffer/replicated.hpp | 0 .../buffer/replicated_common.hpp | 0 .../tensorwrapper/buffer/replicated_view.hpp | 0 .../tensorwrapper/concepts/floating_point.hpp | 0 .../tensorwrapper/concepts/has_begin_end.hpp | 0 .../tensorwrapper/detail_/detail_.hpp | 0 .../tensorwrapper/detail_/dsl_base.hpp | 0 .../tensorwrapper/detail_/dsl_base.ipp | 0 .../detail_/integer_utilities.hpp | 0 .../detail_/polymorphic_base.hpp | 0 .../detail_/unique_ptr_utilities.hpp | 0 .../tensorwrapper/detail_/view_traits.hpp | 0 .../include}/tensorwrapper/diis/diis.hpp | 2 +- .../include}/tensorwrapper/dsl/dsl.hpp | 0 .../tensorwrapper/dsl/dsl_forward.hpp | 0 .../tensorwrapper/dsl/dummy_indices.hpp | 0 .../include}/tensorwrapper/dsl/labeled.hpp | 0 .../tensorwrapper/dsl/pairwise_parser.hpp | 0 .../tensorwrapper/forward_declarations.hpp | 0 .../tensorwrapper/generate/add_noise.hpp | 0 .../tensorwrapper/generate/generate.hpp | 0 .../generate/generate_eigen_system.hpp | 0 .../generate/generate_eigenvalues.hpp | 0 .../tensorwrapper/generate/generate_utils.hpp | 0 .../generate/identity_matrix.hpp | 0 .../generate/random_orthogonal_matrix.hpp | 0 .../tensorwrapper/interfaces/sliceable.hpp | 0 .../include}/tensorwrapper/layout/layout.hpp | 0 .../tensorwrapper/layout/layout_base.hpp | 0 .../tensorwrapper/layout/layout_common.hpp | 0 .../tensorwrapper/layout/layout_fwd.hpp | 0 .../include}/tensorwrapper/layout/logical.hpp | 0 .../tensorwrapper/layout/physical.hpp | 0 .../operations/approximately_equal.hpp | 0 .../tensorwrapper/operations/norm.hpp | 0 .../tensorwrapper/operations/operations.hpp | 0 .../tensorwrapper/operations/power.hpp | 0 .../include}/tensorwrapper/shape/shape.hpp | 0 .../tensorwrapper/shape/shape_base.hpp | 0 .../tensorwrapper/shape/shape_fwd.hpp | 0 .../include}/tensorwrapper/shape/smooth.hpp | 2 +- .../tensorwrapper/shape/smooth_common.hpp | 0 .../tensorwrapper/shape/smooth_view.hpp | 2 +- .../tensorwrapper/sparsity/pattern.hpp | 0 .../tensorwrapper/sparsity/sparsity.hpp | 0 .../tensorwrapper/sparsity/sparsity_fwd.hpp | 0 .../include}/tensorwrapper/symmetry/group.hpp | 0 .../tensorwrapper/symmetry/operation.hpp | 0 .../tensorwrapper/symmetry/permutation.hpp | 0 .../tensorwrapper/symmetry/symmetry.hpp | 0 .../tensorwrapper/symmetry/symmetry_fwd.hpp | 0 .../tensor/detail_/tensor_input.hpp | 0 .../include}/tensorwrapper/tensor/tensor.hpp | 0 .../tensorwrapper/tensor/tensor_class.hpp | 0 .../include}/tensorwrapper/tensorwrapper.hpp | 0 .../tensorwrapper/types/buffer_traits.hpp | 0 .../tensorwrapper/types/class_traits.hpp | 0 .../tensorwrapper/types/common_types.hpp | 0 .../tensorwrapper/types/floating_point.hpp | 0 .../tensorwrapper/types/il_traits.hpp | 0 .../tensorwrapper/types/layout_traits.hpp | 2 +- .../tensorwrapper/types/preserve_const.hpp | 0 .../tensorwrapper/types/shape_traits.hpp | 0 .../tensorwrapper/types/sparsity_traits.hpp | 0 .../tensorwrapper/types/symmetry_traits.hpp | 0 .../include}/tensorwrapper/types/types.hpp | 0 .../utilities/block_diagonal_matrix.hpp | 0 .../utilities/diagonal_matrix.hpp | 0 .../tensorwrapper/utilities/make_tensor.hpp | 0 .../tensorwrapper/utilities/to_json.hpp | 0 .../tensorwrapper/utilities/utilities.hpp | 0 .../src}/tensorwrapper/backends/backends.hpp | 0 .../backends/cutensor/cuda_tensor.cpp | 0 .../backends/cutensor/cuda_tensor.cu | 0 .../backends/cutensor/cuda_tensor.cuh | 0 .../backends/cutensor/cuda_tensor.hpp | 0 .../backends/cutensor/cutensor_traits.cuh | 0 .../backends/eigen/eigen_tensor.hpp | 0 .../backends/eigen/eigen_tensor_impl.cpp | 0 .../backends/eigen/eigen_tensor_impl.hpp | 0 .../src}/tensorwrapper/buffer/buffer_base.cpp | 0 .../src}/tensorwrapper/buffer/contiguous.cpp | 0 .../buffer/contraction_planner.hpp | 0 .../detail_/binary_operation_visitor.hpp | 0 .../buffer/detail_/hash_utilities.hpp | 0 .../buffer/detail_/replicated_view_pimpl.hpp | 0 .../buffer/detail_/slice_pimpl.hpp | 0 .../detail_/unary_operation_visitor.hpp | 0 .../tensorwrapper/buffer/einsum_planner.hpp | 0 .../tensorwrapper/buffer/replicated_view.cpp | 0 {src => cxx/src}/tensorwrapper/diis/diis.cpp | 0 .../tensorwrapper/dsl/pairwise_parser.cpp | 0 .../tensorwrapper/export_tensorwrapper.cpp | 0 .../tensorwrapper}/export_tensorwrapper.hpp | 0 .../src}/tensorwrapper/generate/add_noise.cpp | 0 .../generate/generate_eigen_system.cpp | 0 .../generate/generate_eigenvalues.cpp | 0 .../generate/random_orthogonal_matrix.cpp | 0 .../src}/tensorwrapper/layout/converter.hpp | 0 .../src}/tensorwrapper/layout/layout_base.cpp | 0 .../operations/approximately_equal.cpp | 0 .../src}/tensorwrapper/operations/norm.cpp | 0 .../src}/tensorwrapper/operations/power.cpp | 0 .../shape/detail_/smooth_alias.hpp | 0 .../shape/detail_/smooth_view_pimpl.hpp | 0 .../tensorwrapper/shape/shape_from_labels.hpp | 0 .../src}/tensorwrapper/shape/smooth.cpp | 0 .../src}/tensorwrapper/shape/smooth_view.cpp | 0 .../src}/tensorwrapper/sparsity/pattern.cpp | 0 .../src}/tensorwrapper/symmetry/group.cpp | 0 .../tensorwrapper/symmetry/permutation.cpp | 0 .../tensorwrapper/tensor/detail_/il_utils.hpp | 0 .../tensor/detail_/tensor_factory.cpp | 0 .../tensor/detail_/tensor_factory.hpp | 0 .../tensor/detail_/tensor_pimpl.hpp | 0 .../tensorwrapper}/tensor/export_tensor.cpp | 0 .../tensorwrapper}/tensor/export_tensor.hpp | 0 .../tensorwrapper/tensor/tensor_class.cpp | 0 .../tensorwrapper/types/floating_point.cpp | 0 .../utilities/block_diagonal_matrix.cpp | 0 .../utilities/diagonal_matrix.cpp | 0 .../src}/tensorwrapper/utilities/to_json.cpp | 0 pyproject.toml | 45 ++++ 133 files changed, 163 insertions(+), 171 deletions(-) rename {include => cxx/include}/tensorwrapper/buffer/buffer.hpp (100%) rename {include => cxx/include}/tensorwrapper/buffer/buffer_base.hpp (100%) rename {include => cxx/include}/tensorwrapper/buffer/buffer_base_common.hpp (100%) rename {include => cxx/include}/tensorwrapper/buffer/buffer_fwd.hpp (100%) rename {include => cxx/include}/tensorwrapper/buffer/buffer_view_base.hpp (100%) rename {include => cxx/include}/tensorwrapper/buffer/contiguous.hpp (100%) rename {include => cxx/include}/tensorwrapper/buffer/detail_/buffer_view_base_pimpl.hpp (100%) rename {include => cxx/include}/tensorwrapper/buffer/local.hpp (100%) rename {include => cxx/include}/tensorwrapper/buffer/replicated.hpp (100%) rename {include => cxx/include}/tensorwrapper/buffer/replicated_common.hpp (100%) rename {include => cxx/include}/tensorwrapper/buffer/replicated_view.hpp (100%) rename {include => cxx/include}/tensorwrapper/concepts/floating_point.hpp (100%) rename {include => cxx/include}/tensorwrapper/concepts/has_begin_end.hpp (100%) rename {include => cxx/include}/tensorwrapper/detail_/detail_.hpp (100%) rename {include => cxx/include}/tensorwrapper/detail_/dsl_base.hpp (100%) rename {include => cxx/include}/tensorwrapper/detail_/dsl_base.ipp (100%) rename {include => cxx/include}/tensorwrapper/detail_/integer_utilities.hpp (100%) rename {include => cxx/include}/tensorwrapper/detail_/polymorphic_base.hpp (100%) rename {include => cxx/include}/tensorwrapper/detail_/unique_ptr_utilities.hpp (100%) rename {include => cxx/include}/tensorwrapper/detail_/view_traits.hpp (100%) rename {include => cxx/include}/tensorwrapper/diis/diis.hpp (98%) rename {include => cxx/include}/tensorwrapper/dsl/dsl.hpp (100%) rename {include => cxx/include}/tensorwrapper/dsl/dsl_forward.hpp (100%) rename {include => cxx/include}/tensorwrapper/dsl/dummy_indices.hpp (100%) rename {include => cxx/include}/tensorwrapper/dsl/labeled.hpp (100%) rename {include => cxx/include}/tensorwrapper/dsl/pairwise_parser.hpp (100%) rename {include => cxx/include}/tensorwrapper/forward_declarations.hpp (100%) rename {include => cxx/include}/tensorwrapper/generate/add_noise.hpp (100%) rename {include => cxx/include}/tensorwrapper/generate/generate.hpp (100%) rename {include => cxx/include}/tensorwrapper/generate/generate_eigen_system.hpp (100%) rename {include => cxx/include}/tensorwrapper/generate/generate_eigenvalues.hpp (100%) rename {include => cxx/include}/tensorwrapper/generate/generate_utils.hpp (100%) rename {include => cxx/include}/tensorwrapper/generate/identity_matrix.hpp (100%) rename {include => cxx/include}/tensorwrapper/generate/random_orthogonal_matrix.hpp (100%) rename {include => cxx/include}/tensorwrapper/interfaces/sliceable.hpp (100%) rename {include => cxx/include}/tensorwrapper/layout/layout.hpp (100%) rename {include => cxx/include}/tensorwrapper/layout/layout_base.hpp (100%) rename {include => cxx/include}/tensorwrapper/layout/layout_common.hpp (100%) rename {include => cxx/include}/tensorwrapper/layout/layout_fwd.hpp (100%) rename {include => cxx/include}/tensorwrapper/layout/logical.hpp (100%) rename {include => cxx/include}/tensorwrapper/layout/physical.hpp (100%) rename {include => cxx/include}/tensorwrapper/operations/approximately_equal.hpp (100%) rename {include => cxx/include}/tensorwrapper/operations/norm.hpp (100%) rename {include => cxx/include}/tensorwrapper/operations/operations.hpp (100%) rename {include => cxx/include}/tensorwrapper/operations/power.hpp (100%) rename {include => cxx/include}/tensorwrapper/shape/shape.hpp (100%) rename {include => cxx/include}/tensorwrapper/shape/shape_base.hpp (100%) rename {include => cxx/include}/tensorwrapper/shape/shape_fwd.hpp (100%) rename {include => cxx/include}/tensorwrapper/shape/smooth.hpp (99%) rename {include => cxx/include}/tensorwrapper/shape/smooth_common.hpp (100%) rename {include => cxx/include}/tensorwrapper/shape/smooth_view.hpp (99%) rename {include => cxx/include}/tensorwrapper/sparsity/pattern.hpp (100%) rename {include => cxx/include}/tensorwrapper/sparsity/sparsity.hpp (100%) rename {include => cxx/include}/tensorwrapper/sparsity/sparsity_fwd.hpp (100%) rename {include => cxx/include}/tensorwrapper/symmetry/group.hpp (100%) rename {include => cxx/include}/tensorwrapper/symmetry/operation.hpp (100%) rename {include => cxx/include}/tensorwrapper/symmetry/permutation.hpp (100%) rename {include => cxx/include}/tensorwrapper/symmetry/symmetry.hpp (100%) rename {include => cxx/include}/tensorwrapper/symmetry/symmetry_fwd.hpp (100%) rename {include => cxx/include}/tensorwrapper/tensor/detail_/tensor_input.hpp (100%) rename {include => cxx/include}/tensorwrapper/tensor/tensor.hpp (100%) rename {include => cxx/include}/tensorwrapper/tensor/tensor_class.hpp (100%) rename {include => cxx/include}/tensorwrapper/tensorwrapper.hpp (100%) rename {include => cxx/include}/tensorwrapper/types/buffer_traits.hpp (100%) rename {include => cxx/include}/tensorwrapper/types/class_traits.hpp (100%) rename {include => cxx/include}/tensorwrapper/types/common_types.hpp (100%) rename {include => cxx/include}/tensorwrapper/types/floating_point.hpp (100%) rename {include => cxx/include}/tensorwrapper/types/il_traits.hpp (100%) rename {include => cxx/include}/tensorwrapper/types/layout_traits.hpp (95%) rename {include => cxx/include}/tensorwrapper/types/preserve_const.hpp (100%) rename {include => cxx/include}/tensorwrapper/types/shape_traits.hpp (100%) rename {include => cxx/include}/tensorwrapper/types/sparsity_traits.hpp (100%) rename {include => cxx/include}/tensorwrapper/types/symmetry_traits.hpp (100%) rename {include => cxx/include}/tensorwrapper/types/types.hpp (100%) rename {include => cxx/include}/tensorwrapper/utilities/block_diagonal_matrix.hpp (100%) rename {include => cxx/include}/tensorwrapper/utilities/diagonal_matrix.hpp (100%) rename {include => cxx/include}/tensorwrapper/utilities/make_tensor.hpp (100%) rename {include => cxx/include}/tensorwrapper/utilities/to_json.hpp (100%) rename {include => cxx/include}/tensorwrapper/utilities/utilities.hpp (100%) rename {src => cxx/src}/tensorwrapper/backends/backends.hpp (100%) rename {src => cxx/src}/tensorwrapper/backends/cutensor/cuda_tensor.cpp (100%) rename {src => cxx/src}/tensorwrapper/backends/cutensor/cuda_tensor.cu (100%) rename {src => cxx/src}/tensorwrapper/backends/cutensor/cuda_tensor.cuh (100%) rename {src => cxx/src}/tensorwrapper/backends/cutensor/cuda_tensor.hpp (100%) rename {src => cxx/src}/tensorwrapper/backends/cutensor/cutensor_traits.cuh (100%) rename {src => cxx/src}/tensorwrapper/backends/eigen/eigen_tensor.hpp (100%) rename {src => cxx/src}/tensorwrapper/backends/eigen/eigen_tensor_impl.cpp (100%) rename {src => cxx/src}/tensorwrapper/backends/eigen/eigen_tensor_impl.hpp (100%) rename {src => cxx/src}/tensorwrapper/buffer/buffer_base.cpp (100%) rename {src => cxx/src}/tensorwrapper/buffer/contiguous.cpp (100%) rename {src => cxx/src}/tensorwrapper/buffer/contraction_planner.hpp (100%) rename {src => cxx/src}/tensorwrapper/buffer/detail_/binary_operation_visitor.hpp (100%) rename {src => cxx/src}/tensorwrapper/buffer/detail_/hash_utilities.hpp (100%) rename {src => cxx/src}/tensorwrapper/buffer/detail_/replicated_view_pimpl.hpp (100%) rename {src => cxx/src}/tensorwrapper/buffer/detail_/slice_pimpl.hpp (100%) rename {src => cxx/src}/tensorwrapper/buffer/detail_/unary_operation_visitor.hpp (100%) rename {src => cxx/src}/tensorwrapper/buffer/einsum_planner.hpp (100%) rename {src => cxx/src}/tensorwrapper/buffer/replicated_view.cpp (100%) rename {src => cxx/src}/tensorwrapper/diis/diis.cpp (100%) rename {src => cxx/src}/tensorwrapper/dsl/pairwise_parser.cpp (100%) rename src/python/module.cpp => cxx/src/tensorwrapper/export_tensorwrapper.cpp (100%) rename {src/python => cxx/src/tensorwrapper}/export_tensorwrapper.hpp (100%) rename {src => cxx/src}/tensorwrapper/generate/add_noise.cpp (100%) rename {src => cxx/src}/tensorwrapper/generate/generate_eigen_system.cpp (100%) rename {src => cxx/src}/tensorwrapper/generate/generate_eigenvalues.cpp (100%) rename {src => cxx/src}/tensorwrapper/generate/random_orthogonal_matrix.cpp (100%) rename {src => cxx/src}/tensorwrapper/layout/converter.hpp (100%) rename {src => cxx/src}/tensorwrapper/layout/layout_base.cpp (100%) rename {src => cxx/src}/tensorwrapper/operations/approximately_equal.cpp (100%) rename {src => cxx/src}/tensorwrapper/operations/norm.cpp (100%) rename {src => cxx/src}/tensorwrapper/operations/power.cpp (100%) rename {src => cxx/src}/tensorwrapper/shape/detail_/smooth_alias.hpp (100%) rename {src => cxx/src}/tensorwrapper/shape/detail_/smooth_view_pimpl.hpp (100%) rename {src => cxx/src}/tensorwrapper/shape/shape_from_labels.hpp (100%) rename {src => cxx/src}/tensorwrapper/shape/smooth.cpp (100%) rename {src => cxx/src}/tensorwrapper/shape/smooth_view.cpp (100%) rename {src => cxx/src}/tensorwrapper/sparsity/pattern.cpp (100%) rename {src => cxx/src}/tensorwrapper/symmetry/group.cpp (100%) rename {src => cxx/src}/tensorwrapper/symmetry/permutation.cpp (100%) rename {src => cxx/src}/tensorwrapper/tensor/detail_/il_utils.hpp (100%) rename {src => cxx/src}/tensorwrapper/tensor/detail_/tensor_factory.cpp (100%) rename {src => cxx/src}/tensorwrapper/tensor/detail_/tensor_factory.hpp (100%) rename {src => cxx/src}/tensorwrapper/tensor/detail_/tensor_pimpl.hpp (100%) rename {src/python => cxx/src/tensorwrapper}/tensor/export_tensor.cpp (100%) rename {src/python => cxx/src/tensorwrapper}/tensor/export_tensor.hpp (100%) rename {src => cxx/src}/tensorwrapper/tensor/tensor_class.cpp (100%) rename {src => cxx/src}/tensorwrapper/types/floating_point.cpp (100%) rename {src => cxx/src}/tensorwrapper/utilities/block_diagonal_matrix.cpp (100%) rename {src => cxx/src}/tensorwrapper/utilities/diagonal_matrix.cpp (100%) rename {src => cxx/src}/tensorwrapper/utilities/to_json.cpp (100%) create mode 100644 pyproject.toml diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b1f5624..04334162 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,67 @@ 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) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_SCAN_FOR_MODULES 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}") +option(BUILD_TESTING "Whether to build the unit tests" OFF) +option(BUILD_PYBIND11_BINDINGS "Build Python bindings via pybind11" ON) +option(ENABLE_SIGMA "Enable Sigma for uncertainty tracking" OFF) +option(ENABLE_CUTENSOR "Enable cuTENSOR GPU backend" OFF) -# 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") - -### 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?" -) - -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() - -### Dependendencies ### -include(get_utilities) - -include(get_parallelzone) - -find_package(Boost REQUIRED) - -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 -) - -if("${ENABLE_CUTENSOR}") - include(cmake/FindcuTENSOR.cmake) - list(APPEND DEPENDENCIES cuTENSOR::cuTENSOR) -endif() - -cmaize_add_library( - ${PROJECT_NAME} - SOURCE_DIR "${project_src_dir}" - SOURCE_EXTS "${SOURCE_EXTS}" - INCLUDE_DIRS "${project_inc_dir}" - INCLUDE_EXTS "${INCLUDE_EXTS}" - DEPENDS "${DEPENDENCIES}" -) -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( - ${PROJECT_NAME} - SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/src/python" - DEPENDS "${PROJECT_NAME}" -) - - -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} +nwx_cxx_api_docs("cxx/include" "cxx/src") + +# Dependencies +include(get_dependencies) +get_dependencies(utilities parallelzone wtf eigen boost) + +# TODO: ENABLE_SIGMA and ENABLE_CUTENSOR handling + +# Build the library +include(nwx_library) +nwx_library(${PROJECT_NAME} "cxx/include" "cxx/src" + utilities parallelzone wtf + PUBLIC eigen boost) + +# Generated config headers (e.g. from configure_file) live in binary dir +target_include_directories(${PROJECT_NAME} PUBLIC + $) + +# Python module +include(nwx_python_module) +nwx_python_module(${PROJECT_NAME} "cxx/src") + +# C++ tests +if(BUILD_TESTING) + 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 ) - - 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} + catch2_tests_from_dir( + "test_acceptance_${PROJECT_NAME}" + "tests/cxx/acceptance_tests/${PROJECT_NAME}" + ${PROJECT_NAME} + PRIVATE_INCLUDES cxx/src ) - - nwx_pybind11_tests( - py_${PROJECT_NAME} ${python_unit_test_dir}/test_tensorwrapper.py - SUBMODULES parallelzone pluginplay - DEPENDS py_test_${PROJECT_NAME} + catch2_tests_from_dir( + "test_performance_${PROJECT_NAME}" + "tests/cxx/performance_tests/${PROJECT_NAME}" + ${PROJECT_NAME} + PRIVATE_INCLUDES cxx/src ) 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..cc493ea8 --- /dev/null +++ b/pyproject.toml @@ -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. + +[build-system] +requires = [ + "scikit-build-core>=0.10", + "pybind11", + "setuptools-scm>=8", + "nwchemex-nwxcmake @ git+https://github.com/NWChemEx/NWXCMake", +] +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" + +[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 = ["-DBUILD_PYBIND11_BINDINGS=ON", "-DBUILD_TESTING=ON"] From 0f86430258095b67680776ac92d464d72cc86f68 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Thu, 2 Jul 2026 08:57:56 -0500 Subject: [PATCH 02/29] adds upstream dependencies --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index cc493ea8..d78fef00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,10 @@ dynamic = ["version"] description = "Tensor abstraction library for the NWChemEx ecosystem" license = { text = "Apache-2.0" } requires-python = ">=3.8" +dependencies = [ + "nwchemex-utilities", + "nwchemex-parallelzone", +] [tool.scikit-build] metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" From e56e47da12ed06ebc968653ce77ee51c2a86998b Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Mon, 6 Jul 2026 15:16:04 -0500 Subject: [PATCH 03/29] code factorization --- CMakeLists.txt | 47 ++++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04334162..99b22cca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,12 +24,7 @@ nwx_set_version(tw_version "${CMAKE_CURRENT_LIST_DIR}") project(tensorwrapper VERSION "${tw_version}" LANGUAGES CXX) include(disable_in_source_builds) -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_SCAN_FOR_MODULES OFF) - -option(BUILD_TESTING "Whether to build the unit tests" OFF) -option(BUILD_PYBIND11_BINDINGS "Build Python bindings via pybind11" ON) -option(ENABLE_SIGMA "Enable Sigma for uncertainty tracking" OFF) +include(set_default_nwx_options) option(ENABLE_CUTENSOR "Enable cuTENSOR GPU backend" OFF) # Documentation target @@ -57,24 +52,22 @@ include(nwx_python_module) nwx_python_module(${PROJECT_NAME} "cxx/src") # C++ tests -if(BUILD_TESTING) - 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 - ) - catch2_tests_from_dir( - "test_acceptance_${PROJECT_NAME}" - "tests/cxx/acceptance_tests/${PROJECT_NAME}" - ${PROJECT_NAME} - PRIVATE_INCLUDES cxx/src - ) - catch2_tests_from_dir( - "test_performance_${PROJECT_NAME}" - "tests/cxx/performance_tests/${PROJECT_NAME}" - ${PROJECT_NAME} - PRIVATE_INCLUDES cxx/src - ) -endif() +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 +) +catch2_tests_from_dir( + "test_acceptance_${PROJECT_NAME}" + "tests/cxx/acceptance_tests/${PROJECT_NAME}" + ${PROJECT_NAME} + PRIVATE_INCLUDES cxx/src +) +catch2_tests_from_dir( + "test_performance_${PROJECT_NAME}" + "tests/cxx/performance_tests/${PROJECT_NAME}" + ${PROJECT_NAME} + PRIVATE_INCLUDES cxx/src +) From 2e07d2d10a0752fc271920bd2ac770a4bbb6bb5a Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Tue, 7 Jul 2026 09:26:51 -0500 Subject: [PATCH 04/29] adds mac files to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 2715503b..fa740740 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,6 @@ install/ toolchain.cmake .devcontainers/ + +# These are MacOS files +.DS_Store \ No newline at end of file From c52293515a10104983d3b38686a9dfff339ee099 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Thu, 9 Jul 2026 11:08:41 -0500 Subject: [PATCH 05/29] Build py_test_tensorwrapper via nwx_python_module The old build system built this test-helper pybind11 module via nwx_add_pybind11_module(py_test_tensorwrapper SOURCE_DIR tests/python/unit_tests ...), which build_overhaul's CMakeLists.txt never got an equivalent for -- test_tensorwrapper.cpp (still defining PYBIND11_MODULE(py_test_tensorwrapper, m)) was left in the tree but nothing built it, so tests/python/unit_tests/tensor/test_tensor.py's `import py_test_tensorwrapper.testing` would fail with ModuleNotFoundError. Renamed to export_test_tensorwrapper.cpp so it matches nwx_python_module's source filter, then wired up via nwx_python_module(py_test_tensorwrapper "tests/python/unit_tests" NO_INSTALL) -- reusing the same macro extended (NO_INSTALL/DEPENDS) for PluginPlay's analogous py_test_pluginplay/pluginplay_examples gap. No ryanmrichard/TensorWrapper fork exists yet (only Utilities, ParallelZone, and PluginPlay were fork-tested this pass), so this is a local-only commit pending future CI verification. --- CMakeLists.txt | 8 ++++++++ ...st_tensorwrapper.cpp => export_test_tensorwrapper.cpp} | 0 2 files changed, 8 insertions(+) rename tests/python/unit_tests/{test_tensorwrapper.cpp => export_test_tensorwrapper.cpp} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99b22cca..5a59b688 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,3 +71,11 @@ catch2_tests_from_dir( ${PROJECT_NAME} PRIVATE_INCLUDES cxx/src ) + +# 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() 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 From bb76f1c31fd40e56531b301eb525d2b633bc8ef8 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Thu, 9 Jul 2026 11:51:05 -0500 Subject: [PATCH 06/29] Retarget NWChemEx/ -> ryanmrichard/ for fork testing; adopt test_nwx_cmake_build Co-Authored-By: Claude Sonnet 5 --- .github/workflows/merge.yaml | 6 +++--- .github/workflows/pull_request.yaml | 20 ++++++++++---------- cmake/get_nwx_cmake.cmake | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index f00546af..45c6edbd 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -18,15 +18,15 @@ name: Merge Workflow on: push: branches: - - master + - build_overhaul jobs: tag-commit: - uses: NWChemEx/.github/.github/workflows/tag.yaml@master + uses: ryanmrichard/.github/.github/workflows/tag.yaml@master secrets: inherit deploy_nwx_docs: - uses: NWChemEx/.github/.github/workflows/deploy_nwx_docs.yaml@master + uses: ryanmrichard/.github/.github/workflows/deploy_nwx_docs.yaml@master with: doc_target: "tensorwrapper_cxx_api" secrets: inherit diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 18dd6915..d2809cf9 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -18,24 +18,24 @@ name: Pull Request Workflow on: pull_request: branches: - - master + - build_overhaul jobs: check_formatting: - uses: NWChemEx/.github/.github/workflows/check_formatting.yaml@master + uses: ryanmrichard/.github/.github/workflows/check_formatting.yaml@master test_nwx_docs: - uses: NWChemEx/.github/.github/workflows/test_nwx_docs.yaml@master + uses: ryanmrichard/.github/.github/workflows/test_nwx_docs.yaml@master with: doc_target: "tensorwrapper_cxx_api" - test_library: - uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master + test_cmake_build: + uses: ryanmrichard/.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: ryanmrichard/.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: "-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/.github/enable_sigma.cmake" diff --git a/cmake/get_nwx_cmake.cmake b/cmake/get_nwx_cmake.cmake index 9188ad48..c936012a 100644 --- a/cmake/get_nwx_cmake.cmake +++ b/cmake/get_nwx_cmake.cmake @@ -57,7 +57,7 @@ macro(get_nwx_cmake) include(FetchContent) FetchContent_Declare( nwx_cmake - GIT_REPOSITORY https://github.com/NWChemEx/NWXCMake + GIT_REPOSITORY https://github.com/ryanmrichard/NWXCMake ) FetchContent_MakeAvailable(nwx_cmake) set(_gnc_resolved "${nwx_cmake_SOURCE_DIR}/cmake") From 99e2e646c64ad81dafa9cca52a5400cd26af7121 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Thu, 9 Jul 2026 12:01:18 -0500 Subject: [PATCH 07/29] Retrigger CI now that Actions are enabled on fork From c09a217ac437847c1ba38870c73587d09bc778f0 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Thu, 9 Jul 2026 12:12:37 -0500 Subject: [PATCH 08/29] Add requirements.txt (numpy) for Python tests; fix .gitignore missing trailing newline Co-Authored-By: Claude Sonnet 5 --- .gitignore | 2 +- requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index fa740740..e87377e4 100644 --- a/.gitignore +++ b/.gitignore @@ -50,4 +50,4 @@ toolchain.cmake .devcontainers/ # These are MacOS files -.DS_Store \ No newline at end of file +.DS_Store diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..24ce15ab --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +numpy From b23e64819a058a8e4415a85f9cad917b3284ff50 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Thu, 9 Jul 2026 12:56:33 -0500 Subject: [PATCH 09/29] Add session-scoped RuntimeView pytest fixture; fix isort ordering for Python 3.14 Without a session-scoped RuntimeView, MPI is finalized after the first Tensor construction in TestTensor.setUp, so the second construction aborts with "MPI_Comm_rank() called after MPI_FINALIZE". Mirrors the fixture already added to ParallelZone/PluginPlay for the same reason. Also fixes an isort import-grouping difference between Python 3.13 and 3.14 that only reproduces under 3.14 (confirmed via docker run python:3.14). Co-Authored-By: Claude Sonnet 5 --- tests/python/conftest.py | 35 +++++++++++++++++++ tests/python/unit_tests/tensor/test_tensor.py | 1 - 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 tests/python/conftest.py diff --git a/tests/python/conftest.py b/tests/python/conftest.py new file mode 100644 index 00000000..d9c5a96e --- /dev/null +++ b/tests/python/conftest.py @@ -0,0 +1,35 @@ +# +# 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 parallelzone as pz +import pytest + + +@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/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 From d4b2b7dfea58916a39c5b1d5ff46876c96c36c86 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Thu, 9 Jul 2026 13:14:17 -0500 Subject: [PATCH 10/29] Fix Sigma toolchain cmake_opts: github.workspace is empty in the calling (uses:-only) job The pull_request.yaml job that delegates to test_nwx_cmake_build.yaml never runs on a runner itself, so github.workspace resolves empty there, producing "-DCMAKE_TOOLCHAIN_FILE=/.github/enable_sigma.cmake" (root-relative, missing file). The actual cmake invocation always runs from the checked-out repo root, so a plain relative path works and was verified locally (docker ubuntu:24.04 + gcc-14) to configure and build cleanly. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/pull_request.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index d2809cf9..822a3847 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -38,4 +38,4 @@ jobs: uses: ryanmrichard/.github/.github/workflows/test_nwx_cmake_build.yaml@master with: run_python_tests: "true" - cmake_opts: "-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/.github/enable_sigma.cmake" + cmake_opts: "-DCMAKE_TOOLCHAIN_FILE=.github/enable_sigma.cmake" From 47d093592a13194440151b818caaf2d0bcd31afd Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Thu, 9 Jul 2026 15:22:30 -0500 Subject: [PATCH 11/29] Retrigger CI: workflow write permissions now enabled From 5480c4f42b64dfbc97dfabb78bcfeab91585292a Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Fri, 10 Jul 2026 10:39:18 -0500 Subject: [PATCH 12/29] deploy_to_pypi: add needs_boost (Boost was never actually installed in the container) Co-Authored-By: Claude Sonnet 5 --- .github/workflows/merge.yaml | 49 ++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index 45c6edbd..b7ac474a 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -30,3 +30,52 @@ jobs: with: doc_target: "tensorwrapper_cxx_api" secrets: inherit + + platform_matrix: + uses: ryanmrichard/.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: ryanmrichard/.github/.github/actions/build_pypi_dist@master + with: + cibw_build: ${{ matrix.cibw_build }} + build_sdist: ${{ matrix.os == 'ubuntu-latest' && 'true' || 'false' }} + extra_index_url: https://test.pypi.org/simple/ + 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/ + repository-url: https://test.pypi.org/legacy/ From c1fc2e34013ff45296be5a0693f2994a966a6cd7 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Fri, 10 Jul 2026 10:41:28 -0500 Subject: [PATCH 13/29] Retarget NWXCMake build dependency to fork Co-Authored-By: Claude Sonnet 5 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d78fef00..9a22d2d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ requires = [ "scikit-build-core>=0.10", "pybind11", "setuptools-scm>=8", - "nwchemex-nwxcmake @ git+https://github.com/NWChemEx/NWXCMake", + "nwchemex-nwxcmake @ git+https://github.com/ryanmrichard/NWXCMake", ] build-backend = "scikit_build_core.build" From 56a42690820e97d79322fd50162d8774a8a697ae Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Fri, 10 Jul 2026 10:50:45 -0500 Subject: [PATCH 14/29] Retrigger CI: use boost169-devel with BOOST_INCLUDEDIR From 349ac9498a772b085370db57339bdadf65d29fb9 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Fri, 10 Jul 2026 12:40:22 -0500 Subject: [PATCH 15/29] Simplify Sigma CI job to a plain cmake_opts, drop stale ENABLE_SIGMA TODO ENABLE_SIGMA is already a real CMake option defined globally by nwxcmake's set_default_nwx_options.cmake, so no toolchain file is needed to set it for CI, and no placeholder TODO is needed in CMakeLists.txt. --- .github/workflows/pull_request.yaml | 2 +- CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 822a3847..ac1d8cb7 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -38,4 +38,4 @@ jobs: uses: ryanmrichard/.github/.github/workflows/test_nwx_cmake_build.yaml@master with: run_python_tests: "true" - cmake_opts: "-DCMAKE_TOOLCHAIN_FILE=.github/enable_sigma.cmake" + cmake_opts: "-DENABLE_SIGMA=ON" diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a59b688..ee965c40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ nwx_cxx_api_docs("cxx/include" "cxx/src") include(get_dependencies) get_dependencies(utilities parallelzone wtf eigen boost) -# TODO: ENABLE_SIGMA and ENABLE_CUTENSOR handling +# TODO: ENABLE_CUTENSOR handling # Build the library include(nwx_library) From 4e5e46e8b2c9edc829653ed0f7f3e60be2faa12d Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Sun, 12 Jul 2026 12:37:05 -0500 Subject: [PATCH 16/29] Re-trigger CI to rebuild wheel with OpenMPI 4.1.6 fix (matches Ubuntu's ambient MPI ABI) From 1a789fe9d69c90f4bba380bd4981f840bd639c12 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Sun, 12 Jul 2026 13:08:45 -0500 Subject: [PATCH 17/29] Re-trigger CI to rebuild wheel with OpenMPI --enable-mpirun-prefix-by-default fix From 7181a65dba13c30ec23f6aac13c6bd55497e92aa Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Sun, 12 Jul 2026 13:45:27 -0500 Subject: [PATCH 18/29] Re-trigger CI to rebuild wheel with OpenMPI --disable-dlopen fix From cd963f4d31ce9da431a6e081c7cf413e916b344f Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Sun, 12 Jul 2026 14:32:47 -0500 Subject: [PATCH 19/29] Republish: pick up build_pypi_dist fix (stop vendoring MPI, require system MPI on Linux) From fb80400681e05b7bdedf5b44ff323f21a053613c Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Sun, 12 Jul 2026 22:28:25 -0500 Subject: [PATCH 20/29] Republish: fix build_pypi_dist to use exact sonames for auditwheel --exclude (glob patterns don't work on cibuildwheel v2.22.0's pinned auditwheel 6.1.0) From 210720a3d76eb2310c91389d350e74bb0a5c93ad Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Wed, 15 Jul 2026 10:12:28 -0500 Subject: [PATCH 21/29] use fork --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9a22d2d9..0a044bce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,8 +28,8 @@ description = "Tensor abstraction library for the NWChemEx ecosystem" license = { text = "Apache-2.0" } requires-python = ">=3.8" dependencies = [ - "nwchemex-utilities", - "nwchemex-parallelzone", + "nwchemex-utilities @ git+https://github.com/ryanmrichard/Utilities", + "nwchemex-parallelzone @ @ git+https://github.com/ryanmrichard/ParallelZone", ] [tool.scikit-build] From 2c861b2270820274a62d2660e6f4287fe3a88962 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Wed, 15 Jul 2026 10:32:18 -0500 Subject: [PATCH 22/29] fix typo --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0a044bce..bbf3b35f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ license = { text = "Apache-2.0" } requires-python = ">=3.8" dependencies = [ "nwchemex-utilities @ git+https://github.com/ryanmrichard/Utilities", - "nwchemex-parallelzone @ @ git+https://github.com/ryanmrichard/ParallelZone", + "nwchemex-parallelzone @ git+https://github.com/ryanmrichard/ParallelZone", ] [tool.scikit-build] From c9645be58d80d39ecb5f456ea879a82ff96e141d Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Mon, 3 Aug 2026 12:16:09 -0500 Subject: [PATCH 23/29] add pre-commit to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index e87377e4..b858a256 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,6 @@ toolchain.cmake # These are MacOS files .DS_Store + +# Automatically installed in dev mode +.pre-commit-config.yaml From 5c67a9b1eb52eb0a0786d44adcef2636d9c75334 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Mon, 3 Aug 2026 12:26:32 -0500 Subject: [PATCH 24/29] update pyproject.toml --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bbf3b35f..0e800b66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,9 @@ dependencies = [ "nwchemex-parallelzone @ git+https://github.com/ryanmrichard/ParallelZone", ] +[project.optional-dependencies] +dev = ["pytest", "pre-commit"] + [tool.scikit-build] metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" cmake.build-type = "Release" @@ -46,4 +49,4 @@ fallback_version = "0.0.0" # For editable (developer) installs, also build the tests. [[tool.scikit-build.overrides]] if.state = "editable" -cmake.args = ["-DBUILD_PYBIND11_BINDINGS=ON", "-DBUILD_TESTING=ON"] +cmake.args = ["-DDEVELOPER_SETUP=ON"] From 4feff34b1cee36bb5c240db8a9cbb6773380c9b4 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Mon, 3 Aug 2026 13:27:55 -0500 Subject: [PATCH 25/29] works in dev mode --- pyproject.toml | 6 +++++- tests/python/conftest.py | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0e800b66..68bcc905 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,11 @@ dependencies = [ ] [project.optional-dependencies] -dev = ["pytest", "pre-commit"] +# 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" diff --git a/tests/python/conftest.py b/tests/python/conftest.py index d9c5a96e..9ca83291 100644 --- a/tests/python/conftest.py +++ b/tests/python/conftest.py @@ -14,9 +14,19 @@ # 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(): From 977c4ae9312fa092a79ec9dbe48030493dad3e3a Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Tue, 4 Aug 2026 11:52:17 -0500 Subject: [PATCH 26/29] adds python build --- .github/workflows/pull_request.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index ac1d8cb7..36fe1017 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -39,3 +39,6 @@ jobs: with: run_python_tests: "true" cmake_opts: "-DENABLE_SIGMA=ON" + + test_pip_build: + uses: ryanmrichard/.github/.github/workflows/test_nwx_pip_build.yaml@master From a203232593295aa7b50fc31a9373671a0cdf7b2d Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Tue, 4 Aug 2026 21:45:29 -0500 Subject: [PATCH 27/29] move nwxcmake/pybind11 to project --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 68bcc905..b3134b16 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,9 +15,7 @@ [build-system] requires = [ "scikit-build-core>=0.10", - "pybind11", "setuptools-scm>=8", - "nwchemex-nwxcmake @ git+https://github.com/ryanmrichard/NWXCMake", ] build-backend = "scikit_build_core.build" @@ -28,6 +26,8 @@ description = "Tensor abstraction library for the NWChemEx ecosystem" license = { text = "Apache-2.0" } requires-python = ">=3.8" dependencies = [ + "pybind11", + "nwchemex-nwxcmake @ git+https://github.com/ryanmrichard/NWXCMake", "nwchemex-utilities @ git+https://github.com/ryanmrichard/Utilities", "nwchemex-parallelzone @ git+https://github.com/ryanmrichard/ParallelZone", ] From 0874fb11153c897e34bd5c640b27ea49d31e2041 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Wed, 5 Aug 2026 10:32:26 -0500 Subject: [PATCH 28/29] update nightly --- .github/workflows/nightly.yaml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index e6fa7276..b1d278c6 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: ryanmrichard/.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: ryanmrichard/.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: ryanmrichard/.github/.github/workflows/test_nwx_pip_build.yaml@master From 7b019149f5851c4b047fd172d69765cc24d6b6e4 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Wed, 5 Aug 2026 15:27:11 -0500 Subject: [PATCH 29/29] Migrate CI and dependencies from ryanmrichard to NWChemEx Repoints this repo's workflows at NWChemEx/.github (landed in NWChemEx/.github#187) instead of the ryanmrichard fork they were developed against, and switches merge.yaml's and pull_request.yaml's branch triggers from build_overhaul to master now that master is the ecosystem's working branch. Drops the test.pypi.org extra_index_url and repository-url overrides -- this repo's runtime dependencies (nwxcmake, utilities, parallelzone) are all now on real PyPI, so a merge to master can publish nwchemex-tensorwrapper there directly (trusted publisher registered). get_nwx_cmake.cmake's FetchContent fallback and pyproject.toml's runtime dependencies repoint at NWChemEx/NWXCMake, switching all three Python dependencies from git+ URLs to published floors (nwchemex-nwxcmake>=0.1.0, nwchemex-utilities>=0.1.45, nwchemex-parallelzone>=0.1.43). --- .github/workflows/merge.yaml | 12 +++++------- .github/workflows/nightly.yaml | 6 +++--- .github/workflows/pull_request.yaml | 12 ++++++------ cmake/get_nwx_cmake.cmake | 2 +- pyproject.toml | 6 +++--- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index b7ac474a..1af459b9 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -18,21 +18,21 @@ name: Merge Workflow on: push: branches: - - build_overhaul + - master jobs: tag-commit: - uses: ryanmrichard/.github/.github/workflows/tag.yaml@master + uses: NWChemEx/.github/.github/workflows/tag.yaml@master secrets: inherit deploy_nwx_docs: - uses: ryanmrichard/.github/.github/workflows/deploy_nwx_docs.yaml@master + uses: NWChemEx/.github/.github/workflows/deploy_nwx_docs.yaml@master with: doc_target: "tensorwrapper_cxx_api" secrets: inherit platform_matrix: - uses: ryanmrichard/.github/.github/workflows/platform_matrix.yaml@master + uses: NWChemEx/.github/.github/workflows/platform_matrix.yaml@master build_pypi_dist: needs: [tag-commit, platform_matrix] @@ -43,11 +43,10 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Build PyPI Distribution - uses: ryanmrichard/.github/.github/actions/build_pypi_dist@master + uses: NWChemEx/.github/.github/actions/build_pypi_dist@master with: cibw_build: ${{ matrix.cibw_build }} build_sdist: ${{ matrix.os == 'ubuntu-latest' && 'true' || 'false' }} - extra_index_url: https://test.pypi.org/simple/ needs_mpi: "true" needs_boost: "true" @@ -78,4 +77,3 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: packages-dir: dist/ - repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index b1d278c6..b9009396 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -25,15 +25,15 @@ on: jobs: test_cmake_build: - uses: ryanmrichard/.github/.github/workflows/test_nwx_cmake_build.yaml@master + uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master with: run_python_tests: "true" test_cmake_build_with_sigma: - uses: ryanmrichard/.github/.github/workflows/test_nwx_cmake_build.yaml@master + uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master with: run_python_tests: "true" cmake_opts: "-DENABLE_SIGMA=ON" test_pip_build: - uses: ryanmrichard/.github/.github/workflows/test_nwx_pip_build.yaml@master + 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 36fe1017..60f35e32 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -18,27 +18,27 @@ name: Pull Request Workflow on: pull_request: branches: - - build_overhaul + - master jobs: check_formatting: - uses: ryanmrichard/.github/.github/workflows/check_formatting.yaml@master + uses: NWChemEx/.github/.github/workflows/check_formatting.yaml@master test_nwx_docs: - uses: ryanmrichard/.github/.github/workflows/test_nwx_docs.yaml@master + uses: NWChemEx/.github/.github/workflows/test_nwx_docs.yaml@master with: doc_target: "tensorwrapper_cxx_api" test_cmake_build: - uses: ryanmrichard/.github/.github/workflows/test_nwx_cmake_build.yaml@master + uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master with: run_python_tests: "true" test_cmake_build_with_sigma: - uses: ryanmrichard/.github/.github/workflows/test_nwx_cmake_build.yaml@master + uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master with: run_python_tests: "true" cmake_opts: "-DENABLE_SIGMA=ON" test_pip_build: - uses: ryanmrichard/.github/.github/workflows/test_nwx_pip_build.yaml@master + uses: NWChemEx/.github/.github/workflows/test_nwx_pip_build.yaml@master diff --git a/cmake/get_nwx_cmake.cmake b/cmake/get_nwx_cmake.cmake index c936012a..9188ad48 100644 --- a/cmake/get_nwx_cmake.cmake +++ b/cmake/get_nwx_cmake.cmake @@ -57,7 +57,7 @@ macro(get_nwx_cmake) include(FetchContent) FetchContent_Declare( nwx_cmake - GIT_REPOSITORY https://github.com/ryanmrichard/NWXCMake + GIT_REPOSITORY https://github.com/NWChemEx/NWXCMake ) FetchContent_MakeAvailable(nwx_cmake) set(_gnc_resolved "${nwx_cmake_SOURCE_DIR}/cmake") diff --git a/pyproject.toml b/pyproject.toml index b3134b16..28195fc4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,9 +27,9 @@ license = { text = "Apache-2.0" } requires-python = ">=3.8" dependencies = [ "pybind11", - "nwchemex-nwxcmake @ git+https://github.com/ryanmrichard/NWXCMake", - "nwchemex-utilities @ git+https://github.com/ryanmrichard/Utilities", - "nwchemex-parallelzone @ git+https://github.com/ryanmrichard/ParallelZone", + "nwchemex-nwxcmake>=0.1.0", + "nwchemex-utilities>=0.1.45", + "nwchemex-parallelzone>=0.1.43", ] [project.optional-dependencies]