Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 25 additions & 1 deletion .github/workflows/ci_simple_compilation_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ jobs:
libopenmpi-dev \
libfftw3-dev \
libscalapack-openmpi-dev

sudo pip3 install --upgrade meson
# to circumvent meson issue with system path & pkg-config
# https://github.com/mesonbuild/meson/issues/12993
# https://github.com/mesonbuild/meson/issues/11088
export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
# sudo apt-get install -y pkg-config # this version is too old... manual install
wget https://distfiles.ariadne.space/pkgconf/pkgconf-2.5.1.tar.xz
tar -xf pkgconf-2.5.1.tar.xz
cd pkgconf-2.5.1
./configure --prefix=/usr
make
sudo make install
- name: compile TDEP with debug flags
id: compile_debug
run: |
Expand All @@ -48,8 +62,18 @@ jobs:
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
rm -r build # clean build dir
- name: compile TDEP with meson
if: steps.compile_debug.outcome == 'success'
id: compile_meson
run: |
meson setup build
cd build
meson compile
meson install
rm -r build # clean build dir
- name: compile TDEP production
if: steps.compile_meson.outcome == 'success'
id: compile_production
run: |
cd ${{ github.workspace }}
Expand Down
30 changes: 6 additions & 24 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Installation
- python should be installed
- gnuplot should be installed

**Note: The `build_things.sh` script assumes that TDEP was cloned and lives in a git repository. If you wish obtain TDEP in another you have to adjust the script.**
**Note: The `build_things.sh` script assumes that TDEP was cloned and lives in a git repository. If you wish obtain TDEP in another way you have to adjust the script.**

**If you have a package manager, `homebrew`, `apt-get`, `yay`, `pacman`, you name it, getting these dependencies should be straightforward.**

Expand Down Expand Up @@ -78,29 +78,6 @@ i.e., add the respective lines to your `.bashrc` and you are all set up!

