Skip to content

Commit c8db036

Browse files
committed
feat(graph): add NewPJRTClient for external PJRT usage
Expose a graph-level factory function that loads a PJRT plugin and creates a client. This allows external packages (zerfoo) to call CompilePJRT without directly importing the internal/pjrt package.
1 parent c57b4c5 commit c8db036

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

graph/pjrt_client.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package graph
2+
3+
import "github.com/zerfoo/ztensor/internal/pjrt"
4+
5+
// NewPJRTClient loads a PJRT plugin shared library and creates a client.
6+
// pluginPath is the bare library filename (e.g. "pjrt_c_api_cpu_plugin.so")
7+
// or an absolute path. The returned client must be closed when no longer
8+
// needed (typically after closing all PJRTPlans that reference it).
9+
func NewPJRTClient(pluginPath string) (*pjrt.Client, error) {
10+
lib, err := pjrt.Load(pluginPath)
11+
if err != nil {
12+
return nil, err
13+
}
14+
return pjrt.NewClient(lib)
15+
}

0 commit comments

Comments
 (0)