Skip to content

Commit b894b1a

Browse files
authored
Merge pull request #136 from mir-group/develop
Phoebe 1.0 merge to master
2 parents 920f772 + 6123485 commit b894b1a

343 files changed

Lines changed: 355651 additions & 2777 deletions

File tree

Some content is hidden

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

.github/workflows/buildandtest.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Build and Test
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build:
6+
strategy:
7+
matrix:
8+
omp: [OFF, ON]
9+
mpi: [OFF, ON]
10+
name: "(OpenMP, MPI) ="
11+
runs-on: ubuntu-20.04
12+
env:
13+
BUILD_DIR: build_${{ matrix.omp }}_${{ matrix.mpi }}
14+
OMP_NUM_THREADS: 4
15+
steps:
16+
- name: Install dependencies
17+
run: |
18+
sudo apt-get update
19+
sudo apt install -y libopenblas-dev liblapack-dev libhdf5-dev libhdf5-openmpi-dev libscalapack-openmpi-dev python3-pip -o Acquire::Retries=3 --fix-missing
20+
pip3 install numpy
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
with:
24+
submodules: true
25+
- name: Configure
26+
run: |
27+
mkdir ${BUILD_DIR}
28+
cd ${BUILD_DIR}
29+
cmake .. -DOMP_AVAIL=${{ matrix.omp }} -DKokkos_ENABLE_OPENMP=${{ matrix.omp }} -DMPI_AVAIL=${{ matrix.mpi }} -DHDF5_AVAIL=ON
30+
- name: Build
31+
run: |
32+
cd ${BUILD_DIR}
33+
make -j4
34+
make -j4 runTests
35+
- name: RunTests
36+
run : |
37+
cd ${BUILD_DIR}
38+
./runTests
39+
- name: Download test data
40+
run: |
41+
wget github.com/mir-group/phoebe-data/archive/master.zip
42+
unzip -j master.zip "phoebe-data-master/example/Silicon-ph/qe-phonons/*" -d "example/Silicon-ph/qe-phonons"
43+
unzip -j master.zip "phoebe-data-master/example/Silicon-ph/qe-ph-anharmonic/*" -d "example/Silicon-ph/qe-ph-anharmonic"
44+
unzip -j master.zip "phoebe-data-master/example/Silicon-el/qe-elph/*" -d "example/Silicon-el/qe-elph"
45+
unzip 'example/Silicon-el/qe-elph/silicon.phoebe.*.dat.zip' -d example/Silicon-el/qe-elph/
46+
cp example/Silicon-el/qe-elph/* example/Silicon-epa/qe-elph
47+
mkdir example/Silicon-epa/qe-elph/out
48+
unzip -j master.zip "phoebe-data-master/example/Silicon-epa/qe-elph/out/*" -d "example/Silicon-epa/qe-elph/out"
49+
- name: Run epa example without MPI
50+
working-directory: example/Silicon-epa
51+
run: |
52+
../../${BUILD_DIR}/phoebe -in qeToPhoebeEPA.in
53+
../../${BUILD_DIR}/phoebe -in epaTransport.in
54+
../../${BUILD_DIR}/phoebe -in electronFourierBands.in
55+
../../${BUILD_DIR}/phoebe -in electronFourierDos.in
56+
python3 reference/run_check.py
57+
- name: Run epa example with MPI
58+
working-directory: example/Silicon-epa
59+
if: matrix.mpi == 'ON'
60+
run: |
61+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in epaTransport.in
62+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in electronFourierBands.in
63+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in electronFourierDos.in
64+
python3 reference/run_check.py
65+
- name: Run ph example without MPI
66+
working-directory: example/Silicon-ph
67+
run: |
68+
../../${BUILD_DIR}/phoebe -in phononTransport.in
69+
../../${BUILD_DIR}/phoebe -in phononBands.in
70+
../../${BUILD_DIR}/phoebe -in phononDos.in
71+
../../${BUILD_DIR}/phoebe -in phononLifetimes.in
72+
python3 reference/run_check.py
73+
- name: Run ph example with MPI
74+
working-directory: example/Silicon-ph
75+
if: matrix.mpi == 'ON'
76+
run: |
77+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in phononTransport.in
78+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in phononBands.in
79+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in phononDos.in
80+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in phononLifetimes.in
81+
python3 reference/run_check.py
82+
- name: Run el example without MPI
83+
working-directory: example/Silicon-el
84+
run: |
85+
../../${BUILD_DIR}/phoebe -in qeToPhoebeWannier.in
86+
../../${BUILD_DIR}/phoebe -in electronWannierTransport.in
87+
../../${BUILD_DIR}/phoebe -in electronWannierBands.in
88+
../../${BUILD_DIR}/phoebe -in electronWannierDos.in
89+
../../${BUILD_DIR}/phoebe -in electronLifetimes.in
90+
python3 reference/run_check.py
91+
- name: Run el example with MPI
92+
working-directory: example/Silicon-el
93+
if: matrix.mpi == 'ON'
94+
run: |
95+
# Note: don't run this as it runs out-of-memory on the VM
96+
#mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in qeToPhoebeWannier.in
97+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in electronWannierTransport.in
98+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in electronWannierBands.in
99+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in electronWannierDos.in
100+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -in electronLifetimes.in
101+
python3 reference/run_check.py
102+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -ps 2 -in electronWannierTransport.in
103+
mpirun -np 4 --oversubscribe ../../${BUILD_DIR}/phoebe -ps 2 -in electronLifetimes.in
104+
python3 reference/run_check.py
105+

.gitignore

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Build folders
2+
*build*/
3+
4+
# Output files
5+
*.json
6+
17
# Prerequisites
28
*.d
39