**If problems occur, please look at the [Troubleshooting section below](#Troubleshooting). If you cannot fix the error, please reach out, e.g., via the [issue tracker](https://github.com/tdep-developers/tdep/issues).**

## Meson build system

Alternativaly to the `build_things.sh` script, there is also the possibility to use [Meson](https://mesonbuild.com/). It is a build automation tool, and it supports incremental builds. The dependencies should be installed in standard locations (e.g. `/usr/local/`) or specified in the `PKG_CONFIG_PATH`.

First setup the git version for the code:
```setup_git_version.sh```
Then you can run the configuration step:
```meson setup build```
And finally compile the code:
```
cd build
meson compile
meson install
```

If some dependencies are not found, please make sure that they are in your PKG_CONFIG_PATH. For example, put something of the form in your `.bashrc` / `.bash_profile` :
```export PKG_CONFIG_PATH="/path/to/your/netcdf/:${PKG_CONFIG_PATH}"```
Depending on the method used to install the required libraries, they may not be automatically put inside the search path (Homebrew is known to not always do it).
You can make sure that `pkg-config` is able to find the dependencies by running: `pkg-config --libs hdf5`
Meson will first try to find dependencies via `pkg-config`. If it does not find them, it will try to use CMake (if installed/loaded).

Once the configuration step is done, everything should go smoothly. The binaries will be in build/bin/executable_name.

## Check your installation

We advise to run the tests in [`./tests`](./tests) to check your installation.
Expand All @@ -122,6 +99,7 @@ where `FC` and `CC` should point to the same Fortran/C compilers you are using t
- [macOS](#macOS)
- [Supercomputers](#Supercomputers)
- [Platform-agnostic installation using Anaconda](#Anaconda)
- [Platform-agnostic installation using the Meson build system](#Meson-build-system)

## macOS

Expand All @@ -146,6 +124,10 @@ There are two template settings files you can look into:

One convenient, (mostly) platform-agnostic way to install TDEP is to use [Anaconda](https://anaconda.org/).

## Meson build system

To use the Meson build system instead of the `build_things.sh` script, see [INSTALL_Meson.md](INSTALL_Meson.md).

### Prepare environment


Expand Down
23 changes: 23 additions & 0 deletions INSTALL_Meson.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Installation with the Meson build system
===

Alternativaly to the `build_things.sh` script, there is also the possibility to use [Meson](https://mesonbuild.com/). It is a build automation tool, and it supports incremental builds. The dependencies should be installed in standard locations (e.g. `/usr/local/`) or specified in the `PKG_CONFIG_PATH`.

First setup the git version for the code:
```setup_git_version.sh```
Then you can run the configuration step:
```meson setup build```
And finally compile the code:
```
cd build
meson compile
meson install
```

If some dependencies are not found, please make sure that they are in your PKG_CONFIG_PATH. For example, put a line of the form in your `.bashrc` / `.bash_profile` :
```export PKG_CONFIG_PATH="/path/to/your/hdf5/:${PKG_CONFIG_PATH}"```
Depending on the method used to install the required libraries, they may not be automatically put inside the search path (Homebrew is known to not always do it).
You can make sure that `pkg-config` is able to find the dependencies by running: `pkg-config --libs hdf5`
Meson will first try to find dependencies via `pkg-config`. If it does not find them, it will try to use CMake (if installed/loaded).

Once the configuration step is done, everything should go smoothly. The binaries will be in build/bin/executable_name.
42 changes: 37 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,17 +1,49 @@
project('tdep', 'fortran', 'c', 'cpp')
project('tdep',
'fortran', 'c', 'cpp',
meson_version: '>=1.1',
default_options: ['buildtype=custom', 'debug=true', 'optimization=3'])
add_project_arguments('-cpp', language: 'fortran')
add_project_arguments('-ffree-line-length-none', language: 'fortran')
# add_project_arguments('-std=f2008', language: 'fortran')
add_project_arguments('-fallow-argument-mismatch', language: 'fortran')

# global dependencies:

# mpi
dep_mpi = dependency('mpi', language: 'fortran')
dep_blas = dependency('blas')
dep_lapack = dependency('lapack')

# linear algebra
dep_linalg_found = false
# 1) try accelerate framework for macos (if wanted)
if build_machine.system() == 'darwin' and get_option('accfrmwrk') == true
dep_linalg = dependency('appleframeworks', modules : 'accelerate', required: false)
dep_linalg_found = dep_linalg.found()
endif

# 2) try blas/openblas + lapack otherwise
if not dep_linalg_found
dep_blas = dependency('blas', required: false)
if not dep_blas.found()
message('Did not find the blas library. Trying with openblas')
dep_blas = dependency('openblas', required: true) # required as it is the last try
endif
dep_lapack = dependency('lapack', required: true)
dep_linalg = [dep_blas, dep_lapack]
endif
# # add some common path to pkg-config search path
# env = environ()
# env.prepend('PKG_CONFIG_PATH', '/usr/lib/x86_64-linux-gnu')

# message(get_option('linalg_flavor'))

# fft
dep_fftw = dependency('fftw3')

# hdf5
dep_hdf5 = dependency('hdf5', language: 'fortran', version: '>1.10.7')
dep_netcdf = dependency('netcdf', language: 'fortran')
dep_all = [dep_mpi, dep_blas, dep_lapack, dep_fftw, dep_hdf5, dep_netcdf]

# dep_all = [dep_mpi, dep_blas, dep_lapack, dep_fftw, dep_hdf5]
dep_all = [dep_mpi, dep_linalg, dep_fftw, dep_hdf5]

subdir('src/libolle')
subdir('src/libflap')
Expand Down
4 changes: 4 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# wether to use the apple accelerate framework on macos
option('accfrmwrk', type : 'boolean', value : false)
# option('linalg_flavor', type : 'combo', choices : ['auto', 'lapack', 'mkl'])
# option('fft_flavor', type : 'combo', choices : ['auto', 'fftw', 'mkl_dfti'])
5 changes: 3 additions & 2 deletions src/anharmonic_free_energy/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('anharmonic_free_energy',
exec_name='anharmonic_free_energy'
executable(exec_name,
'energy.f90',
'epot.f90',
'main.f90',
Expand All @@ -9,4 +10,4 @@ executable('anharmonic_free_energy',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('anharmonic_free_energy', pointing_to: meson.project_build_root() / 'bin/anharmonic_free_energy', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/atomic_distribution/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('atomic_distribution',
exec_name='atomic_distribution'
executable(exec_name,
'correlationfunction.f90',
'diffraction.f90',
'main.f90',
Expand All @@ -13,4 +14,4 @@ executable('atomic_distribution',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('atomic_distribution', pointing_to: meson.project_build_root() / 'bin/atomic_distribution', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/canonical_configuration/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('canonical_configuration',
exec_name='canonical_configuration'
executable(exec_name,
'main.f90',
'options.f90',
'semirandom.f90',
Expand All @@ -8,4 +9,4 @@ executable('canonical_configuration',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('canonical_configuration', pointing_to: meson.project_build_root() / 'bin/canonical_configuration', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/crystal_structure_info/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('crystal_structure_info',
exec_name='crystal_structure_info'
executable(exec_name,
'main.f90',
'options.f90',
link_with: [libolle, libflap],
Expand All @@ -7,4 +8,4 @@ executable('crystal_structure_info',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('crystal_structure_info', pointing_to: meson.project_build_root() / 'bin/crystal_structure_info', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/dump_dynamical_matrices/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('dump_dynamical_matrices',
exec_name='dump_dynamical_matrices'
executable(exec_name,
'main.f90',
'options.f90',
link_with: [libolle, libflap],
Expand All @@ -7,4 +8,4 @@ executable('dump_dynamical_matrices',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('dump_dynamical_matrices', pointing_to: meson.project_build_root() / 'bin/dump_dynamical_matrices', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/extract_forceconstants/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('extract_forceconstants',
exec_name='extract_forceconstants'
executable(exec_name,
'main.f90',
'options.f90',
link_with: [libolle, libflap],
Expand All @@ -7,4 +8,4 @@ executable('extract_forceconstants',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('extract_forceconstants', pointing_to: meson.project_build_root() / 'bin/extract_forceconstants', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/generate_structure/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('generate_structure',
exec_name='generate_structure'
executable(exec_name,
'autocell.f90',
'main.f90',
'options.f90',
Expand All @@ -8,4 +9,4 @@ executable('generate_structure',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('generate_structure', pointing_to: meson.project_build_root() / 'bin/generate_structure', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/lineshape/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('lineshape',
exec_name='lineshape'
executable(exec_name,
'dielscatter.f90',
'dielscatter_helper.f90',
# 'dielscatter_matrixelement.f90',
Expand All @@ -20,4 +21,4 @@ executable('lineshape',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('lineshape', pointing_to: meson.project_build_root() / 'bin/lineshape', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/pack_simulation/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('pack_simulation',
exec_name='pack_simulation'
executable(exec_name,
'main.f90',
'options.f90',
link_with: [libolle, libflap],
Expand All @@ -7,4 +8,4 @@ executable('pack_simulation',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('pack_simulation', pointing_to: meson.project_build_root() / 'bin/pack_simulation', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/phasespace_surface/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('phasespace_surface',
exec_name='phasespace_surface'
executable(exec_name,
'main.f90',
'options.f90',
'type_phasespacesurface.f90',
Expand All @@ -8,4 +9,4 @@ executable('phasespace_surface',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('phasespace_surface', pointing_to: meson.project_build_root() / 'bin/phasespace_surface', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/phonon_dispersion_relations/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('phonon_dispersion_relations',
exec_name='phonon_dispersion_relations'
executable(exec_name,
'activity.f90',
'densityplots.f90',
'densityplots_stuntscattering.f90',
Expand All @@ -13,4 +14,4 @@ executable('phonon_dispersion_relations',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('phonon_dispersion_relations', pointing_to: meson.project_build_root() / 'bin/phonon_dispersion_relations', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/refine_structure/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('refine_structure',
exec_name='refine_structure'
executable(exec_name,
'lo_spacegroup_applyoperation.f90',
'lo_spacegroup_charactertable.f90',
'lo_spacegroup.f90',
Expand All @@ -13,4 +14,4 @@ executable('refine_structure',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('refine_structure', pointing_to: meson.project_build_root() / 'bin/refine_structure', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name/ exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/samples_from_md/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('samples_from_md',
exec_name='samples_from_md'
executable(exec_name,
'main.f90',
'options.f90',
link_with: [libolle, libflap],
Expand All @@ -7,4 +8,4 @@ executable('samples_from_md',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('samples_from_md', pointing_to: meson.project_build_root() / 'bin/samples_from_md', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/thermal_conductivity/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('thermal_conductivity',
exec_name='thermal_conductivity'
executable(exec_name,
'cumulative_kappa.f90',
'kappa.f90',
'main.f90',
Expand All @@ -10,4 +11,4 @@ executable('thermal_conductivity',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('thermal_conductivity', pointing_to: meson.project_build_root() / 'bin/thermal_conductivity', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
5 changes: 3 additions & 2 deletions src/thermal_conductivity_2023/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('thermal_conductivity_2023',
exec_name='thermal_conductivity_2023'
executable(exec_name,
'main.f90',
'mfp.f90',
'options.f90',
Expand All @@ -11,4 +12,4 @@ executable('thermal_conductivity_2023',
install: true,
install_dir: meson.project_build_root() / 'bin')

install_symlink('thermal_conductivity_2023', pointing_to: meson.project_build_root() / 'bin/thermal_conductivity_2023', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
Loading