Skip to content

Commit 4f7f317

Browse files
authored
Merge pull request #2 from svalat/fix/idefix-tutorial-dir-env-var
fix: introduce IDEFIX_TUTORIAL_DIR + make directory layout consistent + remove the second venv
2 parents 8daa2f6 + 950613f commit 4f7f317

6 files changed

Lines changed: 23 additions & 38 deletions

File tree

Readme.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ In the directory of your choice, you then clone the tutorial to the directory `i
2020

2121
```shell
2222
git clone --branch asnum2026 https://github.com/idefix-code/tutorial.git ./idefix-tutorial
23+
export IDEFIX_TUTORIAL_DIR="$PWD/idefix-tutorial"
24+
cd "$IDEFIX_TUTORIAL_DIR"
2325
```
2426

2527
We then create a python environement, install what we need, and launch a jupyter lab session
2628
```shell
27-
python3 -m venv ./idefix-env
28-
source idefix-env/bin/activate
29-
pip install -r ./idefix-tutorial/python_requirements.txt
29+
cd "$IDEFIX_TUTORIAL_DIR"
30+
python3 -m venv ./idefix.env
31+
source idefix.env/bin/activate
32+
pip install -r ./python_requirements.txt
3033
jupyter lab --sock=~/mysock.sock
3134
```
3235

@@ -36,7 +39,7 @@ you're now good to go. On your laptop, using your favourite browser, open the li
3639
http://localhost:8888/lab?token=<your_token>
3740
```
3841

39-
Which should open your jupyter lab session running on the distant machine. From there, go to the tutorial directory `idefix-tutorial` created above, and open `start.ipynb`.
42+
Which should open your jupyter lab session running on the distant machine. From there, open `start.ipynb`.
4043

4144

4245

SimpleSetup/problem1/read_problem.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"import os\n",
1313
"import sys\n",
1414
"# Possibly adapt the idefix path depending on where you cloned the sources\n",
15-
"sys.path.append(\"../../../idefix.src\")\n",
15+
"sys.path.append(\"../../idefix.src\")\n",
1616
"from pytools.vtk_io import readVTK\n",
1717
"import matplotlib.pyplot as plt\n",
1818
"import numpy as np"

SimpleSetup/solution1/read_problem.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"import os\n",
1313
"import sys\n",
1414
"# Possibly adapt the idefix path depending on where you cloned the sources\n",
15-
"sys.path.append(\"../../../idefix.src\")\n",
15+
"sys.path.append(\"../../idefix.src\")\n",
1616
"from pytools.vtk_io import readVTK\n",
1717
"import matplotlib.pyplot as plt\n",
1818
"import numpy as np"
@@ -96,7 +96,7 @@
9696
"name": "python",
9797
"nbconvert_exporter": "python",
9898
"pygments_lexer": "ipython3",
99-
"version": "3.12.3"
99+
"version": "3.13.5"
100100
}
101101
},
102102
"nbformat": 4,

VisualisationAndPost/nonos/Intro_to_nonos.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@
549549
"name": "python",
550550
"nbconvert_exporter": "python",
551551
"pygments_lexer": "ipython3",
552-
"version": "3.10.14"
552+
"version": "3.13.5"
553553
}
554554
},
555555
"nbformat": 4,

VisualisationAndPost/readVTK/Direct_VTK_visualisation.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"import os\n",
4747
"import sys\n",
4848
"# Possibly adapt the idefix path depending on where you cloned the sources\n",
49-
"sys.path.append(\"../../../idefix.src/\")\n",
49+
"sys.path.append(\"../../idefix.src/\")\n",
5050
"from pytools.vtk_io import readVTK"
5151
]
5252
},
@@ -320,7 +320,7 @@
320320
"name": "python",
321321
"nbconvert_exporter": "python",
322322
"pygments_lexer": "ipython3",
323-
"version": "3.12.3"
323+
"version": "3.13.5"
324324
}
325325
},
326326
"nbformat": 4,