@@ -33,4 +39,41 @@
3339
*phoebe
3440

3541
#IDE files
36-
.project
42+
.project
43+
.pydevproject
44+
45+
#MacOS specific files
46+
.DS_Store
47+
48+
.Makefile.swp
49+
50+
#CMake stuff:
51+
*CMakeCache.txt
52+
*CMakeFiles
53+
*cmake_install.cmake
54+
CMakeDoxy*
55+
Makefile
56+
CMakeLists.txt.orig
57+
CTestTestfile.cmake
58+
59+
eigen_dep-prefix/
60+
epa_test/
61+
example/Silicon/log
62+
googletest/
63+
pugixml_dep-prefix/
64+
runTests*_include.cmake
65+
scalapack_dep-prefix/
66+
spglib_dep-prefix/
67+
runTests[1]_include.cmake
68+
69+
runTests
70+
tags
71+
*.plist
72+
73+
# Clion IDE
74+
.idea
75+
76+
*zip
77+
78+
# built by cmake for version number
79+
src/main.h

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "lib/kokkos"]
2+
path = lib/kokkos
3+
url = https://github.com/kokkos/kokkos.git

CITATION.cff

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# YAML 1.2
2+
---
3+
authors:
4+
-
5+
affiliation: "Harvard University"
6+
family-names: Cepellotti
7+
given-names: Andrea
8+
-
9+
affiliation: "Harvard University"
10+
family-names: Coulter
11+
given-names: Jennifer
12+
-
13+
affiliation: "Harvard University"
14+
family-names: Johansson
15+
given-names: Anders
16+
-
17+
affiliation: "Harvard University"
18+
family-names: Fedorova
19+
given-names: Natalya
20+
-
21+
affiliation: "Harvard University"
22+
family-names: Kozinsky
23+
given-names: Boris
24+
cff-version: "1.1.0"
25+
license: "MIT License"
26+
message: "If you use this software, please cite it using these metadata."
27+
repository-code: "https://github.com/mir-group/phoebe"
28+
title: "Phoebe: a collection of Phonon and Electron Boltzmann Equation solvers"
29+
version: "1.0"
30+
...

