Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batched GF2 Computation in CalHam #43

Draft
wants to merge 40 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
28da223
Port from libVMC
xrq-phys Feb 10, 2023
a07f273
ltl2inv via Eig Build Sys
xrq-phys Feb 10, 2023
24700aa
Port from libVMC + Fixes for Complex Nums.
xrq-phys Feb 10, 2023
26ae546
Adapt mVMC for Modified PfUpdates Interface
xrq-phys Feb 10, 2023
01b2b60
Fix CI
xrq-phys Feb 10, 2023
75efd69
Fix CI
xrq-phys Feb 10, 2023
d50eac0
Fix CI
xrq-phys Feb 10, 2023
5766c58
Upgrade BLIS
xrq-phys Feb 10, 2023
8334613
Upgrade CI BLIS
xrq-phys Feb 10, 2023
0375f1c
Fix: Use BLIS GEMMT
xrq-phys Feb 10, 2023
2687fd4
First Step: Extract PfM from GF2 for FCMP Exchange Only
xrq-phys Feb 9, 2023
78d3c0c
Fix Malloc/Memset/Conj Typos
xrq-phys Feb 10, 2023
d6ce918
Env Adjustments
xrq-phys Feb 10, 2023
f345f25
Not-working Batch GF2
xrq-phys Feb 11, 2023
8806127
Fix: Batch GF2 Forgot to Convert AmpRatio to Amp
xrq-phys Feb 11, 2023
e77f0ae
Fix: Batch GF2 OMP
xrq-phys Feb 11, 2023
5389c0c
Fix: CMake Eigen
xrq-phys Feb 11, 2023
c987aee
Eigen Should Offload MMuls to BLAS
xrq-phys Feb 11, 2023
32887d0
Fix: Include <tuple>
xrq-phys Feb 11, 2023
88c1884
Fix: Link PfUpdates Always
xrq-phys Feb 11, 2023
e34ed8d
Batch GF2 Parallel in QP
xrq-phys Feb 11, 2023
932b141
Silent Bracket Warning
xrq-phys Feb 14, 2023
e41ba71
Batch GF2 for all Ham in complex cSz
xrq-phys May 22, 2023
72baf9b
Batch GF2 var 1/2 Heuristics
xrq-phys May 22, 2023
21caa1b
Batch GF2 for all Ham in complex fSz
xrq-phys May 23, 2023
aedba08
Upgrade PFAPACK77 w/ 2-Step Algos
xrq-phys Aug 1, 2023
01824c2
Adopt Fix in PFAPACK77 2-Step
xrq-phys Nov 6, 2023
f40bd6b
Batched GF2 for Real non-fsz
Jun 29, 2024
8b831ea
Heuristics
Jun 29, 2024
5b474aa
Remove clutter print
xrq-phys Jun 29, 2024
fa841f4
real calc use makeInitialSample: non-fsz
xrq-phys Jun 29, 2024
5a43674
Use Direct-blocked+Left-looking Pfapack
Jun 30, 2024
27dab86
Correct para amp
xrq-phys Jun 30, 2024
65fed48
Batched GF2 for non-fsz
xrq-phys Jun 30, 2024
7fa0c68
Merge .github/workflows changes ahead of #64
xrq-phys Oct 2, 2024
10bdc6c
Merge upstream config changes
xrq-phys Oct 2, 2024
8be9b7f
Merge branch 'master' into batch-interall
xrq-phys Oct 2, 2024
1c19012
Update main.yml
xrq-phys Oct 3, 2024
805b19d
Update download_blis_artifact.cmake
xrq-phys Oct 3, 2024
3203b34
Update CMakeLists.txt
xrq-phys Oct 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- develop
- gh_actions # test branch
- '!gh-pages'
tags: '*'
Expand All @@ -13,21 +14,21 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v3.x
uses: rlespinasse/github-slug-action@v4.x

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: main

- name: Checkout gh-pages
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: gh-pages
path: gh-pages

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand All @@ -42,7 +43,7 @@ jobs:
cmake -E make_directory build
cd build
cmake -DDocument=ON -DENABLE_MPI=OFF ../
make doc-ja-html doc-en-html
make doc-ja-html doc-en-html tutorial-ja-html

