opengate icon indicating copy to clipboard operation
opengate copied to clipboard

Refactor actors - towards merge

Open nkrah opened this issue 1 year ago • 1 comments

created based on PR #363 as a branch in the main repo.

nkrah avatar May 13 '24 11:05 nkrah

CHECK that commit https://github.com/OpenGATE/opengate/commit/bd743c9564379a1356640f36ff0c4a9c56e075ea is considered in this PR!

nkrah avatar May 17 '24 02:05 nkrah

Status:

  • WARNING: I change all output files to the output folder (NOT in the current folder), this is important for users using opengate_tests
  • tests 075, 074, 073, 072 = OK
  • test 071 and 070 needs debug (Nils)
  • test 068: OK
  • test 067: run but fails. To check

dsarrut avatar Aug 23 '24 15:08 dsarrut

  • Fixed test073 (there were still problems)
  • Fixed TesselatedSolid and worked on test067_stl... -> works intermittently. Sometimes tests pass, sometimes not. Need to understand better.
  • I also get occasional segfaults, but they do not seem to be related to the specifics of the test, rather related to nuclear physics components. Maybe some change in G4? (I was still on the previous version until very recently)

nkrah avatar Aug 25 '24 10:08 nkrah

General comment: I strongly advise to set the output directory via Simulation.output_dir and define the output_filename via the actor. GATE will automatically combine the two. This is much easier to maintain than concatenating the folder and the filename in the output_filename of each actor. If the user wants to change the output location, she just needs to change the single parameter Simulation.output_dir. ... also more robust to maintain in the tests here ...

nkrah avatar Aug 25 '24 10:08 nkrah

Status (starting from the last tests):

  • All test from 060 to 075 are ok, except : test071_test_operator_compt_splitting.py test070_test_operator_brem_splitting.py

dsarrut avatar Aug 27 '24 15:08 dsarrut

Regarding test065_dose_from_edep_ct.py: I added a timing test of the method patient.create_label_image(). Creating the label image (voxel labels) takes about 5.5 sec on my MacBook Pro.

How "very slow" is the image read on your machine?

nkrah avatar Aug 27 '24 23:08 nkrah

Regarding test065_dose_from_edep_ct.py: I added a timing test of the method patient.create_label_image(). Creating the label image (voxel labels) takes about 5.5 sec on my MacBook Pro.

How "very slow" is the image read on your machine?

on my computers, this i around 10 to 15 sec. This is (still) due to torch inside itk. If you dont have torch installed, it is fast. I will try to investigate, but we may consider to switch to SimpleITK (much faster)

dsarrut avatar Aug 28 '24 07:08 dsarrut

I see.

​Indeed the disadvantage of the LazyLoaeder mechanism is that the imports happen at some point during run time. Makes debugging slow code more difficult. Something to consider.

​Yes, simpleITK could be an option, but that is definitely an extra PR with quite a bit of work because ITK is scattered in many places.

On Aug 28 2024, at 9:14 am, David Sarrut @.***> wrote:

Regarding test065_dose_from_edep_ct.py: I added a timing test of the method

patient.create_label_image()

. Creating the label image (voxel labels) takes about 5.5 sec on my MacBook Pro.

How "very slow" is the image read on your machine?

this is (still) due to torch inside itk. If you dont have torch installed, it is fast. I will try to investigate, but we may consider to

switch to SimpleITK (much faster)

Reply to this email directly, view it on GitHub (https://github.com/OpenGATE/opengate/pull/403#issuecomment-2314500129), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AIFQFYJKH2WT66N2WE42LG3ZTV2FTAVCNFSM6AAAAABHUBCJGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJUGUYDAMJSHE).

You are receiving this because you authored the thread.

nkrah avatar Aug 28 '24 09:08 nkrah

Quick update on the DoseActor segfault: After cleaning the GateDoseActor (C++) class, the segfault only appears when activating any squared scoring in the dose actor. Scoring squared quantities implies instantiating a thread local struct and I therefore believe that the segfault is somehow caused by that mechanism. Will further look into it.

nkrah avatar Aug 28 '24 09:08 nkrah

WARNING to #34ccbce I change the way image data are sent from py to cpp. Now this is explicitely copied on the cpp side. I had to do this to avoid (all? some?) seg fault. Before that, it worked (sometimes) on osx, but always seg fault on linux. To be discussed ... @nkrah

Status : https://github.com/OpenGATE/opengate/wiki/Status-of-test-for-refactor%E2%80%90actors-branch

dsarrut avatar Aug 29 '24 07:08 dsarrut

Intéressant ça. On en discute.

On Aug 29, 2024 at 9:12 AM, <David Sarrut @.***)> wrote:

WARNING to #34ccbce (https://github.com/OpenGATE/opengate/pull/403/commits/34ccbce7dc26f2c4e9ed7f5e841ca93b40997efb) I change the way image data are sent from py to cpp. Now this is explicitely copied on the cpp side. I had to do this to avoid (all? some?) seg fault. Before that it works (sometimes) on osx, but always seg fault on linux.

To be discussed ...

— Reply to this email directly, view it on GitHub (https://github.com/OpenGATE/opengate/pull/403#issuecomment-2316874265), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AIFQFYJGFBEW2HRLQLYN6F3ZT3CWPAVCNFSM6AAAAABHUBCJGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJWHA3TIMRWGU). You are receiving this because you authored the thread.Message ID: @.***>

nkrah avatar Aug 29 '24 15:08 nkrah

https://github.com/OpenGATE/opengate/wiki/Status-of-test-for-refactor%E2%80%90actors-branch

dsarrut avatar Sep 05 '24 06:09 dsarrut

Started implementing a mechanism to have interfaces to the user_output in actors. The idea is that the user accesses the user_output via these interfaces to hide the underlying complexity. Important: The mechanism works, but I have not yet finished cleaning up. Except bugs introduced by these recent changes. I'll fix them this weekend.

nkrah avatar Sep 07 '24 00:09 nkrah

hurray !!

dsarrut avatar Sep 15 '24 11:09 dsarrut