@@ -18,7 +18,7 @@ scratch filesystems, which you can share with other members in the VO.
1818Space is limited on the cluster's storage. To check your quota, see section
1919[ Pre-defined quota] ( ../running_jobs_with_input_output_data.md#pre-defined-quotas ) .
2020
21- To figure out where your quota is being spent, the ` du ` (isk sage)
21+ To figure out where your quota is being spent, the ` du ` (** d ** isk ** u ** sage)
2222command can come in useful:
2323<pre ><code >$ <b >du -sh test</b >
242459M test
@@ -59,16 +59,69 @@ Detailed information is available in section
5959
6060## Exercises
6161
62- Create and submit a job script that computes the sum of 1-100 using
63- Python, and prints the numbers to a * unique* output file in
64- ` $VSC_SCRATCH ` .
65-
66- Hint: ` python -c "print(sum(range(1, 101)))" `
67-
68- - How many modules are available for Python version 3.6.4?
69- - How many modules get loaded when you load the ` Python/3.6.4-intel-2018a ` module?
70- - Which ` cluster ` modules are available?
71- <!-- -->
72- - What's the full path to your personal home/data/scratch directories?
73- - Determine how large your personal directories are.
74- - What's the difference between the size reported by ` du -sh $HOME ` and by ` ls -ld $HOME ` ?
62+ ??? abstract "Create and submit a job script that computes the sum of 1-100 using Python, and prints the result to the standard output."
63+
64+ We make the following job script:
65+
66+ ```bash title="jobscript.pbs"
67+ #!/bin/bash
68+
69+ # Basic parameters
70+ #PBS -N sum_1_to_100 ## Job name
71+ #PBS -l nodes=1:ppn=1 ## 1 node, 1 processor per node
72+ #PBS -l walltime=00:00:15 ## Max time your job will run (no more than 72:00:00)
73+
74+ module load Python/3.10.4-GCCcore-11.3.0
75+
76+ cd $PBS_O_WORKDIR # Change working directory to the location where the job was submmitted
77+
78+ python -c "print(sum(range(1, 101)))"
79+ ```
80+
81+ We optionally switch to a cluster of choice, for example `skitty`:
82+
83+ ```bashand prints the numbers to a *unique* output file in `$VSC_SCRATCH`.
84+ $ module swap cluster/skitty
85+ ```
86+
87+ We submit the job script:
88+
89+ ```bash
90+ $ qsub jobscript.pbs
91+ ```
92+
93+ after some time, two files (`sum_1_to_100.e[JOBID]` and `sum_1_to_100.o[JOBID]`) should appear.
94+ The first one contains the error output, and is empty in this case.
95+ The second one contains the output of the Python command.
96+
97+
98+ ??? abstract "How many modules are available for Python version 3.10?"
99+
100+ We can use the ` module avail ` command to list all available modules.
101+ To filter the list for Python 3.10, we can use ` module avail Python/3.10 ` .
102+
103+ ```bash
104+ $ module avail Python/3.10
105+ ```
106+
107+ ??? abstract "How many modules get loaded when you load the ` Python/3.10.4-GCCcore-11.3.0 ` module?"
108+
109+ We can use the ` module load ` command to load the Python module.
110+ After loading the module, we can use the ` module list ` command to list all loaded modules.
111+
112+ ```bash
113+ $ module load Python/3.10.4-GCCcore-11.3.0
114+ $ module list
115+ ```
116+
117+ These are the modules the python module depends on.
118+
119+
120+ ??? abstract "Which ` cluster ` modules are available?"
121+
122+ We can use the ` module avail ` command to list all available modules.
123+ To filter the list for modules with the name ` cluster ` , we can use ` module avail cluster ` .
124+
125+ ```bash
126+ $ module avail cluster
127+ ```
0 commit comments