# Needed to set OMPI\_ARGV unused value to load PETSc

**URL:** <https://community.freefem.org/t/needed-to-set-ompi-argv-unused-value-to-load-petsc/2239>\
**Category:** General Discussion\
**Created:** [January 22, 2023, 2:42pm UTC](https://community.freefem.org/t/needed-to-set-ompi-argv-unused-value-to-load-petsc/2239 "2023-01-22T14:42:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [January 22, 2023, 2:42pm UTC](https://community.freefem.org/t/needed-to-set-ompi-argv-unused-value-to-load-petsc/2239/1 "2023-01-22T14:42:09Z")

</div>

After about a week of playing around I had to look at the MIP  
initialization. It seems that the arg list is pass to PETSc and  
then to MPI which eventually passes arg[1] to someone expecting  
a null terminated parameter list ( argc no longer is in the signature lol).

Is this a well known or documented issue some where? From the error  
message it looked like a linking problem so I cyclted thorugh a bunch of  
mpi libs and other junk … I had to disasemble the code to find it …  
…

```
8 : //load "PETSc"
9 : load "PETSc-complex" (load: dlopen /home/ubuntu/dev/freefem/install/lib/ff++/4.12/lib/mpi/PETSc-complex.so 0x15500c0) PETSc (St7complexIdE)

```

Program received signal SIGSEGV, Segmentation fault.  
strlen () at …/sysdeps/x86\_64/strlen.S:106  
106 …/sysdeps/x86\_64/strlen.S: No such file or directory.  
(gdb) bt  
#0 strlen () at …/sysdeps/x86\_64/strlen.S:106  
#1 0x00007ffff1ff3295 in opal\_argv\_join (argv=0x155a178, delimiter=32)  
at argv.c:297  
#2 0x00007ffff273ca50 in ompi\_mpi\_init (argc=2, argv=0x155a170, requested=1,  
provided=0x7fffffffb21c, reinit\_ok=false) at runtime/ompi\_mpi\_init.c:505  
#3 0x00007ffff2697bab in PMPI\_Init\_thread (argc=0x7fffffffb4b4,  
argv=0x7fffffffb4b8, required=1, provided=0x7fffffffb21c)  
at pinit\_thread.c:67  
#4 0x00007fffeecc2dee in PetscInitialize (argc=0x7fffffffb4b4,  
args=0x7fffffffb4b8, file=0x0, help=0x7ffff08b7dc7 “”)  
at /home/ubuntu/dev/freefem/FreeFem-sources-master/3rdparty/ff-petsc/petsc-3.18.2/src/sys/objects/pinit.c:1244  
#5 0x00007fffeecc3075 in PetscInitialize (argc=argc@entry=0x7fffffffb4b4,  
args=args@entry=0x7fffffffb4b8, file=file@entry=0x0,  
help=help@entry=0x7ffff08b7dc7 “”)  
at /home/ubuntu/dev/freefem/FreeFem-sources-master/3rdparty/ff-petsc/petsc-3.18.2/src/sys/objects/pinit.c:1269  
#6 0x00007ffff084958d in Init\_PETSc () at PETSc-code.hpp:5475  
#7 0x0000000000cee00b in call (a=…) at InitFunct.cpp:51  
#8 0x0000000000cee7cc in std::for\_each\<std::\_Deque\_iterator\<std::pair\<int, void (_)()\>, std::pair\<int, void (_)()\>&, std::pair\<int, void (_)()\>_\>, void (_)(std::pair\<int, void (_)()\> const&)\> (\_\_f=, \_\_last=…, \_\_first=…)  
at /usr/include/c++/5/bits/stl\_algo.h:3767  
#9 callInitsFunct () at InitFunct.cpp:67  
#10 0x0000000000cfa381 in load (ss=“PETSc-complex”) at load.cpp:104  
#11 0x00000000008d5473 in lgparse () at lg.ypp:582  
#12 0x00000000008d7bca in Compile () at lg.ypp:853  
#13 0x00000000008d85f4 in mainff (argc=2, argv=0x7fffffffd1b8) at lg.ypp:1027  
#14 0x00007ffff5599840 in \_\_libc\_start\_main (  
main=0x8c1470 \<main(int, char\*\*)\>, argc=2, argv=0x7fffffffd1b8,  
init=, fini=, rtld\_fini=,  
stack\_end=0x7fffffffd1a8) at …/csu/libc-start.c:291  
#15 0x00000000008c51f9 in \_start ()  
(gdb)

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [January 22, 2023, 3:55pm UTC](https://community.freefem.org/t/needed-to-set-ompi-argv-unused-value-to-load-petsc/2239/2 "2023-01-22T15:55:28Z")

</div>

and then at the end, it seems to be waiting for some kind of close.  
Is this a MPI configuration issue? I would have thought FreeFem would  
tell these things to stop at the end.

times: compile 0.065244s, execution 0.838418s, mpirank:0  
^C  
Thread 1 “FreeFem++” received signal SIGINT, Interrupt.  
0x00007ffff55e8198 in \_IO\_new\_proc\_close (fp=0x147e980) at iopopen.c:339  
339 iopopen.c: No such file or directory.  
(gdb) bt  
#0 0x00007ffff55e8198 in \_IO\_new\_proc\_close (fp=0x147e980) at iopopen.c:339  
#1 0x00007ffff55f2970 in \_IO\_new\_file\_close\_it (fp=fp@entry=0x147e980)  
at fileops.c:172  
#2 0x00007ffff55e63ff in \_IO\_new\_fclose (fp=0x147e980) at iofclose.c:58  
#3 0x00000000008d30a7 in lgparse () at lg.ypp:387  
#4 0x00000000008d7bca in Compile () at lg.ypp:853  
#5 0x00000000008d85f4 in mainff (argc=2, argv=0x7fffffffd178) at lg.ypp:1027  
#6 0x00007ffff5599840 in \_\_libc\_start\_main (  
main=0x8c1470 \<main(int, char\*\*)\>, argc=2, argv=0x7fffffffd178,  
init=, fini=, rtld\_fini=,  
stack\_end=0x7fffffffd168) at …/csu/libc-start.c:291  
#7 0x00000000008c51f9 in \_start ()  
(gdb) info threads  
Id Target Id Frame

