Skip to content

Commit

Permalink
Merge pull request #136 from mir-group/develop
Browse files Browse the repository at this point in the history
Phoebe 1.0 merge to master
  • Loading branch information
cepellotti authored Dec 7, 2021
2 parents 920f772 + 6123485 commit b894b1a
Show file tree
Hide file tree
Showing 343 changed files with 355,651 additions and 2,777 deletions.
105 changes: 105 additions & 0 deletions .github/workflows/buildandtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Build and Test
on: [push, pull_request]

jobs:
build:
strategy:
matrix:
omp: [OFF, ON]
mpi: [OFF, ON]
name: "(OpenMP, MPI) ="
runs-on: ubuntu-20.04
env:
BUILD_DIR: build_${{ matrix.omp }}_${{ matrix.mpi }}
OMP_NUM_THREADS: 4
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt install -y libopenblas-dev liblapack-dev libhdf5-dev libhdf5-openmpi-dev libscalapack-openmpi-dev python3-pip -o Acquire::Retries=3 --fix-missing
pip3 install numpy
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Configure
run: |
mkdir ${BUILD_DIR}
cd ${BUILD_DIR}
cmake .. -DOMP_AVAIL=${{ matrix.omp }} -DKokkos_ENABLE_OPENMP=${{ matrix.omp }} -DMPI_AVAIL=${{ matrix.mpi }} -DHDF5_AVAIL=ON
- name: Build
run: |
cd ${BUILD_DIR}
make -j4
make -j4 runTests
- name: RunTests
run : |
cd ${BUILD_DIR}
./runTests
- name: Download test data
run: |
wget github.com/mir-group/phoebe-data/archive/master.zip
unzip -j master.zip "phoebe-data-master/example/Silicon-ph/qe-phonons/*" -d "example/Silicon-ph/qe-phonons"
unzip -j master.zip "phoebe-data-master/example/Silicon-ph/qe-ph-anharmonic/*" -d "example/Silicon-ph/qe-ph-anharmonic"
unzip -j master.zip "phoebe-data-master/example/Silicon-el/qe-elph/*" -d "example/Silicon-el/qe-elph"
unzip 'example/Silicon-el/qe-elph/silicon.phoebe.*.dat.zip' -d example/Silicon-el/qe-elph/
cp example/Silicon-el/qe-elph/* example/Silicon-epa/qe-elph
mkdir example/Silicon-epa/qe-elph/out
unzip -j master.zip "phoebe-data-master/example/Silicon-epa/qe-elph/out/*" -d "example/Silicon-epa/qe-elph/out"
- name: Run epa example without MPI
working-directory: example/Silicon-epa
run: |
../../${BUILD_DIR}/phoebe -in qeToPhoebeEPA.in
../../${BUILD_DIR}/phoebe -in epaTransport.in
../../${BUILD_DIR}/phoebe -in electronFourierBands.in
../../${BUILD_DIR}/phoebe -in electronFourierDos.in
python3 reference/run_check.py
- name: Run epa example with MPI
working-directory: example/Silicon-epa
if: matrix.mpi == 'ON'
run: |
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in epaTransport.in
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in electronFourierBands.in
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in electronFourierDos.in
python3 reference/run_check.py
- name: Run ph example without MPI
working-directory: example/Silicon-ph
run: |
../../${BUILD_DIR}/phoebe -in phononTransport.in
../../${BUILD_DIR}/phoebe -in phononBands.in
../../${BUILD_DIR}/phoebe -in phononDos.in
../../${BUILD_DIR}/phoebe -in phononLifetimes.in
python3 reference/run_check.py
- name: Run ph example with MPI
working-directory: example/Silicon-ph
if: matrix.mpi == 'ON'
run: |
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in phononTransport.in
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in phononBands.in
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in phononDos.in
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in phononLifetimes.in
python3 reference/run_check.py
- name: Run el example without MPI
working-directory: example/Silicon-el
run: |
../../${BUILD_DIR}/phoebe -in qeToPhoebeWannier.in
../../${BUILD_DIR}/phoebe -in electronWannierTransport.in
../../${BUILD_DIR}/phoebe -in electronWannierBands.in
../../${BUILD_DIR}/phoebe -in electronWannierDos.in
../../${BUILD_DIR}/phoebe -in electronLifetimes.in
python3 reference/run_check.py
- name: Run el example with MPI
working-directory: example/Silicon-el
if: matrix.mpi == 'ON'
run: |
# Note: don't run this as it runs out-of-memory on the VM
#mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in qeToPhoebeWannier.in
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in electronWannierTransport.in
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in electronWannierBands.in
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in electronWannierDos.in
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in electronLifetimes.in
python3 reference/run_check.py
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -ps 2 -in electronWannierTransport.in
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -ps 2 -in electronLifetimes.in
python3 reference/run_check.py
45 changes: 44 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Build folders
*build*/

