Skip to content

Add catalyst executor server side to catalyst - #3088

Open
mehrdad2m wants to merge 4 commits into
mainfrom
add-catalyst-executor
Open

Add catalyst executor server side to catalyst#3088
mehrdad2m wants to merge 4 commits into
mainfrom
add-catalyst-executor

Conversation

@mehrdad2m

Copy link
Copy Markdown
Contributor

Context:
Catalyst already has the host side of the remote-executor connection which is rt_executor that exposes the C ABI a compiled program calls, and catalyst_executor_session which is the ORC client that holds the connection.

Description of the Change:
This PR adds the node end the ORC server that receives objects, maps them and calls them.

Benefits:

Possible Drawbacks:

Related GitHub Issues:

Comment on lines +326 to +327
std::fprintf(stderr, "[%s] executor ready, waiting for next connection\n",
Label.c_str());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it exits immediately, and doesn't wait for anything?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's the thing that listed in TODO:

// TODO: This is a temporary solution to initialize the catalyst CTX.
// Done per-connection so each circuit owns its own context.

So what the issue on that executor:  exit(0) skips destructors and finalize, the child never explicitly tears down CTX or device state for now. Memory and FDs are reclaimed by the OS, state may linger until the driver notices the process died, so the next connection can occasionally need a reset (It's fine I think if we now what we are doing)

I think it's low priority for now, we can revise it later, it need more careful lifetime control over the system.

int32_t _catalyst_remote_store_asset(std::vector<char> bytes, std::string name)
{
namespace fs = std::filesystem;
fs::path dst = fs::temp_directory_path() / "catalyst-assets" / fs::path(name).filename();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we put it in a subdir with PID so multiple writes won't overwrite/collide?

Comment thread runtime/lib/executor/executor.cpp Outdated
std::strerror(errno));
return -1;
}
size_t wrote = std::fwrite(bytes.data(), 1, bytes.size(), f);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JB: Partial-write file left on disk. On a short fwrite, the function returns -1 but leaves the truncated file in place and does not check fclose for flush errors. A later load_asset could pick up a corrupt file. Remove the file on failure and check fclose.

@josephleekl josephleekl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mehrdad2m . Do you think we should add tests for this? up to you

@multiphaseCFD multiphaseCFD left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @mehrdad2m

rniczh and others added 2 commits August 3, 2026 17:19
Co-authored-by: Joseph Lee <40768758+josephleekl@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants