Skip to content

Commit

Permalink
Renamed cray compiler wrapper to be CrayCcWrapper and CrayFtnWrapper,…
Browse files Browse the repository at this point in the history
… to avoid confusion with Craycc.
  • Loading branch information
hiker committed Nov 21, 2024
1 parent 8b39f17 commit be1a426
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
8 changes: 4 additions & 4 deletions source/fab/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
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, CrayCc, CrayFtn,
Mpicc, Mpif90)
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 @@ -34,9 +34,9 @@
"Cpp",
"CppFortran",
"Craycc",
"CrayCc",
"CrayCcWrapper",
"Crayftn",
"CrayFtn",
"CrayFtnWrapper",
"Fcm",
"Flags",
"FortranCompiler",
Expand Down
10 changes: 6 additions & 4 deletions source/fab/tools/compiler_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ def __init__(self, compiler: Compiler):


# ============================================================================
class CrayFtn(CompilerWrapper):
'''Class for the Cray Fortran compiler wrapper.
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.
'''
Expand All @@ -216,8 +217,9 @@ def __init__(self, compiler: Compiler):


# ============================================================================
class CrayCc(CompilerWrapper):
'''Class for the Cray C compiler wrapper
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.
'''
Expand Down
12 changes: 7 additions & 5 deletions source/fab/tools/tool_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
from fab.tools.tool import Tool
from fab.tools.category import Category
from fab.tools.compiler import Compiler
from fab.tools.compiler_wrapper import CrayCc, CrayFtn, Mpif90, Mpicc
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,
Expand Down Expand Up @@ -76,19 +77,20 @@ def __init__(self):
for fc in all_fc:
mpif90 = Mpif90(fc)
self.add_tool(mpif90)
# I assume cray has (besides cray) only support for gfortran/ifort
# I assume cray has (besides cray) only support for Intel and GNU
if fc.name in ["gfortran", "ifort"]:
crayftn = CrayFtn(fc)
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 gfortran/ifort
# I assume cray has (besides cray) only support for Intel and GNU
if cc.name in ["gcc", "icc"]:
craycc = CrayCc(cc)
craycc = CrayCcWrapper(cc)
self.add_tool(craycc)

def add_tool(self, tool: Tool):
Expand Down
22 changes: 11 additions & 11 deletions tests/unit_tests/tools/test_compiler_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import pytest

from fab.tools import (Category, CompilerWrapper, CrayCc, CrayFtn,
Gcc, Gfortran, Icc, Ifort, Mpicc, Mpif90,
ToolRepository)
from fab.tools import (Category, CompilerWrapper, CrayCcWrapper,
CrayFtnWrapper, Gcc, Gfortran, Icc, Ifort,
Mpicc, Mpif90, ToolRepository)


def test_compiler_wrapper_compiler_getter():
Expand Down Expand Up @@ -351,9 +351,9 @@ def test_compiler_wrapper_mpi_ifort():

def test_compiler_wrapper_cray_icc():
'''Tests the Cray wrapper for icc.'''
craycc = CrayCc(Icc())
craycc = CrayCcWrapper(Icc())
assert craycc.name == "craycc-icc"
assert str(craycc) == "CrayCc(icc)"
assert str(craycc) == "CrayCcWrapper(icc)"
assert isinstance(craycc, CompilerWrapper)
assert craycc.category == Category.C_COMPILER
assert craycc.mpi
Expand All @@ -362,9 +362,9 @@ def test_compiler_wrapper_cray_icc():

def test_compiler_wrapper_cray_ifort():
'''Tests the Cray wrapper for ifort.'''
crayftn = CrayFtn(Ifort())
crayftn = CrayFtnWrapper(Ifort())
assert crayftn.name == "crayftn-ifort"
assert str(crayftn) == "CrayFtn(ifort)"
assert str(crayftn) == "CrayFtnWrapper(ifort)"
assert isinstance(crayftn, CompilerWrapper)
assert crayftn.category == Category.FORTRAN_COMPILER
assert crayftn.mpi
Expand All @@ -373,9 +373,9 @@ def test_compiler_wrapper_cray_ifort():

def test_compiler_wrapper_cray_gcc():
'''Tests the Cray wrapper for gcc.'''
craycc = CrayCc(Gcc())
craycc = CrayCcWrapper(Gcc())
assert craycc.name == "craycc-gcc"
assert str(craycc) == "CrayCc(gcc)"
assert str(craycc) == "CrayCcWrapper(gcc)"
assert isinstance(craycc, CompilerWrapper)
assert craycc.category == Category.C_COMPILER
assert craycc.mpi
Expand All @@ -384,9 +384,9 @@ def test_compiler_wrapper_cray_gcc():

def test_compiler_wrapper_cray_gfortran():
'''Tests the Cray wrapper for gfortran.'''
crayftn = CrayFtn(Gfortran())
crayftn = CrayFtnWrapper(Gfortran())
assert crayftn.name == "crayftn-gfortran"
assert str(crayftn) == "CrayFtn(gfortran)"
assert str(crayftn) == "CrayFtnWrapper(gfortran)"
assert isinstance(crayftn, CompilerWrapper)
assert crayftn.category == Category.FORTRAN_COMPILER
assert crayftn.mpi
Expand Down

0 comments on commit be1a426

Please sign in to comment.