Discussion:
[petsc-users] PetscOptionsGetString Not Finding Option
Jared Crean
2015-11-01 00:52:03 UTC
Permalink
Hello,
I am trying to use PetscOptionsGetString to retrieve the value of
an option in the options database, but the value returned in the last
argument indicates the option was not found. In the attached code (a
modified version of ksp example 2), the string "-ksp_pc_side" is passed
in as the argument name. If I run the code as

./jc2 -pc_type ilu -ksp_pc_side right

I get the output:

option -ksp_pc_side was found

from line 71 of the file. Petsc does not complain of unused
options when the program finishes. Am I using this function incorrectly?

Jared Crean
Hong
2015-11-01 15:19:17 UTC
Permalink
Jared :
Either call KSPSetPCSide() or change
const char name[] = "-ksp_pc_side"
to a non-petsc option name, e.g., "-my_ksp_pc_side".

Hong

Hello,
I am trying to use PetscOptionsGetString to retrieve the value of an
option in the options database, but the value returned in the last argument
indicates the option was not found. In the attached code (a modified
version of ksp example 2), the string "-ksp_pc_side" is passed in as the
argument name. If I run the code as
./jc2 -pc_type ilu -ksp_pc_side right
option -ksp_pc_side was found
from line 71 of the file. Petsc does not complain of unused options
when the program finishes. Am I using this function incorrectly?
Jared Crean
Jared Crean
2015-11-04 03:01:14 UTC
Permalink
Hell Hong,
Is there a way to directly query the options database to get
the value of Petsc options? This is related to the discussion here:
http://lists.mcs.anl.gov/pipermail/petsc-dev/2015-July/017944.html . I
though PetscOptionsGetString and PetscOptionsSetValue would provide this
capability, but now it seems like petsc options cannot be accessed.

Jared Crean
Post by Hong
Either call KSPSetPCSide() or change
const char name[] = "-ksp_pc_side"
to a non-petsc option name, e.g., "-my_ksp_pc_side".
Hong
Hello,
I am trying to use PetscOptionsGetString to retrieve the value
of an option in the options database, but the value returned in
the last argument indicates the option was not found. In the
attached code (a modified version of ksp example 2), the string
"-ksp_pc_side" is passed in as the argument name. If I run the code as
./jc2 -pc_type ilu -ksp_pc_side right
option -ksp_pc_side was found
from line 71 of the file. Petsc does not complain of unused
options when the program finishes. Am I using this function incorrectly?
Jared Crean
Matthew Knepley
2015-11-04 03:04:17 UTC
Permalink
Post by Jared Crean
Hell Hong,
Is there a way to directly query the options database to get the
http://lists.mcs.anl.gov/pipermail/petsc-dev/2015-July/017944.html . I
though PetscOptionsGetString and PetscOptionsSetValue would provide this
capability, but now it seems like petsc options cannot be accessed.
I am not sure what you mean. This


http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscOptionsGetString.html

will get the raw input string for any option. The other functions return
processed versions. What else do you want?

Matt

Jared Crean
Post by Jared Crean
Either call KSPSetPCSide() or change
const char name[] = "-ksp_pc_side"
to a non-petsc option name, e.g., "-my_ksp_pc_side".
Hong
Hello,
I am trying to use PetscOptionsGetString to retrieve the value of an
option in the options database, but the value returned in the last argument
indicates the option was not found. In the attached code (a modified
version of ksp example 2), the string "-ksp_pc_side" is passed in as the
argument name. If I run the code as
./jc2 -pc_type ilu -ksp_pc_side right
option -ksp_pc_side was found
from line 71 of the file. Petsc does not complain of unused options
when the program finishes. Am I using this function incorrectly?
Jared Crean
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
Matthew Knepley
2015-11-04 03:07:35 UTC
Permalink
Post by Jared Crean
Hello,
I am trying to use PetscOptionsGetString to retrieve the value of an
option in the options database, but the value returned in the last argument
indicates the option was not found. In the attached code (a modified
version of ksp example 2), the string "-ksp_pc_side" is passed in as the
argument name. If I run the code as
./jc2 -pc_type ilu -ksp_pc_side right
option -ksp_pc_side was found
You gave the options and the program says it was found. What is the problem
here?

Matt
Post by Jared Crean
from line 71 of the file. Petsc does not complain of unused options
when the program finishes. Am I using this function incorrectly?
Jared Crean
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
Jared Crean
2015-11-04 03:37:15 UTC
Permalink
Hello Matt,
Ok, something weird is going on. Some of my test cases are
behaving strangely (the output of the test in my previous message is the
expected behavior, but previously the test gave different results). Let
me figure out what is going on with the tests before proceeding.

Jared Crean
Post by Jared Crean
Hello,
I am trying to use PetscOptionsGetString to retrieve the value
of an option in the options database, but the value returned in
the last argument indicates the option was not found. In the
attached code (a modified version of ksp example 2), the string
"-ksp_pc_side" is passed in as the argument name. If I run the code as
./jc2 -pc_type ilu -ksp_pc_side right
option -ksp_pc_side was found
You gave the options and the program says it was found. What is the
problem here?
Matt
from line 71 of the file. Petsc does not complain of unused
options when the program finishes. Am I using this function incorrectly?
Jared Crean
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener
Jared Crean
2015-11-04 03:50:40 UTC
Permalink
Hello Matt,
There was a problem with the way I was doing the tests, not
with PetscOptionsGetString. PetscOptionsGetString now behaves as
expected in all tests. Sorry for the confusion.

Jared Crean
Post by Jared Crean
Hello Matt,
Ok, something weird is going on. Some of my test cases are
behaving strangely (the output of the test in my previous message is
the expected behavior, but previously the test gave different
results). Let me figure out what is going on with the tests before
proceeding.
Jared Crean
Post by Jared Crean
Hello,
I am trying to use PetscOptionsGetString to retrieve the
value of an option in the options database, but the value
returned in the last argument indicates the option was not
found. In the attached code (a modified version of ksp example
2), the string "-ksp_pc_side" is passed in as the argument name.
If I run the code as
./jc2 -pc_type ilu -ksp_pc_side right
option -ksp_pc_side was found
You gave the options and the program says it was found. What is the
problem here?
Matt
from line 71 of the file. Petsc does not complain of unused
options when the program finishes. Am I using this function incorrectly?
Jared Crean
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener
Loading...