- 1 Thread 0x7ffff7fc0840 (LWP 17916) “FreeFem++” 0x00007ffff55e8198 in \_IO\_new\_proc\_close (fp=0x147e980) at iopopen.c:339  
2 Thread 0x7fffeb92e700 (LWP 17929) “FreeFem++” 0x00007ffff567484d in poll  
() at …/sysdeps/unix/syscall-template.S:84  
3 Thread 0x7fffe3fff700 (LWP 17930) “FreeFem++” 0x00007ffff5680b13 in epoll\_wait () at …/sysdeps/unix/syscall-template.S:84  
(gdb) thread 2  
[Switching to thread 2 (Thread 0x7fffeb92e700 (LWP 17929))]  
#0 0x00007ffff567484d in poll () at …/sysdeps/unix/syscall-template.S:84  
84 …/sysdeps/unix/syscall-template.S: No such file or directory.  
(gdb) bt  
#0 0x00007ffff567484d in poll () at …/sysdeps/unix/syscall-template.S:84  
#1 0x00007ffff20208f8 in poll (\_\_timeout=, \_\_nfds=1,  
\_\_fds=0x7fffe40008c0) at /usr/include/x86\_64-linux-gnu/bits/poll2.h:46  
#2 poll\_dispatch (base=0x15ce930, tv=) at poll.c:165  
#3 0x00007ffff201703f in opal\_libevent2022\_event\_base\_loop (base=0x15ce930,  
flags=1) at event.c:1630  
#4 0x00007ffff1fae9f0 in progress\_engine (obj=0x15ce8e8)  
at runtime/opal\_progress\_threads.c:105  
#5 0x00007ffff5ee26ba in start\_thread (arg=0x7fffeb92e700)  
at pthread\_create.c:333  
#6 0x00007ffff568051d in clone ()  
at …/sysdeps/unix/sysv/linux/x86\_64/clone.S:109  
(gdb) thread 3  
[Switching to thread 3 (Thread 0x7fffe3fff700 (LWP 17930))]  
#0 0x00007ffff5680b13 in epoll\_wait ()  
at …/sysdeps/unix/syscall-template.S:84  
84 …/sysdeps/unix/syscall-template.S: No such file or directory.  
(gdb) bt  
#0 0x00007ffff5680b13 in epoll\_wait ()  
at …/sysdeps/unix/syscall-template.S:84  
#1 0x00007ffff2013c78 in epoll\_dispatch (base=0x15f45c0, tv=)  
at epoll.c:407  
#2 0x00007ffff201703f in opal\_libevent2022\_event\_base\_loop (base=0x15f45c0,  
flags=1) at event.c:1630  
#3 0x00007fffeae6b803 in progress\_engine (obj=0x15f44c8)  
at runtime/pmix\_progress\_threads.c:232  
#4 0x00007ffff5ee26ba in start\_thread (arg=0x7fffe3fff700)  
at pthread\_create.c:333  
#5 0x00007ffff568051d in clone ()  
at …/sysdeps/unix/sysv/linux/x86\_64/clone.S:109  
(gdb)

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [January 22, 2023, 4:57pm UTC](https://community.freefem.org/t/needed-to-set-ompi-argv-unused-value-to-load-petsc/2239/3 "2023-01-22T16:57:48Z")

</div>

It seems you are using `FreeFem++`, you need to use `FreeFem++-mpi`.

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [January 22, 2023, 5:40pm UTC](https://community.freefem.org/t/needed-to-set-ompi-argv-unused-value-to-load-petsc/2239/4 "2023-01-22T17:40:47Z")

</div>

Thanks. Actually I forgot “mpirun” and did not have the current  
openmpi on the path either 🙂
