Parallel Processing with Database specified

47 views
Skip to first unread message

Jake Dove

unread,
Sep 6, 2022, 5:20:09 PM9/6/22
to Virtual Photonics
Hello, I am running v6.2 and cannot utilize the parallel processing capabilities when a database is specified. Is there a way that I can work around this limitation? 

Thanks,
Jake

Carole Hayakawa

unread,
Sep 6, 2022, 6:56:07 PM9/6/22
to Virtual Photonics
Hi Jake,
Thanks for your interest in our software.  Currently the software cannot generate databases and run in parallel.  To modify the code, each CPU would create its own database, then the post-processor would have to read each database in and process the photons.  If this capability is of interest, let me know and I can pursue further.
Best,
Carole

Jake Dove

unread,
Sep 6, 2022, 7:04:39 PM9/6/22
to virtual-...@googlegroups.com
Yes, this capability would be of interest to me. 

-Jake

--
You received this message because you are subscribed to a topic in the Google Groups "Virtual Photonics" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/virtual-photonics/vMWW-Uau-98/unsubscribe.
To unsubscribe from this group and all its topics, send an email to virtual-photon...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/virtual-photonics/04c8b032-f584-4a9f-bac3-3d46a429783an%40googlegroups.com.

Carole Hayakawa

unread,
Sep 6, 2022, 9:05:24 PM9/6/22
to Virtual Photonics
Hi Jake,

I'll see what I can do.  It might take a bit though.

Best,
Carole

Jake Dove

unread,
Sep 14, 2022, 4:47:02 PM9/14/22
to Virtual Photonics
Hello Carole, I was able to get this working by creating a script that calls several instances and I believe this will solve my issues. Wanted to let you know that this is not an urgent request.

-Jake

Carole Hayakawa

unread,
Sep 14, 2022, 6:02:02 PM9/14/22
to Virtual Photonics
Hi Jake,
Thank you for your update!  I haven't had a chance to work on it yet so I'm glad to hear you got something working.
Best,
Carole

Jake Dove

unread,
Sep 26, 2022, 6:09:53 PM9/26/22
to Virtual Photonics
Hello Carole, 

I was working with the collision database and was wondering how the binary should be parsed. I was able to find the previous thread (https://groups.google.com/g/virtual-photonics/c/88PKACejDmI) which was helping in parsing the diffuse photon database and curious if you could tell me how the collision database should be parsed. For example, the diffuse photon database is structured:

a) exit location  
b) exit direction (in air)
c) exiting weight
d) total time in tissue
e) flag
 
or
 return {'position': [p[0], p[1], p[2]], 'direction': [p[3], p[4], p[5]], 'weight': p[6], 'time': p[7], 'flag': self._photon_states.get(p[8], 'Unknown')}

I am hoping to know the similar information but for the collision database.

-Jake

Carole Hayakawa

unread,
Sep 26, 2022, 8:45:01 PM9/26/22
to Virtual Photonics
Hi Jake,

For the diffuse photon database the class that is being written is PhotonDataPoint which has the Properties you list above a)-e).  For the collision info database the class that is being written is the CollisionInfo which implements a List of SubRegionCollisionInfo, the list describes the SubRegionCollisionInfo for each tissue subregion.  SubRegionCollisionInfo consists of a) pathlength (a double) and b) number of collisions (a long).  So if you had a tissue defined with air-tissue-air, such as this snippet from an input file:
 "TissueInput": {
    "Regions": [
      {
        "TissueRegionType": "Layer",
        "ZRange": {
          "Start": "-Infinity",
          "Stop": 0.0,
          "Count": 2
        },
        "RegionOP": {
          "Mua": 0.0,
          "G": 1.0,
          "Musp": 1E-10,
          "Mus": 1E-10,
          "N": 1.0
        }
      },
      {
        "TissueRegionType": "Layer",
        "ZRange": {
          "Start": 0.0,
          "Stop": 100.0,
          "Count": 2
        },
        "RegionOP": {
          "Mua": 0.01,
          "G": 0.8,
          "Musp": 1.0,
          "Mus": 5.000000000000001,
          "N": 1.4
        }
      },
      {
        "TissueRegionType": "Layer",
        "ZRange": {
          "Start": 100.0,
          "Stop": "Infinity",
          "Count": 2
        },
        "RegionOP": {
          "Mua": 0.0,
          "G": 1.0,
          "Musp": 1E-10,
          "Mus": 1E-10,
          "N": 1.0
        }
      }
    ],
    "TissueType": "MultiLayer"
  },
Then for each photon exiting the tissue, for each subregion a double (pathlength) then a long (number of collisions) is written.
For this setup the first and third subregion would be writing a 0.0 for pathlength and 0 for number of collisions, and for the second subregion (hopefully) nonzero numbers would be written indicating the total pathlength in the tissue and the total number of collisions in the tissue.

So our code when reading the database is set up in a loop over the number of subregions and reads a double (path length) and then a Int64 (number of collisions).

I hope this helps.  Let me know if I have omitted some information you need to set up your own reader.
Best,
Carole

Jake Dove

unread,
Sep 27, 2022, 4:52:03 PM9/27/22
to virtual-...@googlegroups.com
Carole, that was exactly what I was looking for, thank you!

