fixstars / ion-kit

Modernized graph-based data processing framework
MIT License
7 stars 6 forks source link

Dispose U3V instance gracefully #116

Closed iitaku closed 5 months ago

iitaku commented 2 years ago

Calling U3V::dispose will triger U3V's destructor. We need to change this behavior by following:

Fixstars-momoko commented 6 months ago

Currently all U3V class related BB has the issue of dispose the device. Those BB requires input port for dispose to explicitly close the device

Why we have used explicit dispose input:

The current issue:

Untitled presentation

Here, @iitaku has add the feature of BuildingBlock::register_disposer to manage dispose the device https://github.com/fixstars/ion-kit/pull/175

xinyuli1204 commented 6 months ago

build with halide 16 and ion-kit/master

cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\xinyu\Desktop\ion-kit-install -D Halide_DIR=C:\\Users\\xinyu\\Desktop\\halide-16\\lib\\cmake\\Halide\\ -D HalideHelpers_DIR=C:\\Users\\xinyu\\Desktop\\halide-16\\lib\\cmake\\HalideHelpers -D OpenCV_DIR=C:\Users\xinyu\Downloads\opencv\build\x64\vc15\lib -D ION_BUILD_ALL_BB=OFF -D ION_BBS_TO_BUILD="ion-bb-core;ion-bb-image-processing;ion-bb-sgm;ion-bb-image-io" -D ION_BUILD_DOC=OFF -D ION_BUILD_TEST=OFF -D ION_BUILD_EXAMPLE=ON -D ION_BUNDLE_HALIDE=ON -D WITH_CUDA=OFF ../

cmake --build . --config Release --target install

running this u3v-display script will give :

C:\Users\xinyu\Desktop\ion-kit\build\example\Release>u3v [2023-12-21 06:40:13.606] [ion] [debug] ion-kit version is [2023-12-21 06:40:13.614] [ion] [info] Start building pipeline

Build with halide 12

Reset to precious brach(port map index access and already got rid of the pix-format) git reset --hard fa5bdc0816771c456132104e62e3f66d6b5b8edc

cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\xinyu\Desktop\ion-kit-install -D Halide_DIR=C:\\Users\\xinyu\\Desktop\\halide-12\\lib\\cmake\\Halide\\ -D HalideHelpers_DIR=C:\\Users\\xinyu\\Desktop\\halide-12\\lib\\cmake\\HalideHelpers -D OpenCV_DIR=C:\Users\xinyu\Downloads\opencv\build\x64\vc15\lib -D ION_BUILD_ALL_BB=OFF -D ION_BBS_TO_BUILD="ion-bb-core;ion-bb-image-processing;ion-bb-sgm;ion-bb-image-io" -D ION_BUILD_DOC=OFF -D ION_BUILD_TEST=OFF -D ION_BUILD_EXAMPLE=ON -D ION_BUNDLE_HALIDE=ON -D WITH_CUDA=OFF ../

cmake --build . --config Release --target install

running this script works fine

xinyuli1204 commented 6 months ago

build with halide 16 and ion-kit/master

cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\xinyu\Desktop\ion-kit-install -D Halide_DIR=C:\\Users\\xinyu\\Desktop\\halide-16\\lib\\cmake\\Halide\\ -D HalideHelpers_DIR=C:\\Users\\xinyu\\Desktop\\halide-16\\lib\\cmake\\HalideHelpers -D OpenCV_DIR=C:\Users\xinyu\Downloads\opencv\build\x64\vc15\lib -D ION_BUILD_ALL_BB=OFF -D ION_BBS_TO_BUILD="ion-bb-core;ion-bb-image-processing;ion-bb-sgm;ion-bb-image-io" -D ION_BUILD_DOC=OFF -D ION_BUILD_TEST=OFF -D ION_BUILD_EXAMPLE=ON -D ION_BUNDLE_HALIDE=ON -D WITH_CUDA=OFF ../

cmake --build . --config Release --target install

running this u3v-display script will give :

C:\Users\xinyu\Desktop\ion-kit\build\example\Release>u3v [2023-12-21 06:40:13.606] [ion] [debug] ion-kit version is [2023-12-21 06:40:13.614] [ion] [info] Start building pipeline

Build with halide 12

Reset to precious brach(port map index access and already got rid of the pix-format) git reset --hard fa5bdc0816771c456132104e62e3f66d6b5b8edc

cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\xinyu\Desktop\ion-kit-install -D Halide_DIR=C:\\Users\\xinyu\\Desktop\\halide-12\\lib\\cmake\\Halide\\ -D HalideHelpers_DIR=C:\\Users\\xinyu\\Desktop\\halide-12\\lib\\cmake\\HalideHelpers -D OpenCV_DIR=C:\Users\xinyu\Downloads\opencv\build\x64\vc15\lib -D ION_BUILD_ALL_BB=OFF -D ION_BBS_TO_BUILD="ion-bb-core;ion-bb-image-processing;ion-bb-sgm;ion-bb-image-io" -D ION_BUILD_DOC=OFF -D ION_BUILD_TEST=OFF -D ION_BUILD_EXAMPLE=ON -D ION_BUNDLE_HALIDE=ON -D WITH_CUDA=OFF ../

