Skip to content

Commit

Permalink
Merge branch 'py313-pre'
Browse files Browse the repository at this point in the history
  • Loading branch information
hczhai committed Oct 11, 2024
2 parents 3edef35 + 44b7b18 commit 4f2ddd4
Show file tree
Hide file tree
Showing 110 changed files with 2,043 additions and 42 deletions.
8 changes: 5 additions & 3 deletions .github/actions/build-wheel/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ elif [ "${PYTHON_VERSION}" = "3.11" ]; then
PY_VER=cp311-cp311
elif [ "${PYTHON_VERSION}" = "3.12" ]; then
PY_VER=cp312-cp312
elif [ "${PYTHON_VERSION}" = "3.13-dev" ]; then
PY_VER=cp313-cp313
fi

PY_EXE=/opt/python/"${PY_VER}"/bin/python3
Expand All @@ -35,9 +37,9 @@ $(cat $(which auditwheel) | head -1 | awk -F'!' '{print $2}') -m pip install set

if [ "${PARALLEL}" = "mpi" ]; then
yum install -y wget openssh-clients openssh-server
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.6.tar.gz
tar zxf openmpi-4.1.6.tar.gz
cd openmpi-4.1.6
wget https://download.open-mpi.org/release/open-mpi/v5.0/openmpi-5.0.5.tar.gz
tar zxf openmpi-5.0.5.tar.gz
cd openmpi-5.0.5
./configure --prefix=/usr/local |& tee config.out
make -j 4 |& tee make.out
make install |& tee install.out
Expand Down
173 changes: 142 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ jobs:

strategy:
matrix:
os: [ ubuntu-20.04, macos-12, windows-2022 ]
python: [ 3.12 ]
os: [ ubuntu-20.04, macos-13, macos-14, windows-2022 ]
python: [ '3.13-dev' ]
plat: [ x86_64 ]
parallel: [ mpi, serial, serial-pytest, any-symm-pytest ]
parallel: [ mpi, serial, serial-pytest, any-symm-pytest, main-test ]
exclude:
- os: macos-12
- os: macos-13
parallel: mpi
- os: macos-14
parallel: mpi
- os: windows-2022
parallel: mpi
Expand All @@ -41,13 +43,19 @@ jobs:
python-version: ${{ matrix.python }}