- name: Deploy Configuration
run: |
Expand All @@ -63,6 +64,11 @@ jobs:
mkdir -p "gh-pages/doc/${TARGET_NAME}"
cp -r "main/build/doc/${lang}/source/html" "gh-pages/doc/${TARGET_NAME}/${lang}"
done
for lang in ja; do
rm -rf "gh-pages/doc/${TARGET_NAME}/tutorial/${lang}"
mkdir -p "gh-pages/doc/${TARGET_NAME}"/tutorial/
cp -r "main/build/doc/tutorial/${lang}/source/html" "gh-pages/doc/${TARGET_NAME}/tutorial/${lang}"
done
cd gh-pages
git config --local user.name "${GIT_USER}"
git config --local user.email "${GIT_EMAIL}"
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: CI

on:
push:
pull_request:
schedule:
- cron: '0 0 1,15 * *' # JST 9:00 on 1st and 15th every month

Expand All @@ -27,12 +28,12 @@ jobs:
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt update
sudo apt install liblapack-dev openmpi-bin libopenmpi-dev libscalapack-openmpi-dev
sudo apt install liblapack-dev openmpi-bin libopenmpi-dev libscalapack-openmpi-dev libeigen3-dev

- name: brew
if: ${{ runner.os == 'macOS' }}
run: |
brew install openmpi scalapack libomp
brew install openmpi scalapack libomp blis eigen

- name: Setup Python
uses: actions/setup-python@v5
Expand All @@ -52,13 +53,10 @@ jobs:
run: |
if [ ${{ runner.os }} = "macOS" ] ; then
# CONFIG=apple requires gfortran but macOS runner has not, but gfortran-11, 12, ...
ln -s `which gfortran-11` gfortran
env PATH=`pwd`:$PATH cmake -DCONFIG=apple -DCMAKE_VERBOSE_MAKEFILE=ON $GITHUB_WORKSPACE
cmake -DCONFIG=apple -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_Fortran_COMPILER=gfortran-14 $GITHUB_WORKSPACE
else
cmake -DCMAKE_VERBOSE_MAKEFILE=ON $GITHUB_WORKSPACE
fi
env:
HOMEBREW_PREFIX: /opt/homebrew

- name: build
working-directory: ${{runner.workspace}}/build
Expand Down
6 changes: 1 addition & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[submodule "src/pfaffine"]
path = src/pfaffine
url = https://github.com/xrq-phys/Pfaffine
branch = blis
[submodule "src/blis"]
path = src/blis
url = https://github.com/xrq-phys/blis
url = https://github.com/flame/blis
branch = mvmc
[submodule "src/pfapack"]
path = src/pfapack
Expand Down
77 changes: 67 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(mVMC NONE)

option(USE_SCALAPACK "Use Scalapack" OFF)
option(PFAFFIAN_BLOCKED "Use blocked-update Pfaffian to speed up." OFF)
option(USE_GEMMT "Use GEMMT. Recommended regardless blocked-Pfaffian-update." ON)

add_definitions(-D_mVMC)
if(CONFIG)
Expand All @@ -17,18 +18,18 @@ message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
option(BUILD_SHARED_LIBS "Build shared libraries" ON)

option(GIT_SUBMODULE_UPDATE "execute `git submodule update` automatically" ON)
enable_language(C Fortran)
if(PFAFFIAN_BLOCKED)
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
endif(PFAFFIAN_BLOCKED)

# First, enables C language only.
# External packages only use their C API.
enable_language(C)

set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_MACOSX_RPATH 1)

# TODO: Is this really needed?
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}")
else()
Expand All @@ -37,16 +38,19 @@ else()
endif()

if(CMAKE_C_COMPILER_ID STREQUAL "Intel")
# TODO: Really needs separation?
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528")
set(OMP_FLAG_Intel "-openmp")
else()
set(OMP_FLAG_Intel "-qopenmp")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OMP_FLAG_Intel}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OMP_FLAG_Intel}")
else()
find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_C_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif(OPENMP_FOUND)
endif()

Expand All @@ -57,13 +61,44 @@ if(MPI_C_FOUND)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_C_LINK_FLAGS}")
endif(MPI_C_FOUND)

# BLAS/LAPACK/Pfapack77 needs Fortran interface.
enable_language(Fortran)

find_package(LAPACK)
if(USE_SCALAPACK MATCHES OFF)
if(LAPACK_FOUND)
add_definitions(-D_lapack)
endif(LAPACK_FOUND)
endif()

