PallasInstitute的个人博客分享 http://blog.sciencenet.cn/u/PallasInstitute

博文

Segmentation_Fault_(SIGSEGV_or_SIGBUS)_Errors解决方法

已有 1959 次阅读 2021-4-5 15:48 |系统分类:科研笔记

几种解决方法:

(1)Caused by a limited stack size : automatic arrays are often allocated on the stack whereas allocatable arrays are always allocated on the heap... But this feature depends on the compiler and even on the compiler version.

To include in your .bashrc file the following instruction :

ulimit -s unlimited

(2)Use the options -heap-arrays for ifort compiler and -fno-stack-arrays for gfortran compiler.
Also, the -heap-arrays compiler option can take an optional argument [size] to specify the threshold size in Kbytes at which arrays larger than [size] are allocated on heap, all others on stack.  For example:

-heap-arrays 10

puts all automatic and temporary arrays larger than 10Kbytes on heap

(3)Using with -O2 or -O1 optimization in compiling

(4)For segmentation fault (core dumped) error: most linux systems the core dump is default behaviour unless your core file is exceeding the maximum size allowed by the shell. Try doing the following before running the program:

ulimit -c

if it returns 0, or a small number of bytes, then type in the following:

ulimit -c unlimited

this will allow the creation of a core file of unlimited size (in the directory from which you ran the program.

(5)To debug your code: to find bugs a very good test is to compile with checking options, with ifort using e.g.

-g -check all -traceback -gen-interfaces -warn interfaces




https://blog.sciencenet.cn/blog-3469498-1280408.html

上一篇:六角格子的K点网格设置问题
下一篇:物质赝相变与高压下氢金属化和液-液相变之独特性
收藏 IP: 101.206.226.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-11-24 10:50

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部