# Segmentation fault in

**URL:** <https://bempp.discourse.group/t/segmentation-fault-in/163>\
**Category:** Uncategorized\
**Created:** [3 January 2023 01:40 UTC](https://bempp.discourse.group/t/segmentation-fault-in/163 "2023-01-03T01:40:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jntu2023](https://avatars.discourse-cdn.com/v4/letter/j/eada6e/32.png) [@jntu2023](https://bempp.discourse.group/u/jntu2023)\
**Post date:** [3 January 2023 01:40 UTC](https://bempp.discourse.group/t/segmentation-fault-in/163/1 "2023-01-03T01:40:51Z")

</div>

I am learning to use Bempp-cl. Wen I ran the code of tutorial example “Electromagnetic scattering from flat screens”, I got segmentation fault (core dumped) at the statement

incident\_field\_data = incident\_field(points)

By looking at the function “incident\_field(x)”, I can’t see what the cause of the error is. Is FMM used in this example? I failed to get exafmm-t installed on my Ubuntu 20.04.

Thank you for any helps.

Best regards,  
Jiannan

---

<div class="post-metadata">

**Author:** ![jntu2023](https://avatars.discourse-cdn.com/v4/letter/j/eada6e/32.png) [@jntu2023](https://bempp.discourse.group/u/jntu2023)\
**Post date:** [4 January 2023 18:31 UTC](https://bempp.discourse.group/t/segmentation-fault-in/163/2 "2023-01-04T18:31:24Z")

</div>

I need to correct myself. By debugging, I found that the code line that causes segmentation fault is

**scattered\_field\_data = -slp\_pot \* lambda\_data**

The solver succeeded but calculation of scattered electric field failed. If a small number of elements is used, the program runs fine. The largest number of edges that can let the program succeeds is about 2000, My machine has 32 GB RAM, so 2000 edges should not cause any problems.

Could you anybody help to resolve this issue? I hope bempp could be a useful tool for my project.

Thank you,  
Jiannan

---

<div class="post-metadata">

**Author:** ![marc.jofre](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@marc.jofre](https://bempp.discourse.group/u/marc.jofre)\
**Post date:** [4 January 2023 18:39 UTC](https://bempp.discourse.group/t/segmentation-fault-in/163/3 "2023-01-04T18:39:34Z")

</div>

Hi,

Before changing to OpenCl, I could not perform operations with many edges (maybe around thousands) since it would fail the execution (typically at this sort of lines that you indicate).

Then, I installed OpenCL (for windows: [OpenCl in Windows 10](https://bempp.discourse.group/t/opencl-in-windows-10/165)), and now I can run with many more adges and in faster execution time.

Regards,

Marc

---

<div class="post-metadata">

**Author:** ![marc.jofre](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@marc.jofre](https://bempp.discourse.group/u/marc.jofre)\
**Post date:** [4 January 2023 18:46 UTC](https://bempp.discourse.group/t/segmentation-fault-in/163/4 "2023-01-04T18:46:48Z")

</div>

> [@jntu2023](#):
>
> slp\_pot

Also, it helps reducing the number of points indicated to compute in : slp\_pot(…,NumPoints…)

---

<div class="post-metadata">

**Author:** ![jntu2023](https://avatars.discourse-cdn.com/v4/letter/j/eada6e/32.png) [@jntu2023](https://bempp.discourse.group/u/jntu2023)\
**Post date:** [6 January 2023 01:37 UTC](https://bempp.discourse.group/t/segmentation-fault-in/163/5 "2023-01-06T01:37:45Z")

</div>

Hi Marc,

Thank you for the info. I indeed install openCL on my Ubuntu. I’ll check if openCL is enabled.

Regards,  
Jiannan