if(PFAFFIAN_BLOCKED
OR USE_GEMMT)
set(Require_BLIS ON)
endif()

if(BLA_VENDOR MATCHES "Intel10*"
OR BLAS_LIBRARIES MATCHES "/*mkl*")
# Don't require BLIS when MKL is used.
add_definitions(-DMKL)
add_definitions(-DBLAS_EXTERNAL)
add_definitions(-DF77_COMPLEX_RET_INTEL)
set(Require_BLIS OFF)
elseif(BLA_VENDOR MATCHES "FLA*"
OR BLAS_LIBRARIES MATCHES "/*blis*")
# Skip extra BLIS if it's already the BLAS vendor.
list(GET BLAS_LIBRARIES 0 BLIS_FIRST_LIB)
get_filename_component(BLIS_LIB_DIR ${BLIS_FIRST_LIB} DIRECTORY)
include_directories(${BLIS_LIB_DIR}/../include)
include_directories(${BLIS_LIB_DIR}/../include/blis)
set(Require_BLIS OFF)
else()
# BLAS vendor preference:
# External > BLIS > Reference
if(DEFINED BLA_VENDOR)
add_definitions(-DBLAS_EXTERNAL)
endif()
endif()

# Build and enable tests
# testing setup
# enable_testing() must be called in the top-level CMakeLists.txt before any add_subdirectory() is called.
Expand Down Expand Up @@ -97,19 +132,41 @@ if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
endif()
add_subdirectory("${STDFACE_DIR}")

# C++ support for pfupdates & ltl2inv.
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)

# Require Eigen
find_package(Eigen3 3.4 REQUIRED NO_MODULE)
include_directories(${EIGEN3_INCLUDE_DIR})
# We surely want to offload mmuls to BLAS.
add_definitions(-DEIGEN_USE_BLAS)

if(Require_BLIS)
add_definitions(-D_BLIS)
include("download_blis_artifact.cmake")
else(Require_BLIS)
# Use bundled blis.h
include_directories(src/common/deps)
endif(Require_BLIS)

if(PFAFFIAN_BLOCKED)
add_definitions(-D_pf_block_update)
include("download_blis_artifact.cmake")
# Must set BLIS artifact BEFORE adding pfupdates target.
add_subdirectory(src/pfupdates)
add_dependencies(pfupdates blis_include)
endif(PFAFFIAN_BLOCKED)
add_subdirectory(src/pfupdates)
if(Require_BLIS)
add_dependencies(pfupdates blis_include)
endif(Require_BLIS)

if (Document)
add_subdirectory(doc)
endif(Document)

