Compare commits

..

2 commits

Author SHA1 Message Date
Nicholas Young
89370b7ff2 got the configure vdevice call working 2024-10-14 18:12:44 -07:00
Nicholas Young
65d224db1a debugging tools; using source-compiled library 2024-10-14 18:11:54 -07:00
3 changed files with 20 additions and 7 deletions

View file

@ -47,7 +47,8 @@ pub fn build(b: *std.Build) void {
exe.addIncludePath(.{ .cwd_relative = b.fmt("{s}/lib/glib-2.0/include", .{glib_path.?}) });
exe.addIncludePath(.{ .cwd_relative = "/usr/include/hailo" });
exe.addLibraryPath(.{ .cwd_relative = "/usr/lib"});
// exe.addLibraryPath(.{ .cwd_relative = "/usr/lib"});
exe.addLibraryPath(.{ .cwd_relative = "/home/nixolas/Documents/hailort/build/hailort/libhailort/src"});
exe.linkSystemLibrary("hailort");

View file

@ -15,6 +15,10 @@
in
{
devShell = pkgs.mkShell {
packages = with pkgs; [
valgrind
bat
];
buildInputs = with pkgs; [
zig_exe
glib

View file

@ -26,9 +26,9 @@ pub fn main() void {
var status: hlo.hailo_status = undefined;
var vdevice : hlo.hailo_vdevice = undefined;
var hef : hlo.hailo_hef = undefined;
var device_params: hlo.hailo_vdevice_params_t = undefined; // std.mem.zeroInit(hlo.hailo_vdevice_params_t, .{});
var network_group: hlo.hailo_configured_network_group = null;
const network_group_size : usize = 1;
var config_params: hlo.hailo_configure_params_t = undefined; // std.mem.zeroInit(hlo.hailo_vdevice_params_t, .{});
var network_group: hlo.hailo_configured_network_group = undefined;
var network_group_size : usize = 1;
const input_vstream_params : [max_edge_layers]hlo.hailo_input_vstream_params_by_name_t = undefined;
const output_vstream_params : [max_edge_layers]hlo.hailo_output_vstream_params_by_name_t = undefined;
const output_vstreams : [max_edge_layers]hlo.hailo_output_vstream = undefined;
@ -36,10 +36,11 @@ pub fn main() void {
var input_vstream_size : usize = max_edge_layers;
var output_vstream_size : usize = max_edge_layers;
// const net_ptr: [*c]usize = &network_group_size;
// @memset(&input_vstream_params, 0);
// @memset(&output_vstream_params, 0);
status = hlo.hailo_create_vdevice(null, &vdevice);
assert(status == hlo.HAILO_SUCCESS);
@ -48,12 +49,19 @@ pub fn main() void {
std.debug.print("vdevice inited, hef file created!\n", .{});
status = hlo.hailo_init_configure_params(hef, hlo.HAILO_STREAM_INTERFACE_PCIE, @ptrCast(&device_params));
status = hlo.hailo_init_configure_params_by_vdevice(hef, vdevice, &config_params);
assert(status == hlo.HAILO_SUCCESS);
std.debug.print("Size of network_group: {any}\n", .{ @sizeOf(hlo.hailo_configured_network_group) });
std.debug.print("Init configure params complete\n", .{});
status = hlo.hailo_configure_vdevice(vdevice, hef, @ptrCast(&device_params), &network_group, @constCast(&network_group_size));
assert(vdevice != null);
assert(hef != null);
// assert(&config_params != null);
// assert(network_group != null); // configure inits this var
assert(network_group_size != 0);
status = hlo.hailo_configure_vdevice(vdevice, hef, &config_params, &network_group, &network_group_size);
assert(status == hlo.HAILO_SUCCESS);
std.debug.print("Configure vdevice complete!\n", .{});