Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.13
rev: v0.12.0
hooks:
- id: ruff-format
exclude: ^content/week01/cleanup_bessel\.ipynb$
Expand All @@ -31,7 +31,7 @@ repos:
- id: nbstripout

- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.5.3"
rev: "v3.6.0"
hooks:
- id: prettier

Expand Down
8 changes: 0 additions & 8 deletions content/week02/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ system.
Old school techniques are usually bad.

- Version filenames is a disaster.

- mythesis_v1.tex, mythesis_v2.tex, mythesis_last_v3.tex
- creates clutter
- Filenames rarely contain information other than chronology
Expand All @@ -17,7 +16,6 @@ Old school techniques are usually bad.
but you have no idea where the error was introduced?

- Sharing files with others is a disaster.

- Emailing files sucks --- only magnifies the problems above
- Track changes feature Google Docs or Word --- not so useful for anything
complex
Expand All @@ -32,12 +30,10 @@ Modern version control techniques are usually great.
Modern tools to promote collective intelligence.

- Automated history of everything

- not just files, but whole projects with folders and subfolders
- who, what, when, and (most important) why

- Automated sharing of everyone's latest edits

- no more emailing files around

- Easier disaster recovery with distributed VCSes like Git or Mercurial (see
Expand All @@ -46,7 +42,6 @@ Modern tools to promote collective intelligence.
- Support for automated testing (we'll cover this in future lectures)

- Infinite sandboxes for clutter-free, fear-free experimentation

- this is where Git especially shines -- main topic today

- CAVEAT 1: All of this works best with plain text files
Expand All @@ -63,11 +58,9 @@ Modern tools to promote collective intelligence.
![title](CVCS-vs-DVCS.png)

- Local Version Control

- Mainly just reduced clutter and automated tracking of chronology...

- Centralized Version Control

- Allows group work on the same files...
- Single point of failure --- there is only a single "real" repository
- Backing up is a separate process
Expand Down Expand Up @@ -108,7 +101,6 @@ Things to keep in mind during our exercise

- Some git operations are of a "send it out" variety, while others are of a
"bring it in" variety

- important to keep straight which are of which flavor

- Some git operations are repo-wise, while others are branch-wise
Expand Down
12 changes: 0 additions & 12 deletions content/week10/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ In this lecture, we will:
- learn tips and tricks from a lifelong experience in debugging

- gain practical knowledge in

- simple debugging techniques using compilers
- simple debuggers for C/C++, Rust, and Python
- more advanced graphical debuggers
Expand All @@ -38,7 +37,6 @@ When a code crashes it usually writes out a cryptic error message
### Typical error messages

- `SIGFPE`: floating point exception

- Often controlled by compiler options
- division by zero
- square root of a negative number
Expand Down Expand Up @@ -71,7 +69,6 @@ x[345] = 0.0; // panics at run-time

- Make sure your shell “stack size limit” and "core size limit" are both set to
“unlimited”

- `ulimit -s unlimited` set stack memory to unlimited
- `ulimit -c unlimited` set core file size to unlimited
- `ulimit -a` show all limits
Expand Down Expand Up @@ -169,7 +166,6 @@ All compilers accept the `-g` option.
### Examples of useful compiler options

- All compilers have options that try to detect potential bugs in the code

- Array bounds check (gcc: -Warray-bounds)
- Check for array subscripts and substrings out of bounds
- Should be done on unoptimized code (-O0)
Expand Down Expand Up @@ -222,7 +218,6 @@ All compilers accept the `-g` option.
MPI task in a parallel code)

- No `core` file?

- Check your shell limits: `ulimit –a` (bash) or `limit` (csh)
- Look for `core file size` (bash) or `coredumpsize` (csh) > 0

Expand Down Expand Up @@ -301,7 +296,6 @@ gdb (1) - The GNU Debugger
- Online manual for gdb at `info gdb`

- Can be used within the `emacs` editor

- Can run gdb commands within the emacs source code window (e.g. `C-x SPC` to
set a breakpoint)

Expand Down Expand Up @@ -546,7 +540,6 @@ $ rust-gdb ./example
- Detective work starts

- Try reducing the problem size and see if the error is still there

- The smaller the better
- Running with only 2 processes is ideal if your code is parallel

Expand Down Expand Up @@ -629,21 +622,18 @@ p expression
restart a simulation from that point

- Extremely important for codes that have long runtimes (> 1 hour)

- Allows you to restart your simulation at the point of the latest checkpoint
- Avoid losing hours of precious computer time
- Especially important for parallel codes

- Extremely important when you need to debug a code that crashes after a few
hours!!

- You can recompile the code with `–g` and start from the last checkpoint
- Remember... `-g` slows down the code dramatically so you want to be as close
to the crash as possible

- When restarting a simulation from a checkpointed state, reproducibility is
very important

- Test by running the code to a certain point and saving its state at that
point
- Rerun the same case but split in 2 steps where the 2nd step uses restart
Expand All @@ -666,7 +656,6 @@ p expression
(100,000+ processors)

- The idea is simple:

- Insert `print` statements at strategic locations in the code to gather
information and try to pinpoint the faulty code line
- Advantages over other forms of debugging:
Expand All @@ -689,7 +678,6 @@ p expression
**standard output**

- Write to **standard error** as much as possible since it is not buffered

- `cerr <<` in C++
- `eprint` in Rust
- redirect output: `mpirun –np 1024 ./a.out 1> output.out 2> output.err`
Expand Down
7 changes: 0 additions & 7 deletions notes/week3b.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,20 @@ Design patterns in OOP
- Composition - "has a" & restrict interface (you can't delete attributes with
) - verbose!
- UML diagrams

- Can show classes, interface, relationships
- Several links to read more if interested

- OOP Pattern 1: code injection

- You can replace steps in a calculation via inheritance and overriding

- OOP Pattern 2: Required interface (ABCs)

- You can require an implementation to implement certain methods - called
"abstract" (italics on a UML diagram)
- Example: `content/week03/geom_example`
- We did the dataclasses version in class (voted)
- Example: `content/week03/integrator_example` (also in rendered notes)

- SOLID:

- S: modular
- O: Open/closed API
- Liskov substitution principle (like adding `power=` to `Geometry.area` but
Expand All @@ -52,17 +48,14 @@ Design patterns in OOP
- D: Dependency inversion (low level depend on high level)

- OOP Pattern 3: Functors

- Not very native in Python, but common in some languages like C++
- Can implement with function capture instead of classes

- Separation of concerns

- Some languages have techniques like multifile classes
- Other ways to achieve, like mixins, dispatch (later), etc

- OOP Pattern 4: eDSLs

- Example with Path using division for joining

- OOP Pattern 5: Mixins
Expand Down
Loading
Loading