Skip to content

Commit

Permalink
Merge branch 'branch-22.01' into cholesky-heuristic
Browse files Browse the repository at this point in the history
  • Loading branch information
magnatelee committed Jan 7, 2022
2 parents e464aa8 + 97b6c7c commit 1a15006
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
5 changes: 3 additions & 2 deletions cunumeric/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class CuNumericOpCode(IntEnum):
WRITE = _cunumeric.CUNUMERIC_WRITE


# Match these to BinaryOpCode in binary_op_util.h
# Match these to BinaryOpCode in binary_op_util.h
@unique
class BinaryOpCode(IntEnum):
ADD = 1
Expand Down Expand Up @@ -168,7 +168,7 @@ class UnaryOpCode(IntEnum):
GETARG = 28


# Match these to UnaryRedCode in unary_red_util.h
# Match these to UnaryRedCode in unary_red_util.h
@unique
class UnaryRedCode(IntEnum):
ALL = 1
Expand All @@ -183,6 +183,7 @@ class UnaryRedCode(IntEnum):
COUNT_NONZERO = 10


# Match these to RandGenCode in rand_util.h
@unique
class RandGenCode(IntEnum):
UNIFORM = 1
Expand Down
1 change: 1 addition & 0 deletions src/cunumeric/binary/binary_op_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

namespace cunumeric {

// Match these to BinaryOpCode in config.py
enum class BinaryOpCode : int {
ADD = 1,
DIVIDE,
Expand Down
6 changes: 3 additions & 3 deletions src/cunumeric/cunumeric_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "legate_preamble.h"

// Match these to CuNumericOpCode in cunumeric/config.py
// Match these to CuNumericOpCode in config.py
// Also, sort these alphabetically except the first one for easy lookup later
enum CuNumericOpCode {
_CUNUMERIC_OP_CODE_BASE = 0,
Expand Down Expand Up @@ -54,13 +54,13 @@ enum CuNumericOpCode {
CUNUMERIC_WRITE,
};

// Match these to CuNumericRedopCode in cunumeric/config.py
// Match these to CuNumericRedopCode in config.py
enum CuNumericRedopID {
CUNUMERIC_ARGMAX_REDOP = 1,
CUNUMERIC_ARGMIN_REDOP = 2,
};

// Match these to CuNumericTunable in cunumeric/config.py
// Match these to CuNumericTunable in config.py
enum CuNumericTunable {
CUNUMERIC_TUNABLE_NUM_GPUS = 1,
CUNUMERIC_TUNABLE_NUM_PROCS = 2,
Expand Down
1 change: 1 addition & 0 deletions src/cunumeric/random/rand_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

namespace cunumeric {

// Match these to RandGenCode in config.py
enum class RandGenCode : int32_t {
UNIFORM = 1,
NORMAL = 2,
Expand Down
1 change: 1 addition & 0 deletions src/cunumeric/unary/unary_op_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

namespace cunumeric {

// Match these to UnaryOpCode in config.py
enum class UnaryOpCode : int {
ABSOLUTE = 1,
ARCCOS,
Expand Down
1 change: 1 addition & 0 deletions src/cunumeric/unary/unary_red_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

namespace cunumeric {

// Match these to UnaryRedCode in config.py
enum class UnaryRedCode : int {
ALL = 1,
ANY = 2,
Expand Down
13 changes: 7 additions & 6 deletions tests/matrix_mul.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


def test(ty):
rtol = 2e-03 if ty == np.float16 else 1e-05
np.random.seed(42)

A = num.random.randn(6, 3, 7).astype(ty)
Expand All @@ -29,7 +30,7 @@ def test(ty):
Bn = B.__array__()
Cn = An[1].dot(Bn[2])

assert np.allclose(C, Cn)
assert np.allclose(C, Cn, rtol=rtol)

An = np.random.randn(3, 7).astype(ty)
Bn = np.random.randn(11, 7).astype(ty)
Expand All @@ -39,7 +40,7 @@ def test(ty):
BT = num.array(Bn)
C = A.dot(BT.transpose())

assert np.allclose(C, Cn)
assert np.allclose(C, Cn, rtol=rtol)

An = np.random.randn(7, 3).astype(ty)
Bn = np.random.randn(7, 11).astype(ty)
Expand All @@ -49,7 +50,7 @@ def test(ty):
B = num.array(Bn)
C = AT.transpose().dot(B)

assert np.allclose(C, Cn)
assert np.allclose(C, Cn, rtol=rtol)

An = np.random.randn(7, 3).astype(ty)
Bn = np.random.randn(11, 7).astype(ty)
Expand All @@ -59,7 +60,7 @@ def test(ty):
BT = num.array(Bn)
C = AT.transpose().dot(BT.transpose())

assert np.allclose(C, Cn)
assert np.allclose(C, Cn, rtol=rtol)

A3np = np.empty((2, 7, 3), dtype=ty)
B3np = np.empty((2, 11, 7), dtype=ty)
Expand All @@ -73,7 +74,7 @@ def test(ty):
B3[0] = B3np[0]
C = A3[0].T.dot(B3[0].T)

assert np.allclose(C, Cn)
assert np.allclose(C, Cn, rtol=rtol)

A = num.random.randn(1, 10).astype(ty)
B = num.random.randn(10, 1).astype(ty)
Expand All @@ -83,7 +84,7 @@ def test(ty):
Bn = B.__array__()
Cn = An.dot(Bn)

assert np.allclose(C, Cn)
assert np.allclose(C, Cn, rtol=rtol)


if __name__ == "__main__":
Expand Down

0 comments on commit 1a15006

Please sign in to comment.