some fixes (#1281)

This commit is contained in:
Awni Hannun 2024-07-23 11:49:05 -07:00 committed by GitHub
parent 6768c6a54a
commit e2aa6ec8ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 5 deletions

View File

@ -169,11 +169,18 @@ if (MPI_FOUND)
execute_process(
COMMAND zsh "-c" "mpirun --version"
OUTPUT_VARIABLE MPI_VERSION
COMMAND_ERROR_IS_FATAL ANY
ERROR_QUIET
)
if (${MPI_VERSION} MATCHES ".*Open MPI.*")
target_include_directories(mlx PRIVATE ${MPI_INCLUDE_PATH})
elseif (MPI_VERSION STREQUAL "")
set(MPI_FOUND FALSE)
message(
WARNING
"MPI found but mpirun is not available. Building without MPI."
)
else()
set(MPI_FOUND FALSE)
message(
WARNING
"MPI which is not OpenMPI found. Building without MPI."

View File

@ -4,6 +4,7 @@ set(
bf16_math.h
complex.h
defines.h
expm1f.h
utils.h
)

View File

@ -2833,7 +2833,7 @@ void init_ops(nb::module_& m) {
nb::kw_only(),
"stream"_a = nb::none(),
nb::sig(
"def pad(a: array, pad_with: Union[int, Tuple[int], Tuple[int, int], List[Tuple[int, int]]], constant_values: Union[scalar, array] = 0, *, stream: Union[None, Stream, Device] = None) -> array"),
"def pad(a: array, pad_width: Union[int, Tuple[int], Tuple[int, int], List[Tuple[int, int]]], constant_values: Union[scalar, array] = 0, *, stream: Union[None, Stream, Device] = None) -> array"),
R"pbdoc(
Pad an array with a constant value

View File

@ -847,9 +847,10 @@ class TestOps(mlx_tests.MLXTestCase):
def test_expm1(self):
a = mx.array([-88, -87, 0, 0.5, -0.5, 5, 87, 88, 89, 90])
result = mx.expm1(a)
expected = np.expm1(a, dtype=np.float32)
self.assertTrue(np.allclose(result, expected, rtol=1e-5, atol=1e-5))
errs = np.seterr(over="ignore")
expected = np.expm1(a)
np.seterr(over=errs["over"])
self.assertTrue(np.allclose(result, expected, rtol=1e-3, atol=1e-4))
def test_erf(self):
inputs = [-5, 0.0, 0.5, 1.0, 2.0, 10.0]