Skip to content

Commit cd5804d

Browse files
committed
Remove workload functionality
1 parent 5d66de6 commit cd5804d

File tree

7 files changed

+19
-30
lines changed

7 files changed

+19
-30
lines changed

pykokkos/core/module_setup.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,15 @@ def get_metadata(entity: Union[Callable[..., None], object]) -> EntityMetadata:
5252
name: str
5353
filepath: str
5454

55-
if isinstance(entity, Callable):
56-
# Workunit/functor
57-
is_functor: bool = hasattr(entity, "__self__")
58-
if is_functor:
59-
entity_type: type = get_functor(entity)
60-
name = entity_type.__name__
61-
filepath = inspect.getfile(entity_type)
62-
else:
63-
name = entity.__name__
64-
filepath = inspect.getfile(entity)
65-
66-
else:
67-
# Workload
68-
entity_type: type = type(entity)
55+
# Workunit/functor
56+
is_functor: bool = hasattr(entity, "__self__")
57+
if is_functor:
58+
entity_type: type = get_functor(entity)
6959
name = entity_type.__name__
7060
filepath = inspect.getfile(entity_type)
61+
else:
62+
name = entity.__name__
63+
filepath = inspect.getfile(entity)
7164

7265
return EntityMetadata(entity, name, filepath)
7366

pykokkos/core/parsers/parser.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class PyKokkosEntity:
3636

3737
class Parser:
3838
"""
39-
Parse a PyKokkos workload and its dependencies
39+
Parse a PyKokkos workunit and its dependencies
4040
"""
4141

4242
def __init__(self, path: Optional[str], pk_import: Optional[str] = None):
@@ -55,7 +55,6 @@ def __init__(self, path: Optional[str], pk_import: Optional[str] = None):
5555
self.tree = ast.parse("".join(self.lines))
5656
self.path: Optional[str] = path
5757
self.pk_import: str = self.get_import()
58-
self.workloads: Dict[str, PyKokkosEntity] = {}
5958
self.classtypes: Dict[str, PyKokkosEntity] = {}
6059
self.functors: Dict[str, PyKokkosEntity] = {}
6160
self.workunits: Dict[str, PyKokkosEntity] = {}
@@ -109,8 +108,6 @@ def get_entity(self, name: str) -> PyKokkosEntity:
109108
:returns: the PyKokkosEntity representation of the entity
110109
"""
111110

112-
if name in self.workloads:
113-
return self.workloads[name]
114111
if name in self.functors:
115112
return self.functors[name]
116113
if name in self.workunits:

pykokkos/core/translators/members.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def get_fields(
120120
:returns: a dictionary mapping from field name to type
121121
122122
123-
NOTE: **used by workloads & functors; depreciate with functions**
123+
NOTE: **used by workloads & functors; depreciate with functions**
124124
"""
125125

126126
visitor = ConstructorVisitor(source, "fields", pk_import, True)
@@ -140,7 +140,7 @@ def get_views(
140140
:param pk_import: the identifier used to access the PyKokkos package
141141
:returns: a dictionary mapping from view name to type (only dimensionality and type)
142142
143-
NOTE: **used by workloads & functors; depreciate with functions**
143+
NOTE: **used by workloads & functors; depreciate with functions**
144144
"""
145145

146146
visitor = ConstructorVisitor(source, "views", pk_import, True)
@@ -277,7 +277,7 @@ def get_random_pool(
277277
:param pk_import: the identifier used to access the PyKokkos package
278278
:returns: the type of the random pool if it exists
279279
280-
NOTE: **used by workloads & functors; depreciate with functions**
280+
NOTE: **used by workloads & functors; depreciate with functions**
281281
"""
282282

283283
visitor = ConstructorVisitor(source, "randpool", pk_import, True)

pykokkos/core/translators/static.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def generate_include_guard_end() -> str:
3434

3535
class StaticTranslator:
3636
"""
37-
Translates a PyKokkos workload to C++ using static analysis only
37+
Translates a PyKokkos workunit to C++ using static analysis only
3838
"""
3939

4040
def __init__(
@@ -189,9 +189,9 @@ def translate_classtypes(
189189
self, classtypes: List[PyKokkosEntity], restrict_views: Set[str]
190190
) -> List[cppast.RecordDecl]:
191191
"""
192-
Translate all classtypes, i.e. classes that the workload uses internally
192+
Translate all classtypes, i.e. classes that the workunit uses internally
193193
194-
:param classtypes: the list of classtypes needed by the workload
194+
:param classtypes: the list of classtypes needed by the workunit
195195
:param restrict_views: the views with the restrict keyword
196196
:returns: a list of strings of translated source code
197197
"""
@@ -363,7 +363,7 @@ def translate_functions(
363363
"""
364364
Translate all PyKokkos functions
365365
366-
:param source: the python source code of the workload
366+
:param source: the python source code of the workunit
367367
:param restrict_views: the views with the restrict keyword
368368
:returns: a list of method declarations
369369
"""
@@ -400,9 +400,9 @@ def translate_workunits(
400400
"""
401401
Translate the workunits
402402
403-
:param source: the python source code of the workload
403+
:param source: the python source code of the workunit
404404
:param restrict_views: the views with the restrict keyword
405-
:returns: a tuple of a dictionary mapping from workload name
405+
:returns: a tuple of a dictionary mapping from workunit name
406406
to a tuple of operation name and source, and a boolean
407407
indicating whether the workunit has a call to pk.rand()
408408
"""

pykokkos/core/visitors/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from .classtype_visitor import ClasstypeVisitor
22
from .constructor_visitor import ConstructorVisitor
3-
from .debug_transformer import DebugTransformer
43
from .kokkosfunction_visitor import KokkosFunctionVisitor
54
from .parameter_visitor import ParameterVisitor
65
from .pykokkos_visitor import PyKokkosVisitor

pykokkos/core/visitors/constructor_visitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(
2323
:param pk_import: the identifier used to access the PyKokkos package
2424
:param debug: if true, prints the python AST when an error is encountered
2525
26-
NOTE: **used by workloads & functors; depreciate with functions**
26+
NOTE: **used by workloads & functors; depreciate with functions**
2727
"""
2828

2929
if member_type not in ("fields", "views", "typeinfo", "randpool"):

pykokkos/core/visitors/parameter_visitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(
1717
"""
1818
ParameterVisitor constructor
1919
20-
:param src: the python source code of the workload
20+
:param src: the python source code of the workunit
2121
:param param_begin: where workunit argument begins (excluding tid/acc)
2222
:param pk_import: the identifier used to access the PyKokkos package
2323
:param debug: if true, prints the python AST when an error is encountered

0 commit comments

Comments
 (0)