From ab56ab871a56591b78a02de37f03f770878eb479 Mon Sep 17 00:00:00 2001 From: lshaw8317 Date: Mon, 3 Nov 2025 10:39:56 +0100 Subject: [PATCH 1/2] Force compute for linalg_funcs --- caterva2/services/server.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/caterva2/services/server.py b/caterva2/services/server.py index 7493554a..93fde113 100644 --- a/caterva2/services/server.py +++ b/caterva2/services/server.py @@ -36,6 +36,7 @@ import nbformat import PIL.Image import uvicorn +from blosc2 import linalg_funcs_list as linalg_funcs # FastAPI from fastapi import Depends, FastAPI, Form, Request, UploadFile, responses @@ -706,6 +707,8 @@ def make_expr(name: str, expr: str, operands: dict[str, str], user: db.User, com path = settings.personal / str(user.id) path.mkdir(exist_ok=True, parents=True) urlpath = f"{path / name}.b2nd" + if any(method in expr for method in linalg_funcs): + compute = True if compute: arr.compute(urlpath=urlpath, mode="w") else: From 4fe411ad73854994be0355005c7b5ac59cca9811 Mon Sep 17 00:00:00 2001 From: lshaw8317 Date: Mon, 3 Nov 2025 14:23:11 +0100 Subject: [PATCH 2/2] Add test for eager eval --- caterva2/tests/test_hdf5_proxy.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/caterva2/tests/test_hdf5_proxy.py b/caterva2/tests/test_hdf5_proxy.py index fc6296b0..1aa61822 100644 --- a/caterva2/tests/test_hdf5_proxy.py +++ b/caterva2/tests/test_hdf5_proxy.py @@ -324,6 +324,8 @@ def test_expression(expression, examples_dir, tmp_path, auth_client): operands = {"a": str(remote_root) + "/" + str(remote_a), "b": str(remote_root) + "/" + str(remote_b)} lxpath = auth_client.lazyexpr("myexpr", expression, operands) assert lxpath == pathlib.Path("@personal/myexpr.b2nd") + if expression == "matmul(a, b)": # check evaluated eagerly for linalg + assert "expression" not in auth_client.get_info(lxpath) # Compute the expression result = auth_client.get_slice(lxpath)