nrc-cnrc / EGSnrc

Toolkit for Monte Carlo simulation of ionizing radiation — Trousse d'outils logiciels pour la simulation Monte Carlo du rayonnement ionisant
http://nrc-cnrc.github.io/EGSnrc
GNU Affero General Public License v3.0
216 stars 146 forks source link

BEAMnrc fails to compile more than 15 CMs #734

Open camilabustos1 opened 3 years ago

camilabustos1 commented 3 years ago

Hi, I am having an issue in compiling in BEAMnrc code and i get this error

Mortran compiling ...  compilation error (stop 12)
/home/mayor/EGSnrc/HEN_HOUSE/makefiles/beam_makefile:113: fallo en las instrucciones para el objetivo 'BEAM_bowtie1_linux64.F'
make: *** [BEAM_bowtie1_linux64.F] Error 12
rtownson commented 3 years ago

Hello, I believe this is a duplicate of this question: https://www.reddit.com/r/EGSnrc/comments/o00bsu/error_compiling_beamnrc_i_have_tried_to_build/

Could you follow up there? I don't believe this is a bug with the code, but likely an installation or configuration issue.

rtownson commented 3 years ago

After some further investigation, I can reproduce the issue. See the link to the subreddit for more details, but essentially adding 15+ CMs to a BEAMnrc accelerator results in compilation warnings like this:

BEAM_test-manycms_win3264.F:5662:1:
 Z---

even though in the macros I have the maximum number of CMs set to 25. If you look in the .F file, there are corrupted lines:

Z---

ZZZZ!
Z

"
ZZZZZZZZZ
Z
ZZZZZZZZZZZZ

"Z

ZZZZZZZZZ
Z&.

@blakewalters any ideas about this?

Here is an example .module file:

 CM names:  SLABS PYRAMIDS PYRAMIDS PYRAMIDS PYRAMIDS PYRAMIDS PYRAMIDS PYRAMIDS PYRAMIDS PYRAMIDS PYRAMIDS PYRAMIDS PYRAMIDS PYRAMIDS PYRAMIDS PYRAMIDS
 Identifiers:  q w e r t y u i o p a s d f g h 
camilabustos1 commented 3 years ago

Hi!, Thanks for your answer, by lowering the number of modular components the error was solved.

blakewalters commented 2 weeks ago

@rtownson, @camilabustos1: I've found this upper limit on the no. of CMs is CM-dependent. For example, change one of the PYRAMIDS in the above example to SLABS, and the accelerator will compile. In my experience, this has to do with the size of the MORTRAN macros associated with a particular CM. The larger the macros, the fewer the CMs you'll be able to concatenate and successfully compile. For the above example, replace PYRAMIDS with SYNCHDMLC and you won't even get 15 CMs to compile. In other words, this is an issue with the Mortran compiler and addressing it may require significant revamping/rationalization of the coding for a number of CMs. Moreover, it means that 15 CMs is not a hard limit. We can probably fix PYRAMIDS so that > 15 will compile by "subdividing" some macros, increasing the no. of coding blocks while decreasing the size, but this is a general issue that will require some time to address and likely only on a CM-by-CM basis.

ftessier commented 2 weeks ago

I am guessing then that there is a memory, stack or file size limit in the Mortran compiler. The Mortran compiler code is very obscure. I will check if by any chance I can find where that limit is set, anyone please feel free to hunt for it as well!