Skip to content

Commit dec28fa

Browse files
committed
Merge remote-tracking branch 'origin/master' into manuel/doc_update
2 parents f680c31 + c5dd9c4 commit dec28fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3853
-13087
lines changed

.github/workflows/ci-cmake_pytests.yml

Lines changed: 0 additions & 101 deletions
This file was deleted.

.github/workflows/ci-cmake_tests.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,20 @@ jobs:
1111
run:
1212
shell: bash -l {0}
1313
steps:
14-
- uses: actions/checkout@v3
15-
- uses: conda-incubator/setup-miniconda@v2
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
# When re-running a PR job, GitHub Actions uses the merge commit created at
19+
# the time of the original run, not a fresh merge with the latest target branch.
20+
# This step ensures we always test against the most recent target branch.
21+
- name: Merge with latest target branch (pull_request only)
22+
if: github.event_name == 'pull_request'
23+
run: |
24+
git fetch origin ${{ github.event.pull_request.base.ref }}
25+
git merge --no-edit origin/${{ github.event.pull_request.base.ref }}
26+
27+
- uses: conda-incubator/setup-miniconda@v3
1628
with:
1729
# Specify python version your environment will have. Remember to quote this, or
1830
# YAML will think you want python 3.1 not 3.10

.github/workflows/clang-format-check.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,21 @@ jobs:
77
name: Formatting Check
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
14+
# When re-running a PR job, GitHub Actions uses the merge commit created at
15+
# the time of the original run, not a fresh merge with the latest target branch.
16+
# This step ensures we always test against the most recent target branch.
17+
- name: Merge with latest target branch (pull_request only)
18+
if: github.event_name == 'pull_request'
19+
run: |
20+
git fetch origin ${{ github.event.pull_request.base.ref }}
21+
git merge --no-edit origin/${{ github.event.pull_request.base.ref }}
22+
1123
- name: Run clang-format style check for C/C++/Protobuf programs.
12-
uses: jidicula/clang-format-action@v4.11.0
24+
uses: jidicula/clang-format-action@v4.16.0
1325
with:
1426
clang-format-version: '14'
1527
check-path: '.'

.github/workflows/conda_build.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,18 @@ jobs:
2222
shell: bash -l {0}
2323

2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
# When re-running a PR job, GitHub Actions uses the merge commit created at
30+
# the time of the original run, not a fresh merge with the latest target branch.
31+
# This step ensures we always test against the most recent target branch.
32+
- name: Merge with latest target branch (pull_request only)
33+
if: github.event_name == 'pull_request'
34+
run: |
35+
git fetch origin ${{ github.event.pull_request.base.ref }}
36+
git merge --no-edit origin/${{ github.event.pull_request.base.ref }}
2637
2738
- uses: conda-incubator/setup-miniconda@v3
2839
with:

.github/workflows/conda_build_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
os: [ubuntu-latest, macos-13, macos-latest]
1717

1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020

2121
- uses: conda-incubator/setup-miniconda@v3
2222
with:

.github/workflows/coverity-scan.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
shell: bash
1616

1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919

20-
- uses: conda-incubator/setup-miniconda@v2
20+
- uses: conda-incubator/setup-miniconda@v3
2121
with:
2222
# Specify python version your environment will have. Remember to quote this, or
2323
# YAML will think you want python 3.1 not 3.10
@@ -33,9 +33,9 @@ jobs:
3333
- name: Install dependencies
3434
shell: bash -l {0}
3535
run: |
36-
mamba install _openmp_mutex=*=*_llvm cmake make boost git compilers numpy mkl mkl-include mkl-service pybind11 libblas=*=*mkl gtest
36+
mamba install cmake make boost compilers blas=*=mkl pybind11 arpack
3737
38-
cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_INSTALL_PREFIX=/home/runner/works/Cytnx_lib -DUSE_MKL=on -DUSE_HPTT=on -DHPTT_ENABLE_FINE_TUNE=on -DHPTT_ENABLE_AVX=on -DBUILD_PYTHON=on -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DRUN_TESTS=on
38+
cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_INSTALL_PREFIX=/home/runner/works/Cytnx_lib --preset=mkl-cpu
3939
4040
- name: Download Coverity Build Tool
4141
shell: bash -l {0}

.github/workflows/coverity-scan_old

Lines changed: 0 additions & 66 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ endfunction()
146146

147147
include(CMakeDependentOption)
148148

149-
set(CMAKE_INSTALL_PREFIX "/usr/local/cytnx" CACHE PATH "Destination path for installation")
149+
set(CMAKE_INSTALL_PREFIX "~/.local/cytnx" CACHE PATH "Destination path for installation")
150150
option(BUILD_PYTHON "Build Python API. Requires Python and pybind11 installed." ON)
151151
option(BACKEND_TORCH "Use PyTorch as a backend container for tensors." OFF)
152152
cmake_dependent_option(USE_MKL "Use MKL as a BLAS provider otherwise use OpenBLAS." OFF "NOT BACKEND_TORCH" OFF)
@@ -339,7 +339,7 @@ IF(BUILD_PYTHON)
339339
endif()
340340
endif()
341341