start.ipynb

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,6 @@
2626
"git clone --recurse-submodules https://github.com/idefix-code/idefix.git idefix.src\n",
2727
"export IDEFIX_DIR=$PWD/idefix.src\n",
2828
"```\n",
29-
"For conveniance, we set the `IDEFIX_DIR` environment variable to the absolute path of the root directory of idefix (as above). \n",
30-
"\n",
31-
"If you intend to use the python script provided in this tutorial, best is to deploy a python environement with everything already set up. \n",
32-
"We therefore create a python environement in the directory `$IDEFIX_DIR/test` with the right modules\n",
33-
"\n",
34-
"```shell\n",
35-
"cd $IDEFIX_DIR/test\n",
36-
"python3 -m venv ./env\n",
37-
"source env/bin/activate\n",
38-
"pip install -r python_requirements.txt\n",
39-
"```"
40-
]
41-
},
42-
{
43-
"cell_type": "markdown",
44-
"id": "6a5f21fb-2d61-4ab6-8539-a666b83ddc05",
45-
"metadata": {},
46-
"source": [
4729
"For conveniance, we set the `IDEFIX_DIR` environment variable to the absolute path of the root directory of idefix (as above). "
4830
]
4931
},
@@ -134,10 +116,10 @@
134116
"\n",
135117
"Running on a GPU usually requires a specific environement for the architecture you target. For Nvidia gpus, you will need CUDA with a compatible host compiler, on AMD GPUs, this is Rocm with its llvm compiler, while for intel you will need the intel oneapi compiler.\n",
136118
"\n",
137-
"For this tutorial, we have prepared and tested environement for each machine (dgx, h200 and pocamd). You just need to source the right environement from `idefix-tutorial/environement/xxx.sh` in your terminal window. e.g. on dgx:\n",
119+
"For this tutorial, we have prepared and tested environement for each machine (dgx, h200 and pocamd). You just need to source the right environement from `idefix-tutorial/environement/xxx.env` in your terminal window. e.g. on dgx:\n",
138120
"\n",
139121
"```shell\n",
140-
"source <path_to_idefix_tutorial>/environements/dgx.sh\n",
122+
"source $IDEFIX_TUTORIAL_DIR/environements/dgx.env\n",
141123
"```\n",
142124
"\n",
143125
"Don't forget to source this environement each time you open a new terminal on the target machine.\n",
@@ -213,7 +195,7 @@
213195
"For this first simple setup, we move in the SimpleSetup/problem1 directory of the tutorial. i.e\n",
214196
"\n",
215197
"```shell\n",
216-
"cd <path_to_idefix_tutorial>/SimpleSetup/problem1/\n",
198+
"cd $IDEFIX_TUTORIAL_DIR/SimpleSetup/problem1/\n",
217199
"```\n",
218200
"\n",
219201
"## What is an idefix setup?\n",
@@ -278,7 +260,7 @@
278260
"import os\n",
279261
"import sys\n",
280262
"# Possibly adapt the idefix path depending on where you cloned the sources\n",
281-
"sys.path.append(\"../idefix.src\")\n",
263+
"sys.path.append(\"idefix.src\")\n",
282264
"from pytools.vtk_io import readVTK\n",
283265
"import matplotlib.pyplot as plt\n",
284266
"import numpy as np"
@@ -402,7 +384,7 @@
402384
"We first move to the problem directory\n",
403385
"\n",
404386
"```shell\n",
405-
"cd <path_to_idefix_tutorial>/PythonSetup/problem/\n",
387+
"cd $IDEFIX_TUTORIAL_DIR/PythonSetup/problem/\n",
406388
"```\n",
407389
"\n",
408390
"## Your tasks\n",
@@ -465,7 +447,7 @@
465447
"For now, lets move to the problem directory\n",
466448
"\n",
467449
"```shell\n",
468-
"cd idefix-tutorial/AdvancedSetup/problem1\n",
450+
"cd $IDEFIX_TUTORIAL_DIR/AdvancedSetup/problem1\n",
469451
"```"
470452
]
471453
},
@@ -657,7 +639,7 @@
657639
"The first problem is a simple 1D shock tube problem. This can be compiled and run on your laptop or on a cluster.\n",
658640
"\n",
659641
"```shell\n",
660-
"cd idefix-tutorial/Debugging/problem1\n",
642+
"cd $IDEFIX_TUTORIAL_DIR/Debugging/problem1\n",
661643
"```\n",
662644
"\n",
663645
"We then configure, compile and run the code\n",
@@ -740,7 +722,7 @@
740722
"The second problem is a pure thermal diffusion problem where the gas is kept fixed with 0 velocity. This can be compiled and run *on your laptop*.\n",
741723
"\n",
742724
"```shell\n",
743-
"cd idefix-tutorial/Debugging/problem2\n",
725+
"cd $IDEFIX_TUTORIAL_DIR/Debugging/problem2\n",
744726
"```\n",
745727
"\n",
746728
"We then configure, compile and run the code\n",
@@ -861,7 +843,7 @@
861843
"Let's move to problem 4, which is again a planet-disk interraction problem. This can be compiled and run *on your laptop* or on the on a cluster, but let's focus for now on the GPU version on the a cluster (you can try to do the exercise on your laptop). First go to the right directory\n",
862844
"\n",
863845
"```shell\n",
864-
"cd idefix-tutorial/Debugging/problem4\n",
846+
"cd $IDEFIX_TUTORIAL_DIR/Debugging/problem4\n",
865847
"```\n",
866848
"\n",
867849
"We then configure\n",
@@ -909,7 +891,7 @@
909891
{
910892
"cell_type": "code",
911893
"execution_count": null,
912-
"id": "68fea61b-5fa3-4cfe-85a6-c170b43aeaec",
894+
"id": "0e28f9fb-0dc0-4e35-9eca-8ae4254c4529",
913895
"metadata": {},
914896
"outputs": [],
915897
"source": []

0 commit comments

Comments
 (0)