-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve and test Pyccel compiler flags (#428)
- Add compiler flags for GFortran >= 14 on Apple silicon chips - Add unit test in `test_epyccel_flags.py` to check compiler flags passed to `epyccel` - Update GitHub actions used in documentation workflow
- Loading branch information
Showing
5 changed files
with
58 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,35 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.pyccel | ||
def test_epyccel_flags(): | ||
|
||
from pyccel.epyccel import epyccel | ||
from psydac.api.settings import PSYDAC_BACKEND_GPYCCEL as backend | ||
|
||
kwargs = {'language' : 'fortran', | ||
'compiler' : backend['compiler'], | ||
'fflags' : backend['flags'], | ||
'accelerators' : ['openmp'] if backend['openmp'] else [], | ||
'verbose' : True, | ||
} | ||
|
||
# Function to be Pyccel-ized | ||
def f(x : float): | ||
return 3 * x | ||
|
||
# Pyccel magic | ||
# ------------ | ||
# Fortran code is generated and then compiled with the selected compiler. | ||
# The compiled function is callable from Python through the C Python API. | ||
# The necessary C wrapper functions are also generated by Pyccel. | ||
fast_f = epyccel(f, **kwargs) | ||
|
||
# Check output of pyccelized function | ||
assert fast_f(3.5) == f(3.5) | ||
|
||
|
||
# Interactive usage | ||
if __name__ == '__main__': | ||
test_epyccel_flags() | ||
print('PASSED') |
This file contains 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