Statická analýza NumPy programů
Static Analysis of NumPy Programs
bachelor thesis (DEFENDED)
View/ Open
Permanent link
http://hdl.handle.net/20.500.11956/184306Identifiers
Study Information System: 257503
Collections
- Kvalifikační práce [11242]
Author
Advisor
Referee
Blicha, Martin
Faculty / Institute
Faculty of Mathematics and Physics
Discipline
Computer Science with specialisation in Systems Programming
Department
Department of Distributed and Dependable Systems
Date of defense
7. 9. 2023
Publisher
Univerzita Karlova, Matematicko-fyzikální fakultaLanguage
Czech
Grade
Very good
Keywords (Czech)
statická analýza|NumPy|data-flow analýza|symbolic executionKeywords (English)
static analysis|NumPy|data-flow analysis|symbolic executionNumPy programy se těžko ladí. Kvůli dynamické povaze Pythonu se chyba často projeví až poté, co program delší dobu běží. Výpočet poté spadne a všechen výpočet je ztracen. Existující nástroje statické analýzy nedokážou poznat chyby specifické pro NumPy. Použili jsme data-flow analýzu zkombi- novanou se symbolickým vykonáváním programu k detekování chyb plynoucí z nevyhovujících tvarů matic. Naše metoda pomocí dynamické množiny sym- bolů sleduje ve vstupním program rozměry matic a vztahy mezi nimi. Ná- sledně pomocí SMT vyhodnotí, jestli jsou vztahy splnitelné, nebo jestli došlo k chybě a kde. Naše implementace rozumí základním NumPy konstrukcím a detekuje některé chyby pro pole a matice.
NumPy programs can be hard to debug. Due to the dynamic nature of Python, a bug can manifest itself after a long time of run time. This causes the computation to crash, ditching all the progress. Existing static analysis tools can't detect NumPy-specific errors. We propose a solution that uses data-flow analysis combined with symbolic execution to detect ndarray shape mismatch errors. With a dynamic set of symbols, our method tracks ndarray dimensions and constraints between them throughout the program. It uses an SMT solver to solve the constraints and locate the bug. Our implementation understands core NumPy constructs and detects some shape mismatch errors for 1D and 2D ndarrays.