342-
pybind11_add_module(pycytnx SHARED pybind/cytnx.cpp
342+
pybind11_add_module(pycytnx MODULE pybind/cytnx.cpp
343343
pybind/generator_py.cpp
344344
pybind/storage_py.cpp
345345
pybind/tensor_py.cpp
@@ -357,13 +357,31 @@ IF(BUILD_PYTHON)
357357
pybind/ncon_py.cpp
358358
)
359359
target_link_libraries(pycytnx PUBLIC cytnx)
360+
361+
# On macOS, Python extensions should NOT link to libpython
362+
# Use -undefined dynamic_lookup to resolve symbols from the running interpreter
363+
if(APPLE)
364+
target_link_options(pycytnx PRIVATE "-undefined" "dynamic_lookup")
365+
endif()
360366
set_target_properties(pycytnx PROPERTIES OUTPUT_NAME cytnx)
361367
message(STATUS "pybind11 include dir: ${CUTENSOR_LIBRARY_DIRS}")
362368
message(STATUS "pybind11 include dir: ${CUQUANTUM_LIBRARY_DIRS}")
363-
set_target_properties(pycytnx
364-
PROPERTIES
365-
INSTALL_RPATH "${CUTENSOR_LIBRARY_DIRS};${CUQUANTUM_LIBRARY_DIRS}"
366-
)
369+
message(STATUS "pybind11 include dir: ${LAPACK_LIBRARY_DIRS}")
370+
message(STATUS "pybind11 include dir: ${LAPACKE_LIBRARY_DIRS}")
371+
# Configure RPATH for macOS to make the Python extension relocatable
372+
if(APPLE)
373+
set_target_properties(pycytnx
374+
PROPERTIES
375+
BUILD_WITH_INSTALL_RPATH TRUE
376+
INSTALL_RPATH_USE_LINK_PATH TRUE
377+
INSTALL_RPATH "@loader_path;@loader_path/../../../lib;${CMAKE_INSTALL_PREFIX}/lib"
378+
)
379+
else()
380+
set_target_properties(pycytnx
381+
PROPERTIES
382+
INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib"
383+
)
384+
endif()
367385

368386
message(STATUS " Build Python Wrapper: YES")
369387
message(STATUS " - Python Excutable : ${PYTHON_EXECUTABLE}")

CMakePresets.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"RUN_BENCHMARKS": "OFF",
2525
"USE_DEBUG": "OFF",
2626
"BUILD_DOC": "OFF",
27-
"DEV_MODE": "OFF"
27+
"DEV_MODE": "OFF",
28+
"CMAKE_INSTALL_PREFIX": "~/.local/cytnx"
2829
}
2930
},
3031
{
@@ -60,6 +61,12 @@
6061
"description": "Intel MKL as the BLAS vendor with CUDA support.",
6162
"inherits": ["mkl", "openblas-cuda"]
6263
},
64+
{
65+
"name": "openblas-apple",
66+
"description": "OpenBLAS as the BLAS vendor with CUDA support on Apple.",
67+
"inherits": [ "default"]
68+
69+
},
6370
{
6471
"name": "debug",
6572
"hidden": true,
@@ -93,6 +100,11 @@
93100
"name": "debug-mkl-cuda",
94101
"description": "Debug build: Intel MKL as the BLAS vendor with CUDA support.",
95102
"inherits": ["debug", "mkl-cuda"]
103+
},
104+
{
105+
"name": "debug-openblas-apple",
106+
"description": "Debug build: OpenBLAS as the BLAS vendor with CUDA support on Apple.",
107+
"inherits": ["debug", "openblas-apple"]
96108
}
97109
],
98110
"buildPresets": [
@@ -128,6 +140,12 @@
128140
"configurePreset": "mkl-cuda",
129141
"inherits": "default"
130142
},
143+
{
144+
"name": "openblas-apple",
145+
"description": "Build using OpenBLAS with CUDA support on Apple.",
146+
"configurePreset": "openblas-apple",
147+
"inherits": "default"
148+
},
131149
{
132150
"name": "debug-openblas-cpu",
133151
"description": "Debug build using OpenBLAS with CPU-only support.",
@@ -151,6 +169,12 @@
151169
"description": "Debug build using Intel MKL with CUDA support.",
152170
"configurePreset": "debug-mkl-cuda",
153171
"inherits": "default"
172+
},
173+
{
174+
"name": "debug-openblas-apple",
175+
"description": "Debug build using OpenBLAS with CUDA support on Apple.",
176+
"configurePreset": "debug-openblas-apple",
177+
"inherits": "default"
154178
}
155179
],
156180
"testPresets": [

0 commit comments

Comments
 (0)