Skip to content

Commit 596a405

Browse files
authored
Merge pull request #64 from bsc-dom/Cyclops-dataclay
Cyclops dataclay
2 parents 08a8c65 + aeee808 commit 596a405

17 files changed

Lines changed: 742 additions & 142 deletions

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ classifiers = [
1818
"Topic :: System :: Distributed Computing",
1919
"Topic :: Software Development :: Libraries :: Application Frameworks",
2020
"Programming Language :: Python :: 3",
21-
"Programming Language :: Python :: 3.9",
2221
"Programming Language :: Python :: 3.10",
2322
"Programming Language :: Python :: 3.11",
2423
"Programming Language :: Python :: 3.12",
2524
"Programming Language :: Python :: 3 :: Only",
2625
]
27-
requires-python = ">=3.9,<3.13"
26+
requires-python = ">=3.10,<3.13"
2827
dependencies = [
2928
"aiorwlock>=1.4.0",
3029
"bcrypt>=4.1.1",

src/dataclay/contrib/persistent_block.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,7 @@ def partial_sum(self, centers: np.ndarray) -> np.ndarray:
7676
def partial_histogram(self, n_bins: int, n_dimensions: int) -> np.ndarray:
7777
values, _ = np.histogramdd(self.block_data, n_bins, [(0, 1)] * n_dimensions)
7878
return values
79+
80+
@activemethod
81+
def block_apply(self, func, *args, **kwargs):
82+
return func(self.block_data, *args, **kwargs)

src/dataclay/contrib/pycompss_dummy/_decorator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
This file contains the dummy class task used as decorator.
2424
"""
2525

26-
from pycompss.util.typing_helper import typing
26+
try:
27+
from pycompss.util.typing_helper import typing
28+
except ModuleNotFoundError:
29+
import typing
2730

2831

2932
class _Dummy:

src/dataclay/contrib/pycompss_dummy/api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525

2626
import os
2727

28-
from pycompss.util.typing_helper import typing
28+
try:
29+
from pycompss.util.typing_helper import typing
30+
except ModuleNotFoundError:
31+
import typing
2932

3033

3134
def compss_start(

src/dataclay/contrib/pycompss_dummy/constraint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
This file contains the dummy class constraint used as decorator.
2424
"""
2525

26-
from pycompss.api.dummy._decorator import _Dummy as Dummy
26+
from ._decorator import _Dummy as Dummy
2727

2828
Constraint = Dummy # pylint: disable=invalid-name
2929
constraint = Dummy # pylint: disable=invalid-name

src/dataclay/contrib/pycompss_dummy/container.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
This file contains the dummy class container used as decorator.
2424
"""
2525

26-
from pycompss.api.dummy._decorator import _Dummy as Dummy
26+
from ._decorator import _Dummy as Dummy
2727

2828
Container = Dummy # pylint: disable=invalid-name
2929
container = Dummy # pylint: disable=invalid-name
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class EventMaster:
2+
def __init__(self, *args, **kwargs):
3+
pass
4+
5+
def __enter__(self):
6+
return self
7+
8+
def __exit__(self, exc_type, exc, tb):
9+
return False

src/dataclay/contrib/pycompss_dummy/on_failure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
This file contains the dummy class on failure used as decorator.
2424
"""
2525

26-
from pycompss.api.dummy._decorator import _Dummy as Dummy
26+
from ._decorator import _Dummy as Dummy
2727

2828
OnFailure = Dummy # pylint: disable=invalid-name
2929
on_failure = Dummy # pylint: disable=invalid-name
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Copyright 2002-2026 Barcelona Supercomputing Center (www.bsc.es)
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# -*- coding: utf-8 -*-
19+
20+
"""
21+
PyCOMPSs API - Parameter definitions.
22+
23+
This file contains the classes needed for the parameter definition.
24+
1. DIRECTION.
25+
- IN
26+
- OUT
27+
- INOUT
28+
- CONCURRENT
29+
- COMMUTATIVE
30+
- IN_DELETE
31+
2. TYPE.
32+
- FILE
33+
- BOOLEAN
34+
- STRING
35+
- INT
36+
- LONG
37+
- FLOAT
38+
- OBJECT
39+
- COLLECTION
40+
- DICTIONARY
41+
- EXTERNAL_PSCO
42+
- EXTERNAL_STREAM
43+
- ... (check _DataType generated during installation)
44+
3. IOSTREAM.
45+
- STDIN
46+
- STDOUT
47+
- STDERR
48+
- UNSPECIFIED
49+
4. PREFIX.
50+
5. ALIASES.
51+
"""
52+
53+
# Numbers match both C and Java enums
54+
class SupportedDirections: # pylint: disable=too-few-public-methods
55+
"""Used as enum for direction types."""
56+
57+
IN = 0
58+
OUT = 1
59+
INOUT = 2
60+
CONCURRENT = 3
61+
COMMUTATIVE = 4
62+
IN_DELETE = 5
63+
64+
65+
# Numbers match both C and Java enums
66+
class SupportedIoStreams: # pylint: disable=too-few-public-methods
67+
"""Used as enum for stream types."""
68+
69+
STDIN = 0
70+
STDOUT = 1
71+
STDERR = 2
72+
UNSPECIFIED = 3
73+
74+
75+
# String that identifies the prefix
76+
class SupportedPrefixes: # pylint: disable=too-few-public-methods
77+
"""Used as enum for prefix."""
78+
79+
PREFIX = "null" # NOSONAR
80+
81+
class SupportedFiles: # pylint: disable=too-few-public-methods
82+
"""Used as enum for prefix."""
83+
84+
FILE = None
85+
FILE_IN = None
86+
FILE_OUT = None
87+
FILE_INOUT = None
88+
FILE_CONCURRENT = None
89+
FILE_COMMUTATIVE = None
90+
91+
DIRECTION = SupportedDirections()
92+
IOSTREAM = SupportedIoStreams()
93+
PREFIX = SupportedPrefixes()
94+
FILES = SupportedFiles()
95+
96+
97+
98+
99+
# Aliases for objects (just direction)
100+
IN = DIRECTION.IN
101+
OUT = DIRECTION.OUT
102+
INOUT = DIRECTION.INOUT
103+
CONCURRENT = DIRECTION.CONCURRENT
104+
COMMUTATIVE = DIRECTION.COMMUTATIVE
105+
IN_DELETE = DIRECTION.IN_DELETE
106+
107+
# Aliases for files with direction
108+
FILE = FILES.FILE
109+
FILE_IN = FILES.FILE_IN
110+
FILE_OUT = FILES.FILE_OUT
111+
FILE_INOUT = FILES.FILE_INOUT
112+
FILE_CONCURRENT = FILES.FILE_CONCURRENT
113+
FILE_COMMUTATIVE = FILES.FILE_COMMUTATIVE
114+
115+
# Aliases for files with stream
116+
FILE_STDIN = None
117+
FILE_STDERR = None
118+
FILE_STDOUT = None
119+
120+
# Aliases for files with direction and stream
121+
FILE_IN_STDIN = None
122+
FILE_IN_STDERR = None
123+
FILE_IN_STDOUT =None
124+
FILE_OUT_STDIN = None
125+
FILE_OUT_STDERR = None
126+
FILE_OUT_STDOUT = None
127+
FILE_INOUT_STDIN = None
128+
FILE_INOUT_STDERR = None
129+
FILE_INOUT_STDOUT = None
130+
FILE_CONCURRENT_STDIN = None
131+
FILE_CONCURRENT_STDERR = None
132+
FILE_CONCURRENT_STDOUT = None
133+
FILE_COMMUTATIVE_STDIN = None
134+
FILE_COMMUTATIVE_STDERR = None
135+
FILE_COMMUTATIVE_STDOUT = None
136+
# Aliases for dirs
137+
DIRECTORY = None
138+
DIRECTORY_IN = None
139+
DIRECTORY_OUT = None
140+
DIRECTORY_INOUT = None
141+
142+
# Aliases for collections
143+
COLLECTION = None
144+
COLLECTION_IN = None
145+
COLLECTION_INOUT = None
146+
COLLECTION_OUT = None
147+
COLLECTION_IN_DELETE = None
148+
COLLECTION_FILE = None
149+
COLLECTION_FILE_IN = None
150+
COLLECTION_FILE_INOUT = None
151+
COLLECTION_FILE_OUT = None
152+
153+
# Aliases for dictionary collections
154+
DICTIONARY = None
155+
DICTIONARY_IN = None
156+
DICTIONARY_INOUT = None
157+
DICTIONARY_OUT = None
158+
DICTIONARY_IN_DELETE = None
159+
160+
# Aliases for streams
161+
STREAM_IN = None
162+
STREAM_OUT = None
163+
164+
# Aliases for std IO streams (just stream direction)
165+
STDIN = IOSTREAM.STDIN
166+
STDOUT = IOSTREAM.STDOUT
167+
STDERR = IOSTREAM.STDERR
168+
169+
# Aliases for parameter definition as dictionary
170+
# - Parameter type
171+
Type = None # pylint: disable=invalid-name
172+
# - Parameter direction
173+
Direction = None # pylint: disable=invalid-name
174+
# - Parameter stream
175+
StdIOStream = None # pylint: disable=invalid-name
176+
# - Parameter prefix
177+
Prefix = None # pylint: disable=invalid-name
178+
# - Collection recursive depth
179+
Depth = None # pylint: disable=invalid-name
180+
# - Parameter weight
181+
Weight = None # pylint: disable=invalid-name
182+
# - Parameter keep rename property
183+
Keep_rename = None # pylint: disable=invalid-name
184+
# - Enable/disable store in cache
185+
Cache = None # pylint: disable=invalid-name
186+
187+
# Aliases for collection layout for native mpi tasks
188+
block_count = None # pylint: disable=invalid-name
189+
block_length = None # pylint: disable=invalid-name
190+
stride = None # pylint: disable=invalid-name

src/dataclay/contrib/pycompss_dummy/reduction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
This file contains the dummy class reduction used as decorator.
2424
"""
2525

26-
from pycompss.api.dummy._decorator import _Dummy as Dummy
26+
from ._decorator import _Dummy as Dummy
2727

2828
Reduction = Dummy # pylint: disable=invalid-name
2929
reduction = Dummy # pylint: disable=invalid-name

0 commit comments

Comments
 (0)