-
Notifications
You must be signed in to change notification settings - Fork 23
Meson compiler test #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mesonepigreco
merged 175 commits into
SSCHAcode:master
from
diegomartinez2:Meson_compiler_test
Sep 29, 2025
Merged
Meson compiler test #115
Changes from all commits
Commits
Show all changes
175 commits
Select commit
Hold shift + click to select a range
0d88630
Merge branch 'SSCHAcode:master' into master
diegomartinez2 d91171b
Merge branch 'master' into Diegom_spectral_function_multiprocessing
diegomartinez2 d2f8e6d
Merge branch 'master' of github.com:diegomartinez2/CellConstructor
diegomartinez2 63bc915
Merge branch 'master' into Diegom_spectral_function_multiprocessing
diegomartinez2 33f7388
Merge branch 'SSCHAcode:master' into master
diegomartinez2 ca298a0
Merge branch 'master' into Diegom_spectral_function_multiprocessing
diegomartinez2 251df58
Added title to function
diegomartinez2 bf60173
Added documentation to subfunction
diegomartinez2 f9b0d5d
OMP loop for big number of atoms.
diegomartinez2 07f3518
Undo, too many proccesess at the same time
diegomartinez2 ebf3571
Removed unused nu
diegomartinez2 b235490
Merge branch 'SSCHAcode:master' into master
diegomartinez2 06269f7
Merge branch 'master' into Diegom_spectral_function_multiprocessing
diegomartinez2 5f0a916
Fix bug
diegomartinez2 9504f9d
Fix "output_file_sort_function" filename input
diegomartinez2 7e0e3f6
Fix bug
diegomartinez2 a153ac7
Merge branch 'SSCHAcode:master' into master
diegomartinez2 cea2c1f
Update
diegomartinez2 eb62a51
Quickfix to the spglib/ASE problem
diegomartinez2 a804ed4
Merge branch 'SSCHAcode:master' into master
diegomartinez2 33fd222
Merge branch 'SSCHAcode:master' into master
diegomartinez2 508aeb0
Merge branch 'master' into Diegom_spectral_function_multiprocessing
diegomartinez2 a6c2173
Merge branch 'SSCHAcode:master' into master
diegomartinez2 c6985ce
Merge branch 'master' into Diegom_spectral_function_multiprocessing
diegomartinez2 f5a6990
Just fix a typo
diegomartinez2 9281353
Merge branch 'SSCHAcode:master' into master
diegomartinez2 9131e99
Djordje update
diegomartinez2 10c09e0
Merge branch 'master' of github.com:diegomartinez2/CellConstructor
diegomartinez2 1f4bc64
Merge branch 'Diegom_spectral_function_multiprocessing'
diegomartinez2 7037718
Merge branch 'master' of github.com:diegomartinez2/CellConstructor
diegomartinez2 608948e
Test Meson compilation
diegomartinez2 82aa5de
Set a build.yml for automatic github compilation and testing (first try)
diegomartinez2 5d66e4f
Change README.md to show how to make a basic compilation.
diegomartinez2 1092794
Removing 'python' from meson compilation and use as a imported module.
diegomartinez2 abdeb0e
Python libraries must be declared in Meson as modules.
diegomartinez2 959f7ba
Eliminating numpy_dep = python_installation.dependency(...)
diegomartinez2 2e85838
Changed 'build.yml' to install lapack, etc.
diegomartinez2 2c941d8
I did remove the numpy from the dependencies, so this goes out too.
diegomartinez2 009001f
Removing also the other cases of numpy dependency on FORTRAN and C.
diegomartinez2 ed32d5c
Set install = True instead of "install_extmod()".
diegomartinez2 4ca0ad7
Test to manually set the python scripts to install.
diegomartinez2 9e2f4f9
Another manual list to install.
diegomartinez2 7772e40
Again, I use manual installation of the python scripts.
diegomartinez2 1160c24
Including numpy subdirectories in compilation. May be excesive...
diegomartinez2 e2acfda
Fix typo
diegomartinez2 ad62009
Lets see if this removes some warnings and errors.
diegomartinez2 89cecc4
Comment this part as it fails on github,
diegomartinez2 cd2c36d
Adding the tests (with pytest)
diegomartinez2 6b84d46
Trying to fix the "Program 'pytest' not found or not executable" error.
diegomartinez2 122c61c
github doesn't have pytest in the bin path by default
diegomartinez2 f9727b0
Merge branch 'SSCHAcode:master' into master
diegomartinez2 902d2f3
Merge branch 'SSCHAcode:master' into Meson_compiler_test
diegomartinez2 3a395c0
For the test to work it needs pytest installed.
diegomartinez2 83e9085
Meson compilation and installation instructions
diegomartinez2 1f75f56
Merge branch 'Meson_compiler_test' of github.com:diegomartinez2/CellC…
diegomartinez2 ad67683
Added meson-python to implement the Python build system hooks
diegomartinez2 b60252e
Update 'README.md' with the instructions for running the tests.
diegomartinez2 5028fdf
Automatic check for pytest
diegomartinez2 d903a38
If no pytest installed, no test done.
diegomartinez2 e207150
Update README.md
diegomartinez2 aadc327
(Commented) method for installing python sources by Meson.
diegomartinez2 4f170c0
Test 'python.install_sources()'
diegomartinez2 8718fb1
Test everything, including full installation.
diegomartinez2 bff9e30
Test CellConstructor installation
diegomartinez2 63836d0
Test the tests with pytest.
diegomartinez2 1f8897c
Full tests (pytest)
diegomartinez2 8703a92
Testing with pytest from Meson builddir.
diegomartinez2 cd71226
Using join_paths.source_root() because pytest do not find any test.
diegomartinez2 b019a47
I made an 'error' by both changing the workdir and using join_paths. …
diegomartinez2 a60e0f9
Test with join_paths from builddir.
diegomartinez2 bc829e4
Removing "-m 'not release'" from the pytest call.
diegomartinez2 6a545dc
Test the tests with "pytest -v" from Meson.
diegomartinez2 998688b
Github "PermissionError: [Errno 13] Permission denied: '/usr/local/li…
diegomartinez2 ce695e9
Forcing the RPATH
diegomartinez2 de5d195
Automatic install RPATH
diegomartinez2 09ed518
Fix typo
diegomartinez2 a7761ab
No boolean here
diegomartinez2 3bbb003
Adding 1 more dependence to 'symph' library
diegomartinez2 8cbcc29
Try with f2py C wrapper
diegomartinez2 3f0c369
Added "Fortran Package Manager" into the pip install list
diegomartinez2 d3b6a61
Fix error
diegomartinez2 a978ac8
Fix error
diegomartinez2 6bf1bf5
Test f2py way
diegomartinez2 b9e47bb
Manually set fpm output name
diegomartinez2 e555976
Trying to fix the FORTRAN to python lib.
diegomartinez2 10c6ea7
Fixing error and looking for alternatives
diegomartinez2 9a4e571
Test with "fpm.toml"
diegomartinez2 c258522
Fix and another try with f2py wrapper (with fpm).
diegomartinez2 d0df90a
New way of solving the FORTRAN library with Meson
diegomartinez2 35d19f3
Fix the "meson.build:27:21: ERROR: custom_target keyword argument "ou…
diegomartinez2 eb44651
Fix "meson.build:78:52: ERROR: Unknown method "outputs" in object <Cu…
diegomartinez2 8703b03
Fix "meson.build:78:59: ERROR: Expecting lparen got lbracket.
diegomartinez2 8893c66
Fix "meson.build:75:71: ERROR: Expecting lparen got lbracket.
diegomartinez2 056baee
Fix "meson.build:52:40: ERROR: Expecting lparen got eol.
diegomartinez2 f5ff56d
This is a error from fpm, not Meson: "meson.build:52:33: ERROR: Unkno…
diegomartinez2 527adf1
The most robust way to handle this is to use a dedicated custom_targe…
diegomartinez2 d482536
Clean code
diegomartinez2 b4e7b9a
Setting 'link_with:' in the FORTRAN libraries creation scripts.
diegomartinez2 4d8524c
Fixing "meson.build:70:35: ERROR: Tried to form an absolute path to a…
diegomartinez2 715069c
Fix another absolute path: "meson.build:48:10: ERROR: Tried to form a…
diegomartinez2 6ed55a1
I will not use include_directories, I'll use compiler args instead.
diegomartinez2 a982bd9
Revert to previous fpm_inc definition.
diegomartinez2 9e2b1eb
Comment out unused code.
diegomartinez2 d9d5a70
Removing "to_string()" due to the fact that probably fpm_include_dir …
diegomartinez2 901b9c2
Fix bug
diegomartinez2 f97adc7
Removing the fpm wrapper and try with all the automatic Meson tricks …
diegomartinez2 518c531
Setting the '-cpp' explicity to try to force the preprocessiing on FO…
diegomartinez2 9f26c34
Separating the compilation of the Fortran code from the compilation o…
diegomartinez2 830bd26
Clear the 'dependencies' for now.
diegomartinez2 14823e9
Fix small bug
diegomartinez2 f5ca369
A step back, and set include_directories (I think I'm going in circles).
diegomartinez2 25f652c
OK lets test using the '.' directory.
diegomartinez2 4e66e22
Just renaming the files to help meson find the files.
diegomartinez2 9c2128b
Set the anidated compilation headers
diegomartinez2 c03fdcd
A simple fix?
diegomartinez2 bf4a56e
QuickFix
diegomartinez2 f04a16c
Include directories to have the numpy libs at hand
diegomartinez2 1232b97
Update, now the problem is with nupmpy?
diegomartinez2 314b08b
Include f2py directory
diegomartinez2 4794d6d
Adding python dependency
diegomartinez2 d2d4cf1
Now it compiles but gives a problem when importing symph on python (b…
diegomartinez2 4000585
Added some files to work later with meson
diegomartinez2 0c22d15
A total rebuild and clean.
diegomartinez2 977b190
Include the mpi dependence and set it as not required
diegomartinez2 5eab080
Almost forgot to include the lapack and blas dependences in 'meson.bu…
diegomartinez2 fa5a7c2
Adding the openblas and lapak in the comppilation of the FORTRAN modules
diegomartinez2 91fdb4b
tests
diegomartinez2 7773b72
Forgot to add the openblas dependency
diegomartinez2 c564823
Put the dependecies in a list
diegomartinez2 658dc9a
Put the 'endif'
diegomartinez2 bbb75d1
test without openblas
diegomartinez2 b269270
remove unused 'fpm' code
diegomartinez2 fb3f377
Removing old configurations
diegomartinez2 08fbc6f
Merge branch 'SSCHAcode:master' into master
diegomartinez2 27559c0
Manually adding the f2py wrappers.
diegomartinez2 f32a40d
update tests
diegomartinez2 8f11a52
New solution for fortranobject.c
diegomartinez2 7611e2a
Test fix
diegomartinez2 ad70c7a
Merge branch 'master' into Meson_compiler_test
diegomartinez2 76b41e3
Removing manual configuration, lets meson work with all automatically.
diegomartinez2 94281cb
Remove some unused files
diegomartinez2 6119921
Removing fpm toml files
diegomartinez2 8908dc4
Removing file meson.build.test_fpm_toml
diegomartinez2 0c88e24
Merge branch 'Meson_compiler_test' of github.com:diegomartinez2/CellC…
diegomartinez2 cd70730
Added openmp dependency for thermal_transport module
diegomartinez2 db8568f
Set an option to use Intel Math Kernel Library (MKL) in meson. Using …
diegomartinez2 204a061
Update README.md and setting the file meson.options for the mkl option
diegomartinez2 d436ac8
Update README.md
diegomartinez2 9f0ee70
The custom f2py wrapper may be necessary until meson is updated to a …
diegomartinez2 9eff8db
Set the meson minimun version
diegomartinez2 5c2ee41
Group things up
diegomartinez2 a3e080a
For testing...
diegomartinez2 228d023
Old method to compile the FORTRAN libraries with f2py.
diegomartinez2 1a6b6e0
Fix f2pywrappers on symph module
diegomartinez2 fb65a51
Adding an installation guide
diegomartinez2 e804795
Set installation guide
diegomartinez2 4a10996
Clean directory
diegomartinez2 fe27eee
More clean
diegomartinez2 14ff17c
Cleaning code
diegomartinez2 ff49eab
Update wrapper3.c to new numpy and python versions
diegomartinez2 ce20cbb
Translation of comments into English
diegomartinez2 f521112
From "python setup.py install --user" to "meson install -C builddir"
diegomartinez2 489f28f
Test by "removing" setup.py (setup.py -> old_setup.py)
diegomartinez2 8d0a2ed
Test with "pip install -e ."
diegomartinez2 989c540
It needs numpy for 'pip' installation
diegomartinez2 ba2a99e
Sorry, typo!!
diegomartinez2 ccea1ac
Taking out the editable in pip install
diegomartinez2 da3aecf
Lets see if meson can work with f2py internally without wrappers.
diegomartinez2 ced59c9
Change the installation method of the python modules.
diegomartinez2 f4c6727
Maybe it needs fortranobject_c
diegomartinez2 bb7a7d7
Include omp for thermal_conductivity
diegomartinez2 4256c7f
Set the correct repository and issues links
diegomartinez2 f73f58b
Advanced configuration with Meson
diegomartinez2 849e144
How to Install with a Specific Compiler Path
diegomartinez2 756705b
New CellConstructor Installation Guide (following 'mesonepigreco' rev…
diegomartinez2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Build and Test | ||
|
|
||
| on: [push, pull_request] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.9 | ||
|
|
||
| - name: Install system dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y libblas-dev liblapack-dev gfortran pkg-config | ||
|
|
||
| - name: Install Python dependencies | ||
| run: | | ||
| pip install meson ninja meson-python numpy scipy ase pytest | ||
|
|
||
| - name: Setup build directory | ||
| run: meson setup builddir | ||
|
|
||
| - name: Compile | ||
| run: meson compile -C builddir | ||
|
|
||
|
|
||
| # - name: Install package | ||
| # run: meson install -C builddir | ||
|
|
||
| # - name: Run tests | ||
| # run: meson test -C builddir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| # CellConstructor Installation Guide | ||
|
|
||
| This guide provides step-by-step instructions to compile and install the CellConstructor library. The project uses the Meson build system to compile C and Fortran extensions for Python. | ||
|
|
||
| ## Recommended Installation: Conda / Mamba | ||
|
|
||
| The easiest and most reproducible way to install CellConstructor is by using a Conda environment. We strongly recommend using *micromamba* or *mamba* as they are significantly faster. This method installs all the required compilers, libraries, and Python packages inside an isolated environment, avoiding the need to modify your base system. | ||
|
|
||
| ### Step 1: Create and Activate the Environment | ||
|
|
||
| 1. Install Conda/Mamba. If you don't have it, we recommend installing micromamba. | ||
|
|
||
| 2. Create the environment. Open your terminal and run the following command. It will create a new environment named sscha with all the necessary dependencies. | ||
|
|
||
| ```bash | ||
| micromamba create -n sscha python=3.12 gfortran libblas lapack openmpi openmpi-mpicc pkg-config pip numpy scipy spglib=2.2 | ||
| ``` | ||
|
|
||
| * Python Version: We use Python 3.12. Newer versions are not yet supported due to a dependency constraint from *spglib <= 2.2.* | ||
|
|
||
| * pkg-config: This package is essential. Meson requires it to correctly detect the BLAS and LAPACK libraries provided by Conda. | ||
|
|
||
| 3. Activate the environment. You must activate the environment before proceeding. | ||
|
|
||
| ```bash | ||
| micromamba activate sscha | ||
| ``` | ||
|
|
||
| ### Step 2: Clone the Repository (if not done) | ||
|
|
||
| If you don't have the source code locally, clone it from the repository. | ||
|
|
||
| ```bash | ||
| git clone https://github.com/SSCHAcode/CellConstructo | ||
| cd CellConstructor | ||
| ``` | ||
|
|
||
| ### Step 3: Install CellConstructor | ||
|
|
||
| With the environment active, install the package using *pip*. *pip* will automatically use Meson to compile and install the project. | ||
|
|
||
| ```bash | ||
| pip install . | ||
| ``` | ||
|
|
||
| The installation is now complete! You can verify it by running the tests or importing the modules in Python. | ||
|
|
||
| ## Advanced Installation: Manual Configuration | ||
|
|
||
| This section is for users who cannot use Conda or need to configure the build with specific compilers or options. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| * A C and Fortran compiler. | ||
|
|
||
| * Python 3.12 and pip. | ||
|
|
||
| * Ninja and Meson: *pip install meson ninja*. | ||
|
|
||
| * System libraries for BLAS, LAPACK, and MPI. | ||
|
|
||
| ### Method 1: Using Environment Variables | ||
|
|
||
| You can specify compilers by setting the *CC* (C compiler) and *FC* (Fortran compiler) environment variables before running *pip*. | ||
|
|
||
| ```bash | ||
| # Example using compilers from a specific toolchain | ||
| export CC=/usr/local/bin/gcc-11 | ||
| export FC=/usr/local/bin/gfortran-11 | ||
|
|
||
| # Install the project | ||
| pip install . | ||
| ``` | ||
|
|
||
| ### Method 2: Using a Meson Cross File | ||
|
|
||
| For a reproducible setup, define your compilers in a file (e.g., native-toolchain.ini). | ||
| Example *native-toolchain.ini*: | ||
|
|
||
| ```bash | ||
| [binaries] | ||
| c = '/path/to/my/custom/gcc' | ||
| fortran = '/path/to/my/custom/gfortran' | ||
| ``` | ||
|
|
||
| Then, install by passing this file to Meson via pip: | ||
|
|
||
| ```bash | ||
| pip install . --config-settings=meson-args="--native-file=native-toolchain.ini" | ||
| ``` | ||
|
|
||
| ### Build Options | ||
| You can pass options to Meson to customize the build. | ||
|
|
||
| * Create a debug build: | ||
|
|
||
| ```bash | ||
| pip install . --config-settings=meson-args="-Dbuildtype=debug" | ||
| ``` | ||
|
|
||
| * Enable Intel MKL (requires MKL to be installed and findable by your system): | ||
|
|
||
| ```bash | ||
| pip install . --config-settings=meson-args="-Duse_mkl=true" | ||
| ``` | ||
|
|
||
| * Combine multiple options: | ||
|
|
||
| ```bash | ||
| pip install . --config-settings=meson-args="-Dbuildtype=debug,-Duse_mkl=true" | ||
| ``` | ||
|
|
||
| #### Reconfiguring a Build | ||
|
|
||
| If you need to change build options, it is best to perform a clean installation. | ||
|
|
||
| ```bash | ||
| # 1. Uninstall the package | ||
| pip uninstall CellConstructor | ||
|
|
||
| # 2. (Optional but recommended) Remove the build directory | ||
| rm -rf build/ | ||
|
|
||
| # 3. Reinstall with the new options | ||
| pip install . --config-settings=meson-args="-Dnew_option=value" | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.