Skip to content

Commit

Permalink
Merge pull request #64 from issp-center-dev/develop
Browse files Browse the repository at this point in the history
ver. 1.3.0
  • Loading branch information
tmisawa authored Oct 4, 2024
2 parents 7fa0c68 + 0597f34 commit 0287749
Show file tree
Hide file tree
Showing 192 changed files with 13,577 additions and 1,001 deletions.
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[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
Expand Down
104 changes: 82 additions & 22 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.5 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 All @@ -76,33 +111,54 @@ endif()

# git submodule update
# ref: https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html
set(MVMC ON) # Option for upstream StdFace.
option(MVMC "build mvmc" ON) # Option for upstream StdFace.
option(TestStdFace "run test for StdFace" OFF)
find_package(Git QUIET)
set(STDFACE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/StdFace")
if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
# Update submodules as needed
if(GIT_SUBMODULE_UPDATE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")

if(NOT STDFACE_DIR)
set(STDFACE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/StdFace")
if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
# Update submodules as needed
if(GIT_SUBMODULE_UPDATE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()

if(NOT EXISTS "${STDFACE_DIR}/CMakeLists.txt")
message(FATAL_ERROR "The submodule StdFace were not downloaded! GIT_SUBMODULE_UPDATE was turned off or failed. Please update submodules and try again.")
endif()
endif()
else()
if(NOT EXISTS "${STDFACE_DIR}/CMakeLists.txt")
message(FATAL_ERROR "The submodule StdFace were not downloaded! GIT_SUBMODULE_UPDATE was turned off or failed. Please update submodules and try again.")
message(FATAL_ERROR "STDFACE_DIR is manually set to ${STDFACE_DIR}, but ${STDFACE_DIR}/CMakeLists.txt does not exists")
else()
message(STATUS "STDFACE_DIR is manually set to ${STDFACE_DIR}.")
endif()
endif()
add_subdirectory("${STDFACE_DIR}")

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

if(Require_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)
if(Require_BLIS)
add_dependencies(pfupdates blis_include)
endif(Require_BLIS)
endif(PFAFFIAN_BLOCKED)

if (Document)
Expand All @@ -111,5 +167,9 @@ 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)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ are available at [mVMC-tutorial](https://github.com/issp-center-dev/mVMC-tutoria

## Authors

Takahiro Misawa, Satoshi Morita, Takahiro Ohgoe, Kota Ido, Yuichi Motoyama, Mitsuaki Kawamura, Kazuyoshi Yoshimi, Takeo Kato, Masatoshi Imada.
Takahiro Misawa, Satoshi Morita, Takahiro Ohgoe, Kota Ido, RuQing G. Xu, Yuichi Motoyama, Mitsuaki Kawamura, Kazuyoshi Yoshimi, Takeo Kato, Masatoshi Imada.
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)
2 changes: 2 additions & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
add_subdirectory(en/source)
add_subdirectory(ja/source)
add_subdirectory(tutorial/ja/source)

add_custom_target(doc DEPENDS doc-ja doc-en)
add_custom_target(tutorial DEPENDS tutorial-ja)
4 changes: 2 additions & 2 deletions doc/en/source/algorithm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Properties of the Pfaffian-Slater determinant
In this section, we explain some properties of the Pfaffian-Slater
determinant. We derive the general relation between a Pfaffian-Slater
determinant and a single Slater determinant in :ref:`Antiparallel Pfaffian <PfaffianAP>`
and :ref:`General Pfaffian <PfaffianP>` . We also discuss the meaning of the singular value
and :ref:`General Pfaffian <PfaffianP>` . We also discuss meaning of the singular value
decomposition of coefficients :math:`f_{ij}` in
:ref:`SVD <PfaffianSingular>`.

Expand Down Expand Up @@ -190,7 +190,7 @@ redundancy.
Relation between :math:`F_{IJ}` and :math:`\Phi_{In}` (the case of the general pairing)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We extend the relationship between the Pfaffian-Slater wave function and the
We extend the relation between the Pfaffian-Slater wave function and the
single Slater wave function into the general pairing case including the
spin-parallel pairing. We define the Pfaffian-Slater wave function and
the single Slater wave function as
Expand Down
Loading

0 comments on commit 0287749

Please sign in to comment.