Commit 7fce1f2
[numba.md] numba_ex3: run the solution at the n the exercise asks for (#601)
* [numba.md] numba_ex3: run the solution at the n the exercise asks for
The statement says to use a substantial sample size such as
n = 100_000_000, but the solution reused the shared 10^6 arrays --- at
that size both timed cells display as 0.00 seconds, demonstrating
nothing. The solution now draws its own 10^8 points (with a memory
note), times the parallel version, and compares against speed_ex1's
serial jitted function on the same arrays so the multithreading gain
is visible on the page.
The shared 10^6 arrays are unchanged: speed_ex1's pure-Python
comparison would take minutes at 10^8.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* @mmcky edit of lecture wording
* [numba.md] numba_ex3: release the 1e8 arrays after the timings
The `u_big`/`v_big` pair added for numba_ex3 stayed alive for the rest of
the notebook. Because `numba_ex_draw_speed` rebinds `u_draws`/`v_draws` to
a second pair of 1e8-element arrays, peak memory reached ~3.2 GB rather
than ~1.6 GB. That is comfortable on the g4dn.2xlarge CI runner but not on
the smaller machines the accompanying memory note is written for.
Delete the arrays after their last use, and fix "Lets" -> "Let's" plus the
trailing whitespace introduced alongside it.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* [numba.md] numba_ex3: align the prose with the measured timings
The Netlify preview of 6246b07 reports 0.1448s serial against 0.0353s
parallel at n=100_000_000, a 4.1x gain, but the solution claimed "around
3x on our workstation". Drop the multiple rather than restate it: these
lectures re-execute every build on a shared runner, so a pinned figure
drifts, and line 765 was the only hardcoded speedup in the file — the rest
describes gains qualitatively and lets the printed timings carry the fact.
The exercise preamble still warned "you should not expect huge gains
here", which was written for the old small-n setup and now contradicts the
near-linear scaling the solution demonstrates. Reframe it around giving
each thread enough work, which is why the exercise asks for a large n.
Prose only, so the execution cache for the code cells is unaffected.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent d35eb83 commit 7fce1f2
1 file changed
Lines changed: 51 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
690 | | - | |
691 | | - | |
692 | | - | |
| 690 | + | |
| 691 | + | |
693 | 692 | | |
694 | | - | |
695 | | - | |
| 693 | + | |
| 694 | + | |
696 | 695 | | |
697 | | - | |
| 696 | + | |
| 697 | + | |
698 | 698 | | |
699 | | - | |
| 699 | + | |
| 700 | + | |
700 | 701 | | |
701 | | - | |
702 | | - | |
| 702 | + | |
| 703 | + | |
703 | 704 | | |
704 | 705 | | |
705 | 706 | | |
| |||
723 | 724 | | |
724 | 725 | | |
725 | 726 | | |
726 | | - | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
727 | 746 | | |
728 | 747 | | |
729 | 748 | | |
730 | | - | |
| 749 | + | |
731 | 750 | | |
732 | 751 | | |
733 | 752 | | |
734 | 753 | | |
735 | | - | |
| 754 | + | |
736 | 755 | | |
737 | 756 | | |
738 | | - | |
739 | | - | |
740 | | - | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
741 | 764 | | |
742 | | - | |
743 | | - | |
| 765 | + | |
| 766 | + | |
744 | 767 | | |
745 | 768 | | |
746 | | - | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
747 | 779 | | |
748 | 780 | | |
749 | 781 | | |
750 | 782 | | |
751 | 783 | | |
752 | 784 | | |
753 | | - | |
754 | | - | |
755 | | - | |
| 785 | + | |
756 | 786 | | |
757 | 787 | | |
758 | 788 | | |
| |||
0 commit comments