docs: add linear static beam harness phase
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
# Step 20: MKL PARDISO Linear Solver
|
||||
|
||||
## 담당 역할과 필수 스킬
|
||||
|
||||
- 담당 역할: `implementation-agent`
|
||||
- 필수 스킬: `fesa-cpp-msvc-tdd`
|
||||
- 모든 C++ build/test와 최종 VERIFY는 MSVC x64 Debug 기준으로 수행한다.
|
||||
|
||||
## 읽어야 할 파일
|
||||
|
||||
- `/AGENTS.md`
|
||||
- `/docs/ARCHITECTURE.md`
|
||||
- `/docs/ADR.md`
|
||||
- `/docs/requirements/linear-static-3d-euler-beam.md`
|
||||
- `/docs/implementation-plans/linear-static-3d-euler-beam.md`
|
||||
- `/include/fesa/core/status.hpp`
|
||||
- `/include/fesa/core/diagnostic.hpp`
|
||||
- `/include/fesa/math/vector.hpp`
|
||||
- `/include/fesa/math/sparse_matrix.hpp`
|
||||
- `/src/fesa/math/sparse_matrix.cpp`
|
||||
- `/cmake/FesaDependencies.cmake`
|
||||
|
||||
## 소유 파일
|
||||
|
||||
- Create: `/include/fesa/solvers/linear/linear_solver.hpp`
|
||||
- Create: `/include/fesa/solvers/linear/mkl_pardiso_solver.hpp`
|
||||
- Create: `/src/fesa/solvers/linear/mkl_pardiso_solver.cpp`
|
||||
- Create: `/tests/unit/solvers/linear/linear_solver_test.cpp`
|
||||
- Create: `/tests/unit/solvers/linear/mkl_pardiso_solver_test.cpp`
|
||||
- Modify: `/src/fesa/CMakeLists.txt`
|
||||
- Modify: `/tests/CMakeLists.txt`
|
||||
|
||||
## 작업
|
||||
|
||||
MKL PARDISO를 solver core에서 숨기며 SPD `Kff` factorization과 RHS substitution을 분리하는
|
||||
adapter를 구현하라. Public interface는 승인된 계약과 동일해야 한다.
|
||||
|
||||
```cpp
|
||||
class LinearSolver {
|
||||
public:
|
||||
virtual ~LinearSolver() = default;
|
||||
virtual Status factorize(const SparseMatrix& matrix) = 0;
|
||||
virtual Status solve(const Vector& rhs, Vector& solution) const = 0;
|
||||
};
|
||||
|
||||
class MklPardisoSolver final : public LinearSolver {
|
||||
public:
|
||||
MklPardisoSolver();
|
||||
~MklPardisoSolver() override;
|
||||
Status factorize(const SparseMatrix& matrix) override;
|
||||
Status solve(const Vector& rhs, Vector& solution) const override;
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> impl_;
|
||||
};
|
||||
```
|
||||
|
||||
Adapter는 0-based CSR을 명시적으로 처리하고 real symmetric positive definite matrix
|
||||
descriptor를 사용한다. Factorization state/workspace를 RAII로 소유하고 destructor와
|
||||
re-factorization에서 누수 없이 해제한다. 동일 factorization에 여러 RHS를 substitution할
|
||||
수 있어야 한다. invalid CSR, solve-before-factorize, dimension mismatch, nonfinite RHS,
|
||||
PARDISO singular/positive-definite failure를 deterministic structured diagnostic으로 반환한다.
|
||||
MKL header/type은 `.cpp`/private Impl 밖에 노출하지 않는다.
|
||||
|
||||
Tests는 known SPD solution/residual `1e-10`, repeated RHS, re-factorization, invalid CSR,
|
||||
singular/indefinite matrix, solve-before-factorize, dimension mismatch를 포함하고
|
||||
`MklPardisoSolver` regex로 등록한다.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
```powershell
|
||||
cmake --build .harness/build --config Debug --target fesa_tests
|
||||
ctest --test-dir .harness/build -C Debug -R MklPardisoSolver --output-on-failure
|
||||
```
|
||||
|
||||
RED 후 GREEN/VERIFY:
|
||||
|
||||
```powershell
|
||||
cmake -S . -B .harness/build -A x64 `
|
||||
-DFESA_GTEST_SOURCE_DIR=C:/git/googletest `
|
||||
"-DMKL_DIR=C:/Program Files (x86)/Intel/oneAPI/mkl/2026.1/lib/cmake/mkl" `
|
||||
"-DTBB_DIR=C:/Program Files (x86)/Intel/oneAPI/tbb/2023.1/lib/cmake/tbb" `
|
||||
"-DHDF5_DIR=C:/Program Files/HDF_Group/HDF5/2.1.1/cmake"
|
||||
cmake --build .harness/build --config Debug
|
||||
ctest --test-dir .harness/build -C Debug -R MklPardisoSolver --output-on-failure
|
||||
ctest --test-dir .harness/build -C Debug --show-only=json-v1
|
||||
ctest --test-dir .harness/build -C Debug --output-on-failure
|
||||
$leaks = rg -n "mkl\.h|MKL_INT|pardiso" include/fesa
|
||||
if ($LASTEXITCODE -eq 0) { throw "PARDISO API leaked into public headers:`n$leaks" }
|
||||
if ($LASTEXITCODE -ne 1) { throw 'Public-header dependency scan failed' }
|
||||
```
|
||||
|
||||
마지막 scan은 public header에서 no-match여야 한다.
|
||||
|
||||
## 검증 절차
|
||||
|
||||
1. adapter tests를 먼저 작성하고 missing solver RED를 확인한다.
|
||||
2. factorize/solve phase를 분리한 최소 PARDISO adapter로 GREEN을 만든다.
|
||||
3. repeated RHS, RAII, residual, public boundary와 전체 VERIFY를 확인한다.
|
||||
4. `/docs/implementation-plans/linear-static-3d-euler-beam-implementation-report.md`의
|
||||
Step 20 section에 실제 RED/GREEN/VERIFY command, exit code,
|
||||
핵심 output과 변경 파일을 기록한다.
|
||||
5. Step 20을 `completed`로 갱신하고 factorization/substitution evidence를 summary에 기록한다.
|
||||
|
||||
## 금지사항
|
||||
|
||||
- factorization과 solve를 하나의 opaque method로 합치지 마라. 이유: 승인 runtime order를 깨뜨린다.
|
||||
- MKL type/header를 public interface에 노출하지 마라. 이유: adapter boundary 계약이다.
|
||||
- singularity에 임의 regularization을 적용하지 마라. 이유: invalid model을 숨긴다.
|
||||
- 직접 commit하지 마라. 이유: Harness executor가 담당한다.
|
||||
Reference in New Issue
Block a user