victorliu / S4

Stanford Stratified Structure Solver - Electromagnetic simulator for layered periodic structures
http://www.stanford.edu/group/fan/S4/
GNU General Public License v2.0
128 stars 149 forks source link

2d examples execution fail due to segmentation fault #77

Open Neoarroway opened 6 years ago

Neoarroway commented 6 years ago

The 1D examples work well, however, when I tried to run the 2d examples , most of them fail due to segmentation fault( core dumped). I used a Ubuntu 16.04 VM. The following is the error message

~/src/examples/2d/Tikhodeev_PRB_66_45102_2002$ /home/neoarroway/src/build/S4 fig4.lua >output_fig4.txt Segmentation fault (core dumped)

Most forums suggest the problem comes from pointer, which I assume in the cpp file. However, as the bottom layer code, the cpp must already been stable. Where does this problem come from? VM, inappropriate compilation? how should I debug?

Trave11er commented 6 years ago

Same here - tried running: S4/examples/2d/Li_JOSA_14_2758_1997. All example in the directory fail after the first iteration except ex3.lua which exits successfully.

Run on Ubuntu 16.04. Attached is the compilation output for info. compilation_output.txt

jtambasco commented 5 years ago

Hi, Same problem here compiling on Arch Linux. The problem appears to be caused when the Clone method is called in that script.

I compiled with debug and run GDB on the problem file. Looks like there is a problem deallocating the memory after Clone().

Starting program: /home/jl/Gits/s4-git/src/S4/build/S4 ../examples/2d/Tikhodeev_PRB_66_45102_2002/fig4.lua
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
Simulation_DestroyLayerModes (layer=0x555555613590) at S4/S4.cpp:952
952         if(NULL != layer->modes->q){ S4_free(layer->modes->q); }
nelsongt commented 5 years ago

I also have this error. I compiled on 64bit RedHat EL6 using gcc 4.4.7 with openmpi 1.10 using both gcc and mpicc. It only happens when S4.SolveInParallel is called, I believe. I agree with above that it is from freeing memory, as once I got a glibc error that attempting to free memory referenced an invalid pointer.

WangL3i commented 2 years ago

I also have this error. I compiled on 64bit RedHat EL6 using gcc 4.4.7 with openmpi 1.10 using both gcc and mpicc. It only happens when S4.SolveInParallel is called, I believe. I agree with above that it is from freeing memory, as once I got a glibc error that attempting to free memory referenced an invalid pointer.

Hi, nelsongt! Not only did I get a 'Segmentation fault (core dumped)' error during my use of S4, but another problem kept bugging me. I have installed mpi in the system, but when I run MPI_examples, mpi does not work. Do I need to do some extra operations when compiling after installing mpi? Have you saved the two problems? I really need your help. I'm looking forward to your reply!!!

nelsongt commented 2 years ago

I have not used this software in years, I cannot remember anymore.

I suggest looking for the answer at this more active fork: https://github.com/phoebe-p/S4 and also explore her RayFlare software that integrates S4