Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault in generating the stoichiom file #64

Closed
cshsgy opened this issue Nov 10, 2022 · 8 comments
Closed

Segmentation fault in generating the stoichiom file #64

cshsgy opened this issue Nov 10, 2022 · 8 comments
Assignees
Labels
bug Something isn't working build Related to makefiles and/or compilation

Comments

@cshsgy
Copy link

cshsgy commented Nov 10, 2022

Hi, I was trying out the examples of KPP. However, an error comes up when I came to the compiling stage:


kpp small_f90.kpp 

This is KPP-3.0.0-rc.3.

KPP is parsing the equation file.
KPP is computing Jacobian sparsity structure.
KPP is starting the code generation.
KPP is initializing the code generation.
KPP is generating the monitor data:
    - small_f90_Monitor
KPP is generating the utility data:
    - small_f90_Util
KPP is generating the global declarations:
    - small_f90_Main
KPP is generating the ODE function:
    - small_f90_Function
KPP is generating the ODE Jacobian:
    - small_f90_Jacobian
    - small_f90_JacobianSP
KPP is generating the linear algebra routines:
    - small_f90_LinearAlgebra
KPP is generating the Hessian:
    - small_f90_Hessian
    - small_f90_HessianSP
KPP is generating the utility functions:
    - small_f90_Util
KPP is generating the rate laws:
    - small_f90_Rates
KPP is generating the parameters:
    - small_f90_Parameters
KPP is generating the global data:
    - small_f90_Global
KPP is generating the stoichiometric description files:
    - small_f90_Stoichiom
Segmentation fault (core dumped)

I used the files in the example folder, and they all fail at the same place. Is there a way to trace where the problem happens or does anyone have any ideas on how I can fix this?

@yantosca yantosca added bug Something isn't working build Related to makefiles and/or compilation labels Nov 10, 2022
@yantosca
Copy link
Contributor

Thanks for writing @cshsgy. Are you building KPP on a Mac? I've noticed this issue on MacOS as well. I think it may have to do with the much lower amount of stack memory on MacOS than on Linux-based systems.
You can try setting

export OMP_STACKSIZE=500m

which should set the stack memory to the maximum value on the system, and then rebuild again.

Also, if you don't need the stoichometric numbers, you can also disable that option with

#STOICHIOM off

Also tagging @RolfSander @jimmielin

@yantosca yantosca self-assigned this Nov 10, 2022
@yantosca
Copy link
Contributor

Re: stack memory on MacOSX, we have this documentation: https://kpp.readthedocs.io/en/stable/getting_started/01_installation.html#request-maximum-stack-memory

@Cobaltito27
Copy link

Hi. I am using the latest KPP on a Windows Linux Subsystem (Ubuntu) and I also encountered the exact problem as well. I managed to set the stack limit to unlimit and recompiled the source code of KPP. But the problem persists.

When I check the small_strato.log file and generated .f90 files, it seems that they are interrupted. For example, below are line 71 to the rear of the file small_strato.log:

### Subroutines ---------------------------------------

SUBROUTINE Fun ( V, F, RCT, Vdot, Aout )
SUBROUTINE Fun_SPLIT ( V, F, RCT, Vdot, P_VAR, D_VAR, Aout )
SUBROUTINE CalcStoichNum ( StoichNum )
SUBROUTINE Jac_SP ( V, F, RCT, JVS )
SUBROU

@cshsgy
Copy link
Author

cshsgy commented Nov 11, 2022

Thanks for writing @cshsgy. Are you building KPP on a Mac? I've noticed this issue on MacOS as well. I think it may have to do with the much lower amount of stack memory on MacOS than on Linux-based systems. You can try setting

export OMP_STACKSIZE=500m

which should set the stack memory to the maximum value on the system, and then rebuild again.

Also, if you don't need the stoichometric numbers, you can also disable that option with

#STOICHIOM off

Also tagging @RolfSander @jimmielin

Hi @yantosca thanks for your reply! Yes I am using KPP in a UNIX-based system, but a x86-64 Ubuntu system. I tried your suggestion of changing the OMP stack size but also tried to set the ulimit, neither of them work and the error persists.
What is strange to me is that, the log file shows nothing (an empty file created), which makes it quite hard to trace down the error.
Thanks again for your kind help :D

@prithvi09
Copy link

hello @cshsgy ! i was wondering if you solved the problem already ! I am facing the similar issue on my PC. I tried much to solve this but i failed to do so. can you help me ?

@obin1
Copy link
Member

obin1 commented Feb 7, 2023

@prithvi09, there's a 2 line change in this pull request: #67, which fixes the stack overflow and allows the STOICMAT option to run for me. I'm not sure if this has been validated or will get pulled into KPP at some point, but it has worked for my purposes

@cshsgy
Copy link
Author

cshsgy commented Feb 13, 2023

hello @cshsgy ! i was wondering if you solved the problem already ! I am facing the similar issue on my PC. I tried much to solve this but i failed to do so. can you help me ?

Hi! For me eventually ulimit -s unlimited solved the problem. I have to say the tutorial was poorly organized and we have to go to the very bottom of the page to find out the solution to this problem.

@yantosca
Copy link
Contributor

This should be now solved by PR #67, which has been merged into KPP 3.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build Related to makefiles and/or compilation
Projects
None yet
Development

No branches or pull requests

5 participants