(Solved) Segmentation fault with tools/registry during compilation when new variables are added to Registry/Registry.EM_COMMON

onishi

New member
Hi WRF forum

I am trying to compile WRF4.4 (with chemistry) with new variables added in Registry/Registry.EM_COMMON.
But I get Segmentation fault from tools/registry during a compilation.
New variables were already tested and used in WRF v3 without problem.
Apparently the number of variables in Registry seems to go over some threshold.
To check this I only added the half of new variables (randomly selected). It did not segfault.
I also turned off chemistry (WRF_CHEM=0) with all new variables added in Registry.EM_COMMON, and it did not segfault either.
I tested it with two different versions of intel compilers and one gfortran compiler on two different machines. The results are always the same.
ulimit -s unlimited is also done.

Does anyone know if there is a limit for the number of variables in Registry and if so, how to change it to add more variables in Registry.EM_COMMON?

Thank you
Tatsuo
 
Hi Tatsuo,

I am not aware of a registry variable limit, but as you suspected, it may be a memory issue. Are you compiling at the command line or submitting a job to cluster? Are you able to provide more memory?

Jordan
 

onishi

New member
Hello Jordan

Thank you for your reply. I tried to provide more memory (up to 40G). I think it is enough for a normal installation.
I also checked the memory usage after an installation attempt, It used only a few GBs.
I submit a job to a cluster. I use SLURM on one machine and PBS on the other machine. Both segfault.
I also tried to compile at the command line, only to get the same result.
For now, I am trying to locate where segfault occurs in source codes. But no success so far....

Tatsuo
 

onishi

New member
Hello WRF forum

I found a bug of this segfault problem with tools/registry.
The number of registry variables is actually limited.
While tools/registry goes through Registry files, it creates a temporary string in C function "contains_tok" by adding all registry variables separated by commas. You can find the function in tools/gen_interp.c.
The number of string length allocated to "tempstr" is 8092.
In my case, this temporary string became longer than 8092 and caused a segmentation error.
Now I have increased the number and tools/registry runs normally during an installation.
So it is not exactly the number of registry variables, but a total length of variable strings (all added together with commas).

Tatsuo
 
Top