add_subdirectory(src/ComplexUHF)
add_subdirectory(src/pfapack/fortran)
add_subdirectory(src/ltl2inv)
if(Require_BLIS)
add_dependencies(ltl2inv blis_include)
endif(Require_BLIS)
add_subdirectory(src/mVMC)
add_subdirectory(tool)
3 changes: 3 additions & 0 deletions config/aocc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ set(CMAKE_C_FLAGS_RELEASE "-Wno-unknown-pragmas -O3 -DNDEBUG -DHAVE_SSE2" CACHE
set(CMAKE_Fortran_COMPILER "flang" CACHE STRING "" FORCE)
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -DHAVE_SSE2" CACHE STRING "" FORCE)

# OpenMP, libatomic
set(CMAKE_EXE_LINKER_FLAGS "-fopenmp -latomic")

# for AOCL
set(BLA_VENDOR "FLAME" CACHE STRING "" FORCE)

Expand Down
3 changes: 1 addition & 2 deletions config/apple.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
# additional libomp and gfortran installation required
# mac computers are suggested to use this configuration for better performance

if(NOT $ENV{HOMEBREW_PREFIX})
if(NOT DEFINED ENV{HOMEBREW_PREFIX})
message(FATAL "Homebrew is not installed. Please install Homebrew first.")
endif()

set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall -Wformat -Werror=format-security")
set(CMAKE_C_FLAGS_RELEASE "-O3 -Wno-unknown-pragmas -Wno-logical-not-parentheses")
# set(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "" FORCE)

# OpenMP with libomp
set(CMAKE_EXE_LINKER_FLAGS "-L$ENV{HOMEBREW_PREFIX}/opt/libomp/lib -lomp")
Expand Down
1 change: 1 addition & 0 deletions config/gcc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ set(CMAKE_C_COMPILER "gcc" CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER "g++" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall -Wformat -Werror=format-security")
set(CMAKE_C_FLAGS_RELEASE "-O3 -Wno-unknown-pragmas ")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wno-unknown-pragmas ")
set(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "" FORCE)
29 changes: 7 additions & 22 deletions download_blis_artifact.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,8 @@ if(NOT DEFINED BLIS_ARTIFACT_CONFIG)
COMMAND tr -d '\n'
OUTPUT_VARIABLE ARCHITECTURE)
if(${ARCHITECTURE} STREQUAL "x86_64")
execute_process(
COMMAND cat /proc/cpuinfo
COMMAND grep Intel
COMMAND head -1
COMMAND tr -d '\n'
OUTPUT_VARIABLE UARCH_INTEL)
if(NOT "${UARCH_INTEL} " STREQUAL " ")
set(BLIS_ARTIFACT_CONFIG "intel64")
else()
set(BLIS_ARTIFACT_CONFIG "amd64")
endif()
elseif(${ARCHITECTURE} STREQUAL "aarch64" OR
${ARCHITECTURE} STREQUAL "arm64")
# Currently SVE requires being set manually.
set(BLIS_ARTIFACT_CONFIG "x86_64")
elseif(${ARCHITECTURE} STREQUAL "aarch64" OR ${ARCHITECTURE} STREQUAL "arm64")
set(BLIS_ARTIFACT_CONFIG "arm64")
else()
message(FATAL_ERROR "Failed to recognize architecture ${ARCHITECTURE}.")
Expand All @@ -27,14 +15,10 @@ endif(NOT DEFINED BLIS_ARTIFACT_CONFIG)
message(STATUS "Downloading BLIS artifact...")

set(BLIS_ARCHIVE ${CMAKE_CURRENT_BINARY_DIR}/libblis_artifact.tar.gz)
if(${BLIS_ARTIFACT_CONFIG} STREQUAL "intel64")
set(BLIS_ARTIFACT_URL https://github.com/xrq-phys/blis/releases/download/sv0.8.1+arm/libblis_intel64_gcc.tar.gz)
elseif(${BLIS_ARTIFACT_CONFIG} STREQUAL "amd64")
set(BLIS_ARTIFACT_URL https://github.com/xrq-phys/blis/releases/download/sv0.8.1+arm/libblis_amd64_gcc.tar.gz)
elseif(${BLIS_ARTIFACT_CONFIG} STREQUAL "arm64")
set(BLIS_ARTIFACT_URL https://github.com/xrq-phys/blis/releases/download/sv0.8.1+arm/libblis_cortexa57_aarch64-linux-gnu-gcc.tar.gz)
elseif(${BLIS_ARTIFACT_CONFIG} STREQUAL "armsve")
set(BLIS_ARTIFACT_URL https://github.com/xrq-phys/blis/releases/download/sv0.8.1+arm/libblis_armsve_aarch64-linux-gnu-gcc-10.tar.gz)
if(${BLIS_ARTIFACT_CONFIG} STREQUAL "x86_64")
set(BLIS_ARTIFACT_URL https://github.com/JuliaBinaryWrappers/blis_jll.jl/releases/download/blis-v0.9.0%2B4/blis.v0.9.0.x86_64-linux-gnu.tar.gz)
elseif(${BLIS_ARTIFACT_CONFIG} STREQUAL "arm64" OR ${BLIS_ARTIFACT_CONFIG} STREQUAL "armsve")
set(BLIS_ARTIFACT_URL https://github.com/JuliaBinaryWrappers/blis_jll.jl/releases/download/blis-v0.9.0%2B4/blis.v0.9.0.aarch64-linux-gnu.tar.gz)
elseif(${BLIS_ARTIFACT_CONFIG} STREQUAL "a64fx")
set(BLIS_ARTIFACT_URL https://github.com/xrq-phys/blis/releases/download/sv0.8.1+arm/libblis_a64fx_aarch64-linux-gnu-gcc-10.tar.gz)
else()
Expand All @@ -53,6 +37,7 @@ add_custom_target(blis_target
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/lib/libblis.a)
add_custom_target(blis_include
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/include/blis/blis.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/blis)

add_library(blis STATIC IMPORTED GLOBAL)
Expand Down
Loading
Loading