- name: install requirements (linux / macos)
if: matrix.os == 'macos-12' || matrix.os == 'ubuntu-20.04'
if: matrix.os == 'macos-13' || matrix.os == 'ubuntu-20.04'
env:
MKLROOT: ~/.local
run: |
python -m pip install pip build twine setuptools --upgrade
python -m pip install mkl==2021.4 mkl-include intel-openmp numpy 'cmake>=3.19' pybind11==2.12.0
- name: install requirements (linux / macos)
if: matrix.os == 'macos-14'
run: |
python -m pip install pip build twine setuptools --upgrade
python -m pip install numpy 'cmake>=3.19' pybind11==2.12.0
- name: install requirements (linux / mpi)
if: matrix.parallel == 'mpi' && matrix.os == 'ubuntu-20.04'
run: |
Expand Down Expand Up @@ -110,7 +118,7 @@ jobs:
getconf LONG_BIT
- name: build gtest (macos)
if: matrix.os == 'macos-12'
if: matrix.os == 'macos-13'
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
Expand All @@ -123,11 +131,25 @@ jobs:
brew install libomp
cp /usr/local/opt/libomp/include/*.h /usr/local/include/
- name: build gtest (macos)
if: matrix.os == 'macos-14'
env:
GTESTROOT: ~/gtest
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
git clone -b release-1.8.0 https://github.com/google/googletest
cd googletest
cmake CMakeLists.txt -DCMAKE_INSTALL_PREFIX=${GTESTROOT}
make
make install
brew update
brew install libomp
- name: build test (serial-pytest, linux | macos)
if: matrix.parallel == 'serial-pytest' && (matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-12')
if: (matrix.parallel == 'serial-pytest' || matrix.parallel == 'main-test') && (matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13')
env:
MKLROOT: ~/.local
MACOSX_DEPLOYMENT_TARGET: '10.9'
MACOSX_DEPLOYMENT_TARGET: '11.0'
CC: gcc-9
CXX: g++-9
run: |
Expand All @@ -137,8 +159,24 @@ jobs:
cmake .. -DUSE_MKL=ON -DBUILD_LIB=ON -DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SG=ON
make -j 2
- name: build test (serial-pytest, macos-arm64)
if: (matrix.parallel == 'serial-pytest' || matrix.parallel == 'main-test') && matrix.os == 'macos-14'
env:
MACOSX_DEPLOYMENT_TARGET: '11.0'
CC: gcc-9
CXX: g++-9
run: |
mkdir build
cd build
cmake --version
export OMPROOT=$(brew --prefix libomp)
cmake .. -DUSE_MKL=OFF -DARCH_ARM64=ON -DCMAKE_CXX_FLAGS=-I${OMPROOT}/include -DOMP_LIB=OMP \
-DBUILD_LIB=ON -DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SG=ON -DFORCE_LIB_ABS_PATH=OFF \
-DAPPLE_ACC_SINGLE_PREC=OFF
make -j 2
- name: build test (serial-pytest, windows)
if: matrix.parallel == 'serial-pytest' && matrix.os == 'windows-2022'
if: (matrix.parallel == 'serial-pytest' || matrix.parallel == 'main-test') && matrix.os == 'windows-2022'
env:
BLAS_ROOT: D:\a\openblas
run: |
Expand All @@ -150,10 +188,10 @@ jobs:
cmake --build . -j 2 --config Release -- '/v:d'
- name: build test (any-symm-pytest, linux | macos)
if: matrix.parallel == 'any-symm-pytest' && (matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-12')
if: matrix.parallel == 'any-symm-pytest' && (matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13')
env:
MKLROOT: ~/.local
MACOSX_DEPLOYMENT_TARGET: '10.9'
MACOSX_DEPLOYMENT_TARGET: '11.0'
CC: gcc-9
CXX: g++-9
run: |
Expand All @@ -163,6 +201,22 @@ jobs:
cmake .. -DUSE_MKL=ON -DBUILD_LIB=ON -DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SU2SZ=OFF -DUSE_SANY=ON
make -j 2
- name: build test (any-symm-pytest, macos-arm64)
if: matrix.parallel == 'any-symm-pytest' && matrix.os == 'macos-14'
env:
MACOSX_DEPLOYMENT_TARGET: '11.0'
CC: gcc-9
CXX: g++-9
run: |
mkdir build
cd build
cmake --version
export OMPROOT=$(brew --prefix libomp)
cmake .. -DUSE_MKL=OFF -DARCH_ARM64=ON -DCMAKE_CXX_FLAGS=-I${OMPROOT}/include -DBUILD_LIB=ON -DOMP_LIB=OMP \
-DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SU2SZ=OFF -DUSE_SANY=ON -DFORCE_LIB_ABS_PATH=OFF \
-DAPPLE_ACC_SINGLE_PREC=OFF
make -j 2
- name: build test (any-symm-pytest, windows)
if: matrix.parallel == 'any-symm-pytest' && matrix.os == 'windows-2022'
env:
Expand Down Expand Up @@ -201,17 +255,32 @@ jobs:
make -j 2
- name: build test (serial, macos)
if: matrix.parallel == 'serial' && matrix.os == 'macos-12'
if: matrix.parallel == 'serial' && matrix.os == 'macos-13'
env:
MKLROOT: ~/.local
MACOSX_DEPLOYMENT_TARGET: '10.9'
MACOSX_DEPLOYMENT_TARGET: '11.0'
run: |
mkdir build_test
cd build_test
cmake --version
cmake .. -DUSE_MKL=ON -DBUILD_TEST=ON -DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SINGLE_PREC=ON -DUSE_SG=ON
make -j 2
- name: build test (serial, macos-arm64)
if: matrix.parallel == 'serial' && matrix.os == 'macos-14'
env:
GTESTROOT: ~/gtest
MACOSX_DEPLOYMENT_TARGET: '11.0'
run: |
mkdir build_test
cd build_test
cmake --version
export OMPROOT=$(brew --prefix libomp)
cmake .. -DUSE_MKL=OFF -DARCH_ARM64=ON -DCMAKE_CXX_FLAGS=-I${OMPROOT}/include -DBUILD_TEST=ON -DOMP_LIB=OMP \
-DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SINGLE_PREC=OFF -DUSE_SG=ON -DGTEST_ROOT=${GTESTROOT} \
-DFORCE_LIB_ABS_PATH=OFF -DSIMPLE_TEST=ON
make -j 2
- name: run test (serial, windows)
if: matrix.parallel == 'serial' && matrix.os == 'windows-2022'
env:
Expand All @@ -238,7 +307,7 @@ jobs:
./block2_tests
- name: run test (serial, macos)
if: matrix.parallel == 'serial' && matrix.os == 'macos-12'
if: matrix.parallel == 'serial' && (matrix.os == 'macos-13' || matrix.os == 'macos-14')
run: |
cd build_test
./block2_tests
Expand All @@ -250,7 +319,7 @@ jobs:
run: |
$vcpath = Get-ChildItem 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC'
$dumpbin = "$($vcpath[0].FullName)\bin\Hostx64\x64\dumpbin.exe"
& $dumpbin /DEPENDENTS .\build\Release\block2.cp312-win_amd64.pyd
& $dumpbin /DEPENDENTS .\build\Release\block2.cp313-win_amd64.pyd
$xpwd = Get-Location
$env:PYTHONPATH = "${xpwd};${xpwd}\build\Release;" + $env:PYTHONPATH
$env:PATH = "${env:BLAS_ROOT}\bin;" + $env:PATH
Expand All @@ -263,7 +332,7 @@ jobs:
- name: run test (serial-pytest, linux)
if: matrix.parallel == 'serial-pytest' && matrix.os == 'ubuntu-20.04'
run: |
python -m pip install pytest 'pyscf==2.5.0' 'scipy==1.12.0'
python -m pip install pytest 'pyscf==2.6.2' 'scipy==1.14.1'
export PYTHONPATH=$(pwd)/build:$(pwd):${PYTHONPATH}
export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}')
if [ "$CPUTYPE" = "AuthenticAMD" ]; then
Expand All @@ -273,20 +342,62 @@ jobs:
py.test -s pyblock2/unit_test/*.py
- name: run test (serial-pytest, macos)
if: matrix.parallel == 'serial-pytest' && matrix.os == 'macos-12'
if: matrix.parallel == 'serial-pytest' && (matrix.os == 'macos-13' || matrix.os == 'macos-14')
run: |
python -m pip install pytest 'pyscf==2.5.0' 'scipy==1.12.0'
python -m pip install pytest 'pyscf==2.6.2' 'scipy==1.14.1'
export PYTHONPATH=$(pwd)/build:$(pwd):${PYTHONPATH}
py.test -s pyblock2/unit_test/*.py
- name: run test (main-test, windows)
if: matrix.parallel == 'main-test' && matrix.os == 'windows-2022'
env:
BLAS_ROOT: D:\a\openblas
run: |
$vcpath = Get-ChildItem 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC'
$dumpbin = "$($vcpath[0].FullName)\bin\Hostx64\x64\dumpbin.exe"
& $dumpbin /DEPENDENTS .\build\Release\block2.cp313-win_amd64.pyd
$xpwd = Get-Location
$env:PYTHONPATH = "${xpwd};${xpwd}\build\Release;" + $env:PYTHONPATH
$env:PATH = "${env:BLAS_ROOT}\bin;" + $env:PATH
$env:PATH = "${env:Python_ROOT_DIR}\Library\bin;" + $env:PATH
$env:PATH = "${env:Python_ROOT_DIR};" + $env:PATH
$env:PATH = "$($vcpath[0].FullName)\bin\Hostx64\x64;" + $env:PATH
$env:block2main = "${xpwd}\pyblock2\driver\block2main"
python -m pip install 'scipy==1.14.1'
cd pyblock2\main_test
.\run-test.ps1
- name: run test (main-test, linux)
if: matrix.parallel == 'main-test' && matrix.os == 'ubuntu-20.04'
run: |
python -m pip install pytest 'pyscf==2.6.2' 'scipy==1.14.1'
export PYTHONPATH=$(pwd)/build:$(pwd):${PYTHONPATH}
export PATH=$(pwd)/pyblock2/driver:$PATH
export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}')
if [ "$CPUTYPE" = "AuthenticAMD" ]; then
export LD_PRELOAD=$PWD/libfixcpu.so
fi
echo $LD_PRELOAD
cd pyblock2/main_test
./run-test.sh
- name: run test (main-test, macos)
if: matrix.parallel == 'main-test' && (matrix.os == 'macos-13' || matrix.os == 'macos-14')
run: |
python -m pip install pytest 'pyscf==2.6.2' 'scipy==1.14.1'
export PYTHONPATH=$(pwd)/build:$(pwd):${PYTHONPATH}
export PATH=$(pwd)/pyblock2/driver:$PATH
cd pyblock2/main_test
./run-test.sh
- name: run test (any-symm-pytest, windows)
if: matrix.parallel == 'any-symm-pytest' && matrix.os == 'windows-2022'
env:
BLAS_ROOT: D:\a\openblas
run: |
$vcpath = Get-ChildItem 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC'
$dumpbin = "$($vcpath[0].FullName)\bin\Hostx64\x64\dumpbin.exe"
& $dumpbin /DEPENDENTS .\build\Release\block2.cp312-win_amd64.pyd
& $dumpbin /DEPENDENTS .\build\Release\block2.cp313-win_amd64.pyd
$xpwd = Get-Location
$env:PYTHONPATH = "${xpwd};${xpwd}\build\Release;" + $env:PYTHONPATH
$env:PATH = "${env:BLAS_ROOT}\bin;" + $env:PATH
Expand All @@ -299,7 +410,7 @@ jobs:
- name: run test (any-symm-pytest, linux)
if: matrix.parallel == 'any-symm-pytest' && matrix.os == 'ubuntu-20.04'
run: |
python -m pip install pytest 'pyscf==2.5.0' 'scipy==1.12.0'
python -m pip install pytest 'pyscf==2.6.2' 'scipy==1.14.1'
export PYTHONPATH=$(pwd)/build:$(pwd):${PYTHONPATH}
export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}')
if [ "$CPUTYPE" = "AuthenticAMD" ]; then
Expand All @@ -309,9 +420,9 @@ jobs:
py.test -s pyblock2/unit_test/*.py --symm sany
- name: run test (any-symm-pytest, macos)
if: matrix.parallel == 'any-symm-pytest' && matrix.os == 'macos-12'
if: matrix.parallel == 'any-symm-pytest' && (matrix.os == 'macos-13' || matrix.os == 'macos-14')
run: |
python -m pip install pytest 'pyscf==2.5.0' 'scipy==1.12.0'
python -m pip install pytest 'pyscf==2.6.2' 'scipy==1.14.1'
export PYTHONPATH=$(pwd)/build:$(pwd):${PYTHONPATH}
py.test -s pyblock2/unit_test/*.py --symm sany
Expand Down Expand Up @@ -342,17 +453,17 @@ jobs:

strategy:
matrix:
os: [ ubuntu-20.04, macos-12, windows-2022, macos-14 ]
python: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12' ]
os: [ ubuntu-20.04, macos-13, windows-2022, macos-14 ]
python: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13-dev' ]
manylinux: [ 2014 ]
plat: [ x86_64, arm64 ]
parallel: [ mpi, serial ]
exclude:
- os: macos-12
- os: macos-13
parallel: mpi
- os: macos-14
parallel: mpi
- os: macos-12
- os: macos-13
plat: arm64
- os: macos-14
plat: x86_64
Expand All @@ -373,7 +484,7 @@ jobs:
python-version: ${{ matrix.python }}

- name: install requirements (linux / macos)
if: matrix.os == 'macos-12' || matrix.os == 'ubuntu-20.04'
if: matrix.os == 'macos-13' || matrix.os == 'ubuntu-20.04'
env:
MKLROOT: ~/.local
run: |
Expand Down Expand Up @@ -430,10 +541,10 @@ jobs:
delvewheel repair "$($rr[0].FullName)" -v -w dist
- name: build wheels (macos-x86_64)
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'macos-12' && matrix.plat == 'x86_64'
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'macos-13' && matrix.plat == 'x86_64'
env:
TAG_STRING: ${{ github.event.ref }}
MACOSX_DEPLOYMENT_TARGET: '10.9'
MACOSX_DEPLOYMENT_TARGET: '11.0'
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
brew update
Expand Down Expand Up @@ -534,7 +645,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: '3.13-dev'

- name: build source dist (serial)
env:
Expand Down Expand Up @@ -596,7 +707,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: '3.13-dev'

- name: build source dist (serial)
env:
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ OPTION(USE_PCH "Build precompiled headers" ON)
OPTION(FORCE_LIB_ABS_PATH "Using absolute path when linking libraries" ON)
# For BUILD_CLIB, local static variables may vaiolate ODR in .so and .exe.
OPTION(USE_GLOBAL_VARIABLE "Use global variable instead of local static ones" ON)
OPTION(SIMPLE_TEST "Only compile basic unit tests" OFF)

IF (NOT ${USE_DMRG})
SET(USE_BIG_SITE OFF)
Expand Down Expand Up @@ -785,7 +786,11 @@ IF (${BUILD_TEST})
FIND_PACKAGE(GTest REQUIRED)
INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})

FILE(GLOB TSRCS unit_test/test_*.cpp)
IF (${SIMPLE_TEST})
FILE(GLOB TSRCS unit_test/test_wick_*.cpp unit_test/test_npdm_*.cpp unit_test/test_dmrg_*.cpp)
ELSE()
FILE(GLOB TSRCS unit_test/test_*.cpp)
ENDIF()
MESSAGE(STATUS "TSRCS = ${TSRCS}")

IF ((NOT APPLE) AND (NOT WIN32))
Expand Down
Loading

0 comments on commit 4f2ddd4

Please sign in to comment.