njoy / NJOY21

NJOY for the 21st Century
https://www.njoy21.io/NJOY21
Other
72 stars 38 forks source link

Segmentation fault in compiling NJOY on Conda enviroment #162

Closed mehmeturkmen closed 2 years ago

mehmeturkmen commented 2 years ago

I tried to compile NJOY21 on the Conda environment on Ubuntu 20.04 (installed on Windows Subsystem for Linux). I saw no error in configuring the building process by following the steps in "Installing NJOY". The compilers I am using are: Cmake 3.23.1, GCC/Gfortran 11.2.0, and Pyhton 3.9.4. Any idea about what may cause the following error? Besides this, I wonder why I am getting a bunch of warnings during the compilation. Even some of them occur to me very important.

[ 72%] Building Fortran object _deps/njoy-build/CMakeFiles/njoy.dir/src/aceth.f90.o /home/memo/NJOY21/bin/_deps/njoy-src/src/aceth.f90:26:22:

26 | real(kr)::xss(nxss) | 1 Warning: Array 'xss' at (1) is larger than limit set by '-fmax-stack-var-size=', moved from stack to static storage. This makes the procedure unsafe when called recursively, or concurrently from multiple threads. Consider using '-frecursive', or increase the '-fmax-stack-var-size=' limit, or change the code to use an ALLOCATABLE array. [-Wsurprising] [ 73%] Building Fortran object _deps/njoy-build/CMakeFiles/njoy.dir/src/errorr.f90.o f951: internal compiler error: Segmentation fault 0x16a17c7 internal_error(char const, ...) ???:0 0x77fec0 gfc_sym_get_dummy_args(gfc_symbol) ???:0 0x8237f9 gfc_code_walker(gfc_code, int (*)(gfc_code*, int, void), int ()(gfc_expr, int, void), void*) ???:0 0x82390e gfc_code_walker(gfc_code, int (*)(gfc_code*, int, void), int ()(gfc_expr, int, void), void*) ???:0 0x8237f9 gfc_code_walker(gfc_code, int (*)(gfc_code*, int, void), int ()(gfc_expr, int, void), void*) ???:0 0x82390e gfc_code_walker(gfc_code, int (*)(gfc_code*, int, void), int ()(gfc_expr, int, void), void*) ???:0 0x82390e gfc_code_walker(gfc_code, int (*)(gfc_code*, int, void), int ()(gfc_expr, int, void), void*) ???:0 0x82390e gfc_code_walker(gfc_code, int (*)(gfc_code*, int, void), int ()(gfc_expr, int, void), void) ???:0 0x824f2a gfc_run_passes(gfc_namespace) ???:0 0x748877 gfc_resolve(gfc_namespace) ???:0 0x758d57 gfc_resolve_code(gfc_code, gfc_namespace) ???:0 0x75b627 gfc_resolve_blocks(gfc_code, gfc_namespace) ???:0 0x758c16 gfc_resolve_code(gfc_code, gfc_namespace) ???:0 0x75b627 gfc_resolve_blocks(gfc_code, gfc_namespace) ???:0 0x758c16 gfc_resolve_code(gfc_code, gfc_namespace) ???:0 0x74884e gfc_resolve(gfc_namespace) ???:0 0x73b311 gfc_parse_file() ???:0 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See https://github.com/conda-forge/ctng-compilers-feedstock/issues/new/choose for instructions. make[2]: [_deps/njoy-build/CMakeFiles/njoy.dir/build.make:231: _deps/njoy-build/CMakeFiles/njoy.dir/src/errorr.f90.o] Error 1 make[2]: Waiting for unfinished jobs.... make[1]: [CMakeFiles/Makefile2:2088: _deps/njoy-build/CMakeFiles/njoy.dir/all] Error 2 make: [Makefile:146: all] Error 2

whaeck commented 2 years ago

Gcc-11 has an issue with the NJOY2016 source code for the ERRORR module. It's a weird issue that we've tried to diagnose but it does not seem to be caused by the actual source code. Something seems to be wrong with the gcc-11 preprocessor or compiler itself that causes this. If you can switch to a different compiler (gcc-7 up to and including gcc-10 and gcc-12) should compile things correctly.

As for the warnings you're seeing: NJOY2016 is used under the hood in NJOY21 and is a relatively old code-base. The compiler warnings have always been there but we see them now because we compile with -Wall. We're working on reducing the amount of warnings since most of them are easy to fix (unused variables, not properly initialised variables, etc.) but we only do that when we have to actively intervene in a particular part of NJOY2016.

As a side note: at the moment, NJOY21 does not offer any extra features compared to NJOY2016. We are still actively maintaining NJOY2016 and it is still used at LANL as the main production tool for our data libraries. You may want to switch to that version of NJOY instead of NJOY21.

NJOY21 will be the future, but we've changed our approach to the modernisation effort. Initially, NJOY21 was supposed to be a module by module modernisation (i.e. modernise RECONR, etc.) but we've now decided to go for a component based approach. With the component based approach, we're developing C++ based libraries that have specific tasks (e.g. resonance reconstruction, ENDF data reading and formatting, ACE data reading and formatting, etc.) with a python interface on top. These components provide features that the modernised modules will need but they also provide other functionality of interest to our users that a modernised module cannot provide (e.g. easy access to data inside an ACE file). These components can also be deployed to users more easily and more quickly compared to a full module - which allows us to show off the progress we make more easily.

Eventually, we'll use the components to develop the modernised modules themselves, which will then make it into NJOY21.

mehmeturkmen commented 2 years ago

Thanks for the clarification. The only version which works on my computer is GCC-10. Other versions gave the same error. Tests passed but I am not sure if I face some serious problems while I produce cross-sections. I am gonna try later once again with an updated version of GCC. I have already had a complied version of NJOY2016. For now, I will continue to use it.

whaeck commented 2 years ago

I will have to update the prerequisites to exclude gcc-11 as a supported compiler due to this issue which should help in the future. Either way, I'm happy you managed to use gcc-10 instead.