Skip to content
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

Additional compilers #349

Merged
merged 416 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
416 commits
Select commit Hold shift + click to select a range
5f6625c
Moved OBJECT_ARCHIVES from constants to ArtefactSet.
hiker Jun 4, 2024
3d58184
Moved PRAGMAD_C from constants to ArtefactSet.
hiker Jun 4, 2024
f2942b1
Turned 'all_source' into an enum.
hiker Jun 4, 2024
d005c47
Allow integer as revision.
hiker Jun 4, 2024
73f91d4
Fixed flake8 error.
hiker Jun 4, 2024
6d5e82e
Removed specific functions to add/get fortran source files etc.
hiker Jun 5, 2024
37f7adc
Removed non-existing and unneccessary collections.
hiker Jun 5, 2024
ac93579
Try to fix all run_configs.
hiker Jun 4, 2024
2f633b9
Fixed rebase issues.
hiker Jun 6, 2024
03c6076
Added replace functionality to ArtefactStore, updated test_artefacts …
hiker Jun 6, 2024
499c9b5
Started to replace artefacts when files are pre-processed.
hiker Jun 6, 2024
7570696
Removed linker argument from linking step in all examples.
hiker Jun 7, 2024
41d9273
Try to get jules to link.
hiker Jun 7, 2024
56f001a
Fixed build_jules.
hiker Jun 7, 2024
8fb2be1
Fixed other issues raised in reviews.
hiker Jun 7, 2024
71cd141
Merge pull request #26 from hiker/3_better_compiler_support
jasonjunweilyu Jun 7, 2024
5b959c3
Merge branch '3_better_compiler_support' into add_standard_artefacts
hiker Jun 7, 2024
0f6c1a5
Try to get jules to link.
hiker Jun 7, 2024
588f647
Fixed other issues raised in reviews.
hiker Jun 7, 2024
cd81ce3
Merge branch 'bom_master' into add_standard_artefacts
hiker Jun 7, 2024
e857c94
Simplify handling of X90 files by replacing the X90 with x90, meaning…
hiker Jun 7, 2024
e024824
Make OBJECT_ARCHIVES also a dict, migrate more code to replace/add fi…
hiker Jun 11, 2024
a1346cf
Merge branch '3_better_compiler_support' into improve_artefact_workflow
hiker Jun 11, 2024
a0c2b98
Fixed some examples.
hiker Jun 11, 2024
169ff69
Merge branch 'master' into 3_better_compiler_support
hiker Jun 11, 2024
a34febc
Fix flake8 error.
hiker Jun 11, 2024
df893d6
Fixed failing tests.
hiker Jun 11, 2024
a2a8a54
Support empty comments.
hiker Jun 11, 2024
f03bc37
Fix preprocessor to not unnecessary remove and add files that are alr…
hiker Jun 12, 2024
7632775
Allow find_soure_files to be called more than once by adding files (n…
hiker Jun 12, 2024
e73179f
Updated lfric_common so that files created by configurator are writte…
hiker Jun 12, 2024
f7919ce
Use c_build_files instead of pragmad_c.
hiker Jun 12, 2024
50f4a42
Removed unnecessary str.
hiker Jun 12, 2024
36fa57b
Documented the new artefact set handling.
hiker Jun 13, 2024
77b2b97
Fixed typo.
hiker Jun 13, 2024
07e86d4
Make the PSyclone API configurable.
hiker Jun 13, 2024
5c895ba
Fixed formatting of documentation, properly used ArtefactSet names.
hiker Jun 13, 2024
e556115
Merge branch 'improve_artefact_workflow' into generalisation
hiker Jun 13, 2024
8a552f0
Support .f and .F Fortran files.
hiker Jun 14, 2024
f0e660d
Removed setter for tool.is_available, which was only used for testing.
hiker Jun 17, 2024
9f1ffc3
#3 Fix documentation and coding style issues from review.
hiker Jun 17, 2024
a0531a2
Renamed Categories into Category.
hiker Jun 17, 2024
4ff887c
Minor coding style cleanup.
hiker Jun 17, 2024
8a3b02d
Removed more unnecessary ().
hiker Jun 17, 2024
10ae159
Re-added (invalid) grab_pre_build call.
hiker Jun 17, 2024
622d0bd
Fixed typo.
hiker Jun 17, 2024
3f48703
Renamed set_default_vendor to set_default_compiler_suite.
hiker Jun 18, 2024
ba9245d
Renamed VendorTool to CompilerSuiteTool.
hiker Jun 18, 2024
f8c4418
Also accept a Path as exec_name specification for a tool.
hiker Jun 18, 2024
6a7aef8
Move the check_available function into the base class.
hiker Jun 18, 2024
0b73089
Fixed some types and documentation.
hiker Jun 18, 2024
7796246
Fix typing error.
hiker Jun 18, 2024
412a136
Added explanation for meta-compiler.
hiker Jun 18, 2024
8ec2227
Improved error handling and documentation.
hiker Jun 18, 2024
6d1a1ee
Replace mpiifort with mpifort to be a tiny bit more portable.
hiker Jun 18, 2024
8d4c66f
Use classes to group tests for git/svn/fcm together.
hiker Jun 18, 2024
46bc4ef
Fixed issue in get_transformation script, and moved script into lfric…
hiker Jun 18, 2024
ffdfd1a
Merge remote-tracking branch 'upstream/master' into 3_better_compiler…
hiker Jun 18, 2024
4f436f3
Code improvement as suggested by review.
hiker Jun 19, 2024
52d5751
Fixed run config
hiker Jun 19, 2024
562d56f
Merge branch 'add_standard_artefacts' into improve_artefact_workflow
hiker Jun 20, 2024
ca7e477
Merge pull request #28 from hiker/add_standard_artefacts
jasonjunweilyu Jun 20, 2024
1150318
Merge branch 'improve_artefact_workflow' into generalisation
hiker Jun 20, 2024
516ec34
Added reference to ticket.
hiker Jun 20, 2024
c17545a
Merge branch 'bom_master' into improve_artefact_workflow
hiker Jun 20, 2024
19005e3
Merge branch 'improve_artefact_workflow' into generalisation
hiker Jun 20, 2024
ee2fc85
Updated type information.
hiker Jun 20, 2024
5912e59
More typing fixes.
hiker Jun 20, 2024
83ba6a1
Fixed typing warnings.
hiker Jun 21, 2024
7e66eca
As requested by reviewer removed is_working_copy functionality.
hiker Jun 21, 2024
ddd3cf2
Issue a warning (which can be silenced) when a tool in a toolbox is r…
hiker Jun 21, 2024
68bc218
Fixed flake8.
hiker Jun 21, 2024
2bdcb8c
Merge remote-tracking branch 'upstream/master' into 3_better_compiler…
hiker Jun 21, 2024
c02729c
Fixed flake8.
hiker Jun 21, 2024
a29be95
Merge remote-tracking branch 'upstream/master' into 3_better_compiler…
hiker Jun 21, 2024
03bed8e
Merge branch 'master' into 3_better_compiler_support
hiker Jun 24, 2024
9ccdefd
Merge branch '3_better_compiler_support' into bom_master
hiker Jun 24, 2024
00fa8b2
Merge branch '3_better_compiler_support' into improve_artefact_workflow
hiker Jun 24, 2024
c21d34f
Merge branch '3_better_compiler_support' into add_standard_artefacts
hiker Jun 24, 2024
d8fe42b
Merge branch 'add_standard_artefacts' into improve_artefact_workflow
hiker Jun 24, 2024
2f069c8
Merge branch 'bom_master' into add_standard_artefacts
hiker Jun 24, 2024
9abfc1d
Merge branch 'add_standard_artefacts' into improve_artefact_workflow
hiker Jun 24, 2024
772e79c
Merge branch 'improve_artefact_workflow' into generalisation
hiker Jun 24, 2024
c04ab9e
Fixed failing test.
hiker Jun 24, 2024
87b8012
Addressed issues raised in review.
hiker Jun 24, 2024
523e876
Removed now unnecessary operations.
hiker Jun 24, 2024
538e4da
Updated some type information.
hiker Jun 24, 2024
e3114c7
Merge pull request #29 from hiker/improve_artefact_workflow
jasonjunweilyu Jun 24, 2024
88cf3ea
Merge branch 'bom_master' into generalisation
hiker Jun 24, 2024
0f1ead3
Fixed all references to APIs to be consistent with PSyclone 2.5.
hiker Jun 25, 2024
8ab8c40
Added api to the checksum computation.
hiker Jun 25, 2024
674575e
Fixed type information.
hiker Jun 25, 2024
c980e7e
Added test to verify that changing the api changes the checksum.
hiker Jun 28, 2024
0a61359
Merge pull request #30 from hiker/generalisation
jasonjunweilyu Jul 1, 2024
ff306da
Make compiler version a tuple of integers
lukehoffmann Jul 16, 2024
c5b1b02
Update some tests to use tuple versions
lukehoffmann Jul 16, 2024
ccf4ad8
Explicitly test handling of bad version format
lukehoffmann Jul 16, 2024
fd02c8c
Fix formatting
lukehoffmann Jul 16, 2024
10eb726
Tidying up
lukehoffmann Jul 16, 2024
ea18256
Make compiler raise an error for any invalid version string
lukehoffmann Jul 18, 2024
6e6579a
Merge remote-tracking branch 'origin/master' into bom_master
hiker Jul 19, 2024
932f401
Merge remote-tracking branch 'upstream/master' into bom_master
hiker Jul 19, 2024
120116c
Check compiler version string for compiler name
lukehoffmann Jul 22, 2024
5a24c24
Fix formatting
lukehoffmann Jul 23, 2024
dbc3d73
Add compiler.get_version_string() method
lukehoffmann Jul 24, 2024
90adcca
Add mpi and openmp settings to BuildConfig, made compiler MPI aware.
hiker Jul 24, 2024
150dc37
Looks like the circular dependency has been fixed.
hiker Jul 24, 2024
db34597
Revert "Looks like the circular dependency has been fixed." ...
hiker Jul 24, 2024
7c347c8
Don't even try to find a C compiler if no C files are to be compiled.
hiker Jul 24, 2024
ff71393
Updated gitignore to ignore (recently renamed) documentation.
hiker Jul 25, 2024
5dc01f3
Fixed failing test.
hiker Jul 25, 2024
2b5c4bd
Return from compile Fortran early if there are no files to compiles. …
hiker Jul 25, 2024
46706c5
Add MPI enables wrapper for intel and gnu compiler.
hiker Jul 25, 2024
d55344f
Fixed test.
hiker Jul 25, 2024
d00c187
Automatically add openmp flag to compiler and linker based on BuildCo…
hiker Jul 25, 2024
e9333fd
Removed enforcement of keyword parameters, which is not supported in …
hiker Jul 25, 2024
a85bc7a
Fixed failing test.
hiker Jul 25, 2024
6c8e8df
Support more than one tool of a given suite by sorting them.
hiker Jul 26, 2024
3bb726e
Use different version checkout for each compiler vendor with mixins
lukehoffmann Jul 26, 2024
286d457
Refactoring, remove unittest compiler class
lukehoffmann Jul 26, 2024
dae9102
Fix some mypy errors
lukehoffmann Jul 28, 2024
cdcc023
Use 'Union' type hint to fix build checks
lukehoffmann Jul 28, 2024
493f09d
Added option to add flags to a tool.
hiker Jul 29, 2024
be9e97d
Introduce proper compiler wrapper, used this to implement properly wr…
hiker Jul 29, 2024
cbde919
Fixed typo in types.
hiker Jul 29, 2024
0bdb734
Return run_version_command to base Compiler class
lukehoffmann Jul 29, 2024
b97ec50
Add a missing type hint
lukehoffmann Jul 29, 2024
b1b4057
Merge remote-tracking branch 'upstream/master' into bom_master
hiker Jul 29, 2024
93c6810
Added (somewhat stupid) 'test' to reach 100% coverage of PSyclone tool.
hiker Jul 30, 2024
50a891a
Simplified MPI support in wrapper.
hiker Jul 30, 2024
5b51aa1
Merge pull request #13 from hiker/update_bom_master_to_upstream_master
jasonjunweilyu Jul 30, 2024
6b05755
More compiler wrapper coverage.
hiker Jul 31, 2024
4d03ed6
Removed duplicated function.
hiker Jul 31, 2024
ada8a8f
Removed debug print.
hiker Jul 31, 2024
c3d0e6e
Removed permanently changing compiler attributes, which can cause tes…
hiker Jul 31, 2024
1abdd53
More test for C compiler wrapper.
hiker Aug 1, 2024
e921a3d
More work on compiler wrapper tests.
hiker Aug 1, 2024
81136b1
Fixed version and availability handling, added missing tests for 100%…
hiker Aug 1, 2024
84a25b9
Fixed typing error.
hiker Aug 1, 2024
13da4fe
Try to fix python 3.7.
hiker Aug 1, 2024
590dc75
Tried to fix failing tests.
hiker Aug 1, 2024
19eab9f
Remove inheritance from mixins and use protocol
lukehoffmann Aug 2, 2024
cbe1cb8
Simplify compiler inheritance
lukehoffmann Aug 2, 2024
bf81dee
Merge pull request #9 from hiker/version_tuples
hiker Aug 2, 2024
196e034
Merge branch 'bom_master' into mpi_omp_support
hiker Aug 2, 2024
a375a34
Merge branch 'mpi_omp_support' into compiler_wrapper
hiker Aug 2, 2024
83a3045
Updated wrapper and tests to handle error raised in get_version.
hiker Aug 7, 2024
becb483
Simplified regular expressions (now tests cover detection of version …
hiker Aug 7, 2024
19576b2
Test for missing mixin.
hiker Aug 7, 2024
01e5480
Use the parsing mixing from the compiler in a compiler wrapper.
hiker Aug 7, 2024
cd6d9b0
Use setattr instead of assignment to make mypy happy.
hiker Aug 7, 2024
540b544
Simplify usage of compiler-specific parsing mixins.
hiker Aug 7, 2024
08ac3b5
Minor code cleanup.
hiker Aug 7, 2024
07d84db
Updated documentation.
hiker Aug 7, 2024
3076715
Simplify usage of compiler-specific parsing mixins.
hiker Aug 7, 2024
7a50859
Test for missing mixin.
hiker Aug 7, 2024
749fa2d
Fixed test.
hiker Aug 7, 2024
20fef2c
Merge branch 'version_tuples' into mpi_omp_support
hiker Aug 8, 2024
6c438dc
Merge branch 'mpi_omp_support' into compiler_wrapper
hiker Aug 8, 2024
86612ad
Added missing openmp_flag property to compiler wrapper.
hiker Aug 8, 2024
8b7ea63
Don't use isinstance for consistency check, which does not work for C…
hiker Aug 8, 2024
51b8324
Fixed isinstance test for C compilation which doesn't work with a Com…
hiker Aug 8, 2024
c8c8956
Use a linker's compiler to determine MPI support. Removed mpi propert…
hiker Aug 8, 2024
9598c09
Added more tests for invalid version numbers.
hiker Aug 9, 2024
5c6f99f
Added more test cases for invalid version number, improved regex to w…
hiker Aug 9, 2024
c1eb158
Fixed typo in test.
hiker Aug 9, 2024
1524777
Merge branch 'version_tuples' into mpi_omp_support
hiker Aug 9, 2024
3731719
Merge branch 'mpi_omp_support' into compiler_wrapper
hiker Aug 9, 2024
7fa4340
Fixed flake/mypy errors.
hiker Aug 9, 2024
f99145a
Combine wrapper flags with flags from wrapped compiler.
hiker Aug 10, 2024
f9a467d
Made mypy happy.
hiker Aug 10, 2024
02fbb7b
Fixed test.
hiker Aug 12, 2024
955befc
Merge remote-tracking branch 'upstream/master' into bom_master
hiker Aug 12, 2024
552e4cc
Merge pull request #18 from hiker/version_tuples
lukehoffmann Aug 12, 2024
b38cdb8
Merge remote-tracking branch 'upstream/master' into mpi_omp_support
hiker Aug 12, 2024
247eeb5
Merge branch 'mpi_omp_support' into compiler_wrapper
hiker Aug 12, 2024
6826c85
Merge remote-tracking branch 'upstream/master' into version_tuples
hiker Aug 13, 2024
e5aca3b
Merge branch 'version_tuples' into mpi_omp_support
hiker Aug 13, 2024
c6b4ef2
Merge branch 'mpi_omp_support' into compiler_wrapper
hiker Aug 13, 2024
ccbe810
Split tests into smaller individual ones, fixed missing asssert in test.
hiker Aug 14, 2024
f8f8ab0
Parameterised compiler version tests to also test wrapper.
hiker Aug 14, 2024
1543841
Added missing MPI parameter when getting the compiler.
hiker Aug 14, 2024
cd8ec62
Fixed comments.
hiker Aug 14, 2024
13935c0
Order parameters to be in same order for various compiler classes.
hiker Aug 14, 2024
de80c44
Merge branch 'bom_master' into mpi_omp_support
hiker Aug 14, 2024
009478f
Merge remote-tracking branch 'origin/bom_master' into mpi_omp_support
hiker Aug 14, 2024
304d6e9
Merge branch 'mpi_omp_support' into compiler_wrapper
hiker Aug 14, 2024
7887d24
Remove stray character
lukehoffmann Aug 16, 2024
83836e7
Merge pull request #14 from hiker/mpi_omp_support
lukehoffmann Aug 16, 2024
2f9beab
Merge remote-tracking branch 'origin/bom_master' into compiler_wrapper
hiker Aug 16, 2024
a79b41d
Merge remote-tracking branch 'MetOffice/master' into bom_master
lukehoffmann Aug 21, 2024
420fa5e
Added getter for wrapped compiler.
hiker Aug 21, 2024
07a50a6
Fixed small error that would prevent nested compiler wrappers from be…
hiker Aug 21, 2024
282df65
Merge branch 'bom_master' into compiler_wrapper
hiker Aug 21, 2024
e5dd7c9
Added a cast to make mypy happy.
hiker Aug 21, 2024
d7c66c6
Add simple getter for linker library flags
lukehoffmann Aug 6, 2024
0340a27
Add getter for linker flags by library
lukehoffmann Aug 21, 2024
4cc5485
Fix formatting
lukehoffmann Aug 21, 2024
f017eed
Add optional libs argument to link function
lukehoffmann Aug 21, 2024
4f62bfd
Reorder and clean up linker tests
lukehoffmann Aug 22, 2024
1caf110
Make sure `Linker.link()` raises for unknown lib
lukehoffmann Aug 22, 2024
dd81dbe
Add missing type
lukehoffmann Aug 22, 2024
8d72ccd
Fix typing error
lukehoffmann Aug 22, 2024
b3021d6
Add 'libs' argument to link_exe function
lukehoffmann Aug 29, 2024
c9b4183
Try to add documentation for the linker libs feature
lukehoffmann Aug 29, 2024
390a2fb
Use correct list type in link_exe hint
lukehoffmann Aug 30, 2024
d8c9db1
Add silent replace option to linker.add_lib_flags
lukehoffmann Aug 30, 2024
0a6f374
Fixed spelling mistake in option.
hiker Sep 4, 2024
09dceb5
Clarified documentation.
hiker Sep 4, 2024
ef17154
Removed unnecessary functions in CompilerWrapper.
hiker Sep 4, 2024
a9e1ad5
Merge pull request #16 from hiker/compiler_wrapper
lukehoffmann Sep 4, 2024
c612aae
Merge remote-tracking branch 'origin/bom_master' into linker-lib-flags
hiker Sep 5, 2024
649b9ff
Fixed failing test triggered by executing them in specific order (too…
hiker Sep 5, 2024
b0e5842
Fixed line lengths.
hiker Sep 5, 2024
0645816
Add tests for linker LDFLAG
lukehoffmann Sep 11, 2024
728089e
Add pre- and post- lib flags to link function
lukehoffmann Sep 11, 2024
76322a1
Fix syntax in built-in lib flags
lukehoffmann Sep 23, 2024
58007e8
Remove netcdf as a built-in linker library
lukehoffmann Sep 23, 2024
7286200
Configure pre- and post-lib flags on the Linker object
lukehoffmann Sep 23, 2024
c6e3b42
Use more realistic linker lib flags
lukehoffmann Sep 23, 2024
f7e40f3
Formatting fix
lukehoffmann Sep 23, 2024
282f068
Merge pull request #19 from hiker/linker-lib-flags
hiker Sep 24, 2024
b9aabf8
Removed mixing, use a simple regex instead.
hiker Oct 17, 2024
8ee10e8
Added support for ifx/icx compiler as intel-llvm class.
hiker Oct 18, 2024
d7b2008
Added support for nvidia compiler.
hiker Oct 18, 2024
9005b3b
Add preliminary support for Cray compiler.
hiker Oct 18, 2024
8771e80
Added Cray compiler wrapper ftn and cc.
hiker Oct 18, 2024
2617322
Made mpi and openmp default to False in the BuildConfig constructor.
hiker Oct 21, 2024
f165e46
Removed white space.
hiker Oct 21, 2024
0188050
Follow a more consistent naming scheme for crays, even though the nat…
hiker Oct 22, 2024
3c569bd
Changed names again.
hiker Oct 22, 2024
df5f63a
Support compilers that do not support OpenMP.
hiker Nov 8, 2024
788e75a
Added documentation for openmp parameter.
hiker Nov 8, 2024
edc5fcd
Renamed cray compiler wrapper to be CrayCcWrapper and CrayFtnWrapper,…
hiker Nov 11, 2024
f6a70c8
Fixed incorrect name in comments.
hiker Nov 11, 2024
4f0e70f
Merge pull request #28 from hiker/additional_compilers
lukehoffmann Nov 11, 2024
755ad9a
Merge branch 'mpi_omp_support' into compiler_wrapper
hiker Nov 11, 2024
58caecf
Merge branch 'compiler_wrapper' into bom_master
hiker Nov 11, 2024
60b105c
Merge branch 'compiler_wrapper' into linker-lib-flags
hiker Nov 12, 2024
5452d70
Merge branch 'linker-lib-flags' into additional_compilers
hiker Nov 12, 2024
d54d94c
Merge branch 'linker-lib-flags' into bom_master
hiker Nov 12, 2024
605e7e5
Merge branch 'additional_compilers' into bom_master
hiker Nov 12, 2024
23d2f8e
Merge branch 'dev' into compiler_wrapper
hiker Nov 12, 2024
b7f53e9
Merge branch 'compiler_wrapper' into linker-lib-flags
hiker Nov 12, 2024
70ad4b1
Merge branch 'linker-lib-flags' into additional_compilers
hiker Nov 12, 2024
2a15f0e
Merge remote-tracking branch 'upstream/dev' into compiler_wrapper
hiker Nov 12, 2024
0b3d5b7
Merge branch 'compiler_wrapper' into linker-lib-flags
hiker Nov 12, 2024
b70f98f
Merge branch 'linker-lib-flags' into additional_compilers
hiker Nov 12, 2024
602d57b
Merge remote-tracking branch 'upstream/dev' into linker-lib-flags
hiker Nov 12, 2024
2f7e3ba
Merge branch 'linker-lib-flags' into additional_compilers
hiker Nov 12, 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
19 changes: 13 additions & 6 deletions source/fab/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

from fab.tools.ar import Ar
from fab.tools.category import Category
from fab.tools.compiler import (CCompiler, Compiler, FortranCompiler, Gcc,
Gfortran, GnuVersionHandling, Icc, Ifort,
IntelVersionHandling)
from fab.tools.compiler_wrapper import CompilerWrapper, Mpicc, Mpif90
from fab.tools.compiler import (CCompiler, Compiler, Craycc, Crayftn,
FortranCompiler, Gcc, Gfortran, Icc,
Icx, Ifort, Ifx, Nvc, Nvfortran)
from fab.tools.compiler_wrapper import (CompilerWrapper, CrayCcWrapper,
CrayFtnWrapper, Mpicc, Mpif90)
from fab.tools.flags import Flags
from fab.tools.linker import Linker
from fab.tools.psyclone import Psyclone
Expand All @@ -32,20 +33,26 @@
"CompilerWrapper",
"Cpp",
"CppFortran",
"Craycc",
"CrayCcWrapper",
"Crayftn",
"CrayFtnWrapper",
"Fcm",
"Flags",
"FortranCompiler",
"Fpp",
"Gcc",
"Gfortran",
"Git",
"GnuVersionHandling",
"Icc",
"Icx",
"Ifort",
"IntelVersionHandling",
"Ifx",
"Linker",
"Mpif90",
"Mpicc",
"Nvc",
"Nvfortran",
"Preprocessor",
"Psyclone",
"Rsync",
Expand Down
272 changes: 182 additions & 90 deletions source/fab/tools/compiler.py

Large diffs are not rendered by default.

31 changes: 27 additions & 4 deletions source/fab/tools/compiler_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,9 @@ def __init__(self, name: str, exec_name: str,
name=name, exec_name=exec_name,
category=self._compiler.category,
suite=self._compiler.suite,
version_regex=self._compiler._version_regex,
mpi=mpi,
availability_option=self._compiler.availability_option)
# We need to have the right version to parse the version output
# So we set this function based on the function that the
# wrapped compiler uses:
setattr(self, "parse_version_output", compiler.parse_version_output)

def __str__(self):
return f"{type(self).__name__}({self._compiler.name})"
Expand Down Expand Up @@ -196,3 +193,29 @@ class Mpicc(CompilerWrapper):
def __init__(self, compiler: Compiler):
super().__init__(name=f"mpicc-{compiler.name}",
exec_name="mpicc", compiler=compiler, mpi=True)


# ============================================================================
class CrayFtnWrapper(CompilerWrapper):
'''Class for the Cray Fortran compiler wrapper. We add 'wrapper' to the
class name to make this class distinct from the Crayftn compiler class.

:param compiler: the compiler that the ftn wrapper will use.
'''

def __init__(self, compiler: Compiler):
super().__init__(name=f"crayftn-{compiler.name}",
exec_name="ftn", compiler=compiler, mpi=True)


# ============================================================================
class CrayCcWrapper(CompilerWrapper):
'''Class for the Cray C compiler wrapper. We add 'wrapper' to the class
name to make this class distinct from the Craycc compiler class

:param compiler: the compiler that the mpicc wrapper will use.
'''

def __init__(self, compiler: Compiler):
super().__init__(name=f"craycc-{compiler.name}",
exec_name="cc", compiler=compiler, mpi=True)
33 changes: 24 additions & 9 deletions source/fab/tools/tool_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@
from fab.tools.tool import Tool
from fab.tools.category import Category
from fab.tools.compiler import Compiler
from fab.tools.compiler_wrapper import (CrayCcWrapper, CrayFtnWrapper,
Mpif90, Mpicc)
from fab.tools.linker import Linker
from fab.tools.versioning import Fcm, Git, Subversion
from fab.tools import (Ar, Cpp, CppFortran, Craycc, Crayftn,
Gcc, Gfortran, Icc, Icx, Ifort, Ifx,
Nvc, Nvfortran, Psyclone, Rsync)


class ToolRepository(dict):
Expand Down Expand Up @@ -57,26 +62,36 @@ def __init__(self):

# Add the FAB default tools:
# TODO: sort the defaults so that they actually work (since not all
# tools FAB knows about are available). For now, disable Fpp:
# We get circular dependencies if imported at top of the file:
# pylint: disable=import-outside-toplevel
from fab.tools import (Ar, Cpp, CppFortran, Gcc, Gfortran,
Icc, Ifort, Psyclone, Rsync)

for cls in [Gcc, Icc, Gfortran, Ifort, Cpp, CppFortran,
Fcm, Git, Subversion, Ar, Psyclone, Rsync]:
# tools FAB knows about are available). For now, disable Fpp (by not
# adding it). IF someone actually uses it it can added.
for cls in [Craycc, Crayftn,
Gcc, Gfortran,
Icc, Icx, Ifort, Ifx,
Nvc, Nvfortran,
Cpp, CppFortran,
Ar, Fcm, Git, Psyclone, Rsync, Subversion]:
self.add_tool(cls())

from fab.tools.compiler_wrapper import Mpif90, Mpicc
# Now create the potential mpif90 and Cray ftn wrapper
all_fc = self[Category.FORTRAN_COMPILER][:]
for fc in all_fc:
mpif90 = Mpif90(fc)
self.add_tool(mpif90)
# I assume cray has (besides cray) only support for Intel and GNU
if fc.name in ["gfortran", "ifort"]:
crayftn = CrayFtnWrapper(fc)
print("NEW NAME", crayftn, crayftn.name)
self.add_tool(crayftn)

# Now create the potential mpicc and Cray cc wrapper
all_cc = self[Category.C_COMPILER][:]
for cc in all_cc:
mpicc = Mpicc(cc)
self.add_tool(mpicc)
# I assume cray has (besides cray) only support for Intel and GNU
if cc.name in ["gcc", "icc"]:
craycc = CrayCcWrapper(cc)
self.add_tool(craycc)

def add_tool(self, tool: Tool):
'''Creates an instance of the specified class and adds it
Expand Down
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
@pytest.fixture(name="mock_c_compiler")
def fixture_mock_c_compiler():
'''Provides a mock C-compiler.'''
mock_compiler = CCompiler("mock_c_compiler", "mock_exec", "suite")
mock_compiler = CCompiler("mock_c_compiler", "mock_exec", "suite",
version_regex="something")
mock_compiler.run = mock.Mock()
mock_compiler._version = (1, 2, 3)
mock_compiler._name = "mock_c_compiler"
Expand All @@ -32,6 +33,7 @@ def fixture_mock_fortran_compiler():
'''Provides a mock Fortran-compiler.'''
mock_compiler = FortranCompiler("mock_fortran_compiler", "mock_exec",
"suite", module_folder_flag="",
version_regex="something",
syntax_only_flag=None, compile_flag=None,
output_flag=None, openmp_flag=None)
mock_compiler.run = mock.Mock()
Expand Down
1 change: 0 additions & 1 deletion tests/unit_tests/steps/test_archive_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def test_for_library(self):
def test_incorrect_tool(self, tool_box):
'''Test that an incorrect archive tool is detected
'''

config = BuildConfig('proj', tool_box)
cc = tool_box.get_tool(Category.C_COMPILER, config.mpi, config.openmp)
# And set its category to be AR
Expand Down
Loading