CMakeLists.txt

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
if(NOT CMAKE_BUILD_TYPE)
2+
set(CMAKE_BUILD_TYPE "Release" CACHE
3+
STRING "Choose the type of build." FORCE)
4+
endif(NOT CMAKE_BUILD_TYPE)
5+
6+
if(Kokkos_ENABLE_CUDA)
7+
set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "don't touch")
8+
set(CMAKE_CXX_COMPILER ${CMAKE_CURRENT_SOURCE_DIR}/lib/kokkos/bin/nvcc_wrapper)
9+
endif()
10+
11+
cmake_minimum_required(VERSION 3.16)
12+
set(CMAKE_CXX_STANDARD 14)
13+
14+
project(Phoebe LANGUAGES C CXX Fortran VERSION 1.0)
15+
16+
configure_file(src/main.h.in ../src/main.h)
17+
18+
## load custom cmake find_package
19+
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
20+
21+
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
22+
SET(GCC_COVERAGE_COMPILE_FLAGS "-Wall -Wextra -ggdb -fno-omit-frame-pointer -Wno-deprecated-copy -Wno-ignored-attributes")
23+
add_definitions(${GCC_COVERAGE_COMPILE_FLAGS})
24+
add_compile_options(-Wno-error=parentheses)
25+
endif()
26+
27+
############ OPTIONS ################
28+
# these can be toggled in a build script by
29+
# supplying arguments to cmake like cmake -DHDF5_AVAIL=OFF ../
30+
option(MPI_AVAIL "Build with MPI wrappers" ON)
31+
option(OMP_AVAIL "Build with OMP" ON)
32+
option(HDF5_AVAIL "Build with HDF5" ON)
33+
option(HDF5_SERIAL "Force build to accomodate serial only HDF5, but still use MPI" OFF)
34+
option(BUILD_DOC "Build documentation" ON)
35+
36+
############### SOURCE ###############
37+
38+
FILE(GLOB_RECURSE SOURCE_FILES src src/*.cpp)
39+
list(REMOVE_ITEM SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
40+
41+
message(${CMAKE_CURRENT_SOURCE_DIR})
42+
message(${SOURCE_FILES})
43+
44+
FILE(GLOB TEST_SOURCES test/*.cpp test/interaction3ph/*.cpp)
45+
46+
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)
47+
48+
include(lib/CMakeLists.txt)
49+
include(GoogleTest)
50+
51+
add_executable(phoebe src/main.cpp ${SOURCE_FILES})
52+
add_executable(runTests ${TEST_SOURCES} ${SOURCE_FILES})
53+
set_target_properties(runTests PROPERTIES EXCLUDE_FROM_ALL TRUE)
54+
55+
# dependencies
56+
add_dependencies(phoebe spglib_dep pugixml_dep eigen_dep)
57+
add_dependencies(runTests spglib_dep pugixml_dep eigen_dep)
58+
59+
target_link_libraries(phoebe symspg pugixml kokkos nlohmann_json::nlohmann_json)
60+
enable_testing()
61+
target_link_libraries(runTests symspg pugixml gtest_main kokkos nlohmann_json::nlohmann_json)
62+
63+
gtest_discover_tests(
64+
runTests
65+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
66+
)
67+
68+
################ PARALLEL ####################
69+
# build with MPI and scalapack
70+
if (MPI_AVAIL)
71+
find_package(MPI REQUIRED)
72+
target_link_libraries(phoebe MPI::MPI_CXX)
73+
target_link_libraries(runTests MPI::MPI_CXX)
74+
add_definitions("-DMPI_AVAIL") # this sets turns on ifdefs for mpi in the cpp
75+
76+
find_library(SCALAPACK_LIB NAMES scalapack scalapack-openmpi mkl_scalapack_lp64 PATHS ENV LD_LIBRARY_PATH)
77+
if(${SCALAPACK_LIB} MATCHES NOTFOUND)
78+
ExternalProject_Add(scalapack_dep
79+
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/scalapack_build
80+
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/scalapack_src
81+
GIT_REPOSITORY https://github.com/Reference-ScaLAPACK/scalapack.git
82+
INSTALL_COMMAND ""
83+
UPDATE_COMMAND ""
84+
CMAKE_ARGS
85+
-DCMAKE_BUILD_TYPE=Release
86+
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
87+
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
88+
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
89+
)
90+
set(SCALAPACK_LIB scalapack)
91+
message(WARNING "No SCALAPACK library found in CMAKE_LIBRARY_PATH, building our own.")
92+
add_dependencies(phoebe scalapack_dep)
93+
else()
94+
if(${SCALAPACK_LIB} MATCHES mkl)
95+
if("${MPI_CXX_LIBRARIES}" MATCHES openmpi)
96+
find_library(BLACS_LIB NAMES mkl_blacs_openmpi_lp64 PATHS ENV LD_LIBRARY_PATH)
97+
elseif("${MPI_CXX_LIBRARIES}" MATCHES intel)
98+
find_library(BLACS_LIB NAMES mkl_blacs_intelmpi_lp64 PATHS ENV LD_LIBRARY_PATH)
99+
else()
100+
message(FATAL_ERROR "Confused by MPI library when looking for BLACS.")
101+
endif()
102+
if(${BLACS_LIB} MATCHES NOTFOUND)
103+
message(FATAL_ERROR "Found Intel SCALAPACK but not BLACS")
104+
endif()
105+
message(STATUS "Found BLACS: ${BLACS_LIB}")
106+
endif()
107+
message(STATUS "Found SCALAPACK: ${SCALAPACK_LIB}")
108+
endif()
109+
110+
find_package(BLAS REQUIRED)
111+
find_package(LAPACK REQUIRED)
112+
include_directories(${BLAS_INCLUDE_DIR})
113+
include_directories(${LAPACK_INCLUDE_DIR})
114+
## Very important to link scalapack before blas and lapack
115+
target_link_libraries(phoebe ${SCALAPACK_LIB} ${BLACS_LIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} -lgfortran)
116+
target_link_libraries(runTests ${SCALAPACK_LIB} ${BLACS_LIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} -lgfortran)
117+
118+
else()
119+
set(HDF5_SERIAL ON)
120+
121+
## even for the serial version, we require lapack
122+
find_package(BLAS REQUIRED)
123+
find_package(LAPACK REQUIRED)
124+
include_directories(${BLAS_INCLUDE_DIR})
125+
include_directories(${LAPACK_INCLUDE_DIR})
126+
target_link_libraries(phoebe ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} -lgfortran)
127+
target_link_libraries(runTests ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} -lgfortran)
128+
129+
endif()
130+
131+
# build with openMP
132+
if(OMP_AVAIL)
133+
find_package(OpenMP)
134+
target_link_libraries(phoebe OpenMP::OpenMP_CXX)
135+
target_link_libraries(runTests OpenMP::OpenMP_CXX)
136+
add_definitions("-DOMP_AVAIL")
137+
endif()
138+
139+
# build with HDF5
140+
if(HDF5_AVAIL)
141+
if(HDF5_SERIAL)
142+
add_definitions("-DHDF5_SERIAL")
143+
else()
144+
set(HDF5_PREFER_PARALLEL TRUE)
145+
endif()
146+
add_dependencies(phoebe highfive_dep)
147+
add_dependencies(runTests highfive_dep)
148+
find_package(HDF5 REQUIRED)
149+
target_link_libraries(phoebe ${HDF5_LIBRARIES})
150+
target_link_libraries(runTests ${HDF5_LIBRARIES})
151+
include_directories(${HDF5_INCLUDE_DIRS})
152+
add_definitions("-DHDF5_AVAIL")
153+
endif()
154+
155+
############# DOCS ############
156+
157+
find_package(Doxygen)
158+
find_package(Sphinx)
159+
160+
IF (BUILD_DOC)
161+
IF (NOT DOXYGEN_FOUND)
162+
message("Doxygen need to be installed to generate the doxygen documentation")
163+
else()
164+
# set input and output files
165+
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/doxygen/Doxyfile)
166+
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/doc/doxygen/Doxyfile.out)
167+
168+
# request to configure the file
169+
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
170+
message("Doxygen configured")
171+
172+
# note the option ALL which allows to build the docs together with the application
173+
add_custom_target(
174+
docDevel
175+
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_IN}
176+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../doc/doxygen
177+
COMMENT "Generating API documentation with Doxygen"
178+
VERBATIM)
179+
180+
IF (NOT SPHINX_FOUND)
181+
message("Documentation needs also sphinx")
182+
else()
183+
add_custom_target(
184+
doc
185+
COMMAND make html
186+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../doc/sphinx
187+
COMMENT "Building user documentation with Sphinx"
188+
VERBATIM)
189+
add_dependencies(doc docDevel)
190+
endif()
191+
192+
ENDIF()
193+
endif()
194+
195+
196+

0 commit comments

Comments
 (0)