Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

459 restructure directories#460

Merged
shinaoka merged 21 commits intomainfrom
459-restructure-directories
Oct 28, 2025
Merged

459 restructure directories#460
shinaoka merged 21 commits intomainfrom
459-restructure-directories

Conversation

@shinaoka
Copy link
Member

No description provided.

- Created backend/cxx directory
- Moved src/, include/, and test/ to backend/cxx/
- Updated CMakeLists.txt paths for new directory structure
- Updated test/CMakeLists.txt paths (cpp and fortran)
- Build tests successful
- Created fortran/test/ directory
- Moved Fortran test files from backend/cxx/test/fortran to fortran/test/
- Updated CMakeLists.txt to add fortran/test as subdirectory
- Updated backend/cxx/test/CMakeLists.txt to remove fortran reference
- Fixed fortran/test/CMakeLists.txt relative paths
- All tests passing (20/20: 18 C++ + 2 Fortran)
- Moved all test files from backend/cxx/test/cpp/ to backend/cxx/test/
- Updated CMakeLists.txt include paths
- Flattened directory structure for simplicity
…PI dependencies

- Created backend/test/ directory for C-API only tests
- Moved cinterface_integration.cxx from backend/cxx/test to backend/test
- Removed sparseir.hpp dependency by:
  - Replacing sparseir::movedim() with local movedim_local() implementation
  - Removing template parameters for sparseir::Bosonic/Fermionic, sparseir::LogisticKernel
  - Making kernel and stat runtime parameters instead of template parameters
- Added backend/test/CMakeLists.txt for C-API test configuration
- Updated main CMakeLists.txt to add backend/test subdirectory
- Renamed backend/test to backend/capi_test for better clarity
- Updated CMakeLists.txt to use backend/capi_test
- Directory contains C-API only tests (no C++ dependencies)
- Create independent backend/cxx/CMakeLists.txt for C++ library
  - Standalone build system with dependency resolution
  - Can be built and installed independently
  - Add build_capi_with_tests.sh script

- Create independent fortran/CMakeLists.txt
  - Uses find_package(SparseIR) for C library dependency
  - Standalone Fortran bindings build

- Move backend/capi_test to capi_test at top level
  - Update CMakeLists.txt to be fully independent
  - Add test_with_cxx_backend.sh to test against installed backend
  - Remove unused C++ API dependencies from _utils.hpp

- Rename benchmark to capi_benchmark for clarity

- Remove old build scripts and backup to back/ directory

Each component (backend/cxx, fortran, capi_test) can now be built
independently using find_package(SparseIR) to locate dependencies.
- Move old workflows to back/workflows/ for backup
- Create new test_cxx_backend.yml workflow
  - Uses shell scripts for simplicity
  - Tests on Ubuntu and macOS
  - BLAS enabled by default
  - Supports manual trigger (workflow_dispatch)
  - Triggers on push to main and 459-restructure-directories branches

- Update capi_test/test_with_cxx_backend.sh to enable BLAS

Workflow steps:
1. Build C++ backend with tests and run them
2. Build and install C++ backend (no tests)
3. Build and run capi_test against installed backend
Remove 'libsparseir/' prefix from working-directory paths.
The repository root is already at libsparseir/ after checkout.
- Add fortran/test_with_cxx_backend.sh
  - Builds C++ backend and installs to work_cxx/install_backend
  - Builds Fortran bindings against installed backend
  - Runs Fortran tests with library paths set

- Add .github/workflows/test_fortran.yml
  - Tests with GCC/gfortran on Ubuntu
  - Tests with Intel oneAPI compilers on Ubuntu
  - Uses shell scripts for simplicity

- Update fortran/CMakeLists.txt
  - Find SparseIR package before project() to get version
  - Make independent build system

- Update fortran/test/CMakeLists.txt
  - Use SparseIR::sparseir target instead of plain sparseir

Note: Python uses its own independent build system (setup_build.py + CMakeLists.txt)
      that copies source files and builds internally
- Add .github/workflows/test_python.yml
  - Tests on Ubuntu and macOS
  - Python versions: 3.10, 3.11, 3.12
  - Uses astral-sh/setup-uv@v7 for uv management
  - Enables BLAS support via SPARSEIR_USE_BLAS=1

- Update python/setup_build.py
  - Copy files from backend/cxx instead of top-level
  - Do not copy CMakeLists.txt (Python has its own)
  - Do not copy fortran directory

- Update .gitignore
  - Add work_cxx to ignore build artifacts
- Add -fp-model=precise flag for Intel C++ compiler in backend/cxx
- Add -fp-model=precise flag for Intel C++ compiler in capi_test
- Add comment in fortran/CMakeLists.txt explaining the fix

This prevents Intel Compiler from applying aggressive floating-point
optimizations that break xprec's compensated arithmetic operations.
The fix is needed because Intel icx/icpx enable unsafe math
optimizations by default, which reassociate operations and break
compensated addition/subtraction used in xprec's extended precision
arithmetic.
- Restore CI_PublishTestPyPI.yml, conda.yml, PublishPyPI.yml,
  and VersionConsistencyCheck.yml from back/workflows/ to
  .github/workflows/
- Update VersionConsistencyCheck.yml paths to use
  backend/cxx/include/sparseir/version.h
- Update update_version.py to use backend/cxx/include/sparseir/version.h
- conda-recipe/meta.yaml stays at ../../include/sparseir/version.h
  since setup_build.py copies it there

These workflows support publishing Python wheels and conda packages.
- Add RPATH properties to sparseir_fortran and test executables
- Update test_with_cxx_backend.sh to fix install_name on macOS
- Set BUILD_WITH_INSTALL_RPATH and INSTALL_RPATH_USE_LINK_PATH

This ensures test executables can find libsparseir.0.dylib at runtime
on macOS by embedding the correct library paths.
- Move 2>/dev/null to the end of for loop instead of in loop condition
- This fixes 'syntax error near unexpected token 2'
- Remove arr_c and res_c temporary arrays from generated code
- Use direct pointer passing with c_loc() for better performance
- Fix test to use g_ir instead of g_dlr for Matsubara evaluation
- Change all 'stop' to 'stop 1' to return proper error codes for CI
- Update generate_evaluate_matsubara.py, generate_evaluate_tau.py, and generate_fit_tau.py
- Replace compare_with_relative_error_d(coeffs, real(g_ir2_z)) with compare_with_relative_error_z(g_ir, g_ir2_z)
- This compares the correct complex IR coefficients instead of incorrect types
- Add cmake --install step for Fortran bindings before running tests
- This ensures libsparseir_fortran.0.dylib is available at expected location
- Change from DIRECTORY install to FILES install for module files
- Use OPTIONAL flag to avoid errors if modules don't exist
- Include GNUInstallDirs to set CMAKE_INSTALL_INCLUDEDIR correctly
- This fixes the '/sparseir' path issue when installing modules
@shinaoka shinaoka linked an issue Oct 28, 2025 that may be closed by this pull request
@shinaoka shinaoka merged commit 6eb435a into main Oct 28, 2025
21 checks passed
@shinaoka shinaoka deleted the 459-restructure-directories branch October 28, 2025 05:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restructure directories

1 participant