# Output files
*.json

# Prerequisites
*.d

Expand Down Expand Up @@ -33,4 +39,41 @@
*phoebe

#IDE files
.project
.project
.pydevproject

#MacOS specific files
.DS_Store

.Makefile.swp

#CMake stuff:
*CMakeCache.txt
*CMakeFiles
*cmake_install.cmake
CMakeDoxy*
Makefile
CMakeLists.txt.orig
CTestTestfile.cmake

eigen_dep-prefix/
epa_test/
example/Silicon/log
googletest/
pugixml_dep-prefix/
runTests*_include.cmake
scalapack_dep-prefix/
spglib_dep-prefix/
runTests[1]_include.cmake

runTests
tags
*.plist

# Clion IDE
.idea

*zip

# built by cmake for version number
src/main.h
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/kokkos"]
path = lib/kokkos
url = https://github.com/kokkos/kokkos.git
30 changes: 30 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# YAML 1.2
---
authors:
-
affiliation: "Harvard University"
family-names: Cepellotti
given-names: Andrea
-
affiliation: "Harvard University"
family-names: Coulter
given-names: Jennifer
-
affiliation: "Harvard University"
family-names: Johansson
given-names: Anders
-
affiliation: "Harvard University"
family-names: Fedorova
given-names: Natalya
-
affiliation: "Harvard University"
family-names: Kozinsky
given-names: Boris
cff-version: "1.1.0"
license: "MIT License"
message: "If you use this software, please cite it using these metadata."
repository-code: "https://github.com/mir-group/phoebe"
title: "Phoebe: a collection of Phonon and Electron Boltzmann Equation solvers"
version: "1.0"
...
196 changes: 196 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE
STRING "Choose the type of build." FORCE)
endif(NOT CMAKE_BUILD_TYPE)

if(Kokkos_ENABLE_CUDA)
set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "don't touch")
set(CMAKE_CXX_COMPILER ${CMAKE_CURRENT_SOURCE_DIR}/lib/kokkos/bin/nvcc_wrapper)
endif()

cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 14)

project(Phoebe LANGUAGES C CXX Fortran VERSION 1.0)

configure_file(src/main.h.in ../src/main.h)

## load custom cmake find_package
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
SET(GCC_COVERAGE_COMPILE_FLAGS "-Wall -Wextra -ggdb -fno-omit-frame-pointer -Wno-deprecated-copy -Wno-ignored-attributes")
add_definitions(${GCC_COVERAGE_COMPILE_FLAGS})
add_compile_options(-Wno-error=parentheses)
endif()

############ OPTIONS ################
# these can be toggled in a build script by
# supplying arguments to cmake like cmake -DHDF5_AVAIL=OFF ../
option(MPI_AVAIL "Build with MPI wrappers" ON)
option(OMP_AVAIL "Build with OMP" ON)
option(HDF5_AVAIL "Build with HDF5" ON)
option(HDF5_SERIAL "Force build to accomodate serial only HDF5, but still use MPI" OFF)
option(BUILD_DOC "Build documentation" ON)

############### SOURCE ###############

