Skip to content

Commit

Permalink
Building SmartSim without ML backends (CrayLabs#601)
Browse files Browse the repository at this point in the history
Fix an error that would prevent ``smart build`` from moving a successfully
compiled RedisAI shared object to the install location expected by SmartSim
if no ML backend installations were found.

The reason is that after RedisAI is built using the `smart` tool, the
resulting library is only installed to the `lib` folder if and only if
the folder `backends/` exists, which it does not if no backends are
installed. Since after this step the original build folder is deleted
and with it the compiled library.

This problem does not occur if any of the backends (TF, PT, ONNX) is
installed. However, since they are not needed for many applications it
would additional complications and effort to compile them if not
necessary. Also compiling RedisAI by itself on pointing `RAI_PATH` to
the installation also works, but poses additional effort.

To circumvent this problem this change will install the
RedisAI library by itself if it was built.

[ committed by @m-kurz ]
[ reviewed by @MattToast ]
  • Loading branch information
m-kurz authored May 24, 2024
1 parent 54755ad commit 7d995bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,20 @@ To be released at some future point in time

Description

- Improve support for building SmartSim without ML backends
- Update packaging dependency

Detailed Notes

- Fix an error that would prevent ``smart build`` from moving a successfully
compiled RedisAI shared object to the install location expected by SmartSim
if no ML backend installations were found. Previously, this would effectively
require users to build and install an ML backend to use the SmartSim
orchestrator even if it was not necessary for their workflow. Users can
install SmartSim without ML backends by running
``smart build --no_tf --no_pt`` and the RedisAI shared object will now be
placed in the expected location.
([SmartSim-PR601](https://github.com/CrayLabs/SmartSim/pull/601))
- Fix packaging failures due to deprecated `pkg_resources`. ([SmartSim-PR598](https://github.com/CrayLabs/SmartSim/pull/598))

### 0.7.0
Expand Down
3 changes: 2 additions & 1 deletion smartsim/_core/_install/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,9 @@ def _install_backends(self, device: Device) -> None:
rai_lib = self.rai_install_path / "redisai.so"
rai_backends = self.rai_install_path / "backends"

if rai_lib.is_file() and rai_backends.is_dir():
if rai_backends.is_dir():
self.copy_dir(rai_backends, self.lib_path / "backends", set_exe=True)
if rai_lib.is_file():
self.copy_file(rai_lib, self.lib_path / "redisai.so", set_exe=True)

def _move_torch_libs(self) -> None:
Expand Down

0 comments on commit 7d995bb

Please sign in to comment.