Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
57 changes: 57 additions & 0 deletions conda/environment-cluster-3.10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: cunumeric-test
channels:
- conda-forge
dependencies:
- python=3.10

# build
- git
- nccl
- make
- zlib
- cmake==3.24
- ninja
- sysroot_linux-64==2.17 # [linux64]
- setuptools>=60
- cutensor>=1.3.3
- scikit-build>=0.13.1

# runtime
- cffi
- numpy>=1.22
- opt_einsum
- pyarrow>=5
- scipy
- typing_extensions
- llvm-openmp
- openblas=*=*openmp*

# tests
- clang>=8
- clang-tools>=8
- colorama
- coverage
- mock
- mypy>=0.961
- pre-commit
- pynvml
- pytest
- pytest-cov
- pytest-mock
- pytest-lazy-fixture
- types-docutils

# pip dependencies
- pip
- pip:
# docs
- jinja2
- pydata-sphinx-theme
- recommonmark
- markdown<3.4.0
- sphinx>=4.4.0
- sphinx-copybutton
- sphinx-markdown-tables

# examples
- tifffile
57 changes: 57 additions & 0 deletions conda/environment-cluster-3.8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: cunumeric-test
channels:
- conda-forge
dependencies:
- python=3.8

# build
- git
- nccl
- make
- zlib
- cmake==3.24
- ninja
- sysroot_linux-64==2.17 # [linux64]
- setuptools>=60
- cutensor>=1.3.3
- scikit-build>=0.13.1

# runtime
- cffi
- numpy>=1.22
- opt_einsum
- pyarrow>=5
- scipy
- typing_extensions
- llvm-openmp
- openblas=*=*openmp*

# tests
- clang>=8
- clang-tools>=8
- colorama
- coverage
- mock
- mypy>=0.961
- pre-commit
- pynvml
- pytest
- pytest-cov
- pytest-mock
- pytest-lazy-fixture
- types-docutils

# pip dependencies
- pip
- pip:
# docs
- jinja2
- pydata-sphinx-theme
- recommonmark
- markdown<3.4.0
- sphinx>=4.4.0
- sphinx-copybutton
- sphinx-markdown-tables

# examples
- tifffile
57 changes: 57 additions & 0 deletions conda/environment-cluster-3.9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: cunumeric-test
channels:
- conda-forge
dependencies:
- python=3.9

# build
- git
- nccl
- make
- zlib
- cmake==3.24
- ninja
- sysroot_linux-64==2.17 # [linux64]
- setuptools>=60
- cutensor>=1.3.3
- scikit-build>=0.13.1

# runtime
- cffi
- numpy>=1.22
- opt_einsum
- pyarrow>=5
- scipy
- typing_extensions
- llvm-openmp
- openblas=*=*openmp*

# tests
- clang>=8
- clang-tools>=8
- colorama
- coverage
- mock
- mypy>=0.961
- pre-commit
- pynvml
- pytest
- pytest-cov
- pytest-mock
- pytest-lazy-fixture
- types-docutils

# pip dependencies
- pip
- pip:
# docs
- jinja2
- pydata-sphinx-theme
- recommonmark
- markdown<3.4.0
- sphinx>=4.4.0
- sphinx-copybutton
- sphinx-markdown-tables

# examples
- tifffile
15 changes: 15 additions & 0 deletions cunumeric/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,21 @@ def reshape(
return a.reshape(newshape, order=order)


# Support a very basic (and incorrect in the general case) version of
# broadcast_to that only works if we don't perform direct writes to
# the underlying array.
@add_boilerplate("array")
def broadcast_to(
array: ndarray, shape: NdShapeLike, subok: bool = False
) -> ndarray:
from .deferred import DeferredArray

thunk = array._thunk
store = thunk._broadcast(shape) # type: ignore
new_thunk = DeferredArray(thunk.runtime, store, array.dtype)
return ndarray(shape, dtype=array.dtype, thunk=new_thunk)


# Transpose-like operations


Expand Down
42 changes: 31 additions & 11 deletions cunumeric/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,17 +462,37 @@ def find_or_create_array_thunk(
shape=array.shape,
optimize_scalar=False,
)
store.attach_external_allocation(
self.legate_context,
array.data,
share,
)
return DeferredArray(
self,
store,
dtype=array.dtype,
numpy_array=array if share else None,
)
# If the attach hack is enabled, do writes from the input array
# into the resulting array. Otherwise, do an attach. The attach
# hack enables scaling to multiple nodes when restricted
# attaches must be performed.
if settings.attach_hack():
assert not share
thunk = DeferredArray(
self,
store,
dtype=array.dtype,
)
for index in np.ndindex(array.shape):
thunk.set_item(
index,
self.create_wrapped_scalar(
array[index], array.dtype, ()
),
)
return thunk
else:
store.attach_external_allocation(
self.legate_context,
array.data,
share,
)
return DeferredArray(
self,
store,
dtype=array.dtype,
numpy_array=array if share else None,
)

assert not defer
# Make this into an eager evaluated thunk
Expand Down
12 changes: 12 additions & 0 deletions cunumeric/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ class CunumericRuntimeSettings(Settings):
""",
)

attach_hack: PrioritizedSetting[bool] = PrioritizedSetting(
"attach-hack",
"CUNUMERIC_ATTACH_HACK",
default=False,
convert=convert_bool,
help="""
Enable the attach hack which avoids attaching in certain cases by doing
direct writes. This may be needed for multi-node runs of some
applications.
""",
)

report_coverage: PrioritizedSetting[bool] = PrioritizedSetting(
"report_coverage",
"CUNUMERIC_REPORT_COVERAGE",
Expand Down