File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,11 @@ one session.
2020</p >
2121
2222The notebook runs top to bottom and builds real extension modules, so it needs a
23- compiler. In Colab the first cell installs one.
23+ compiler. In Colab the first cell installs one, along with PRIK:
24+
25+ ``` bash
26+ pip install " prik[jupyter]"
27+ ```
2428
2529## 1. Load the extension
2630
Original file line number Diff line number Diff line change 22 "cells" : [
33 {
44 "cell_type" : " markdown" ,
5- "id" : " f69700b9 " ,
5+ "id" : " 7acf44e9 " ,
66 "metadata" : {},
77 "source" : [
88 " # PRIK quickstart\n " ,
1515 },
1616 {
1717 "cell_type" : " markdown" ,
18- "id" : " ea638956 " ,
18+ "id" : " cdfc4fb9 " ,
1919 "metadata" : {},
2020 "source" : [
2121 " ## Setup\n " ,
2626 {
2727 "cell_type" : " code" ,
2828 "execution_count" : null ,
29- "id" : " a446408a " ,
29+ "id" : " 6eb48cdd " ,
3030 "metadata" : {
3131 "tags" : [
3232 " prik-colab-setup"
3535 "outputs" : [],
3636 "source" : [
3737 " !apt-get -qq install -y gfortran > /dev/null\n " ,
38- " !pip install -q \" prik[jupyter] @ git+https://github.com/PyNumLab/prik.git \" "
38+ " !pip install -q \" prik[jupyter]>=0.4.3 \" "
3939 ]
4040 },
4141 {
4242 "cell_type" : " markdown" ,
43- "id" : " cf97f2e1 " ,
43+ "id" : " efbc270e " ,
4444 "metadata" : {},
4545 "source" : [
4646 " If pip upgraded NumPy, Colab will ask you to restart the runtime. Do that,\n " ,
5050 {
5151 "cell_type" : " code" ,
5252 "execution_count" : null ,
53- "id" : " a68d174c " ,
53+ "id" : " c4841aec " ,
5454 "metadata" : {},
5555 "outputs" : [],
5656 "source" : [
6060 {
6161 "cell_type" : " code" ,
6262 "execution_count" : null ,
63- "id" : " d9b016ec " ,
63+ "id" : " 2414c834 " ,
6464 "metadata" : {},
6565 "outputs" : [],
6666 "source" : [
6969 },
7070 {
7171 "cell_type" : " markdown" ,
72- "id" : " b82f42f2 " ,
72+ "id" : " 51493a14 " ,
7373 "metadata" : {},
7474 "source" : [
7575 " ## 1. Compile a Fortran cell\n " ,
8181 {
8282 "cell_type" : " code" ,
8383 "execution_count" : null ,
84- "id" : " 205cf93b " ,
84+ "id" : " 83c0c9ba " ,
8585 "metadata" : {},
8686 "outputs" : [],
8787 "source" : [
9898 {
9999 "cell_type" : " code" ,
100100 "execution_count" : null ,
101- "id" : " 995ac839 " ,
101+ "id" : " 48a277e9 " ,
102102 "metadata" : {},
103103 "outputs" : [],
104104 "source" : [
109109 },
110110 {
111111 "cell_type" : " markdown" ,
112- "id" : " 134d3908 " ,
112+ "id" : " bd5b9c3b " ,
113113 "metadata" : {},
114114 "source" : [
115115 " ## 2. Compile a C cell\n " ,
121121 {
122122 "cell_type" : " code" ,
123123 "execution_count" : null ,
124- "id" : " b77b1866 " ,
124+ "id" : " f8850dbf " ,
125125 "metadata" : {},
126126 "outputs" : [],
127127 "source" : [
137137 },
138138 {
139139 "cell_type" : " markdown" ,
140- "id" : " 7e60efc9 " ,
140+ "id" : " 7eb51280 " ,
141141 "metadata" : {},
142142 "source" : [
143143 " PRIK gave `double *values` a *runtime-rank* contract, so it accepts a NumPy\n " ,
148148 {
149149 "cell_type" : " code" ,
150150 "execution_count" : null ,
151- "id" : " ddd15779 " ,
151+ "id" : " f509b6c6 " ,
152152 "metadata" : {},
153153 "outputs" : [],
154154 "source" : [
160160 },
161161 {
162162 "cell_type" : " markdown" ,
163- "id" : " 6c639d2a " ,
163+ "id" : " 305575f1 " ,
164164 "metadata" : {},
165165 "source" : [
166166 " ## 3. Reshape the API with a contract\n " ,
175175 {
176176 "cell_type" : " code" ,
177177 "execution_count" : null ,
178- "id" : " cdb09a85 " ,
178+ "id" : " 60eeb7d3 " ,
179179 "metadata" : {},
180180 "outputs" : [],
181181 "source" : [
191191 },
192192 {
193193 "cell_type" : " markdown" ,
194- "id" : " 818a7cfe " ,
194+ "id" : " 8f3defb0 " ,
195195 "metadata" : {},
196196 "source" : [
197197 " The generated contract reads `def scale(count: UInt64, values: Float64[...])`.\n " ,
202202 {
203203 "cell_type" : " code" ,
204204 "execution_count" : null ,
205- "id" : " 3955cb30 " ,
205+ "id" : " c2c96fb9 " ,
206206 "metadata" : {},
207207 "outputs" : [],
208208 "source" : [
218218 },
219219 {
220220 "cell_type" : " markdown" ,
221- "id" : " fbc473b2 " ,
221+ "id" : " e75ef594 " ,
222222 "metadata" : {},
223223 "source" : [
224224 " Same C code, same compiler. Only the Python API changed — `count` is gone:"
227227 {
228228 "cell_type" : " code" ,
229229 "execution_count" : null ,
230- "id" : " 1fd12b49 " ,
230+ "id" : " 2bd5adf9 " ,
231231 "metadata" : {},
232232 "outputs" : [],
233233 "source" : [
240240 {
241241 "cell_type" : " code" ,
242242 "execution_count" : null ,
243- "id" : " 57814aab " ,
243+ "id" : " 45e87a44 " ,
244244 "metadata" : {},
245245 "outputs" : [],
246246 "source" : [
251251 },
252252 {
253253 "cell_type" : " markdown" ,
254- "id" : " 25f4b06f " ,
254+ "id" : " 2a39221a " ,
255255 "metadata" : {},
256256 "source" : [
257257 " ## Where to go next\n " ,
You can’t perform that action at this time.
0 commit comments