|
@@ -170,16 +170,78 @@ qdel <job-ID>
|
|
|
```
|
|
|
### GPU Job
|
|
|
|
|
|
-Now we'll run a simple pytorch mnist example this time using a GPU.
|
|
|
+Now we'll run a simple pytorch mnist example this time using a GPU. Slightly different when using myriad (https://www.rc.ucl.ac.uk/docs/Example_Jobscripts/#gpu-job-script-example)[https://www.rc.ucl.ac.uk/docs/Example_Jobscripts/#gpu-job-script-example].
|
|
|
|
|
|
```
|
|
|
-
|
|
|
+##!/bin/bash -l
|
|
|
+#$ -l tmem=16G
|
|
|
+#$ -l h_rt=50:0:0
|
|
|
+# Use this flag for a gpu job
|
|
|
+#$ -l gpu=true
|
|
|
+#$ -S /bin/bash
|
|
|
+#$ -j y
|
|
|
+#$ -N
|
|
|
+# Useful to redirect logs
|
|
|
+#$ -o /home/<ucl-id>/hpc-tutorial/jobs/logs
|
|
|
+
|
|
|
+hostname
|
|
|
+date
|
|
|
+SOURCE_DIR='/home/<ucl-id>/hpc-tutorial'
|
|
|
+export PYTHONPATH=$PYTHONPATH:$SOURCE_DIR
|
|
|
+cd $SOURCE_DIR || exit
|
|
|
+source /share/apps/source_files/cuda/cuda-10.1.source
|
|
|
+conda activate hpc-example
|
|
|
+
|
|
|
+python pl_examples/image_classifier_4_lightning_module.py
|
|
|
+date
|
|
|
+```
|
|
|
+
|
|
|
+### Simple grid search
|
|
|
+
|
|
|
+Best part about using the cluster is the number of GPUs. This next one is an example of how to define a simple grid search using a config file and an array job.
|
|
|
+
|
|
|
+
|
|
|
+```
|
|
|
+##!/bin/bash -l
|
|
|
+#$ -l tmem=16G
|
|
|
+#$ -l h_rt=50:0:0
|
|
|
+# Use this flag for a gpu job
|
|
|
+#$ -l gpu=true
|
|
|
+#$ -S /bin/bash
|
|
|
+#$ -j y
|
|
|
+#$ -N
|
|
|
+# Useful to redirect logs
|
|
|
+#$ -o /home/<ucl-id>/hpc-tutorial/jobs/logs
|
|
|
+# Defines array of jobs
|
|
|
+#$ -t 1:4
|
|
|
+# Max number of jobs running at once
|
|
|
+#$ -tc 4
|
|
|
+
|
|
|
+hostname
|
|
|
+date
|
|
|
+SOURCE_DIR='/home/<ucl-id>/hpc-tutorial'
|
|
|
+export PYTHONPATH=$PYTHONPATH:$SOURCE_DIR
|
|
|
+cd $SOURCE_DIR || exit
|
|
|
+source /share/apps/source_files/cuda/cuda-10.1.source
|
|
|
+conda activate hpc-example
|
|
|
+
|
|
|
+
|
|
|
+CONFIG_PATH='jobs/configs/lr-grid.csv'
|
|
|
+
|
|
|
+ROW=$SGE_TASK_ID
|
|
|
+LINE=$(sed -n $((ROW + 1))'{p;q}' "$CONFIG_PATH")
|
|
|
+ARGS=($(echo "$LINE"))
|
|
|
+
|
|
|
+LR=${ARGS[0]}
|
|
|
+
|
|
|
+python pl_examples/image_classifier_4_lightning_module.py -model.lr $LR
|
|
|
+date
|
|
|
```
|
|
|
|
|
|
## Hyperopt
|
|
|

|
|
|
|
|
|
-My job script
|
|
|
+Possible to do more complicate stuff too... Here using mongodb and hyperopt to pull new hyperparameters from a database.
|
|
|
|
|
|
```
|
|
|
#$ -l tmem=16G
|