One last question, is the photon database in both databases indexed the same? For example, is the 100th photon in the collision database the 100th photon in the collision database? I am asking because I want to look at photons that exit the tissue within a certain area which I can determine the DiffuseTransmission database but will want to look at the collision database for some post processing. 

Thanks!
Jake

Carole Hayakawa

unread,
Sep 27, 2022, 5:08:09 PM9/27/22
to Virtual Photonics
Hi Jake,

Yes, they are aligned. 

Best,
Carole

Jake Dove

unread,
Sep 28, 2022, 2:21:14 PM9/28/22
to virtual-...@googlegroups.com
Thanks Carole. I was just trying to run a cylinder model with pMCDiffuseTransmittance defined and the program does not run and when I change to  DiffuseTransmittance the model does run. Have you run into this issue before? Is there something I can do to fix it?

-Jake

Carole Hayakawa

unread,
Sep 28, 2022, 2:25:42 PM9/28/22
to Virtual Photonics
Hi Jake,

Post your infile and I'll give it a try.  pMCDiffuseTransmittance should work. Also what version of MCCL are you using?  The transmittance database code was added much later than the reflectance code.

Best,
Carole

Jake Dove

unread,
Sep 28, 2022, 10:33:18 PM9/28/22
to virtual-...@googlegroups.com
See attached.

When line 10 is  "DiffuseTransmittance" MCCL will run. When line is "pMCDiffuseTransmittance"  MCCL will not run.

-Jake

Cylinder_660_Test.txt

Virtual Photonics

unread,
Sep 28, 2022, 11:18:16 PM9/28/22
to Virtual Photonics
Hi Jake,

Thanks for the infile, it helped me to debug and find a bug in our code!  I'm sorry about that.  I have made fix but I'd like to add unit tests to complete the fix.  We don't plan to create a release for a while.  Do you possibly have a copy of the source code?  If you did, I could push my fix to GitHub and you could clone a copy of the source code and build.  I could talk you through the steps.

On another issue.  While scanning your infile I noticed something funny about how you set up the concentric cylinders.  You have defined the "Center"s of each to be at location (0,0,0).  This is actually forbidden because the cylinders are half within the tissue and half in the air.  This might be what you want to do, however the code cannot handle such a setup.  It also flags that I should add to our validation code to check for this type of input specification and output to the user that it can't be run.  When I have used this tissue type in the past, I have made the centers (0,0,z) where z is greater than the larger of the two radii.  This way the cylinders are entirely within the tissue and the cylinders are concentric.

After hearing my responses, please let me know how you'd like to proceed.
Thanks for helping me improve the code!
Carole

Jake Dove

unread,
Sep 28, 2022, 11:38:15 PM9/28/22
to virtual-...@googlegroups.com
Carole, thanks for the quick reply. I do not have a copy of the source but I can download a copy. If you provide steps, I can try to clone and build code. 

-Jake

--
You received this message because you are subscribed to a topic in the Google Groups "Virtual Photonics" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/virtual-photonics/vMWW-Uau-98/unsubscribe.
To unsubscribe from this group and all its topics, send an email to virtual-photon...@googlegroups.com.

Jake Dove

unread,
Sep 29, 2022, 4:35:20 PM9/29/22
to virtual-...@googlegroups.com
Carole, a couple more questions.

Can I change the refractive index of the boundary (I believe I read that the boundary layers have to be air, so can I change N from 1.0 to something else)?

Can I have multiple layers and multiple cylinders in the same model? For example, a 2 layer cylinder in a 3 layer plate?

Thanks,
Jake

Carole Hayakawa

unread,
Sep 29, 2022, 4:54:14 PM9/29/22
to Virtual Photonics
Hi Jake,

Yes you can make the "air" layers have N other than 1.0.  And yes you can have the 2 concentric infinite cylinders within a multilayer tissue.  The only caveat is that both cylinders need to be entirely within a tissue layer and need to be refractive matched with the enclosing layer (the other layer can have another N).

Just as an aside, I also noticed in your infile that you set the "air" tissue to go from -Infinity to -3mm.  Our code has an assumption that the "tissue" surface is at z=0.  When you set up your infile shift everything down 3mm and I think all will work.

I will post when all is ready with the code.
Carole

Jake Dove

unread,
Sep 29, 2022, 4:56:51 PM9/29/22
to virtual-...@googlegroups.com
Carole, yes thank you for letting me to work only from Z>=0.

-Jake

--
You received this message because you are subscribed to a topic in the Google Groups "Virtual Photonics" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/virtual-photonics/vMWW-Uau-98/unsubscribe.
To unsubscribe from this group and all its topics, send an email to virtual-photon...@googlegroups.com.

Carole Hayakawa

unread,
Sep 29, 2022, 6:53:52 PM9/29/22
to Virtual Photonics
Hi Jake,

The code modifications are now up in GitHub.    To pull a copy of the source code, please go to this page:
and on right hand side panel, there is a section titled "Getting Started with the Code".  Under that section are pages that provide instructions for whatever operating system you are on.

Don't hesitate to post if you run into any problems or have questions. 
Best,
Carole

Carole Hayakawa

unread,
Oct 12, 2022, 5:51:19 PM10/12/22
to Virtual Photonics
Hi Jake,

Just checking in.   I was wondering how you did with the source code and if the fix worked for you.

Let me know if I can help in anyway.
Best,
Carole
Reply all
Reply to author
Forward
0 new messages