4. Questions about the code
fobis ask answers from sources it retrieves: the knowledge packs shipped with FoBiS (the Fortran standard, OpenMP, OpenACC, MPI, compilers, numerical practice) and, with -p DIR, the project's own units, each described by its header, its documentation comment, its arguments, what it uses and calls:
The model's input (fobis ask --show-context)
$ fobis ask --show-context -p src -p test "Which rule integrates cubic polynomials exactly?"
=== system prompt ===
You answer technical questions about Fortran, OpenMP, OpenACC, MPI, HPC practice and the user's Fortran
project. You may use ONLY the numbered sources given with the question: the knowledge-pack sections and,
when present, entries describing the project's units (modules, procedures, programs). A `doc:` line in such
an entry is the authors' documentation of that unit: what it states may be cited.
Answer with one JSON object:
- `claims`: the statements that answer the question, each a short, self-contained sentence, each with the
labels of the sources that state it (`"citations": ["S2"]`). Cite only sources that really contain the
statement. Prefer several precise claims to one long one.
- `insufficient`: true when the sources do not answer the question; then return no claims rather than
answering from memory.
Rules:
- Never state something that no source supports, even if you believe it is true: such statements are
discarded.
- For the project's procedures, say where things are (procedure, file, line) as the sources give them;
do not describe code you were not shown.
- Quote identifiers, directives and constraint numbers exactly as the sources write them.
- Do not mention the labels or this format inside the claim text.
=== user message ===
## Question
Which rule integrates cubic polynomials exactly?
## Sources
[S1] program test_exactness (test/test_exactness.F90:2) - this project's sources (project:test/test_exactness.F90#test_exactness)
program test_exactness in test/test_exactness.F90, lines 2-12
header: program test_exactness
doc: Each rule integrates exactly the polynomials of its degree: trapezoid lines, Simpson cubics.
uses: polynomials, quad_rules
[S2] function cubic (test/polynomials.F90:18) - this project's sources (project:test/polynomials.F90#cubic)
function cubic in test/polynomials.F90, lines 18-24
header: pure function cubic(x) result(y)
doc: x**3, integral on [0, 2] = 4.
arguments: x
[S3] module polynomials (test/polynomials.F90:2) - this project's sources (project:test/polynomials.F90#polynomials)
module polynomials in test/polynomials.F90, lines 2-25
header: module polynomials
doc: Polynomials whose integrals are known exactly.
uses: quad_rules
[S4] program test_symmetry (test/test_symmetry.F90:2) - this project's sources (project:test/test_symmetry.F90#test_symmetry)
program test_symmetry in test/test_symmetry.F90, lines 2-23
header: program test_symmetry
doc: Every rule integrates an odd function over a symmetric interval to zero.
uses: polynomials, quad_rules
[S5] program integrate (src/integrate.F90:2) - this project's sources (project:src/integrate.F90#integrate)
program integrate in src/integrate.F90, lines 2-18
header: program integrate
doc: Integrate sin(x) over [0, pi], whose exact value is 2, with more and more intervals.
uses: integrands, penf, quad_rules
[S6] program integrate_mpi (src/integrate_mpi.F90:2) - this project's sources (project:src/integrate_mpi.F90#integrate_mpi)
program integrate_mpi in src/integrate_mpi.F90, lines 2-24
header: program integrate_mpi
doc: Simpson's rule over [0, pi] split among the MPI processes: each integrates its piece, rank 0 adds them up.
uses: integrands, mpi, quad_rules
MPI calls: mpi_init, mpi_comm_rank, mpi_comm_size, mpi_reduce, mpi_finalize$ fobis ask -p src -p test "Which rule integrates cubic polynomials exactly?"
Using the running llama-server at http://127.0.0.1:41675
- Simpson's rule integrates exactly cubic polynomials. [1]
Sources:
[1] program test_exactness (test/test_exactness.F90:2) - this project's sources (project:test/test_exactness.F90#test_exactness)The answer comes from the documentation comment of test_exactness ("Simpson cubics"), and says where.

The question comes last in the recording. coder-7b on 6 CPU cores and no GPU; each answer takes about 45 s there, cut from the recording.
What a citation guarantees
A question the sources cannot answer:
$ fobis ask -p src -p test "How long does simpson take on a GPU?"
Using the running llama-server at http://127.0.0.1:41675
- The runtime for simpson on a GPU depends on the specific GPU and the number of intervals (n). [1]
- To run simpson on a GPU, you need to enable OpenACC with the `-acc` option and specify the GPU compute capability with `-gpu=cc80` or `-gpu=ccnative`. [2]
- For optimal performance, minimize host-to-device transfers and maximize data reuse on the device. [3]
Sources:
[1] function simpson (src/quad_rules.F90:61) - this project's sources (project:src/quad_rules.F90#simpson)
[2] NVIDIA Fortran (nvfortran) > GPU options - Fortran compilers in practice: gfortran, ifx, nvfortran defaults, checks, floating point, modules (compilers:nvfortran#gpu-options)
[3] GPU / OpenACC / CUDA Conventions > Data Movement - Fortran and GPU/HPC practice: conventions, pitfalls, measured lessons (hpc-practice:gpu-practice#data-movement)Read the citations. The second and third statements are in their sources (nvfortran's GPU options, the practice of keeping data on the device), but they do not answer the question. The first cites simpson's entry, which says nothing about run times. FoBiS guarantees that every statement cites a source that exists, and drops the ones that do not. It cannot guarantee that the source says what the statement says: the citations are there so that you can check.
WARNING
The order of the answer matters. Asked to declare first whether the sources suffice, coder-7b declined the first question, whose answer is word for word in its first source. FoBiS asks for the statements first and the verdict after: found while recording this chapter.
What you learned
fobis ask, -p, --show-context, --pack, what citations do and do not guarantee. Reference: asking questions, knowledge packs.
Next: 5. Generated tests.