Needed to set OMPI_ARGV unused value to load PETSc

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)

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)

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

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