cmake --build . --config Release --target install

running this script works fine

@iitaku @Fixstars-momoko

iitaku commented 6 months ago

@xinyuli1204 Can you build with RelWithDebInfo config and run it on Visual Studio?

xinyuli1204 commented 6 months ago

U3v Camera1

U3V Camera2

xinyuli1204 commented 6 months ago

@Fixstars-momoko when I change the camera to came1 usb2mode, it shows the error

C:\Users\xinyu\Desktop\ion-kit\build\example\Release>u3v_jit
[2024-01-04 03:50:33.754] [ion] [debug] ion-kit version is v0.3.5-137-gb3373db
[2024-01-04 03:50:33.763] [ion] [info] Start building pipeline
[2024-01-04 03:50:34.475] [ion] [debug] Load module : Trying to load gobject-2.0-0
[2024-01-04 03:50:34.476] [ion] [debug] Load module : Looking for gobject-2.0-0.dll
[2024-01-04 03:50:34.478] [ion] [debug] Load module : Trying to load aravis-0.8-0
[2024-01-04 03:50:34.478] [ion] [debug] Load module : Looking for aravis-0.8-0.dll
[2024-01-04 03:50:34.482] [ion] [debug] U3V:: 23-11-18 : updating obtain and write
[2024-01-04 03:50:34.483] [ion] [info] Using aravis-0.8.25
[2024-01-04 03:50:35.507] [ion] [info] Multiple devices are found; The first device is selected
[2024-01-04 03:50:35.507] [ion] [info] Creating U3V instance with 1 devices...
[2024-01-04 03:50:35.508] [ion] [info] Acquisition option::frame_sync_ is false
[2024-01-04 03:50:35.508] [ion] [info] Acquisition option::realtime_display_mode_ is false
[2024-01-04 03:50:35.508] [ion] [info]  Device/USB 0::DeviceID : Sony Semiconductor Solutions Corporation-054C0EE00091-054C0EE00091
[2024-01-04 03:50:35.538] [ion] [info]  Device/USB 0::PixelFormat : Mono8
[2024-01-04 03:50:35.539] [ion] [info]  Device/USB 0::PayloadSize : 308480
[2024-01-04 03:50:35.543] [ion] [info]  Device/USB 0::GenDC : Available
[2024-01-04 03:50:35.544] [ion] [info]  Device/USB 0::Width : 640
[2024-01-04 03:50:35.544] [ion] [info]  Device/USB 0::Height : 480
[2024-01-04 03:50:35.544] [ion] [info]  Device/USB 0::OperationMode : Came1USB2
[2024-01-04 03:50:35.544] [ion] [info]  Device/USB 1::DeviceID : Sony Semiconductor Solutions Corporation-054C0EE00092-054C0EE00092

** (process:4848): CRITICAL **: 03:50:35.561: arv_device_read_memory: assertion 'buffer != NULL' failed

(process:4848): GLib-CRITICAL **: 03:50:35.561: g_thread_join: assertion 'thread' failed

** (process:4848): CRITICAL **: 03:50:35.591: arv_device_read_memory: assertion 'buffer != NULL' failed

(process:4848): GLib-CRITICAL **: 03:50:35.592: g_thread_join: assertion 'thread' failed
[2024-01-04 03:50:35.593] [ion] [error] Exception was thrown: Failed to bootstrap USB device '(NULL)-(NULL)-(NULL)-054C0EE00092'
PS C:\Users\xinyu\Desktop\GUI> arv-camera-test-0.8.exe
Looking for the first available camera

** (arv-camera-test-0.8.exe:17600): CRITICAL **: 03:55:35.113: arv_device_read_memory: assertion 'buffer != NULL' failed

(arv-camera-test-0.8.exe:17600): GLib-CRITICAL **: 03:55:35.114: g_thread_join: assertion 'thread' failed
No camera found: Failed to bootstrap USB device '(NULL)-(NULL)-(NULL)-054C0EE00092'
PS C:\Users\xinyu\Desktop\GUI> arv-camera-test-0.8.exe
xinyuli1204 commented 6 months ago

@Fixstars-momoko Can you tell me how to test using arvis, I already know two commands arv-camera-test-0.8.exe and arv-tool-0.8.exe -n "Sony Semiconductor Solutions Corporation-054C0EE00091-054C0EE00091" control xxxxx

iitaku commented 5 months ago

Resolved in #183