{"action":"created","issue":{"url":"https://api.github.com/repos/nrc-cnrc/EGSnrc/issues/108","repository_url":"https://api.github.com/repos/nrc-cnrc/EGSnrc","labels_url":"https://api.github.com/repos/nrc-cnrc/EGSnrc/issues/108/labels{/name}","comments_url":"https://api.github.com/repos/nrc-cnrc/EGSnrc/issues/108/comments","events_url":"https://api.github.com/repos/nrc-cnrc/EGSnrc/issues/108/events","html_url":"https://github.com/nrc-cnrc/EGSnrc/issues/108","id":161232530,"number":108,"title":"egs++ simulation hangs when multiple BEAM sources reference same source phase space","user":{"login":"vahx129","id":20047851,"avatar_url":"https://avatars.githubusercontent.com/u/20047851?v=3","gravatar_id":"","url":"https://api.github.com/users/vahx129","html_url":"https://github.com/vahx129","followers_url":"https://api.github.com/users/vahx129/followers","following_url":"https://api.github.com/users/vahx129/following{/other_user}","gists_url":"https://api.github.com/users/vahx129/gists{/gist_id}","starred_url":"https://api.github.com/users/vahx129/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vahx129/subscriptions","organizations_url":"https://api.github.com/users/vahx129/orgs","repos_url":"https://api.github.com/users/vahx129/repos","events_url":"https://api.github.com/users/vahx129/events{/privacy}","received_events_url":"https://api.github.com/users/vahx129/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-06-20T16:05:43Z","updated_at":"2016-06-21T17:47:08Z","closed_at":null,"body":"egs_chamber hangs on a particular set of circumstances involving the source definition containing multiple BEAM simulation sources. \r\n\r\nIn the example I'm having problems with, a linear accelerator is modeled using an above jaws phase space and multiple BEAM simulations with dynamic jaws/MLC configurations which themselves results in below jaws phase spaces.\r\n\r\nUltimately, a patient treatment delivered to a chamber geometry could be simulated in egs_chamber using a weighted composite source consisting of the multiple BEAM simulations described above (with appropriate transformations). Each of those BEAM simulations themselves call upon the same Above Jaws phase space as a source of particles. \r\n\r\nThe issue arises specifically when calling these multiple BEAM sources in an egs_chamber simulation. In isolation, each of the BEAM simulations runs perfectly fine. When multiple BEAM simulations are defined in the source definition of the egs_chamber input, the simulation will hang if the source being referenced is not the first BEAM source defined. For example, if the input file contains: \r\n\r\n:BEAM Source Definition 1: \r\n:BEAM Source Definition 2:\r\n:BEAM Source Definition 3:\r\netc. \r\n\r\nand all 3 BEAM simulations call on the same above jaws phase space file as a source of particles, then the simulation will hang if the user calls on source 2 or source 3 in the egs_chamber simulation (or any composite source that requires source 2 and source 3). This is true even when the egs_chamber simulation calls for 1000 particles and the above jaws phase space contains well over 10 million.  \r\n\r\nA temporary workaround to this issue was to duplicate the above jaws phase space into two files called phasespace_odds and phasespace_evens. The BEAM inputs were adjusted so that the referenced above jaws phase space was being alternated between every BEAM simulation defined in the input. While this did solve the issue on a personal installation of EGS, the issue manifested itself again when trying to do production runs on a parallel computing cluster. Under these circumstances, each parallel run created .egslog files which grew exponentially in size with the following repeated error message:\r\n\r\n**WARNING** USED ALL PARTICLES FROM CHUNK IN SOURCE FILE!\r\n               RESTARTING FROM FIRST PARTICLE IN THIS CHUNK.\r\n\r\nThis does specifically seem to be an issue with how egs++ handles multiple BEAM simulations which all make reference to the same above jaws phase space. \r\n\r\nIf this is purely a user-specific error then I sincerely apologize but I can't think of any other obvious issues that I could be overlooking. "},"comment":{"url":"https://api.github.com/repos/nrc-cnrc/EGSnrc/issues/comments/227517399","html_url":"https://github.com/nrc-cnrc/EGSnrc/issues/108#issuecomment-227517399","issue_url":"https://api.github.com/repos/nrc-cnrc/EGSnrc/issues/108","id":227517399,"user":{"login":"vahx129","id":20047851,"avatar_url":"https://avatars.githubusercontent.com/u/20047851?v=3","gravatar_id":"","url":"https://api.github.com/users/vahx129","html_url":"https://github.com/vahx129","followers_url":"https://api.github.com/users/vahx129/followers","following_url":"https://api.github.com/users/vahx129/following{/other_user}","gists_url":"https://api.github.com/users/vahx129/gists{/gist_id}","starred_url":"https://api.github.com/users/vahx129/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vahx129/subscriptions","organizations_url":"https://api.github.com/users/vahx129/orgs","repos_url":"https://api.github.com/users/vahx129/repos","events_url":"https://api.github.com/users/vahx129/events{/privacy}","received_events_url":"https://api.github.com/users/vahx129/received_events","type":"User","site_admin":false},"created_at":"2016-06-21T17:47:08Z","updated_at":"2016-06-21T17:47:08Z","body":"Thanks for the clarification. So if we just stick to the issue as it pertains to a serial run and so as not to confuse multiple issues together, let me restate the issue like this then:\r\n\r\nIn an egs++ input file with a simple geometry (box), two (or potentially more) BEAM input sources are defined in the source definition block which both come from the same user BEAM linac. \r\n\r\nThese BEAM input files are below jaws simulations of the user linac which both reference the same above jaws phase space as a source for particles. Both BEAM inputs run particles from this above jaws phase space through dynamic jaws/MLC. A single scoring plane is set below the mylar window CM which itself is just below the MLCs. Let's call the first one BEAM source 1 and the second BEAM source 2.\r\n\r\nThe issue occurs when BEAM source 2, or any later source is chosen as the simulation source. The issue is that the simulation will hang  right at the first batch and will remain hung even when running as few as 100 particles over several hours. The egsrun folder in the egs_chamber user code will not populate with any files under these circumstances.\r\n\r\nIn the user BEAM linac code folder, two egsrun folders do appear with .egslog and .egslist files which contain information.  BEAM source 1's  .egslog file shows that the phase space has been read with the following  information: \r\n\r\nFULL PHASE-SPACE TO BE READ FROM UNIT 42...\r\n INPUT NAME OF FILE WITH PHASE SPACE DATA(1 TO 80 CHARS,WITH .EXT)\r\n : \r\n READ PHASE SPACE INFORMATION FROM: \r\nZ:/MC Resources/Phase Spaces/VKD_6MV_AboveJaws_1e8_Combined_Odds.egsphsp1       \r\n          Phase space source with:\r\n               Total number of particles =    722915887\r\n                Number of photons =    662765371\r\n                  Maximum particle kinetic energy =        6.050 MeV\r\n                  Minimumelectron kinetic energy =        0.000 MeV\r\n     # of particles incident from original source =   99998560.0\r\n\r\nThat same line in the .egslog of BEAM source 2 reports the following: \r\n\r\nFULL PHASE-SPACE TO BE READ FROM UNIT 42...\r\n INPUT NAME OF FILE WITH PHASE SPACE DATA(1 TO 80 CHARS,WITH .EXT)\r\n : \r\n READ PHASE SPACE INFORMATION FROM: \r\nZ:/MC Resources/Phase Spaces/VKD_6MV_AboveJaws_1e8_Combined_Odds.egsphsp1       \r\n\r\n Phase space source already open.  Will assume that \r\n DOSXYZnrc Source 20 is using this BEAM code as \r\n an initial geometry.  Will not attempt to \r\n open phase space source.\r\n\r\nBeyond that, no further error messages, warnings, or fatal errors appear to be encountered. \r\n \r\nI think that's everything as it pertains to the issue surrounding a local run using egs_chamber with multiple BEAM sources that each rely on the same above jaws phase space. I hope this clarifies the issue exactly as it pertains to running this simple egs_chamber input on a serial system. \r\n\r\nIt's worth mentioning again that a workaround for serial installs is to duplicate the above jaws phase space one time and point each subsequent BEAM source defined in the egs_chamber input file to either the odds or the evens phase space. So I believe this still qualifies as at least a minor bug with maybe larger implications for potential parallel runs in the future under similar circumstances. \r\n\r\nIf this issue already exists elsewhere in different terms then I sincerely apologize for wasting anyone's time. Thanks!"}}
{"actor":{"display_login":"vahx129"}}