Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1c75dc4
ci | add important_settings
flokno Nov 21, 2024
2651c54
ci | dev
flokno Nov 21, 2024
693d0d0
use mpifort instead of gfortran
flokno Nov 21, 2024
c751a13
hdf5_serial?
flokno Nov 21, 2024
4d52cca
correct hdf5 path
flokno Nov 21, 2024
3567fb5
include path
flokno Nov 21, 2024
bc8c28c
scalapack-openmpi
flokno Nov 21, 2024
6ae9246
link blas
flokno Nov 21, 2024
d1fafbe
ci | compile with O2
flokno Nov 21, 2024
0f8881e
ci | add debug settings
flokno Nov 21, 2024
c29d4ea
ci | compile production tdep with O3
flokno Nov 21, 2024
6643816
gfortran instead of mpifort
flokno Nov 21, 2024
16da4e5
only add debug flags to file, not full thing
flokno Nov 21, 2024
0f99196
debugflags | remove shebang
flokno Nov 21, 2024
0b7adbf
w/o check=all?
flokno Nov 21, 2024
720bd41
fix
flokno Nov 21, 2024
c114ffd
try w/o aggressive sanity
flokno Nov 21, 2024
f50b484
mpi lib path
flokno Nov 21, 2024
1bb6bc3
ok use mpifort
flokno Nov 21, 2024
99db5a1
add fast compile option
flokno Nov 21, 2024
2e54ce3
ci | add fastcompile settings for testing
flokno Nov 21, 2024
5ca3ea9
ci | more generic important_settings with PATH_LIB from env
flokno Nov 23, 2024
acf9032
pytest | ignore netcdf warning?
flokno Nov 23, 2024
8198e72
ci | add a simple test workflow
flokno Dec 4, 2024
24ab44d
Merge branch 'main' into fk_github_ci
flokno Dec 4, 2024
b2d7c58
ci | rename workflow
flokno Dec 4, 2024
dec0394
ci | only upload artifacts when tests fail
flokno Dec 4, 2024
ff9778c
tests | test each variable separately
flokno Dec 5, 2024
7e6783b
ci | changes to test trigger pipeline, also pull requests
flokno Dec 5, 2024
206b2cb
ci | only trigger in a PR
flokno Dec 5, 2024
7620cfb
test | check if thermal conductivity output is consistent
flokno Dec 5, 2024
60405b2
tests | only check final thermal conductivity (#110)
flokno Dec 5, 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
1 change: 1 addition & 0 deletions .github/important_settings.fastcompile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OPTIMIZATION_LEVEL="-O0"
51 changes: 51 additions & 0 deletions .github/important_settings.generic
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
# A central place to put all the important paths. You probably have to modify this to make things work.

# the fortran compiler
FORTRAN_COMPILER="mpifort"
# required compiler flags
FCFLAGS="-ffree-line-length-none -std=gnu -cpp -fallow-argument-mismatch"
# extra flags, for debugging and such
FCFLAGS_EXTRA=""

# optimization stuff. Go all in, sometimes
OPTIMIZATION_LEVEL="-O3"
OPTIMIZATION_SENSITIVE="-O0"

# the flag that sets the default real to a double.
DOUBLE_FLAG= # "-fdefault-real-8"
# The flag that tells the compiler where to put .o and .mod files.
MODULE_FLAG="-J"

# These are the BLAS/LAPACK libraries. On OSX with gfortran, use the built-in 'framework accelerate'

# -> exported outside
# PATH_LIB="/usr/lib/x86_64-linux-gnu"
PATH_INC="/usr/include"
PATH_TO_BLASLAPACK_LIB="-L/$PATH_LIB"
PATH_TO_BLASLAPACK_INC="-I/$PATH_INC"
BLASLAPACK_LIBS="-lblas -llapack -lscalapack-openmpi"

# I use fftw for Fourier transforms.
PATH_TO_FFTW_LIB="-L/$PATH_LIB"
PATH_TO_FFTW_INC="-I/$PATH_INC"
FFTW_LIBS="-lfftw3"

# I also use HDF5 every now and then
PATH_TO_HDF5_LIB="-L/$PATH_LIB/hdf5/openmpi/"
PATH_TO_HDF5_INC="-I/$PATH_INC/hdf5/openmpi/"
HDF5_LIBS="-lhdf5 -lhdf5_fortran"

USECGAL=no

# some less important things
# the header to put in python scripts.
PYTHONHEADER="#!/usr/bin/env python"

# Which gnuplot terminal to use by default.
# Choices: aqua, qt, wxt
GNUPLOTTERMINAL="qt"

# Precompiler flags. Selecting default gnuplot terminal, and make the progressbars work.
PRECOMPILER_FLAGS="-DGP${GNUPLOTTERMINAL} -Dclusterprogressbar"

54 changes: 54 additions & 0 deletions .github/important_settings.x86_64
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
# A central place to put all the important paths. You probably have to modify this to make things work.

# the fortran compiler
FORTRAN_COMPILER="mpifort"
# required compiler flags
FCFLAGS="-ffree-line-length-none -std=gnu -cpp -fallow-argument-mismatch"
# extra flags, for debugging and such
FCFLAGS_EXTRA=""

# optimization stuff. Go all in, sometimes
OPTIMIZATION_LEVEL="-O3"
OPTIMIZATION_SENSITIVE="-O0"

# the flag that sets the default real to a double.
DOUBLE_FLAG= # "-fdefault-real-8"
# The flag that tells the compiler where to put .o and .mod files.
MODULE_FLAG="-J"

# These are the BLAS/LAPACK libraries. On OSX with gfortran, use the built-in 'framework accelerate'
PATH_LIB="/usr/lib/x86_64-linux-gnu"
PATH_INC="/usr/include"
PATH_TO_BLASLAPACK_LIB="-L/$PATH_LIB"
PATH_TO_BLASLAPACK_INC="-I/$PATH_INC"
BLASLAPACK_LIBS="-lblas -llapack -lscalapack-openmpi"

# I use fftw for Fourier transforms.
PATH_TO_FFTW_LIB="-L/$PATH_LIB"
PATH_TO_FFTW_INC="-I/$PATH_INC"
FFTW_LIBS="-lfftw3"

# we use mpifort so not needed
# PATH_TO_MPI_LIB="-L/usr/lib/x86_64-linux-gnu"
# PATH_TO_MPI_INC="-I/$PATH_INC"
# MPI_LIBS="-lmpi_mpifh -lmpi"

# I also use HDF5 every now and then
PATH_TO_HDF5_LIB="-L/usr/lib/x86_64-linux-gnu/hdf5/openmpi/"
PATH_TO_HDF5_INC="-I/usr/include/hdf5/openmpi/"
HDF5_LIBS="-lhdf5 -lhdf5_fortran"

USECGAL=no

# some less important things
# the header to put in python scripts.
PYTHONHEADER="#!/usr/bin/env python"

# Which gnuplot terminal to use by default.
# Choices: aqua, qt, wxt
GNUPLOTTERMINAL="qt"

# Precompiler flags. Selecting default gnuplot terminal, and make the progressbars work.
PRECOMPILER_FLAGS="-DGP${GNUPLOTTERMINAL} -Dclusterprogressbar"

7 changes: 7 additions & 0 deletions .github/important_settings.x86_64_debugflags
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# debug flags
# FCFLAGS_EXTRA="-g -fbacktrace -fcheck=all -finit-real=nan -finit-derived -fmax-errors=10 --pedantic -Wall -Wextra -pedantic -Wcast-align -Wdisabled-optimization -Wmissing-include-dirs -Wshadow -Wunused -fdiagnostics-show-option -fcheck=all -Wstrict-overflow=0 -Wrealloc-lhs"
# FCFLAGS_EXTRA="-fbacktrace -fcheck=all -finit-real=nan -finit-derived -fmax-errors=10 --pedantic --warn-all"
FCFLAGS_EXTRA="-fbacktrace -finit-real=nan -finit-derived -fmax-errors=10 --pedantic --warn-all"
# PRECOMPILER_FLAGS="-DGP${GNUPLOTTERMINAL} -Dclusterprogressbar -DAGRESSIVE_SANITY"
PRECOMPILER_FLAGS="-DGP${GNUPLOTTERMINAL} -Dclusterprogressbar"
OPTIMIZATION_LEVEL="-O0"
1 change: 1 addition & 0 deletions .github/important_settings.x86_64_fastcompile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OPTIMIZATION_LEVEL="-O0"
78 changes: 78 additions & 0 deletions .github/workflows/ci_simple_compilation_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Compile TDEP and test binaries
run-name: ${{ github.actor }} is trying to compile and run TDEP
on:
pull_request:
paths:
- .github/workflows/ci_simple_compilation_and_test.yml
- src/**
- tests/**
workflow_dispatch:

env:
ARTIFACTS: tdep-test-artifacts
N_THREADS: 4

jobs:
Compile-and-run-TDEP:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out TDEP code
uses: actions/checkout@v4
with:
repository: tdep-developers/tdep
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Install packages required for building TDEP
run: |
sudo apt-get update
sudo apt-get install -y \
gfortran \
libblas-dev \
liblapack-dev \
libhdf5-dev \
libhdf5-serial-dev \
libhdf5-openmpi-dev \
openmpi-bin \
libopenmpi-dev \
libfftw3-dev \
libscalapack-openmpi-dev
- name: compile TDEP with debug flags
id: compile_debug
run: |
cd ${{ github.workspace }}
cp .github/important_settings.x86_64 important_settings
cat .github/important_settings.fastcompile >> important_settings
cat .github/important_settings.x86_64_debugflags >> important_settings
bash build_things.sh --nthreads_make ${{ env.N_THREADS }}
- name: compile TDEP production
if: steps.compile_debug.outcome == 'success'
id: compile_production
run: |
cd ${{ github.workspace }}
cp .github/important_settings.x86_64 important_settings
bash build_things.sh --nthreads_make ${{ env.N_THREADS }}
- name: Create testfiles
id: testfiles
if: steps.compile_production.outcome == 'success'
run: |
cd ${{ github.workspace }}/tests
make
- name: Check tests
id: test
if: steps.testfiles.outcome == 'success'
run: |
cd ${{ github.workspace }}/tests
pip install -r requirements.txt
make test || exit 1
- name: Upload results
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ env.ARTIFACTS }}
path: |
${{ github.workspace }}/bin/
${{ github.workspace }}/build/
${{ github.workspace }}/tests/
${{ github.workspace }}/bashrc_tdep
retention-days: 7
2 changes: 2 additions & 0 deletions tests/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# pytest.ini or .pytest.ini
[pytest]
norecursedirs = optional
filterwarnings =
ignore::RuntimeWarning:importlib._bootstrap:
Binary file not shown.
32 changes: 17 additions & 15 deletions tests/thermal_conductivity/test_thermal_conductivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
parent = Path(__file__).parent
folder = parent / "reference"

files_hdf5 = [
"outfile.thermal_conductivity_grid.hdf5",
]
file = "outfile.thermal_conductivity"
file_hdf5 = "outfile.thermal_conductivity_grid.hdf5"


def test_thermal_conductivity(file="outfile.thermal_conductivity", atol=20, rtol=5):
def test_thermal_conductivity(file=file, atol=1, rtol=0.1):
file_ref = folder / file
file_new = parent / file

Expand All @@ -22,20 +21,23 @@ def test_thermal_conductivity(file="outfile.thermal_conductivity", atol=20, rtol
)


def test_hdf5(files=files_hdf5, atol=1, rtol=0.01):
for file in files:
file_ref = folder / file
file_new = parent / file
def test_conductivity_comparison(
file=parent / file,
file_grid=parent / file_hdf5,
):
"""Check if the thermal conducivities conincide"""
data1 = np.loadtxt(file)

ds_ref = xr.load_dataset(file_ref)
ds_new = xr.load_dataset(file_new)
# without off-diagonal contribution
kappa1 = data1[0][:3] + data1[1][:3]

for var in ds_ref.data_vars:
x = ds_ref[var]
y = ds_new[var]
np.testing.assert_allclose(x, y, atol=atol, rtol=rtol, err_msg=var)
ds = xr.load_dataset(file_grid)

kappa2 = np.diag(ds.thermal_conductivity.sum(axis=(0, 1)) / ds.number_of_qpoints)

np.testing.assert_allclose(kappa1, kappa2)


if __name__ == "__main__":
test_thermal_conductivity()
test_hdf5()
test_conductivity_comparison()