Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Manolis Papadakis <[email protected]>
  • Loading branch information
ipdemes and manopapad authored May 22, 2024
1 parent dae21aa commit f4018a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
14 changes: 3 additions & 11 deletions cunumeric/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -6745,7 +6745,7 @@ def gradient(
Return the gradient of an N-dimensional array.
The gradient is computed using second order accurate central differences
in the interior points and either first or second order accurate one-sides
in the interior points and either first or second order accurate one-sided
(forward or backwards) differences at the boundaries.
The returned gradient hence has the same shape as the input array.
Expand All @@ -6768,13 +6768,11 @@ def gradient(
edge_order : {1, 2}, optional
Gradient is calculated using N-th order accurate differences
at the boundaries. Default: 1.
.. versionadded:: 1.9.1
axis : None or int or tuple of ints, optional
Gradient is calculated only along the given axis or axes
The default (axis = None) is to calculate the gradient for all the axes
of the input array. axis may be negative, in which case it counts from
the last to the first axis.
.. versionadded:: 1.11.0
Returns
-------
Expand Down Expand Up @@ -6843,7 +6841,7 @@ def gradient(
if edge_order > 2:
raise ValueError("'edge_order' greater than 2 not supported")
if edge_order < 0:
raise ValueError(" invalid 'edge_order'")
raise ValueError("invalid 'edge_order'")

# use central differences on interior and one-sided differences on the
# endpoints. This preserves second order-accuracy over the full domain.
Expand All @@ -6857,13 +6855,7 @@ def gradient(
slice4 = [slice(None)] * N

otype = f.dtype
if otype.type is np.datetime64:
raise TypeError("datetime64 is not supported by gradient in cuNumeric")
elif otype.type is np.timedelta64:
pass
elif np.issubdtype(otype, np.inexact):
pass
else:
if not np.issubdtype(otype, np.inexact):
# All other types convert to floating point.
# First check if f is a numpy integer type; if so, convert f to float64
# to avoid modular arithmetic when computing the changes in f.
Expand Down
2 changes: 1 addition & 1 deletion install.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def validate_path(path):
"Debug" if debug else "RelWithDebInfo" if debug_release else "Release"
)
cmake_flags += f"""\
-DCMAKE_BUILD_TYPE=build_type
-DCMAKE_BUILD_TYPE={build_type}
-DBUILD_SHARED_LIBS=ON
-DCMAKE_CUDA_ARCHITECTURES={str(arch)}
-DLegion_MAX_DIM={str(maxdim)}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_gradient_with_scalar_dx():
assert np.allclose(res_np, res_cn)


def test_fradient_1d():
def test_gradient_1d():
a_np = np.array(np.random.random(size=1000), dtype=float)
f_np = np.sort(a_np)
f_cn = cn.array(f_np)
Expand Down

0 comments on commit f4018a3

Please sign in to comment.