FILE(GLOB_RECURSE SOURCE_FILES src src/*.cpp)
list(REMOVE_ITEM SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)

message(${CMAKE_CURRENT_SOURCE_DIR})
message(${SOURCE_FILES})

FILE(GLOB TEST_SOURCES test/*.cpp test/interaction3ph/*.cpp)

include_directories(src src/algebra src/apps src/bands src/bte src/constants src/harmonic src/interaction src/mpi src/observable src/parser src/points)

include(lib/CMakeLists.txt)
include(GoogleTest)

add_executable(phoebe src/main.cpp ${SOURCE_FILES})
add_executable(runTests ${TEST_SOURCES} ${SOURCE_FILES})
set_target_properties(runTests PROPERTIES EXCLUDE_FROM_ALL TRUE)

# dependencies
add_dependencies(phoebe spglib_dep pugixml_dep eigen_dep)
add_dependencies(runTests spglib_dep pugixml_dep eigen_dep)

target_link_libraries(phoebe symspg pugixml kokkos nlohmann_json::nlohmann_json)
enable_testing()
target_link_libraries(runTests symspg pugixml gtest_main kokkos nlohmann_json::nlohmann_json)

gtest_discover_tests(
runTests
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

################ PARALLEL ####################
# build with MPI and scalapack
if (MPI_AVAIL)
find_package(MPI REQUIRED)
target_link_libraries(phoebe MPI::MPI_CXX)
target_link_libraries(runTests MPI::MPI_CXX)
add_definitions("-DMPI_AVAIL") # this sets turns on ifdefs for mpi in the cpp

find_library(SCALAPACK_LIB NAMES scalapack scalapack-openmpi mkl_scalapack_lp64 PATHS ENV LD_LIBRARY_PATH)
if(${SCALAPACK_LIB} MATCHES NOTFOUND)
ExternalProject_Add(scalapack_dep
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/scalapack_build
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/scalapack_src
GIT_REPOSITORY https://github.com/Reference-ScaLAPACK/scalapack.git
INSTALL_COMMAND ""
UPDATE_COMMAND ""
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
)
set(SCALAPACK_LIB scalapack)
message(WARNING "No SCALAPACK library found in CMAKE_LIBRARY_PATH, building our own.")
add_dependencies(phoebe scalapack_dep)
else()
if(${SCALAPACK_LIB} MATCHES mkl)
if("${MPI_CXX_LIBRARIES}" MATCHES openmpi)
find_library(BLACS_LIB NAMES mkl_blacs_openmpi_lp64 PATHS ENV LD_LIBRARY_PATH)
elseif("${MPI_CXX_LIBRARIES}" MATCHES intel)
find_library(BLACS_LIB NAMES mkl_blacs_intelmpi_lp64 PATHS ENV LD_LIBRARY_PATH)
else()
message(FATAL_ERROR "Confused by MPI library when looking for BLACS.")
endif()
if(${BLACS_LIB} MATCHES NOTFOUND)
message(FATAL_ERROR "Found Intel SCALAPACK but not BLACS")
endif()
message(STATUS "Found BLACS: ${BLACS_LIB}")
endif()
message(STATUS "Found SCALAPACK: ${SCALAPACK_LIB}")
endif()

find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
include_directories(${BLAS_INCLUDE_DIR})
include_directories(${LAPACK_INCLUDE_DIR})
## Very important to link scalapack before blas and lapack
target_link_libraries(phoebe ${SCALAPACK_LIB} ${BLACS_LIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} -lgfortran)
target_link_libraries(runTests ${SCALAPACK_LIB} ${BLACS_LIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} -lgfortran)

else()
set(HDF5_SERIAL ON)

## even for the serial version, we require lapack
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
include_directories(${BLAS_INCLUDE_DIR})
include_directories(${LAPACK_INCLUDE_DIR})
target_link_libraries(phoebe ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} -lgfortran)
target_link_libraries(runTests ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} -lgfortran)

endif()

# build with openMP
if(OMP_AVAIL)
find_package(OpenMP)
target_link_libraries(phoebe OpenMP::OpenMP_CXX)
target_link_libraries(runTests OpenMP::OpenMP_CXX)
add_definitions("-DOMP_AVAIL")
endif()

# build with HDF5
if(HDF5_AVAIL)
if(HDF5_SERIAL)
add_definitions("-DHDF5_SERIAL")
else()
set(HDF5_PREFER_PARALLEL TRUE)
endif()
add_dependencies(phoebe highfive_dep)
add_dependencies(runTests highfive_dep)
find_package(HDF5 REQUIRED)
target_link_libraries(phoebe ${HDF5_LIBRARIES})
target_link_libraries(runTests ${HDF5_LIBRARIES})
include_directories(${HDF5_INCLUDE_DIRS})
add_definitions("-DHDF5_AVAIL")
endif()

############# DOCS ############

find_package(Doxygen)
find_package(Sphinx)

IF (BUILD_DOC)
IF (NOT DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
else()
# set input and output files
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/doxygen/Doxyfile)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/doc/doxygen/Doxyfile.out)

# request to configure the file
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen configured")

# note the option ALL which allows to build the docs together with the application
add_custom_target(
docDevel
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_IN}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../doc/doxygen
COMMENT "Generating API documentation with Doxygen"
VERBATIM)

IF (NOT SPHINX_FOUND)
message("Documentation needs also sphinx")
else()
add_custom_target(
doc
COMMAND make html
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../doc/sphinx
COMMENT "Building user documentation with Sphinx"
VERBATIM)
add_dependencies(doc docDevel)
endif()

ENDIF()
endif()



Loading

0 comments on commit b894b1a

Please sign in to comment.