[petsc-users] Reading -options_file

Satish Balay balay.anl at fastmail.org
Thu Sep 18 14:59:32 CDT 2025


Perhaps you can try reproducing the issue with a petsc example and then check for differences with your code [or build process?]

Or you can check in debugger. [with a break point in PetscOptionsInsertString_Private - this is where "-options_file" is checked in the library]

Satish

---

balay at p1 /home/balay/petsc/src/ksp/ksp/tutorials (release =)
$ make ex1
mpicc -fPIC -Wall -Wwrite-strings -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-stringop-overflow -fstack-protector -fvisibility=hidden -g3 -O0  -I/home/balay/petsc/include -I/home/balay/petsc/arch-linux-c-debug/include     -Wl,-export-dynamic ex1.c   -Wl,-rpath,/home/balay/petsc/arch-linux-c-debug/lib -L/home/balay/petsc/arch-linux-c-debug/lib -Wl,-rpath,/software/mpich-4.3.0/lib -L/software/mpich-4.3.0/lib -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/15 -L/usr/lib/gcc/x86_64-redhat-linux/15 -lpetsc -llapack -lblas -lm -lX11 -lmpifort -lmpi -lgfortran -lm -lgfortran -lm -lgcc_s -lquadmath -lstdc++ -lquadmath  -o ex1
balay at p1 /home/balay/petsc/src/ksp/ksp/tutorials (release =)
$ ./ex1
Norm of error 2.41202e-15, Iterations 5
balay at p1 /home/balay/petsc/src/ksp/ksp/tutorials (release =)
$ cat options.lst 
-ksp_monitor
balay at p1 /home/balay/petsc/src/ksp/ksp/tutorials (release =)
$ ./ex1 -options_file options.lst 
  0 KSP Residual norm 7.071067811865e-01
  1 KSP Residual norm 3.162277660168e-01
  2 KSP Residual norm 1.889822365046e-01
  3 KSP Residual norm 1.290994448736e-01
  4 KSP Residual norm 9.534625892456e-02
  5 KSP Residual norm 8.082545620881e-16
Norm of error 2.41202e-15, Iterations 5
  0 KSP Residual norm 3.535533905933e-01
  1 KSP Residual norm 8.574929257125e-02
  2 KSP Residual norm 2.272727272727e-02
  3 KSP Residual norm 6.083103193616e-03
  4 KSP Residual norm 1.629797545433e-03
  5 KSP Residual norm 6.414906535963e-17
balay at p1 /home/balay/petsc/src/ksp/ksp/tutorials (release =)
$ ./ex1 --options_file options.lst 
Norm of error 2.41202e-15, Iterations 5
WARNING! There are options you set that were not used!
WARNING! could be spelling mistake, etc!
There is one unused database option. It is:
Option left: name:--options_file value: options.lst source: command line



On Thu, 18 Sep 2025, Riousset, Jeremy via petsc-users wrote:

> Hi,
> 
> I’m updating a code from PETSc 3.4 to run with the latest PETSc. Here is my status:
> 
>   *   I read the parameters via: mpiexec -n 1 bin/./M4 --options_file input/main.in
>   *   I’m not opening main.in correctly
>   *   None of the options are retrieved by e.g., PetscOptionsGetReal
> 
> Do you have a suggestion to test what file the code is actually trying to access?
> 
> Thanks
> 
> Jeremy A. Riousset, Ph.D. (he, him, his)
> Associate Professor of Engineering Physics
> Physical Science
> 
> 1 Aerospace Boulevard
> Daytona Beach, FL 32114
> +1 (386) 226-6407
> jeremy.riousset at erau.edu<mailto:jeremy.riousset at erau.edu>
> https://urldefense.us/v3/__https://orcid.org/0000-0003-1516-5337__;!!G_uCfscf7eWS!YiGxTKiNGs8EnS4pzFoO1YK18z4fx-sCtisUBloRO8dd6sUuh3kfUkimanAH5cJ-jgPhYw-Qk_8q8BBxAtPO0s_6$ 
> 
> Embry-Riddle Aeronautical University
> Florida | Arizona | Worldwide
> 
> 


More information about the petsc-users mailing list